Exemplo n.º 1
0
def save_episode(lookup, path, genres, source_type):
    try:
        tvshow = TVShow.get(media_id=lookup.media_id)
    except TVShow.DoesNotExist:
        tvshow = TVShow.create(media_id=lookup.media_id, title=lookup.title, year=lookup.year, type=source_type)
        if genres:
            tvshow.add_genres(genres)
    else:
        tvshow.watched = False
        if tvshow.is_dirty():
            tvshow.save()

    TVShowEpisode.create(season=lookup.season, episode=lookup.episode, path=path, show=tvshow)