This software extracts from an HTML web page all links pointing to video files (.mpeg .wmv .asf) and passes them to a multimedia player. Upon a button-click, it can open in a browser window a page with the URL with the next/previous number in the filename or directory name (e.g. http://server/dir09/file19.htm -> dir09/file20.htm or dir10/file19.htm)
It is a nice example of using GTK GUI toolkit, programming language Ruby, and parsing web pages from the Internet.
Ruby-GNOME2 (GTK)
html/htmltokenizer package
Download both .rb files and run them from the same directory
$LOAD_PATH << File.dirname($0)
This adds to the path the directory where the starting script executes from. This should have been a standard feature of Ruby language (as it is in Java) but somebody decided to make developer's life harder. Oh, well...
class GtkApp
...
end
This class puts together startup code that is usually repeated in every GTK app that has a main window (i.e. almost every app). This should have been included in GTK...
I wasted a lot of time to get an external process started from Ruby in Win32 environment, and have the arguments passed correctly. Here is what I came up with:
# Need double quotes around filename if the path contains spaces
WMP9_EXE = "\"C:\\Program Files\\Windows Media Player\\wmplayer.exe\""
...
# Type HELP START at the DOS/W prompt
# START "Window Name..." "EXE file" args
system "start " +"\"Window Name\""+ " " +
WMP9_EXE + " " + links.collect{|x| "\"#{x}\""}.join(" ")
Winamp has a nice option of specifying /enqueue option at the command line, which appends given links to the list already playing. Windows Media Player makes an effort to prevent any scripting by developers/users who did not fork out $1000 for Micro$oft Visual Studio.
On the other hand, Winamp is pretty bad with playing video clips. One has to fight RealPlayer from installing itself into startup and hi-jacking extension handlers, plus you have to suffer through its 'marketing content'. Is QuickTime serious at all?