示例#1
0
 def getShowInfo(self, pathname):
     try:
         _series = Series(**self.parser.getFileDetails(pathname))
         if self.args.series_name:
             _series.title = self.args.series_name
             _series.fileDetails.seriesTitle = self.args.series_name
         if self._last_series:
             if self._last_series.title == _series.title:
                 _series.merge(self._last_series)
                 return _series
         _series = _series.search(rtn=object)
         if self._last_series:
             if self._last_series.title == _series.title:
                 _series.merge(self._last_series)
                 return _series
         _series.tvdb_id = _series.tvdb_id
         _series.seasons = 'Load'
     except (KeyError, TypeError), msg:
         raise SeriesNotFound('SeriesNotFound: {}'.format(pathname))
示例#2
0
	def getShowInfo(self, pathname):
		try:
			_series = Series(**self.parser.getFileDetails(pathname))
			if self.args.series_name:
				_series.title = self.args.series_name
				_series.fileDetails.seriesTitle = self.args.series_name
			if self._last_series:
				if self._last_series.title == _series.title:
					_series.merge(self._last_series)
					return _series
			_series = _series.search(rtn=object)
			if self._last_series:
				if self._last_series.title == _series.title:
					_series.merge(self._last_series)
					return _series
			_series.tvdb_id = _series.tvdb_id
			_series.seasons = 'Load'
		except (KeyError, TypeError), msg:
			raise SeriesNotFound('SeriesNotFound: {}'.format(pathname))
示例#3
0
	def __init__(self):
		log.trace('__init__ method: Started')

		super(CheckSeries, self).__init__()

		check_group1= self.cmdoptions.parser.add_argument_group("Series Unique Options", description=None)
		check_group1.add_argument("-a", "--all-shows", dest="all_shows",
								  action="store_true", default=False,
								  help="Process all shows not just Continuing")
		check_group1.add_argument("-x", "--no-excludes", dest="no_excludes",
								  action="store_true", default=False,
								  help="Ignore Exclude File")
		check_group1.add_argument("-s", "--include-specials", dest="specials",
								  action="store_true", default=False,
								  help="Include specials in checks)")
		check_group1.add_argument("-r", "--remove", dest="remove",
								  action="store_true", default=False,
								  help="Remove duplicate files that are found in the duplicate check")
		check_group1.add_argument("-d", "--days", dest="age_limit",
								  action="store", type=int, default=180,
								  help="Limit check back x number of days, default 30")
		check_group1.add_argument("-f", "--no-age-limit-requested", dest="age_limit",
								  action="store_const", const=99999,
								  help="Full Check")
		check_group1.add_argument("--dco", '--dup-check-only', dest="dup_check_only",
								  action="store_true", default=False,
								  help="Duplicate File Check Only")
		check_group1.add_argument("--check", '--check-names', dest="check_names",
								  action="store_true", default=False,
								  help="Perform Name Check")
		check_group1.add_argument("--check-quick", dest="quick",
								  action="store_true", default=False,
								  help="Perform Name Check")

		self.parser = FileParser()
		self.rename = RenameSeries()
		self.Series = Series()

		self.regex_season = re.compile('^(?:Season).(?P<SeasonNum>[0-9]+)$', re.I)
		self.regex_episode = re.compile('^(?:E)(?P<EpisodeNum>[0-9][0-9])[\-]?(?:E)?(?P<EpisodeNum2>[0-9][0-9])?(?P<EpisodeName>.+)?\.(?P<Ext>.+?)$', re.I)
		self.regex_repack = re.compile('^.*(repack|proper).*$', re.IGNORECASE)

		self.last_request = {}
		self.last_request['LastRequestName'] = ''
		self._trakt_top_shows = None

		return
