Media Catalog

The media catalog is basically just a file system directory that contains video files and metadata. The directory layout has a structure like this:

/srv/snaptv/media/
  images/
    ...
  movies/
    anchorman2/
      movie.mpg
      trailer.mpg
      metadata.json
      directory.list
    gambit/
      movie.mpg
      trailer.mpg
      metadata.json
      directory.list
    ...
  news/
    dagsrevyen/
      metadata.json
      directory.list
      _episodes/
        2016-05-22/
          movie.mpg
          metadata.json
          directory.list
        2016-05-23/
          movie.mpg
          metadata.json
          directory.list
    bbc_news/
      metadata.json
      directory.list
      episodes/
        ...

Episodes are ordered alphabetically, so the directory names should be either dates or episode numbers (01, 02, 03,...). There can be other top-level directories as well, such as series etc. Top-level directories can contain both movies and series, distinguished by the existence of either movie.mpg or _episodes/.

In each asset directory, there is also a file called directory.list. This file is required, and it contains a list of filenames, one per line. Each file in the list is also required to be present, for the asset to be included in query results. This mechanism prevents incomplete assets from showing in the user interface, for instance while new content is being downloaded.

Metadata

Movies, series, and episodes within a series all have metadata assiciated with them, in the file metadata.json. Descriptions can include multiple language text, as well as images.

Example metadata:

{
  "timestamp": "2016-05-41T22:10:00Z",
  "popularity": 2.46606901597844,
  "vote_average": 6.2,
  "vote_count": 1840,
  "release_date": "2012-06-29",
  "runtime": 107,
  "adult": false,
  "details": [
    {
      "language": "en",
      "title": "Ted",
      "tagline": "Ted is coming.",
      "overview": "Family Guy creator Seth MacFarlane brings his...",
      "genres": [
        "Comedy",
        "Fantasy"
      ],
      "poster_path": {
        "small": "tmdb/w45/5ExgYTRafm4kFRwHp2jH6C23Yl4.jpg",
        "large": "tmdb/w185/5ExgYTRafm4kFRwHp2jH6C23Yl4.jpg",
        "full": "tmdb/h632/5ExgYTRafm4kFRwHp2jH6C23Yl4.jpg"
      },
      "backdrop_path": {
        "small": "tmdb/w300/sPiFgbWMSQxVMO6TuRFrkeWwarI.jpg",
        "large": "tmdb/w780/sPiFgbWMSQxVMO6TuRFrkeWwarI.jpg",
        "full": "tmdb/w1280/sPiFgbWMSQxVMO6TuRFrkeWwarI.jpg"
      },
      "source": "http://themoviedb.org"
    },
    {
      "language": "fr",
      "title": "Ted",
      "tagline": "Meilleur ami de l'homme, pire ennemi du couple!",
      "backdrop_path": {...},
      ...
    }
  ]
}

Note that the metadata does not need to contain any information that is already given by the directory layout, such as which episodes belong to a series.

Top level attrubutes:

  • timestamp (ISO date)
  • adult (boolean)
  • popularity (number)
  • vote_average (number)
  • vote_count (number)
  • release_date (text)
  • runtime (number)

Details attributes:

Details gan be given in multiple languages, as an array of objects. If a given attribute is not available in the selected language, the first language in the array is used as a default.

  • language (ISO language code, required)
  • title (text)
  • tagline (text)
  • overview (text)
  • genres (array of text)
  • backdrop_path (images)
  • poster_path (images)
  • source (text)

Images are objects that contain path to images, relative to the images/ directory, for each of the following sizes (suggested sizes in pixels):

  • small (poster 45x68, backdrop 300x169)
  • large (poster 185x278, backdrop 780x439)
  • full (poster 426x632, backdrop 1280x720)