def extract_metadata(metadata): md = hdhr_md.HDHomeRunMD(metadata) md.print_metaData() show = md.extract_show() epNumber = md.extract_epNumber() epAirDate = md.extract_epAirDate() epTitle = md.extract_epTitle() season = md.get_season_string(show, epNumber, epAirDate, epTitle) episode = md.get_episode_string(show, epNumber, epAirDate, epTitle) logging.info('=== Extracted: show [' + show + '] Season [' + season + '] Episode: [' + episode + ']') return { 'show': show, 'season': season, 'epnum': episode, 'eptitle': epTitle }
def extract_metadata(self, metadata): md = hdhr_md.HDHomeRunMD(metadata) db = hdhr_thetvdb.TVDBMatcher() if languages: langStr = "" if len(languages) > 1: for lang in languages: langStr += lang + ',' else: langStr = languages[0] hdhr_thetvdb.languages = langStr md.print_metaData() show = md.extract_show() epNumber = md.extract_epNumber() epAirDate = md.extract_epAirDate() epTitle = md.extract_epTitle() season = episode = name = '' # Need to workaround some bad titles that US TV and thetvdb.com are in conflict for. if not self.is_skip_show(show): tvdbEpData = db.getTVDBInfo(show,epAirDate,epTitle,epNumber) season = tvdbEpData['season_num'] episode = tvdbEpData['episode_num'] name = tvdbEpData['seriesname'] # fix for double episode if 'episode2_num' in tvdbEpData: episode = episode + 'E' + tvdbEpData['episode2_num'] if name == season == episode == '': logging.debug('Got nothing from thetvdb, so going to have to fall back to whatever was provided by SD') return {'show':show, 'tvdbname':'', 'season':self.get_season_from_epnumber(epNumber), 'epnum':epNumber, 'eptitle':epTitle} else: logging.info('=== Extracted from thetvdb for [' + show + ']: seriesname [' + name + '] Season [' + season + '] Episode: [' + episode +']') return {'show':show, 'tvdbname':name, 'season':season, 'epnum':('S'+season+'E'+episode), 'eptitle':epTitle} else: logging.debug('*** Show [' + show + '] marked for special handling - and will not use theTvDb.com') season = self.get_season_from_epnumber(epNumber) return {'show':show, 'tvdbname':'', 'season':season, 'epnum':epNumber, 'eptitle':epTitle}
def extract_metadata(metadata): md = hdhr_md.HDHomeRunMD(metadata) md.print_metaData() show = md.extract_show() epNumber = md.extract_epNumber() epAirDate = md.extract_epAirDate() epTitle = md.extract_epTitle() # Need to workaround some bad titles that US TV and thetvdb.com are in conflict for. if not isSpecialShow(show): tvdbEpData = md.getTVDBInfo(show, epAirDate) season = md.resolve_season_string(epNumber, tvdbEpData['season_num'], tvdbEpData['episode_num']) episode = md.resolve_episode_string(epNumber, tvdbEpData['season_num'], tvdbEpData['episode_num']) logging.info('=== Extracted: show [' + show + '] Season [' + season + '] Episode: [' + episode + ']') return { 'show': show, 'season': season, 'epnum': episode, 'eptitle': epTitle, 'tvdbname': tvdbEpData['seriesname'], 'special': False } else: logging.debug( '*** Show [' + show + '] marked for special handling - and will not use theTvDb.com') return { 'show': show, 'season': '-', 'epnum': epNumber, 'eptitle': epTitle, 'tvdbname': show, 'special': True }
def extract_metadata(metadata): md = hdhr_md.HDHomeRunMD(metadata) md.print_metaData() show = md.extract_show() epNumber = md.extract_epNumber() epAirDate = md.extract_epAirDate() epTitle = md.extract_epTitle() tvdbEpData = md.getTVDBInfo(show, epAirDate) season = md.resolve_season_string(epNumber, tvdbEpData['season_num'], tvdbEpData['episode_num']) episode = md.resolve_episode_string(epNumber, tvdbEpData['season_num'], tvdbEpData['episode_num']) logging.info('=== Extracted: show [' + show + '] Season [' + season + '] Episode: [' + episode + ']') return { 'show': show, 'season': season, 'epnum': episode, 'eptitle': epTitle, 'tvdbname': tvdbEpData['seriesname'] }
# Didn't find HDHR MetaData PID.. so break if we found already if pid_found == True: break return parser.extract_metadata(tempMD) if __name__ == "__main__": print '- HDHR Device Discover Dump Tool '+strftime("%Y-%m-%d %H:%M:%S")+'-' logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) md_file = '' SeriesID = '10883892' if (len(sys.argv) == 2): md_file=sys.argv[1] logging.info('Parsing ' + md_file) metaData = parse_file_for_data(md_file) md = hdhr_md.HDHomeRunMD(metaData) md.print_metaData() SeriesID = md.extract_seriesID() else: print 'Unexpected number of parameters - please just provide single input filename.' print 'Usage:' print ' dump_md.py <filename>' print '' print 'Script will parse the TS file for the SD program, extrat the metadata and' print 'dump to stdout' sys.exit(0) dvr = hdhr_dvr.HDHRDVR() logging.info('Getting Recordings for series specified: ' + SeriesID) recordings = dvr.getSeriesRecordings(SeriesID) for recording in recordings:
def check_parsed_by_hdhr2plex(self, metadata): md = hdhr_md.HDHomeRunMD(metadata) if not (md.extract_hdhr2plex() == ''): logging.debug('File already modified by hdhr2plex - value exists in metadata') return True return False