Skip to content

Mythling Media Services

Donald Oakes edited this page Sep 1, 2014 · 21 revisions

Mythling comes with a set of PHP-implemented services that are optimized for retrieving structured media lists. These add capabilities currently lacking in the MythTV Services API, like Music listings and a Search function. Retrieving media lists is faster in Mythling when it uses these specialized services, because the results come pre-organized in the way the app uses them, and all sorting/filtering takes place on the server (actually in the database). Mythling services overlap only a fraction of MythTV services, and are not a substitute by any means. For example, Mythling services do not perform the heavy lifting involved in actually transcoding and streaming content.

####Contents Setup
Video Categorization
Supported Parameters
Storage Groups
Limitations

###Setup 1. Install Apache with PHP according to the instructions for your distribution. - Beyond the basics, the required packages include php-mysqlnd. - If you've installed [MythWeb](http://www.mythtv.org/wiki/MythWeb), you already have everything you need.
  1. Install Mythling Services

    • Download media.php from GitHub:
      https://github.com/oakesville/mythling/blob/master/media.php
    • If necessary, edit the first four lines to reflect your MythTV database information.
    • Copy media.php somewhere under your Apache document root. The suggested location is mythling/media.php.
    • Test service access from a browser:
      http://<backend_ip>/mythling/media.php?type=recordings
  2. Open External Access

  3. Configure On Device

    • In the Mythling Connections preferences, enable the Backend Web Server and slide the Media Services switch to Mythling. In the Credentials section set the Backend Web user and password.
    • Navigate back to the main screen and it'll now use Mythling services for populating its lists.
###Video Categorization One of the main UI actions in Mythling is selecting between the available media types (Recordings, Live TV, Videos, Movies, and TV Series). The Recordings list gets its data from the MythTV *recorded* db table. Live TV takes its data from the MythTV downloaded listings in the *program* table. Videos, Movies and TV Series all come from the MythVideo db tables. The mechanism used to segregate videos into these three types is what we call Video Categorization. Three different methods are supported: Directories, Metadata and None (see the Categories preference screen in Mythling).

If Directories are used to categorize videos, then any files under the server directories designated in Mythling's Categories prefs are considered Movies and TV Series respectively (also see Supported Parameters), and everything else is considered Videos. If Metadata is selected, information in the videometadata table is used to decide what's a Movie vs TV Series vs plain Video. (See the MythTV Wiki MythVideo Metadata Lookup topic for a discussion on how to populate this table.) For Metadata categorization, the logic is as follows:

  • If the inetref column is not populated then the item is considered a Video.
  • If inetref is populated but neither season nor episode is populated, the item is considered a Movie.
  • If inetref is populated and either season or episode is present, the item is considered a TV Series.
    If None is selected as the categorization method, then all items are considered Videos. This same logic applies whether you're using Mythling or MythTV media list services.

For Movies and TV Series in Detail Mode, Mythling can display a link to an external site for information about the item. The Base URLs for these links can be specified in the Categories preference screen. The inetref value for the item is appended to the base URL to build the link destination. A Custom Base URL can also be designated, to which the URL-encoded item title is appended as an alternate link.

###Supported Parameters In case you'd like to access the Mythling services directly, or you just want a better understanding of how they work, here's a complete list of supported parameters with their possible values. These can be appended to the URL query string for an HTTP GET request. The return format is always JSON. - type (mandatory): - recordings - liveTv - videos - movies - tvSeries - search - sort (optional): - title (default) - date - rating - categorizeUsingMetadata (optional): - true (default) - categorizeUsingDirectories (optional): - true - movieDirs (optional, used with categorizeUsingDirectories) - (comma-delimited list of directories containing movies, relative to video base) - tvSeriesDirs (optional, used with categorizeUsingDirectories) - (comma-delimited list of directories containing TV shows, relative to video base) - videoExcludeDirs (optional, used with categorizeUsingDirectories) - (comma-delimited list of directories to exclude, relative to video base) - artworkStorageGroup (optional, for media with associated artwork) - storage group name with the artwork to display for each item - query (mandatory when type=search) - string to search for (case is ignored)

Here's an example URL to list movies sorted by date, categorized using directories, and displaying artwork from the Coverart storage group:
http://192.168.0.69/mythling/media.php?type=movies&sort=title&movieDirs=Horror%2CPre-Code&tvSeriesDirs=TV+Shows&videoExcludeDirs=Home+Movies&artworkStorageGroup=Coverart

###Storage Groups Mythling services work with or without Video Storage groups. ###Limitations - Mythling services work with or without the Videos storage group. However, currently only a single storage group directory is supported:
https://github.com/oakesville/mythling/issues/8
Clone this wiki locally