コード例 #1
0
def set_movie(metadata, movie):
    metadata.title = movie.get("title")
    metadata.title_sort = movie.get("sort_title")
    metadata.original_title = movie.get("original_title")
    metadata.content_rating = movie.get("content_rating")
    metadata.studio = first_or(movie.get("studio"))
    aired = convert_date(movie.get("aired"))
    metadata.originally_available_at = aired
    metadata.year = aired.year if aired is not None else None
    metadata.tagline = " / ".join(movie.get("tagline"))
    metadata.summary = movie.get("summary")
    metadata.rating = movie.get("rating")
    set_metadata_list(metadata, "genres", movie.get("genres"))
    set_metadata_list(metadata, "collections", movie.get("collections"))
    set_metadata_actors(metadata, movie.get("actors"))
    writers = [
        w.get("name") for w in movie.get("writers", [])
        if w.get("name") is not None
    ]
    directors = [
        d.get("name") for d in movie.get("directors", [])
        if d.get("name") is not None
    ]
    set_metadata_list_name(metadata, "writers", writers)
    set_metadata_list_name(metadata, "directors", directors)
コード例 #2
0
def set_episode(metadata, episode):
    metadata.title = episode.get("title")
    metadata.content_rating = episode.get("content_rating")
    metadata.originally_available_at = convert_date(episode.get("upload_date"))
    metadata.summary = episode.get("description")
    average_rating = episode.get("average_rating")
    metadata.rating = average_rating * 2 if average_rating is not None else None
    set_metadata_list(metadata, "writers", episode.get("writers", []))
    set_metadata_list(metadata, "directors", episode.get("directors", []))
コード例 #3
0
def set_show(metadata, channel):
    metadata.title = channel.get("title")
    metadata.title_sort = channel.get("title")
    metadata.original_title = channel.get("title")
    metadata.content_rating = channel.get("content_rating")
    metadata.studio = channel.get("studio")
    metadata.originally_available_at = convert_date(channel.get("aired"))
    metadata.summary = channel.get("description")
    metadata.rating = channel.get("rating")
    set_metadata_list(metadata, "genres", channel.get("keywords").split())
    set_metadata_list(metadata, "collections", channel.get("collections", []))
    set_metadata_actors(metadata, channel.get("actors", []))
コード例 #4
0
def set_album(metadata, media, album):
    metadata.summary = album.get("summary")
    metadata.rating = album.get("rating")
    set_metadata_list(metadata, "genres", album.get("genres"))
    set_metadata_list(metadata, "collections", album.get("collections"))
    aired = convert_date(album.get("aired"))
    metadata.originally_available_at = aired

    update_album(media.id, media.title, album.get("collections"))

    set_album_cover(metadata, album)

    for track in media.children:
        part = track.items[0].parts[0].file
        update_tracks(track.id, part)
コード例 #5
0
def set_show(metadata, media, show):
    metadata.title = show.get("title")
    metadata.title_sort = show.get("sort_title")
    metadata.original_title = show.get("original_title")
    metadata.content_rating = show.get("content_rating")
    metadata.studio = first_or(show.get("studio"))
    metadata.originally_available_at = convert_date(show.get("aired"))
    metadata.summary = show.get("summary")
    metadata.rating = show.get("rating")
    set_metadata_list(metadata, "genres", show.get("genres"))
    set_metadata_list(metadata, "collections", show.get("collections"))
    set_metadata_actors(metadata, show.get("actors"))

    original_title = show.get("original_title")
    tagline = join_list_or(show.get("tagline"))
    update_show(media.id, original_title, tagline)
コード例 #6
0
def set_artist(metadata, media, artist):
    metadata.summary = artist.get("summary")
    metadata.rating = artist.get("rating")
    set_metadata_list(metadata, "genres", artist.get("genres"))
    set_metadata_list(metadata, "collections", artist.get("collections"))
    set_metadata_list(metadata, "similar", artist.get("similar"))

    set_artist_cover(metadata, media)