Perl script I wrote

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
dagretchen Offline
Junior Member
Posts: 3
Joined: Oct 2005
Reputation: 0
Post: #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);
}
find quote
HarshReality Offline
Posting Freak
Posts: 1,544
Joined: Jan 2005
Reputation: 0
Post: #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: x3.jpg]
find quote
dagretchen Offline
Junior Member
Posts: 3
Joined: Oct 2005
Reputation: 0
Post: #3
yep, each movie goes on a seperate line.
find quote