Perl script I wrote
#1
hey everyone, i'm new to the forum's, but not new to xbmc. i've been useing this program since it came out and absolutly love it. i rescently upgraded my xbmc to the newest version and began to use its feature of indexing my offline dvd collection, seeing as i have about 300 dvd's it would clearly take a long time to create "title.vob" for each and everyone of them, i looked around for a script to automate the process of turning a list of movies into files in this format but failed to find one, so i made one myself. i'm sure it could be more efficient, and someone has probably already made something like this before seeing as its not very complex at all, but i figured if i went through the work to make it, i may as well post it here incase someone else needed something like this. the script it written in perl, and works on a windows system. it may not be the most efficient, but it saved me alot of time, and gets the job done. i hope someone finds it useful, otherwise sorry for wasting your time.



#!/usr/bin/perl
print "content-type: text/html\n\n";

#variable for list file
$data_file="/inetpub/wwwroot/perl/xbmc/list.txt";

#opens list file and puts in array
open(dat, $data_file) || die("could not open file!");
@raw_data=<dat>;
close(dat);

#chomps /n character from end
foreach $movie (@raw_data) {
chomp($movie);
}

#change outpt variable for where you want the files to go
foreach $movie (@raw_data) {
$outpt="/inetpub/wwwroot/perl/xbmc/";
$extension=".vob";
$movie=$outpt.$movie.$extension;
open(dat2,'>'.$movie) || die("could not open file!");
print $movie;
close(dat2);
}
Reply
#2
so as i a ma perl idiot, this takes a list in a text file and creates a single file with a vob extension for each line in the text file?
Image
Reply
#3
yep, each movie goes on a seperate line.
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
Perl script I wrote00