示例#4
0
    def __init__(self):
        log.trace('__init__ method: Started')

        super(CheckSeries, self).__init__()

        check_group1 = self.cmdoptions.parser.add_argument_group(
            "Series Unique Options", description=None)
        check_group1.add_argument("-a",
                                  "--all-shows",
                                  dest="all_shows",
                                  action="store_true",
                                  default=False,
                                  help="Process all shows not just Continuing")
        check_group1.add_argument("-x",
                                  "--no-excludes",
                                  dest="no_excludes",
                                  action="store_true",
                                  default=False,
                                  help="Ignore Exclude File")
        check_group1.add_argument("-s",
                                  "--include-specials",
                                  dest="specials",
                                  action="store_true",
                                  default=False,
                                  help="Include specials in checks)")
        check_group1.add_argument(
            "-r",
            "--remove",
            dest="remove",
            action="store_true",
            default=False,
            help="Remove duplicate files that are found in the duplicate check"
        )
        check_group1.add_argument(
            "-d",
            "--days",
            dest="age_limit",
            action="store",
            type=int,
            default=180,
            help="Limit check back x number of days, default 30")
        check_group1.add_argument("-f",
                                  "--no-age-limit-requested",
                                  dest="age_limit",
                                  action="store_const",
                                  const=99999,
                                  help="Full Check")
        check_group1.add_argument("--dco",
                                  '--dup-check-only',
                                  dest="dup_check_only",
                                  action="store_true",
                                  default=False,
                                  help="Duplicate File Check Only")
        check_group1.add_argument("--check",
                                  '--check-names',
                                  dest="check_names",
                                  action="store_true",
                                  default=False,
                                  help="Perform Name Check")
        check_group1.add_argument("--check-quick",
                                  dest="quick",
                                  action="store_true",
                                  default=False,
                                  help="Perform Name Check")

        self.parser = FileParser()
        self.rename = RenameSeries()
        self.Series = Series()

        self.regex_season = re.compile('^(?:Season).(?P<SeasonNum>[0-9]+)$',
                                       re.I)
        self.regex_episode = re.compile(
            '^(?:E)(?P<EpisodeNum>[0-9][0-9])[\-]?(?:E)?(?P<EpisodeNum2>[0-9][0-9])?(?P<EpisodeName>.+)?\.(?P<Ext>.+?)$',
            re.I)
        self.regex_repack = re.compile('^.*(repack|proper).*$', re.IGNORECASE)

        self.last_request = {}
        self.last_request['LastRequestName'] = ''
        self._trakt_top_shows = None

        return
