yc_xbake Schema

software / yc_xbake / ycplay

MongoDB & JSON schema for YC XBake 0.20

onodera/ycplay project | yc_xbake | Revision 2 | 07 Jan 2015

https://yatogami.ycnrg.org/onodera/ycplay


MongoDB schema

db.ycplay.videos

This schema is used in MongoDB to store information for each video. There can be multiple transcoded versions of the video, such as a 720p version, 480p, version without subtitles, etc. It also links to the series and episodes collections for more information.
  • _id - Unique ID (MD5 of source video)
  • metadata{}
    • title
    • series
    • episode
    • season
    • special (bool)
    • dub (bool)
    • sub (bool)
  • series_id - xref to db.ycplay.series collection
  • episode_id - xref to db.ycplay.episodes collection
  • vscap[]
    • #0 {}
      • filename - filename of screenshot
      • offset - offset of capture
      • default - if true, select as preview screenshot
    • ...
  • source{}
    • filename
    • location{}
      • hostname
      • path
    • mediainfo{}
      • ...
    • checksum{}
      • ...
    • stat{}
      • ...
  • versions[]
    • "720p" {}
      • filename - filename of encoded version
      • location{}
        • uri - URI of video
        • realpath - full file path on server
      • mediainfo{}
        • ...
      • encoder{}
        • preencode[] - preencode command(s)
          • ...
        • encode - transcode command
        • time - transcode duration
    • ...
  • subs{}
    • enabled
    • lang - language of subs
    • fansub - Fansub group(s)

db.ycplay.files

MongoDB collection for storing list of candidate files that can be selected for adding to the server
  • _id - Unique ID (MD5 checksum)
  • status
  • checksum{}
    • md5
    • crc32
    • ed2k
  • mediainfo
    • general{}
      • unique_id
      • format
      • duration
      • overall_bit_rate
      • encoded_date
      • writing_application
      • writing_library
    • video[]
      • #0
        • id
        • format
        • format_profile
        • codec_id
        • duration
        • width
        • height
        • aspect
        • frame_rate
        • color_space
        • chroma_subsampling
        • bit_depth
        • scan_type
        • title
        • writing_library
        • encoding_settings
        • language
        • default
        • forced
    • audio[]
      • #0
        • id
        • format
        • codec_id
        • duration
        • channels
        • sampling_rate
        • bit_depth
        • title
        • writing_library
        • language
        • default
        • forced
    • text[]
      • #0
        • id
        • format
        • codec_id
        • language
        • default
        • forced
    • menu[]
      • #0
        • offset
        • title
        • lang
        • tstamp
  • fparse
    • series
    • season
    • episode
    • special
    • regex
  • tdex_id
  • series_id
  • episode_id
  • location{}
    • hostname
      • tstamp
      • dpath{}
        • base - base directory name
        • parent - parent directory (base name)
        • full - full path
      • fpath{}
        • real - absolute file path
        • file - filename
        • base - base name (without extension)
      • stat{} - result of fstat()
        • dev
        • ino
        • mode
        • nlink
        • uid
        • gid
        • rdev
        • size
        • atime
        • mtime
        • ctime
        • blksize
        • blocks
      • mkey_id

db.ycplay.series

MongoDB collection for storing series information
  • _id - Unique ID
  • norm_id - Normalized ID (eg. non_non_biyori)
  • title
  • count - number of matched files for this set/series
    • genre[] - list of genre
    • xrefs[]
      • imdb
      • tvdb
    • tv[] - TV air times
      • network
      • dayslot
      • timeslot
      • debut - debut unix timestamp
  • ctitle - corrected title
  • synopsis[]
    • scraper_name
  • tvdb_info{} - debug info for tvdb_info if LOGLEVEL >= DEBUG2
  • artwork - lists of URLs for images
    • banners[]
    • fanart[]
    • poster[]

db.ycplay.episodes

MongoDB collection for storing episode information (most fields are from theTVDB database)
  • _id - Unique ID
  • Combined_episodenumber
  • Combined_season
  • DVD_chapter
  • DVD_discid
  • DVD_episodenumber
  • DVD_season
  • Director
  • EpImgFlag
  • EpisodeName
  • EpisodeNumber
  • FirstAired - format "YYYY-MM-DD"
  • GuestStars
  • IMDB_ID
  • Language - two-letter ISO abbr
  • Overview - episode synopsis
  • ProductionCode
  • Rating
  • RatingCount
  • SeasonNumber
  • Writer
  • absolute_number
  • filename - URL for episode preview img relative to http://thetvdb.com/banners/
  • lastupdated
  • seasonid
  • seriesid - tvdb seriesid
  • thumb_added
  • thumb_height
  • thumb_width

