lib/digitalfilmtree/vfx/edl_ml_renamer.rb in digitalfilmtree-0.0.3 vs lib/digitalfilmtree/vfx/edl_ml_renamer.rb in digitalfilmtree-0.0.4
- old
+ new
@@ -1,18 +1,19 @@
+require 'fileutils'
require 'edl'
module Digitalfilmtree
module VFX
class EDLMLRenamer
attr_accessor :ml, :edl, :movs
attr_reader :folder, :count
def folder=(path)
@folder = path
- self.ml = self.glob("*.txt").first
- self.edl = self.glob("*.edl").first
- self.movs = self.glob("*.mov")
+ self.ml = self.glob(".txt").first
+ self.edl = self.glob(".edl").first
+ self.movs = self.glob(".mov")
end
def ready?
self.ml && File.exists?(self.ml) &&
self.edl && File.exists?(self.edl) &&
@@ -52,10 +53,21 @@
def parse_marker_list
@ml_data = File.read(self.ml).split(/\r\n?|\n/).map{|i|i.split(/\t/)}
end
def glob(patt)
- Dir.glob(File.join(self.folder, patt))
+ entries = Dir.entries(self.folder).select do |i|
+ i.include? patt
+ end
+ if sep = File::ALT_SEPARATOR
+ entries.map do |entry|
+ File.join self.folder, sep, entry
+ end
+ else
+ entries.map do |entry|
+ File.join self.folder, entry
+ end
+ end
end
end
end
end