def episodes(): return { 'bbt_s07e05': Episode(os.path.join( 'The Big Bang Theory', 'Season 07', 'The.Big.Bang.Theory.S07E05.720p.HDTV.X264-DIMENSION.mkv'), 'The Big Bang Theory', 7, 5, format='HDTV', release_group='DIMENSION', resolution='720p', video_codec='h264', audio_codec='AC3', imdb_id=3229392, size=501910737, title='The Workplace Proximity', year=2007, tvdb_id=80379, hashes={ 'opensubtitles': '6878b3ef7c1bd19e', 'thesubdb': '9dbbfb7ba81c9a6237237dae8589fccc' }), 'got_s03e10': Episode(os.path.join( 'Game of Thrones', 'Season 03', 'Game.of.Thrones.S03E10.Mhysa.720p.WEB-DL.DD5.1.H.264-NTb.mkv'), 'Game of Thrones', 3, 10, format='WEB-DL', release_group='NTb', resolution='720p', video_codec='h264', audio_codec='AC3', imdb_id=2178796, size=2142810931, title='Mhysa', tvdb_id=121361, hashes={ 'opensubtitles': 'b850baa096976c22', 'thesubdb': 'b1f899c77f4c960b84b8dbf840d4e42d' }), 'dallas_s01e03': Episode('Dallas.S01E03.mkv', 'Dallas', 1, 3), 'dallas_2012_s01e03': Episode('Dallas.2012.S01E03.mkv', 'Dallas', 1, 3, year=2012), 'marvels_agents_of_shield_s02e06': Episode( 'Marvels.Agents.of.S.H.I.E.L.D.S02E06.720p.HDTV.x264-KILLERS.mkv', 'Marvels Agents of S.H.I.E.L.D.', 2, 6, format='HDTV', release_group='KILLERS', resolution='720p', video_codec='h264', year=2013) }
def refine_video(video, episode): # try to enrich video object using information in original filename if episode.release_name: guess_ep = Episode.fromguess(None, guessit(episode.release_name)) for name in vars(guess_ep): if getattr(guess_ep, name) and not getattr(video, name): setattr(video, name, getattr(guess_ep, name)) # Use sickbeard metadata metadata_mapping = { 'episode': 'episode', 'release_group': 'release_group', 'season': 'season', 'series': 'show.name', 'series_imdb_id': 'show.imdbid', 'size': 'file_size', 'title': 'name', 'year': 'show.startyear' } def get_attr_value(obj, name): value = None for attr in name.split('.'): if not value: value = getattr(obj, attr, None) else: value = getattr(value, attr, None) return value for name in metadata_mapping: if not getattr(video, name) and get_attr_value(episode, metadata_mapping[name]): setattr(video, name, get_attr_value(episode, metadata_mapping[name])) elif episode.show.subtitles_sr_metadata and get_attr_value(episode, metadata_mapping[name]): setattr(video, name, get_attr_value(episode, metadata_mapping[name])) # Set quality from metadata _, quality = Quality.splitCompositeStatus(episode.status) if not video.format or episode.show.subtitles_sr_metadata: if quality & Quality.ANYHDTV: video.format = Quality.combinedQualityStrings.get(Quality.ANYHDTV) elif quality & Quality.ANYWEBDL: video.format = Quality.combinedQualityStrings.get(Quality.ANYWEBDL) elif quality & Quality.ANYBLURAY: video.format = Quality.combinedQualityStrings.get(Quality.ANYBLURAY) if not video.resolution or episode.show.subtitles_sr_metadata: if quality & (Quality.HDTV | Quality.HDWEBDL | Quality.HDBLURAY): video.resolution = '720p' elif quality & Quality.RAWHDTV: video.resolution = '1080i' elif quality & (Quality.FULLHDTV | Quality.FULLHDWEBDL | Quality.FULLHDBLURAY): video.resolution = '1080p' elif quality & (Quality.UHD_4K_TV | Quality.UHD_4K_WEBDL | Quality.UHD_4K_BLURAY): video.resolution = '4K' elif quality & (Quality.UHD_8K_TV | Quality.UHD_8K_WEBDL | Quality.UHD_8K_BLURAY): video.resolution = '8K'
def refine_video(video, episode): # try to enrich video object using information in original filename if episode.release_name: guess_ep = Episode.fromguess(None, guessit(episode.release_name)) for name in vars(guess_ep): if getattr(guess_ep, name) and not getattr(video, name): setattr(video, name, getattr(guess_ep, name)) # Use sickbeard metadata metadata_mapping = { 'episode': 'episode', 'release_group': 'release_group', 'season': 'season', 'series': 'show.name', 'series_imdb_id': 'show.imdbid', 'size': 'file_size', 'title': 'name', 'year': 'show.startyear' } def get_attr_value(obj, name): value = None for attr in name.split('.'): if not value: value = getattr(obj, attr, None) else: value = getattr(value, attr, None) return value for name in metadata_mapping: if not getattr(video, name) and get_attr_value(episode, metadata_mapping[name]): setattr(video, name, get_attr_value(episode, metadata_mapping[name])) elif episode.show.subtitles_sr_metadata and get_attr_value(episode, metadata_mapping[name]): setattr(video, name, get_attr_value(episode, metadata_mapping[name])) # Set quality from metadata _, quality = Quality.splitCompositeStatus(episode.status) if not video.format or episode.show.subtitles_sr_metadata: if quality & Quality.ANYHDTV: video.format = Quality.combinedQualityStrings.get(Quality.ANYHDTV) elif quality & Quality.ANYWEBDL: video.format = Quality.combinedQualityStrings.get(Quality.ANYWEBDL) elif quality & Quality.ANYBLURAY: video.format = Quality.combinedQualityStrings.get(Quality.ANYBLURAY) if not video.resolution or episode.show.subtitles_sr_metadata: if quality & (Quality.HDTV | Quality.HDWEBDL | Quality.HDBLURAY): video.resolution = '720p' elif quality & Quality.RAWHDTV: video.resolution = '1080i' elif quality & (Quality.FULLHDTV | Quality.FULLHDWEBDL | Quality.FULLHDBLURAY): video.resolution = '1080p' elif quality & (Quality.UHD_4K_TV | Quality.UHD_4K_WEBDL | Quality.UHD_4K_BLURAY): video.resolution = '4K' elif quality & (Quality.UHD_8K_TV | Quality.UHD_8K_WEBDL | Quality.UHD_8K_BLURAY): video.resolution = '8K'
def refine_video(video, episode): # try to enrich video object using information in original filename if episode.release_name: guess_ep = Episode.fromguess(None, guessit(episode.release_name)) for name in vars(guess_ep): if getattr(guess_ep, name) and not getattr(video, name): setattr(video, name, getattr(guess_ep, name)) # Use sickbeard metadata metadata_mapping = { "episode": "episode", "release_group": "release_group", "season": "season", "series": "show.name", "series_imdb_id": "show.imdbid", "size": "file_size", "title": "name", "year": "show.startyear", } def get_attr_value(obj, name): value = None for attr in name.split("."): if not value: value = getattr(obj, attr, None) else: value = getattr(value, attr, None) return value for name in metadata_mapping: if not getattr(video, name) and get_attr_value(episode, metadata_mapping[name]): setattr(video, name, get_attr_value(episode, metadata_mapping[name])) elif episode.show.subtitles_sr_metadata and get_attr_value(episode, metadata_mapping[name]): setattr(video, name, get_attr_value(episode, metadata_mapping[name])) # Set quality form metadata _, quality = Quality.splitCompositeStatus(episode.status) if not video.format or episode.show.subtitles_sr_metadata: if quality & Quality.ANYHDTV: video.format = Quality.combinedQualityStrings.get(Quality.ANYHDTV) elif quality & Quality.ANYWEBDL: video.format = Quality.combinedQualityStrings.get(Quality.ANYWEBDL) elif quality & Quality.ANYBLURAY: video.format = Quality.combinedQualityStrings.get(Quality.ANYBLURAY) if not video.resolution or episode.show.subtitles_sr_metadata: if quality & (Quality.HDTV | Quality.HDWEBDL | Quality.HDBLURAY): video.resolution = "720p" elif quality & Quality.RAWHDTV: video.resolution = "1080i" elif quality & (Quality.FULLHDTV | Quality.FULLHDWEBDL | Quality.FULLHDBLURAY): video.resolution = "1080p" elif quality & (Quality.UHD_4K_TV | Quality.UHD_4K_WEBDL | Quality.UHD_4K_BLURAY): video.resolution = "4K" elif quality & (Quality.UHD_8K_TV | Quality.UHD_8K_WEBDL | Quality.UHD_8K_BLURAY): video.resolution = "8K"
def episodes(): return {'bbt_s07e05': Episode(os.path.join('The Big Bang Theory', 'Season 07', 'The.Big.Bang.Theory.S07E05.720p.HDTV.X264-DIMENSION.mkv'), 'The Big Bang Theory', 7, 5, title='The Workplace Proximity', year=2007, tvdb_id=4668379, series_tvdb_id=80379, series_imdb_id='tt0898266', source='HDTV', release_group='DIMENSION', resolution='720p', video_codec='H.264', audio_codec='Dolby Digital', imdb_id='tt3229392', size=501910737, hashes={'napiprojekt': '6303e7ee6a835e9fcede9fb2fb00cb36', 'opensubtitles': '6878b3ef7c1bd19e', 'shooter': 'c13e0e5243c56d280064d344676fff94;cd4184d1c0c623735f6db90841ce15fc;' '3faefd72f92b63f2504269b4f484a377;8c68d1ef873afb8ba0cc9f97cbac41c1', 'thesubdb': '9dbbfb7ba81c9a6237237dae8589fccc'}), 'got_s03e10': Episode(os.path.join('Game of Thrones', 'Season 03', 'Game.of.Thrones.S03E10.Mhysa.720p.WEB-DL.DD5.1.H.264-NTb.mkv'), 'Game of Thrones', 3, 10, title='Mhysa', tvdb_id=4517466, series_tvdb_id=121361, series_imdb_id='tt0944947', source='Web', release_group='NTb', resolution='720p', video_codec='H.264', audio_codec='Dolby Digital', imdb_id='tt2178796', size=2142810931, hashes={'napiprojekt': '6303e7ee6a835e9fcede9fb2fb00cb36', 'opensubtitles': 'b850baa096976c22', 'shooter': 'b02d992c04ad74b31c252bd5a097a036;ef1b32f873b2acf8f166fc266bdf011a;' '82ce34a3bcee0c66ed3b26d900d31cca;78113770551f3efd1e2d4ec45898c59c', 'thesubdb': 'b1f899c77f4c960b84b8dbf840d4e42d'}), 'dallas_s01e03': Episode('Dallas.S01E03.mkv', 'Dallas', 1, 3, title='Spy in the House', year=1978, tvdb_id=228224, series_tvdb_id=77092, series_imdb_id='tt0077000'), 'dallas_2012_s01e03': Episode('Dallas.2012.S01E03.mkv', 'Dallas', 1, 3, title='The Price You Pay', year=2012, original_series=False, tvdb_id=4199511, series_tvdb_id=242521, series_imdb_id='tt1723760', imdb_id='tt2205526'), 'marvels_agents_of_shield_s02e06': Episode('Marvels.Agents.of.S.H.I.E.L.D.S02E06.720p.HDTV.x264-KILLERS.mkv', 'Marvel\'s Agents of S.H.I.E.L.D.', 2, 6, year=2013, source='HDTV', release_group='KILLERS', resolution='720p', video_codec='H.264'), 'csi_cyber_s02e03': Episode('CSI.Cyber.S02E03.hdtv-lol.mp4', 'CSI: Cyber', 2, 3, source='HDTV', release_group='lol'), 'the_x_files_s10e02': Episode('The.X-Files.S10E02.HDTV.x264-KILLERS.mp4', 'The X-Files', 10, 2, source='HDTV', release_group='KILLERS', video_codec='H.264'), 'colony_s01e09': Episode('Colony.S01E09.720p.HDTV.x264-KILLERS.mkv', 'Colony', 1, 9, title='Zero Day', year=2016, tvdb_id=5463229, series_tvdb_id=284210, series_imdb_id='tt4209256', source='HDTV', release_group='KILLERS', resolution='720p', video_codec='H.264', imdb_id='tt4926022'), 'the_jinx_e05': Episode('The.Jinx-The.Life.and.Deaths.of.Robert.Durst.E05.BDRip.x264-ROVERS.mkv', 'The Jinx: The Life and Deaths of Robert Durst', 1, 5, year=2015, original_series=True, source='Blu-ray', release_group='ROVERS', video_codec='H.264'), 'the_100_s03e09': Episode('The.100.S03E09.720p.HDTV.x264-AVS.mkv', 'The 100', 3, 9, title='Stealing Fire', year=2014, tvdb_id=5544536, series_tvdb_id=268592, series_imdb_id='tt2661044', source='HDTV', release_group='AVS', resolution='720p', video_codec='H.264', imdb_id='tt4799896'), 'the fall': Episode('the_fall.3x01.720p_hdtv_x264-fov.mkv', 'The Fall', 3, 1, title='The Fall', year=2013, tvdb_id=5749493, series_tvdb_id=258107, series_imdb_id='tt2294189', source='HDTV', release_group='fov', resolution='720p', video_codec='H.264', imdb_id='tt4516230'), 'csi_s15e18': Episode('CSI.S15E18.720p.HDTV.X264.DIMENSION.mkv', 'CSI: Crime Scene Investigation', 15, 18, title='The End Game', year=2000, tvdb_id=5104359, series_tvdb_id=72546, series_imdb_id='tt0247082', source='HDTV', release_group='DIMENSION', resolution='720p', video_codec='H.264', imdb_id='tt4145952'), 'turn_s04e03': Episode('Turn.S04E03.720p.HDTV.x264-AVS.mkv', "TURN: Washington's Spies", 4, 3, title='Blood for Blood', year=2014, tvdb_id=6124360, series_tvdb_id=272135, series_imdb_id='tt2543328', source='HDTV', release_group='AVS', resolution='720p', video_codec='H.264', imdb_id='tt6137686', alternative_series=['Turn']), 'turn_s03e01': Episode('Turn.S03E01.720p.HDTV.x264-AVS.mkv', "TURN: Washington's Spies", 3, 1, title='Valediction', year=2014, tvdb_id=5471384, series_tvdb_id=272135, series_imdb_id='tt2543328', source='HDTV', release_group='AVS', resolution='720p', video_codec='H.264', imdb_id='tt4909774', alternative_series=['Turn']), 'marvels_jessica_jones_s01e13': Episode('Marvels.Jessica.Jones.S01E13.720p.WEBRip.x264-2HD', "Marvels Jessica Jones", 1, 13, title='AKA Smile', year=2015, tvdb_id=5311273, series_tvdb_id=284190, series_imdb_id='tt2357547', source='Web', release_group='2HD', resolution='720p', video_codec='H.264', imdb_id='tt4162096', alternative_series=['Jessica Jones']), 'fear_walking_dead_s03e10': Episode('Fear.the.Walking.Dead.S03E10.1080p.WEB-DL.DD5.1.H264-RARBG', 'Fear the Walking Dead', 3, 10, resolution='1080p', source='Web', video_codec='H.264', release_group='RARBG'), 'the_end_of_the_fucking_world': Episode('the.end.of.the.f*****g.world.s01e04.720p.web.x264-skgtv.mkv', 'The End of the F*****g World', 1, 4, resolution='720p', source='Web', video_codec='H.264', release_group='skgtv', alternative_series=['The end of the f***ing world']), 'Marvels.Agents.of.S.H.I.E.L.D.S05E01-E02': Episode('Marvels.Agents.of.S.H.I.E.L.D.S05E01-E02.720p.HDTV.x264-AVS', 'Marvels.Agents.of.S.H.I.E.L.D', 5, 1, resolution='720p', source='HDTV', video_codec='H.264', release_group='AVS'), 'alex_inc_s01e04': Episode('Alex.Inc.S01E04.HDTV.x264-SVA.mkv', 'Alex, Inc.', 1, 4, source='HDTV', video_codec='H.264', release_group='SVA', year=2018, title='The Nanny', series_imdb_id='tt6466948', tvdb_id=6627151, series_tvdb_id=328635), 'shameless_us_s08e01': Episode('Shameless.US.s08e01.web.h264-convoy', 'Shameless', 8, 1, source='Web', video_codec='H.264', country=Country('US'), original_series=False, release_group='convoy', year=2011, alternative_series=['Shameless US'], title='We Become What We... Frank!', series_imdb_id='tt1586680', series_tvdb_id=161511, imdb_id='tt6347410', tvdb_id=6227949), 'house_of_cards_us_s06e01': Episode('house.of.cards.us.s06e01.720p.web-dl.x264', 'House of Cards', 6, 1, source='Web', video_codec='H.264', country=Country('US'), year=2013, original_series=False, alternative_series=['House of Cards (2013)'], title='Chapter 66', series_imdb_id='tt1856010', series_tvdb_id=262980, imdb_id='tt7538918', tvdb_id=6553109), 'walking_dead_s08e07': Episode('The Walking Dead - 08x07 - Time for After.AMZN.WEB-DL-CasStudio.mkv', 'The Walking Dead', 8, 7, source='Web', streaming_service='Amazon Prime', release_group='CasStudio') }
'opensubtitles': '5b8f8f4e41ccb21e', 'thesubdb': 'ad32876133355929d814457537e12dc2' }) ] EPISODES = [ Episode( 'The Big Bang Theory/Season 07/The.Big.Bang.Theory.S07E05.720p.HDTV.X264-DIMENSION.mkv', 'The Big Bang Theory', 7, 5, format='HDTV', release_group='DIMENSION', resolution='720p', video_codec='h264', audio_codec='AC3', imdb_id=3229392, size=501910737, title='The Workplace Proximity', year=2007, tvdb_id=80379, hashes={ 'opensubtitles': '6878b3ef7c1bd19e', 'thesubdb': '9dbbfb7ba81c9a6237237dae8589fccc' }), Episode( 'Game of Thrones/Season 03/Game.of.Thrones.S03E10.Mhysa.720p.WEB-DL.DD5.1.H.264-NTb.mkv', 'Game of Thrones', 3, 10, format='WEB-DL',
def episodes(): return { 'bbt_s07e05': Episode( os.path.join( 'The Big Bang Theory', 'Season 07', 'The.Big.Bang.Theory.S07E05.720p.HDTV.X264-DIMENSION.mkv'), 'The Big Bang Theory', 7, 5, title='The Workplace Proximity', year=2007, tvdb_id=4668379, series_tvdb_id=80379, series_imdb_id='tt0898266', format='HDTV', release_group='DIMENSION', resolution='720p', video_codec='h264', audio_codec='AC3', imdb_id='tt3229392', size=501910737, hashes={ 'napiprojekt': '6303e7ee6a835e9fcede9fb2fb00cb36', 'opensubtitles': '6878b3ef7c1bd19e', 'shooter': 'c13e0e5243c56d280064d344676fff94;cd4184d1c0c623735f6db90841ce15fc;' '3faefd72f92b63f2504269b4f484a377;8c68d1ef873afb8ba0cc9f97cbac41c1', 'thesubdb': '9dbbfb7ba81c9a6237237dae8589fccc' }), 'got_s03e10': Episode( os.path.join( 'Game of Thrones', 'Season 03', 'Game.of.Thrones.S03E10.Mhysa.720p.WEB-DL.DD5.1.H.264-NTb.mkv' ), 'Game of Thrones', 3, 10, title='Mhysa', tvdb_id=4517466, series_tvdb_id=121361, series_imdb_id='tt0944947', format='WEB-DL', release_group='NTb', resolution='720p', video_codec='h264', audio_codec='AC3', imdb_id='tt2178796', size=2142810931, hashes={ 'napiprojekt': '6303e7ee6a835e9fcede9fb2fb00cb36', 'opensubtitles': 'b850baa096976c22', 'shooter': 'b02d992c04ad74b31c252bd5a097a036;ef1b32f873b2acf8f166fc266bdf011a;' '82ce34a3bcee0c66ed3b26d900d31cca;78113770551f3efd1e2d4ec45898c59c', 'thesubdb': 'b1f899c77f4c960b84b8dbf840d4e42d' }), 'dallas_s01e03': Episode('Dallas.S01E03.mkv', 'Dallas', 1, 3, title='Spy in the House', year=1978, tvdb_id=228224, series_tvdb_id=77092, series_imdb_id='tt0077000'), 'dallas_2012_s01e03': Episode('Dallas.2012.S01E03.mkv', 'Dallas', 1, 3, title='The Price You Pay', year=2012, original_series=False, tvdb_id=4199511, series_tvdb_id=242521, series_imdb_id='tt1723760', imdb_id='tt2205526'), 'marvels_agents_of_shield_s02e06': Episode( 'Marvels.Agents.of.S.H.I.E.L.D.S02E06.720p.HDTV.x264-KILLERS.mkv', 'Marvel\'s Agents of S.H.I.E.L.D.', 2, 6, year=2013, format='HDTV', release_group='KILLERS', resolution='720p', video_codec='h264'), 'csi_cyber_s02e03': Episode('CSI.Cyber.S02E03.hdtv-lol.mp4', 'CSI: Cyber', 2, 3, format='HDTV', release_group='lol'), 'the_x_files_s10e02': Episode('The.X-Files.S10E02.HDTV.x264-KILLERS.mp4', 'The X-Files', 10, 2, format='HDTV', release_group='KILLERS', video_codec='h264'), 'colony_s01e09': Episode('Colony.S01E09.720p.HDTV.x264-KILLERS.mkv', 'Colony', 1, 9, title='Zero Day', year=2016, tvdb_id=5463229, series_tvdb_id=284210, series_imdb_id='tt4209256', format='HDTV', release_group='KILLERS', resolution='720p', video_codec='h264', imdb_id='tt4926022'), 'the_jinx_e05': Episode( 'The.Jinx-The.Life.and.Deaths.of.Robert.Durst.E05.BDRip.x264-ROVERS.mkv', 'The Jinx: The Life and Deaths of Robert Durst', 1, 5, year=2015, original_series=True, format='BluRay', release_group='ROVERS', video_codec='h264'), 'the_100_s03e09': Episode('The.100.S03E09.720p.HDTV.x264-AVS.mkv', 'The 100', 3, 9, title='Stealing Fire', year=2014, tvdb_id=5544536, series_tvdb_id=268592, series_imdb_id='tt2661044', format='HDTV', release_group='AVS', resolution='720p', video_codec='h264', imdb_id='tt4799896'), 'csi_s15e18': Episode('CSI.S15E18.720p.HDTV.X264.DIMENSION.mkv', 'CSI: Crime Scene Investigation', 15, 18, title='The End Game', year=2000, tvdb_id=5104359, series_tvdb_id=72546, series_imdb_id='tt0247082', format='HDTV', release_group='DIMENSION', resolution='720p', video_codec='h264', imdb_id='tt4145952') }