Table of Contents

Additional Scripts

VideoDB comes with some additional Scripts to do certain tasks, using them is completely optional and not needed for a functional VideoDB. All these files are stored in the contrib directory.

Some of them are written in Perl and you have to edit them to match your database auth options. Some knowledge of Perl and SQL may be helpful.

If you wrote something you think others could find useful just send it to the Mailinglist and it will be included in the next release.

mklist.pl

This generates a plaintextlist of all files in the database. Edit the variables at the top

setGenre.pl

This script is useful to set the same genres for a bunch of entries based on their title. For example setting all Simpsons episodes to Animation and Comedy. You have to edit some variables at top of the file to make it do what you want.

videoadd.pl

This tool is very useful to automatically add some videofiles to the database. It mounts your CD-ROM drive, searches for video files, tries to guess the title and some other infos from the filename and adds them to the database. It uses MPlayer to extract video informations from the file. It accepts the path to your CD-ROM drive as argument.

direxport.pl

This creates single html pages from the movies in the database. It allows me to browse the database content with my IR File Chooser tool.

langcheck.php

This PHP tool checks all language files for missing translations and displays the missing keys. This is useful for Translators. Just call it from your webbrowser like this: http://myserver.com/videodb/contrib/langcheck.php

tvtome.php

To use this PHP tool call it from your webbrowser like this: http://myserver.com/videodb/contrib/tvtome.php. This tool can fetch episode infos from www.tvtome.com and add the data to the episodes in your VideoDB.

You need to enter the complete URL to the TV shows episode guide at tvtome (eg. http://www.tvtome.com/Futurama/guide.html for Futurama) and some searchstring to select the episodes of this show stored in your VideoDB (eg. Futurama* to find all movies with their titles beginning with Futurama)

After you press the “submit query” button the tool fetches the episode guide and lists all episodes. For each episode you have to choose the matching movie in your VideoDB. The tool tries to suggest the matching title based upon an similarity comparison. For each episodes data you want to import you need to check the checkbox. On pressing the final submit button the selected data is imported.

You need log in with administrator rights to use this tool in multiuser mode.

dvdadd.pl

Use this Perl script to read data from your DVD drive and create an entry in videoDB from it.

Supports: language, video width and height, dvd title, audio format and channels. Newer versions support subtitles. The lsdvd Unix tool is required to read the DVD.

lookupbarcode.php

This script is very handy for people with barcode readers, and a large DVD/VHS collection. Just call it from your webbrowser like this: http://myserver.com/videodb/contrib/lookupbarcode.php. If you have javascript enabled, it should start you in the barcode box. Scan in (or type in the *full* number) of the barcode. VideoDB will then search Amazon for your title, and forward you onto the New page. You should find the title of your DVD/VHS in the title box. If the title is a VHS, it should set the default entry for the media type too, otherwise it will default to DVD.

If you are in multiuser mode you should log in first.

mklist.php

note: this isn't part of the official ditribution and only added here

replacement for the mklist.pl if you like to prefer php.

<?php 
 
//csv dump file (with tabs) .
header("Content-type: application/octet-stream"); 
header("Content-disposition: attachment; filename=videodb_".date("Y-m-d").".csv"); //filename with timestamp
header("Pragma: no-cache"); 
header("Expires: 0"); 
 
$user = "";		//PUT YOUR mysql username here
$password = "";		// PUT YOUR mysql username's password here
$dbname= "videodb";		//database name; change it, if you have different database name
$tablename ="videodata";		// database table name
 
// localhost is the default database for most servers, you might need to change yours if it doesn't work
$global_dbh = mysql_connect("localhost", $user, $password); //  establishing database connection
 
mysql_select_db($dbname, $global_dbh); 	// select database 
 
// you do not need to change the function
function display_db_table($tablename, $connection)
{
	$query_string = "select id,title,subtitle,diskid,imdbID,year,runtime,created,owner_id from $tablename order by title asc"; // perhaps you like different order, change mysql-order-directive
	$result_id = mysql_query($query_string, $connection);
	$column_count = mysql_num_fields($result_id);
	echo "id\ttitle\tsubtitle\tdiskid\timdbID\tyear\truntime(min)\tcreated\towner\n";// csv created with tabs (\t), remember if you want to reimport the file in OOo or Excel
	while ($row = mysql_fetch_row($result_id))
	{
		for ($column_num = 0;$column_num < $column_count; $column_num++)
		{
			echo "$row[$column_num]\t";
		}
		echo "\n";
	}
	/*echo "owner: 1=User1, 2=User2, diskid without value = wanted video";//you have to edit this, if you add more users for videodb.*/
}
 
display_db_table($tablename, $global_dbh); 
 
?>