JSON API response schema

API route mscan/prescan

  • Sent by: server (api.php)
  • Received by: client (yc_xbake)

    This data is requested by yc_xbake prior to initiating MScan. The API will then return a JSON object with a list of files and series objects that already exists, so that they can be omitted in the scan.

mkey_id = md5(file.stat.ino . file.stat.mtime . file.stat.size)  
norm_id = ycxb_normalize($series_name)  
  • files{}
    • mkey_id - realpath of file
  • series{}
    • norm_id - lastupdated (unix timestamp of last update)

API route mscan/complete

  • Sent by: client (yc_xbake)
  • Received by: server (api.php)

    This is used by yc_xbake when sending the results of a scan back to the master. The result contains a 'scan' object with the timestamp of the current run, as well as host information, followed by an array of file and series objects.

  • scan{}

    • hostname - Hostname of machine running report
    • tstamp - Unix timestamp
    • duration - Duration of run in seconds (float)
    • topmost - Topmost directory (where scan was initiated)
  • files{}
    • filename.ext {}
      • type - Type (file, directory, etc.)
      • dpath{}
        • base - base directory name
        • parent - parent directory (base name)
        • full - full path
      • fpath{}
        • real - absolute file path
        • file - filename
        • base - base name (without extension)
      • stat{} - result of fstat()
        • dev
          • ino
          • mode
          • nlink
          • uid
          • gid
          • rdev
          • size
          • atime
          • mtime
          • ctime
          • blksize
          • blocks
      • mkey_id
      • status
        • checksum{}
          • md5
          • crc32
          • ed2k
        • mediainfo
        • general{}
          • unique_id
          • format
          • duration
          • overall_bit_rate
          • encoded_date
          • writing_application
          • writing_library
        • video[]
          • #0
            • id
            • format
            • format_profile
            • codec_id
            • duration
            • width
            • height
            • aspect
            • frame_rate
            • color_space
            • chroma_subsampling
            • bit_depth
            • scan_type
            • title
            • writing_library
            • encoding_settings
            • language
            • default
            • forced
        • audio[]
          • #0
            • id
            • format
            • codec_id
            • duration
            • channels
            • sampling_rate
            • bit_depth
            • title
            • writing_library
            • language
            • default
            • forced
        • text[]
          • #0
            • id
            • format
            • codec_id
            • language
            • default
            • forced
        • menu[]
          • #0
            • offset
            • title
            • lang
            • tstamp
      • fparse
        • series
        • season
        • episode
        • special
        • regex
      • tdex_id
  • series{}
    • series_id
      • title
      • count - number of matched files for this set/series
      • genre[] - list of genre
      • xrefs[]
        • imdb
        • tvdb
      • tv[] - TV air times
        • network
        • dayslot
        • timeslot
        • debut - debut unix timestamp
      • ctitle - corrected title
      • synopsis[]
        • scraper_name
      • tvdb_info{} - debug info for tvdb_info if LOGLEVEL >= DEBUG2
      • artwork - lists of URLs for images
        • banners[]
        • fanart[]
        • poster[]
      • episodes[]
        • #0
          • id
          • Combined_episodenumber
          • Combined_season
          • DVD_chapter
          • DVD_discid
          • DVD_episodenumber
          • DVD_season
          • Director
          • EpImgFlag
          • EpisodeName
          • EpisodeNumber
          • FirstAired - format "YYYY-MM-DD"
          • GuestStars
          • IMDB_ID
          • Language - two-letter ISO abbr
          • Overview - episode synopsis
          • ProductionCode
          • Rating
          • RatingCount
          • SeasonNumber
          • Writer
          • absolute_number
          • filename - URL for episode preview img relative to http://thetvdb.com/banners/
          • lastupdated
          • seasonid
          • seriesid - tvdb seriesid
          • thumb_added
          • thumb_height
          • thumb_width
Share on : Twitter, Facebook or Google+