Showing posts with label perl. Show all posts
Showing posts with label perl. Show all posts

Tuesday, January 9, 2007

Script to create playlists of VOB files

We have a D-Link DSM-320 media player and we use TVersity as its media server. We use it mainly to watch movies across our network. One thing we can do is watch the original VOB files ripped from a DVD, but the problem is there are multiple VOB files for a movie and after each one ends, the next one has to be manually started. (You can merge to VOBs into one, but the DSM-320 has a 4GB file limit.) One solution is to create a playlist for each movie, containing all movie's VOB files.

I wrote this Perl script to do just that. (It is similar to the script I wrote to auto-generate music playlists.) It traverses a directory and creates playlists for all subdirectories containing VOB files.

Just set $path (source) and $dest (playlist directory) in the script and then run it. It assumes the folder containing the VOBs will be named after the movie and it uses that folder name as the playlist name.

Monday, November 6, 2006

Perl script to autogenerate playlists from mp3s

I wrote this perl script to autogenerate playlist files (.m3u) for each CD we have. Some servers don't play the songs in CD order, but they will with a playlist.

# assumes mp3 directory structure of g:/mp3/artist/album/tracks.mp3
# generates playlist of format: g:/m3u/artist-album.m3u

$mp3dir="g:/mp3";
$m3udir="g:/m3u";

opendir(ARTIST, $mp3dir);
@dir = grep !/^\.\.?$/, readdir ARTIST;
foreach $artist (@dir) {
print "\nartist: $artist\n";
opendir(ALBUM,"g:/mp3/$artist");
@album = grep !/^\.\.?$/, readdir ALBUM;

foreach $album (@album) {
print " album: $album\n";

opendir(TRACK,"g:/mp3/$artist/$album");
@track=grep /\.mp3/,readdir TRACK;
$playlist="";
foreach $track (@track) {
print " track: $track\n";
$playlist.="g:\\mp3\\$artist\\$album\\$track\n";
}
closedir TRACK;

# create playlist
$m3u_name="$m3udir/$artist-$album.m3u";
$m3u_name=~s/\\ /_/g;
print " m3u: $m3u_name\n\n";
PrivoxyWindowOpen(A,">$m3u_name");
print A $playlist;
close(A);
}
closedir ALBUM;
}

Monday, October 30, 2006

Perl script to build HAL addrbook.dbf

Building on the previous post, I've modified that script to create the HAL address book database from a text file. This can be used to import data from Outlook or whatever PIM you use. You just need to export your data into a CSV and massage it into the right format. Instructions in the file. Of course, backup your files before you play.

the script

Sunday, October 29, 2006

Perl Script to Build HAL Tasks Database

Here's a script I just finished to build the HAL tasks database. You can now edit your tasks in text and use this script to create the .DBF and .FPT files. No more kludgy HAL point and click editor :) It requires the XBase package from my previous post.

the script

Make sure you backup your HAL data before using this script!!!