Difference between revisions of "Myth.rebuilddatabase.pl"
Pestilence (talk | contribs) m (just added an Ubuntu version which needs an extra package to run this script.) |
(warning concerning script being deprecated) |
||
Line 1: | Line 1: | ||
{{Wrongtitle|myth.rebuilddatabase.pl}} | {{Wrongtitle|myth.rebuilddatabase.pl}} | ||
'''myth.rebuilddatabase.pl''' is a script in the contrib directory that traverses the specified MythTV recordings directory and finds all files with video extensions and checks if they appear in the database. If no entry exists it prompts for identifying information and a recording entry is created. | '''myth.rebuilddatabase.pl''' is a script in the contrib directory that traverses the specified MythTV recordings directory and finds all files with video extensions and checks if they appear in the database. If no entry exists it prompts for identifying information and a recording entry is created. | ||
+ | |||
+ | '''Warning this script is deprecated. It has not been updated in line with changes to the main mythtv programs. The developers are looking to put this functionality into the main backend and frontend programs, but as at 28 Feb 2010 this has not been acheived. See http://www.gossamer-threads.com/lists/mythtv/users/425156#425156''' | ||
Let's say you have a recorded program, a *.nuv file for example. And MythTV doesn't know about it | Let's say you have a recorded program, a *.nuv file for example. And MythTV doesn't know about it |
Revision as of 21:56, 27 February 2010
Note: The correct title of this article is myth.rebuilddatabase.pl. It appears incorrectly here due to technical restrictions.
myth.rebuilddatabase.pl is a script in the contrib directory that traverses the specified MythTV recordings directory and finds all files with video extensions and checks if they appear in the database. If no entry exists it prompts for identifying information and a recording entry is created.
Warning this script is deprecated. It has not been updated in line with changes to the main mythtv programs. The developers are looking to put this functionality into the main backend and frontend programs, but as at 28 Feb 2010 this has not been acheived. See http://www.gossamer-threads.com/lists/mythtv/users/425156#425156
Let's say you have a recorded program, a *.nuv file for example. And MythTV doesn't know about it (e.g., you copied it from your video directory to a backup location and then deleted it from the MythTV list of recordings). And then you want to re-introduce the recording to MythTV (so the recording shows up again in the list of recordings). How do you do that re-introduction? The myth.rebuilddatabase.pl script can do that for you.
usage: myth.rebuilddatabase.pl [options] Where [options] is: --host - hostname of this backend (default: "ubuntu") --dbhost - hostname or IP address of the mysql server (default: "ubuntu") --user - DBUSERNAME (default: "mythtv") --pass - DBPASSWORD (default: "mythtv") --database - DATABASENAME (default: "mythconverg") --show_existing - Dumps current recorded table. --dir - path to recordings --group - Storage Group to import as (default: "Default") --try_default - Try to just run with the defaults. --quick_run - don't prompt for title/subtitle/description just use the default --test_mode - do everything except update the database --ext - file extensions to scan. csh/File::Glob syntax is used (ie, --ext {mpg,avi,divx}) --file - specific file to import --answer - command-line response to prompts (give as many answers as you like) --norename - don't rename file to myth convention Example 1: Assumption: The script is run on DB/backend machine. myth.rebuilddatabase.pl --try_default Example 2: Assumption: The script is run on a backend other than the DB host. myth.rebuilddatabase.pl --dbhost=mydbserver Example 3: Import one specific file and supply first few answers. myth.rebuilddatabase.pl --file MyVideo.avi --answer y \ --answer 1041 --answer "My Video" The script chooses reasonable defaults for all values so it's possible to do a quick import of a single video by taking input from null: myth.rebuilddatabase.pl --file MyVideo.avi < /dev/null this also works with multiple videos but because record start time is synthesized from file modification time you have to be careful of possible collisions.
Here's an example session to re-introduce a recording.
$ cd /video $ ls *Peach* JamesAndTheGiantPeach.nuv $ alias myrbdb=/local/mythtv-src/mythtv-0.20/contrib/myth.rebuilddatabase.pl $ mysql -u mythtv -pmythtv mythconverg -e 'SELECT chanid,starttime,endtime,title,subtitle,description FROM recordedprogram WHERE title LIKE "%Peach%"' chanid starttime endtime title subtitle description 1059 2007-08-08 11:00:00 2007-08-08 12:30:00 James and the Giant Peach A kindly British orphan (Paul Terry) escapes his cruel aunts (Joanna Lumley, Miriam Margolyes) to sail the sea on a giant peach with six friendly bugs. Animated. $ $ myrbdb --dbhost localhost --file JamesAndTheGiantPeach.nuv These are the files stored in (/video) and will be checked against your database to see if the exist. If they do not, you will be prompted for a title and subtitle of the entry, and a record will be created. /video/JamesAndTheGiantPeach.nuv Unknown file /video/JamesAndTheGiantPeach.nuv found. Do you want to import? [y]: Enter channel [1002]: 1059 ... title [JamesAndTheGiantPeach]: James and the Giant Peach ... subtitle: Description [Recovered file JamesAndTheGiantPeach.nuv]: A kindly British orphan (Paul Terry) escapes his cruel aunts (Joanna Lumley, Miriam Margolyes) to sail the sea on a giant peach with six friendly bugs. Animated. ... start time (YYYY-MM-DD HH:MM:SS) [2007-08-18 20:33:23]: 2007-08-08 11:00:00 ... duration (in minutes) [60]: 90 Building a seek table should improve FF/RW and JUMP functions when watching this video Do you want to build a seek table for this file? [y]: 2007-08-20 13:12:19.260 Using runtime prefix = /usr/local 2007-08-20 13:12:19.348 New DB connection, total: 1 2007-08-20 13:12:19.366 mythcommflag version: 0.20.20060828-3 www.mythtv.org 2007-08-20 13:12:19.374 Enabled verbose msgs: important MythTV Commercial Flagger, started at Mon Aug 20 13:12:19 2007 Rebuilding SeekTable(s) for: ChanID Start Time Title Status ------ -------------- ----------------------------------------- ------ 2007-08-20 13:12:21.400 New DB connection, total: 2 1059 20070808110000 James and the Giant Peach 2007-08-20 13:12:21.554 Using protocol version 30 99%/ 1935fpsRebuilt Finished commercial break flagging at Mon Aug 20 13 $
Version Notes
Version 0.0.3 (installed with Ubuntu's Gutsy Gibbon) does not seem to work with the --file command. As a workaround use the --ext command.
Prerequisites
On Ubuntu 6.06, 7.04, and 9.04 at least, you must install the libtime-format-perl package.