Mythtv

2012-05-09
2015-01-13
  • william otten
    william otten
    2012-05-09

    Can I use mediatomb with mythtv to serve the media (tv recordings, video, music & photos). Will mediatomb be able to get the metadata for the tv recording since mythtv uses numeric naming? I\'m looking to use this product with android devices.

     
  • Pumbaa2
    Pumbaa2
    2014-04-10

    MythTV has its own built in uPnP Server to serve Recordings, etc. It works really well. However, there is a MythTV script that works with the database to create symlinks from the numerical filenames to the Recording Titles. Unless you are using a Digital Tuner (HDHomeRun, etc), your recordings might be in NUV Format instead of MPG Format. I've never tried to serve one of these files via MediaTomb. You may need to enable a transcoder to run nuvexport, etc to obtain a usable format that can be served via MediaTomb to your media player.

     
  • I modified the script from http://www.gsjs.org/Home/mythtv-mediatomb

    Diffs for mediatomb JS files
    --- playlists.js.orig 2015-01-13 12:36:38.836475765 +1030
    +++ playlists.js 2015-01-13 13:26:53.034207064 +1030
    @@ -190,3 +190,21 @@
    addPlaylistItem(file, title, playlistDirChain, lastId);
    }
    }
    +else if (type == 'tsv')
    +{
    + var line = readln();
    + while (line)
    + {
    + lineParts = line.split('\t');
    + // /myth/2624_20150111090300.mpg 2015-01-11 1 MythTV Futurama During a Sith War re-enactment, Bender is injured and discovers he is mortal after all. Struggling to cope with the news, Bender and Hermes head to Mexico in search of his inspector.
    + var item = new Object();
    + item.location = lineParts[0];
    + item.title = lineParts[1];
    + item.playlistOrder = lineParts[2];
    + item.description = lineParts[5];
    + item.objectType = OBJECT_TYPE_ITEM;
    + //print("Adding location:" + item.location + ", title:" + item.title + ", desc:" + item.description + ", order:" + item.playlistOrder + ", chain:" + createContainerChain(lineParts.slice(3,5)));
    + addCdsObject(item, createContainerChain(lineParts.slice(3,5)), UPNP_CLASS_PLAYLIST_CONTAINER);
    + line = readln();
    + }
    +}

    Export script (/home/mythtv/bin/myth-export-db-to-tsv)
    #!/bin/sh

    MythDir="/myth" # This is the directory where all the myth recordings are stored
    MediaTombRoot="MythTV" # This is the name of the mediatomb folder that will contain the list of recordings
    MythDBUser="mythtv" # mythconverge db username
    MythDBPass="mythtv" # mythconverge db password

    echo "select distinct title from recorded;" | mysql --user=$MythDBUser --password=$MythDBPass -N mythconverg | \ while read show
    do
    echo "set @i=0; \ select CONCAT('$MythDir/',basename), \ if(subtitle=\"\",DATE_FORMAT(starttime,\"%Y-%m-%d\"),subtitle), \ @i:=@i+1, \"$MediaTombRoot\", title, description from recorded where title=\"$show\" order by starttime;" \ | mysql --user=$MythDBUser --password=$MythDBPass -N mythconverg
    done

    Crontab
    0 * * * * /home/mythtv/bin/myth-export-db-to-tsv >/home/mythtv/mythtv.tsv

    Obviously you will need to adjust if your paths are different :)

    Once you have made the mods you can restart media tomb and add the created tsv file.

    If you remove the // in front of the print in the .js you will see a message printed in the MT log for each file added.