示例#5
0
class CheckSeries(Library):
    def __init__(self):
        log.trace('__init__ method: Started')

        super(CheckSeries, self).__init__()

        check_group1 = self.cmdoptions.parser.add_argument_group(
            "Series Unique Options", description=None)
        check_group1.add_argument("-a",
                                  "--all-shows",
                                  dest="all_shows",
                                  action="store_true",
                                  default=False,
                                  help="Process all shows not just Continuing")
        check_group1.add_argument("-x",
                                  "--no-excludes",
                                  dest="no_excludes",
                                  action="store_true",
                                  default=False,
                                  help="Ignore Exclude File")
        check_group1.add_argument("-s",
                                  "--include-specials",
                                  dest="specials",
                                  action="store_true",
                                  default=False,
                                  help="Include specials in checks)")
        check_group1.add_argument(
            "-r",
            "--remove",
            dest="remove",
            action="store_true",
            default=False,
            help="Remove duplicate files that are found in the duplicate check"
        )
        check_group1.add_argument(
            "-d",
            "--days",
            dest="age_limit",
            action="store",
            type=int,
            default=180,
            help="Limit check back x number of days, default 30")
        check_group1.add_argument("-f",
                                  "--no-age-limit-requested",
                                  dest="age_limit",
                                  action="store_const",
                                  const=99999,
                                  help="Full Check")
        check_group1.add_argument("--dco",
                                  '--dup-check-only',
                                  dest="dup_check_only",
                                  action="store_true",
                                  default=False,
                                  help="Duplicate File Check Only")
        check_group1.add_argument("--check",
                                  '--check-names',
                                  dest="check_names",
                                  action="store_true",
                                  default=False,
                                  help="Perform Name Check")
        check_group1.add_argument("--check-quick",
                                  dest="quick",
                                  action="store_true",
                                  default=False,
                                  help="Perform Name Check")

        self.parser = FileParser()
        self.rename = RenameSeries()
        self.Series = Series()

        self.regex_season = re.compile('^(?:Season).(?P<SeasonNum>[0-9]+)$',
                                       re.I)
        self.regex_episode = re.compile(
            '^(?:E)(?P<EpisodeNum>[0-9][0-9])[\-]?(?:E)?(?P<EpisodeNum2>[0-9][0-9])?(?P<EpisodeName>.+)?\.(?P<Ext>.+?)$',
            re.I)
        self.regex_repack = re.compile('^.*(repack|proper).*$', re.IGNORECASE)

        self.last_request = {}
        self.last_request['LastRequestName'] = ''
        self._trakt_top_shows = None

        return

    def check(self, pathname):
        log.trace('check: Pathname Requested: {}'.format(pathname))

        pathname = os.path.abspath(pathname)
        _series_details = []

        log.info("==== Begin Scan: {} ====".format(pathname))
        print("==== Begin Scan: {} ====".format(pathname))

        if self.args.check_names:
            self.check_series_name(pathname)
            sys.exit(0)

        if self.args.quick:
            self.check_series_name_quick(pathname)
            sys.exit(0)

        _seriesData = self.getSeriesData(pathname)

        if self.args.dup_check_only:
            sys.exit(0)

        for _show_name, _file_data in tqdm(sorted(_seriesData.iteritems()),
                                           mininterval=0.5,
                                           miniters=1,
                                           leave=True):
            DadVision = _file_data['DadVision']
            try:
                _series = self.Series.search(title=_show_name, rtn=object)
                if _series.status == 'Continuing' or self.args.all_shows:
                    _series.seasons = 'Load'
                else:
                    continue
                if _series.seasons is None:
                    raise SeriesNotFound
            except KeyboardInterrupt:
                sys.exit(99)
            except (SeriesNotFound), msg:
                print('\nSeries Not Found, Skipping: {}'.format(_show_name))
                log.error('Series Not Found, Skipping: {}'.format(_show_name))
                continue

            date_boundry = date.today() - timedelta(days=self.args.age_limit)
            missing = {}
            if _series.seasons is None:
                print('\nSeries Season Data Not Found, Skipping: {}'.format(
                    _show_name))
                log.error('Series Season Data Not Found, Skipping: {}'.format(
                    _show_name))
                continue
            for _season in sorted(_series.seasons.itervalues()):
                if not self.args.specials and _season.number == 0:
                    continue
                if _season.episodes is None:
                    print(
                        '\nSeries Episode Data Not Found, Skipping: {} - Season {}'
                        .format(_show_name, _season.number))
                    log.error(
                        'Series Episode Data Not Found, Skipping: {} - Season {}'
                        .format(_show_name, _season.number))
                    continue
                for _episode in _season.episodes.itervalues():
                    try:
                        if _episode.number not in DadVision[_season.number]:
                            raise KeyError
                    except KeyboardInterrupt:
                        sys.exit(99)
                    except KeyError:
                        try:
                            _episode.getDetails()
                        except HTTPError:
                            print(
                                '\nSeries Episode Data Not Found, Skipping: {} - Season {}'
                                .format(_show_name, _season.number))
                            log.error(
                                'Series Episode Data Not Found, Skipping: {} - Season {}'
                                .format(_show_name, _season.number))
                            continue
                        if not _episode.first_aired:
                            continue
                        if _episode.first_aired < date_boundry or \
                           _episode.first_aired >= datetime.today().date():
                            continue
                        if _season.number in missing:
                            missing[int(_season.number)].append(
                                _episode.number)
                        else:
                            missing[int(_season.number)] = [_episode.number]

            _total_missing = 0
            for _missing_season, _missing_episodes in missing.iteritems():
                _total_missing += len(_missing_episodes)
            message = "Missing %3i episode(s) - SERIES: %-35.35s" % (
                _total_missing, _show_name)
            if _total_missing > 0:
                print('\n  {}'.format(message))
                log.warning(message)

            season_message = "         Season: {}  Episode: ALL"
            message = "         Season: {}  Episode: {}  Aired: {} Title: {}"
            for key, val in sorted(missing.iteritems()):
                _season_number = u'<Season {0:02}>'.format(key)
                _episodes = _series.seasons[_season_number].episodes
                _season_num_msg = "S%2.2d" % key
                if len(val) == len(_episodes):
                    #					print(season_message.format(_season_num_msg))
                    log.warning(season_message.format(_season_num_msg))
                else:
                    for _ep_no in sorted(val):
                        _ep_no_fmt = "E%2.2d" % _ep_no
                        _episode = _episodes[_ep_no_fmt]
                        if _episode.first_aired:
                            _first_aired = _episode.first_aired
                        else:
                            _first_aired = "Unknown"
