Class: VLCProgrammer
- Inherits:
-
Object
- Object
- VLCProgrammer
- Defined in:
- lib/vlc_programmer.rb
Class Method Summary collapse
- .convert_to_full_xspf(incoming, filename = nil, drive_with_slash = nil, dvd_title_track = nil, dvd_title_name = nil) ⇒ Object
- .get_footer(idx) ⇒ Object
- .get_header ⇒ Object
- .get_section(title, start, stop, idx, no_audio = false) ⇒ Object
- .to_english(s) ⇒ Object
Class Method Details
.convert_to_full_xspf(incoming, filename = nil, drive_with_slash = nil, dvd_title_track = nil, dvd_title_name = nil) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/vlc_programmer.rb', line 27 def self.convert_to_full_xspf incoming, filename = nil, drive_with_slash = nil, dvd_title_track = nil, dvd_title_name = nil @drive = drive_with_slash || "e:\\" @filename_or_playlist_if_nil = filename @dvd_title_track = dvd_title_track || "1" @dvd_title_name = dvd_title_name combined = EdlParser.convert_incoming_to_split_sectors incoming out = get_header previous_end = 0 idx = 0 combined.each{|start, endy, type| # next unless start #next if endy <= start real_start = start # NB that this fails with VLC or mplayer, because of i-frame difficulties (google mencoder start time) if previous_end != start # play 'uncut' up to next "questionable section" out += get_section("#{@dvd_title_name} : #{to_english previous_end} to #{to_english start} (clean)", previous_end, real_start, idx += 1) else # immediately let it do the next action end # now play through the muted section... if type == :mute out += get_section "#{@dvd_title_name} : #{to_english start}s to #{to_english endy}s muted", real_start, endy, idx += 1, true end previous_end = endy } # now play the rest of the movie... out += get_section to_english(previous_end) + " to end of film", previous_end, 1_000_000, idx += 1 # and close the xml... out += idx end |
.get_footer(idx) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/vlc_programmer.rb', line 96 def self. idx if @filename_or_playlist_if_nil == nil "</trackList></playlist>" else filename = @filename_or_playlist_if_nil files = (1..idx).map{|n| "#{filename}.ps.#{n}"} # concat line = 'copy /b ' + files.join('+') line += " #{@filename_or_playlist_if_nil}.ps\n" line += "@rem del " + files.join(' ') + "\n" # LODO! line += "echo Done--you may now watch file #{filename}.ps in VLC player" end end |
.get_header ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/vlc_programmer.rb', line 65 def self.get_header if @filename_or_playlist_if_nil == nil "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\" xmlns:vlc=\"http://www.videolan.org/vlc/playlist/ns/0/\"> <title>Playlist</title> <!--location>c:\\installs\\test.xspf</location--> <trackList>" else "" end end |
.get_section(title, start, stop, idx, no_audio = false) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/vlc_programmer.rb', line 77 def self.get_section title, start, stop, idx, no_audio = false loc = "dvdsimple://#{@drive}@#{@dvd_title_track}" if @filename_or_playlist_if_nil == nil "<track> <title>#{title}</title> <extension application=\"http://www.videolan.org/vlc/playlist/0\"> <vlc:id>#{idx}</vlc:id> <vlc:option>start-time=#{start}</vlc:option> #{"<vlc:option>noaudio</vlc:option>" if no_audio} <vlc:option>stop-time=#{stop}</vlc:option> </extension> <location>#{loc}</location> </track>" else "vlc --qt-start-minimized #{loc} --start-time=#{start} --stop-time=#{stop} --sout=\"file/ps:#{@filename_or_playlist_if_nil}.ps.#{idx}\" #{"--no-sout-audio" if no_audio} vlc://quit\n" # + #"vlc #{@filename_or_playlist_if_nil}.ps.#{idx}.tmp --sout=file/ps:go.ps end end |
.to_english(s) ⇒ Object
22 23 24 |
# File 'lib/vlc_programmer.rb', line 22 def self.to_english s EdlParser.translate_time_to_human_readable s end |