Sha256: ce964beeff685c5eb12b4729074db81036783b14899ca6b4cc2804f31b0d4214

Contents?: true

Size: 1.19 KB

Versions: 13

Compression:

Stored size: 1.19 KB

Contents

require 'rautomation'
require_relative 'edl_parser'

class AutoWindowFinder
  
  # when they select a file, it contains a...url say...
  # so look for that url, with "this" child window class [?]
  # so basically, if a browser window is "open" to such and such a url
  # and it is mentioned in a file
  # it should find it
  
  def self.search_for_single_url_match regexp = /Chrome/
    EdlParser.find_single_edit_list_matching(true) {|parsed|
      if url = parsed["url"]
        window = RAutomation::Window.new(:title => regexp)
        if window.exist? 
          if window.text =~ Regexp.new(Regexp.escape url.gsub(/http(s|):\/\//, ""))
            p 'got match' + url
            true
          else
            false
          end
        end
      end
    }
  end
  
  def self.search_for_player_and_url_match player_root_dir
    for filename in Dir[player_root_dir + '/*/*.txt']
      settings = YAML.load_file filename
      if regex = settings["window_title"] # assume regex :)
        p 'searching for player regex', regex
        if search_for_single_url_match regex # applies the regex X url
          return filename
        end
      end
    end
    nil
  end
  
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
content-editing-movie-player-0.38.0 lib/auto_window_finder.rb
sensible-cinema-0.35.3 lib/auto_window_finder.rb
sensible-cinema-0.34.0 lib/auto_window_finder.rb
sensible-cinema-0.28.1 lib/auto_window_finder.rb
sensible-cinema-0.28.0 lib/auto_window_finder.rb
sensible-cinema-0.27.0 lib/auto_window_finder.rb
sensible-cinema-0.26.3 lib/auto_window_finder.rb
sensible-cinema-0.26.2 lib/auto_window_finder.rb
sensible-cinema-0.26.1 lib/auto_window_finder.rb
sensible-cinema-0.26.0 lib/auto_window_finder.rb
sensible-cinema-0.25.4 lib/auto_window_finder.rb
sensible-cinema-0.25.3 lib/auto_window_finder.rb
sensible-cinema-0.25.2 lib/auto_window_finder.rb