From MythTV Official Wiki
Revision as of 03:02, 26 May 2009 by Pestilence (talk | contribs) (just added an Ubuntu version which needs an extra package to run this script.)

Jump to: navigation, search

Important.png Note: The correct title of this article is It appears incorrectly here due to technical restrictions. 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.

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 script can do that for you.

    usage: [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. --try_default

    Example 2:
      Assumption: The script is run on a backend other than the DB host. --dbhost=mydbserver

    Example 3:
      Import one specific file and supply first few answers. --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: --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*
$ alias myrbdb=/local/mythtv-src/mythtv-0.20/contrib/
$ 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.

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
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.


On Ubuntu 6.06, 7.04, and 9.04 at least, you must install the libtime-format-perl package.