#						print(message.format(key,
#											 _ep_no,
#											 _first_aired,
#											 self.decode(_episode.title)))
                        log.warning(
                            message.format(key, _ep_no, _first_aired,
                                           self.decode(_episode.title)))

        sys.exit()
示例#6
0
class CheckSeries(Library):

	def __init__(self):
		log.trace('__init__ method: Started')

		super(CheckSeries, self).__init__()

		check_group1= self.cmdoptions.parser.add_argument_group("Series Unique Options", description=None)
		check_group1.add_argument("-a", "--all-shows", dest="all_shows",
								  action="store_true", default=False,
								  help="Process all shows not just Continuing")
		check_group1.add_argument("-x", "--no-excludes", dest="no_excludes",
								  action="store_true", default=False,
								  help="Ignore Exclude File")
		check_group1.add_argument("-s", "--include-specials", dest="specials",
								  action="store_true", default=False,
								  help="Include specials in checks)")
		check_group1.add_argument("-r", "--remove", dest="remove",
								  action="store_true", default=False,
								  help="Remove duplicate files that are found in the duplicate check")
		check_group1.add_argument("-d", "--days", dest="age_limit",
								  action="store", type=int, default=180,
								  help="Limit check back x number of days, default 30")
		check_group1.add_argument("-f", "--no-age-limit-requested", dest="age_limit",
								  action="store_const", const=99999,
								  help="Full Check")
		check_group1.add_argument("--dco", '--dup-check-only', dest="dup_check_only",
								  action="store_true", default=False,
								  help="Duplicate File Check Only")
		check_group1.add_argument("--check", '--check-names', dest="check_names",
								  action="store_true", default=False,
								  help="Perform Name Check")
		check_group1.add_argument("--check-quick", dest="quick",
								  action="store_true", default=False,
								  help="Perform Name Check")

		self.parser = FileParser()
		self.rename = RenameSeries()
		self.Series = Series()

		self.regex_season = re.compile('^(?:Season).(?P<SeasonNum>[0-9]+)$', re.I)
		self.regex_episode = re.compile('^(?:E)(?P<EpisodeNum>[0-9][0-9])[\-]?(?:E)?(?P<EpisodeNum2>[0-9][0-9])?(?P<EpisodeName>.+)?\.(?P<Ext>.+?)$', re.I)
		self.regex_repack = re.compile('^.*(repack|proper).*$', re.IGNORECASE)

		self.last_request = {}
		self.last_request['LastRequestName'] = ''
		self._trakt_top_shows = None

		return

	def check(self, pathname):
		log.trace('check: Pathname Requested: {}'.format(pathname))

		pathname = os.path.abspath(pathname)
		_series_details = []

		log.info("==== Begin Scan: {} ====".format(pathname))
		print("==== Begin Scan: {} ====".format(pathname))

		if self.args.check_names:
			self.check_series_name(pathname)
			sys.exit(0)

		if self.args.quick:
			self.check_series_name_quick(pathname)
			sys.exit(0)

		_seriesData = self.getSeriesData(pathname)

		if self.args.dup_check_only:
			sys.exit(0)

		for _show_name, _file_data in tqdm(sorted(_seriesData.iteritems()),
										   mininterval=0.5,
										   miniters=1,
										   leave=True):
			DadVision = _file_data['DadVision']
			try:
				_series = self.Series.search(title=_show_name, rtn=object)
				if _series.status == 'Continuing' or self.args.all_shows:
					_series.seasons = 'Load'
				else:
					continue
				if _series.seasons is None:
					raise SeriesNotFound
			except KeyboardInterrupt:
				sys.exit(99)
			except (SeriesNotFound), msg:
				print('\nSeries Not Found, Skipping: {}'.format(_show_name))
				log.error('Series Not Found, Skipping: {}'.format(_show_name))
				continue

			date_boundry = date.today() - timedelta(days=self.args.age_limit)
			missing = {}
			if _series.seasons is None:
				print('\nSeries Season Data Not Found, Skipping: {}'.format(_show_name))
				log.error('Series Season Data Not Found, Skipping: {}'.format(_show_name))
				continue
			for _season in sorted(_series.seasons.itervalues()):
				if not self.args.specials and _season.number == 0:
					continue
				if _season.episodes is None:
					print('\nSeries Episode Data Not Found, Skipping: {} - Season {}'.format(_show_name,
																							 _season.number))
					log.error('Series Episode Data Not Found, Skipping: {} - Season {}'.format(_show_name,
																							   _season.number))
					continue
				for _episode in _season.episodes.itervalues():
					try:
						if _episode.number not in DadVision[_season.number]:
							raise KeyError
					except KeyboardInterrupt:
						sys.exit(99)
					except KeyError:
						try:
							_episode.getDetails()
						except HTTPError:
							print('\nSeries Episode Data Not Found, Skipping: {} - Season {}'.format(_show_name,
																									 _season.number))
							log.error('Series Episode Data Not Found, Skipping: {} - Season {}'.format(_show_name,
																									   _season.number))
							continue
						if not _episode.first_aired:
							continue
						if _episode.first_aired < date_boundry or \
						   _episode.first_aired >= datetime.today().date():
							continue
						if _season.number in missing:
							missing[int(_season.number)].append(_episode.number)
						else:
							missing[int(_season.number)] = [_episode.number]

			_total_missing = 0
			for _missing_season, _missing_episodes in missing.iteritems():
				_total_missing += len(_missing_episodes)
			message = "Missing %3i episode(s) - SERIES: %-35.35s" % (_total_missing, _show_name)
			if _total_missing > 0:
				print('\n  {}'.format(message))
				log.warning(message)

			season_message = "         Season: {}  Episode: ALL"
			message = "         Season: {}  Episode: {}  Aired: {} Title: {}"
			for key, val in sorted(missing.iteritems()):
				_season_number = u'<Season {0:02}>'.format(key)
				_episodes = _series.seasons[_season_number].episodes
				_season_num_msg = "S%2.2d" % key
				if len(val) == len(_episodes):
#					print(season_message.format(_season_num_msg))
					log.warning(season_message.format(_season_num_msg))
				else:
					for _ep_no in sorted(val):
						_ep_no_fmt = "E%2.2d" % _ep_no
						_episode = _episodes[_ep_no_fmt]
						if _episode.first_aired:
							_first_aired = _episode.first_aired
						else:
							_first_aired = "Unknown"
#						print(message.format(key,
#											 _ep_no,
#											 _first_aired,
#											 self.decode(_episode.title)))
						log.warning(message.format(key,
												 _ep_no,
												 _first_aired,
												 self.decode(_episode.title)))

		sys.exit()