Kodi Community Forum
Perl script I wrote - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: Perl script I wrote (/showthread.php?tid=15403)



- dagretchen - 2005-10-04

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);
}


- HarshReality - 2005-10-05

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?


- dagretchen - 2005-10-06

yep, each movie goes on a seperate line.