コード例 #1
0
    def _download_propers(self, proper_list):
        """
        Download proper (snatch it)

        :param proper_list:
        """

        session = sickrage.app.main_db.session()

        for curProper in proper_list:
            history_limit = datetime.datetime.today() - datetime.timedelta(days=30)

            # make sure the episode has been downloaded before
            history_results = [x for x in session.query(MainDB.History).filter_by(
                showid=curProper.indexer_id, season=curProper.season, episode=curProper.episode,
                quality=curProper.quality).filter(MainDB.History.date >= history_limit.toordinal(),
                                                  MainDB.History.action.in_(Quality.SNATCHED + Quality.DOWNLOADED))]

            # if we didn't download this episode in the first place we don't know what quality to use for the proper
            # so we can't do it
            if len(history_results) == 0:
                sickrage.app.log.info("Unable to find an original history entry for proper {} so I'm not downloading "
                                      "it.".format(curProper.name))
                continue

            # make sure that none of the existing history downloads are the same proper we're trying to download
            is_same = False
            clean_proper_name = self._generic_name(remove_non_release_groups(curProper.name))

            for curResult in history_results:
                # if the result exists in history already we need to skip it
                if self._generic_name(
                        remove_non_release_groups(curResult.resource)) == clean_proper_name:
                    is_same = True
                    break

            if is_same:
                sickrage.app.log.debug("This proper is already in history, skipping it")
                continue

            # make the result object
            result = curProper.provider.get_result(curProper.season, [curProper.episode])
            result.show_id = curProper.indexer_id
            result.url = curProper.url
            result.name = curProper.name
            result.quality = curProper.quality
            result.release_group = curProper.release_group
            result.version = curProper.version
            result.seeders = curProper.seeders
            result.leechers = curProper.leechers
            result.size = curProper.size
            result.files = curProper.files
            result.content = curProper.content

            # snatch it
            snatch_episode(result, SNATCHED_PROPER)
            time.sleep(cpu_presets[sickrage.app.config.cpu_preset])
コード例 #2
0
ファイル: proper_searcher.py プロジェクト: afctim/SiCKRAGE
    def _downloadPropers(self, properList):
        """
        Download proper (snatch it)

        :param properList:
        """

        for curProper in properList:

            historyLimit = datetime.datetime.today() - datetime.timedelta(days=30)

            # make sure the episode has been downloaded before
            historyResults = main_db.MainDB().select(
                "SELECT resource FROM history " +
                "WHERE showid = ? AND season = ? AND episode = ? AND quality = ? AND date >= ? " +
                "AND action IN (" + ",".join([str(x) for x in Quality.SNATCHED + Quality.DOWNLOADED]) + ")",
                [curProper.indexerid, curProper.season, curProper.episode, curProper.quality,
                 historyLimit.strftime(History.date_format)])

            # if we didn't download this episode in the first place we don't know what quality to use for the proper so we can't do it
            if len(historyResults) == 0:
                sickrage.srCore.srLogger.info(
                    "Unable to find an original history entry for proper " + curProper.name + " so I'm not downloading it.")
                continue

            else:

                # make sure that none of the existing history downloads are the same proper we're trying to download
                clean_proper_name = self._genericName(remove_non_release_groups(curProper.name))
                isSame = False
                for curResult in historyResults:
                    # if the result exists in history already we need to skip it
                    if self._genericName(
                            remove_non_release_groups(curResult["resource"])) == clean_proper_name:
                        isSame = True
                        break
                if isSame:
                    sickrage.srCore.srLogger.debug("This proper is already in history, skipping it")
                    continue

                # get the episode object
                epObj = curProper.show.getEpisode(curProper.season, curProper.episode)

                # make the result object
                result = curProper.provider.getResult([epObj])
                result.show = curProper.show
                result.url = curProper.url
                result.name = curProper.name
                result.quality = curProper.quality
                result.release_group = curProper.release_group
                result.version = curProper.version
                result.content = curProper.content

                # snatch it
                snatchEpisode(result, SNATCHED_PROPER)
                time.sleep(cpu_presets[sickrage.srCore.srConfig.CPU_PRESET])
コード例 #3
0
    def _downloadPropers(self, properList):
        """
        Download proper (snatch it)

        :param properList:
        """

        for curProper in properList:
            historyLimit = datetime.datetime.today() - datetime.timedelta(days=30)

            # make sure the episode has been downloaded before
            historyResults = [x for x in MainDB().db.get_many('history', curProper.indexerid, with_doc=True)
                              if x['doc']['season'] == curProper.season and x['doc']['episode'] == curProper.episode
                              and x['doc']['quality'] == curProper.quality
                              and x['doc']['date'] >= historyLimit.strftime(History.date_format)
                              and x['doc']['action'] in Quality.SNATCHED + Quality.DOWNLOADED]

            # if we didn't download this episode in the first place we don't know what quality to use for the proper so we can't do it
            if len(historyResults) == 0:
                sickrage.srCore.srLogger.info(
                    "Unable to find an original history entry for proper " + curProper.name + " so I'm not downloading it.")
                continue

            else:

                # make sure that none of the existing history downloads are the same proper we're trying to download
                clean_proper_name = self._genericName(remove_non_release_groups(curProper.name))
                isSame = False
                for curResult in historyResults:
                    # if the result exists in history already we need to skip it
                    if self._genericName(
                            remove_non_release_groups(curResult["resource"])) == clean_proper_name:
                        isSame = True
                        break
                if isSame:
                    sickrage.srCore.srLogger.debug("This proper is already in history, skipping it")
                    continue

                # get the episode object
                epObj = curProper.show.getEpisode(curProper.season, curProper.episode)

                # make the result object
                result = curProper.provider.getResult([epObj])
                result.show = curProper.show
                result.url = curProper.url
                result.name = curProper.name
                result.quality = curProper.quality
                result.release_group = curProper.release_group
                result.version = curProper.version
                result.content = curProper.content
                result.size = curProper.provider._get_size(curProper.url)
                result.files = curProper.provider._get_files(curProper.url)

                # snatch it
                snatchEpisode(result, SNATCHED_PROPER)
                time.sleep(cpu_presets[sickrage.srCore.srConfig.CPU_PRESET])
コード例 #4
0
    def _downloadPropers(self, properList):
        """
        Download proper (snatch it)

        :param properList:
        """

        for curProper in properList:
            historyLimit = datetime.datetime.today() - datetime.timedelta(days=30)

            # make sure the episode has been downloaded before
            historyResults = [x for x in sickrage.app.main_db.get_many('history', curProper.indexerid)
                              if x['season'] == curProper.season
                              and x['episode'] == curProper.episode
                              and x['quality'] == curProper.quality
                              and x['date'] >= historyLimit.strftime(History.date_format)
                              and x['action'] in Quality.SNATCHED + Quality.DOWNLOADED]

            # if we didn't download this episode in the first place we don't know what quality to use for the proper so we can't do it
            if len(historyResults) == 0:
                sickrage.app.log.info(
                    "Unable to find an original history entry for proper " + curProper.name + " so I'm not downloading it.")
                continue

            else:

                # make sure that none of the existing history downloads are the same proper we're trying to download
                clean_proper_name = self._genericName(remove_non_release_groups(curProper.name))
                isSame = False
                for curResult in historyResults:
                    # if the result exists in history already we need to skip it
                    if self._genericName(
                            remove_non_release_groups(curResult["resource"])) == clean_proper_name:
                        isSame = True
                        break
                if isSame:
                    sickrage.app.log.debug("This proper is already in history, skipping it")
                    continue

                # make the result object
                result = curProper.provider.getResult([curProper.show.get_episode(curProper.season, curProper.episode)])
                result.show = curProper.show
                result.url = curProper.url
                result.name = curProper.name
                result.quality = curProper.quality
                result.release_group = curProper.release_group
                result.version = curProper.version
                result.seeders = curProper.seeders
                result.leechers = curProper.leechers
                result.size = curProper.size
                result.files = curProper.files
                result.content = curProper.content

                # snatch it
                snatchEpisode(result, SNATCHED_PROPER)
                time.sleep(cpu_presets[sickrage.app.config.cpu_preset])
コード例 #5
0
ファイル: __init__.py プロジェクト: ChrisJamesHobbs/SiCKRAGE
        def release_group(show_id, name):
            from sickrage.core.nameparser import NameParser, InvalidNameException, InvalidShowException

            if name:
                name = remove_non_release_groups(remove_extension(name))

                try:
                    parse_result = NameParser(name, show_id=show_id, naming_pattern=True).parse(name)
                    if parse_result.release_group:
                        return parse_result.release_group
                except (InvalidNameException, InvalidShowException) as e:
                    sickrage.app.log.debug("Unable to get parse release_group: {}".format(e))

            return ''
コード例 #6
0
ファイル: __init__.py プロジェクト: TATUMTOT/SickRage
    def release_group(show, name):
        if name:
            name = remove_non_release_groups(remove_extension(name))
        else:
            return ""

        try:
            np = NameParser(name, showObj=show, naming_pattern=True)
            parse_result = np.parse(name)
        except (InvalidNameException, InvalidShowException) as e:
            sickrage.LOGGER.debug("Unable to get parse release_group: {}".format(e))
            return ''

        if not parse_result.release_group:
            return ''
        return parse_result.release_group
コード例 #7
0
    def release_group(show, name):
        if name:
            name = remove_non_release_groups(remove_extension(name))
        else:
            return ""

        try:
            np = NameParser(name, showObj=show, naming_pattern=True)
            parse_result = np.parse(name)
        except (InvalidNameException, InvalidShowException) as e:
            sickrage.LOGGER.debug(
                "Unable to get parse release_group: {}".format(e))
            return ''

        if not parse_result.release_group:
            return ''
        return parse_result.release_group
コード例 #8
0
ファイル: test_helpers.py プロジェクト: SiCKRAGETV/SiCKRAGE
 def _test(self):
     for test_string in test_strings:
         from sickrage.core.helpers import remove_non_release_groups
         self.assertEqual(remove_non_release_groups(test_string), test_result)
コード例 #9
0
 def _test(self):
     for test_string in test_strings:
         self.assertEqual(remove_non_release_groups(test_string), test_result)
コード例 #10
0
ファイル: __init__.py プロジェクト: ChrisJamesHobbs/SiCKRAGE
 def release_name(name):
     if name:
         name = remove_non_release_groups(remove_extension(name))
     return name
コード例 #11
0
ファイル: test_helpers.py プロジェクト: Jusedawg/SiCKRAGETV
 def _test(self):
     for test_string in test_strings:
         self.assertEqual(remove_non_release_groups(test_string),
                          test_result)
コード例 #12
0
    def _downloadPropers(self, properList):
        """
        Download proper (snatch it)

        :param properList:
        """

        for curProper in properList:

            historyLimit = datetime.datetime.today() - datetime.timedelta(
                days=30)

            # make sure the episode has been downloaded before
            historyResults = main_db.MainDB().select(
                "SELECT resource FROM history " +
                "WHERE showid = ? AND season = ? AND episode = ? AND quality = ? AND date >= ? "
                + "AND action IN (" + ",".join(
                    [str(x)
                     for x in Quality.SNATCHED + Quality.DOWNLOADED]) + ")", [
                         curProper.indexerid, curProper.season,
                         curProper.episode, curProper.quality,
                         historyLimit.strftime(History.date_format)
                     ])

            # if we didn't download this episode in the first place we don't know what quality to use for the proper so we can't do it
            if len(historyResults) == 0:
                sickrage.srCore.srLogger.info(
                    "Unable to find an original history entry for proper " +
                    curProper.name + " so I'm not downloading it.")
                continue

            else:

                # make sure that none of the existing history downloads are the same proper we're trying to download
                clean_proper_name = self._genericName(
                    remove_non_release_groups(curProper.name))
                isSame = False
                for curResult in historyResults:
                    # if the result exists in history already we need to skip it
                    if self._genericName(
                            remove_non_release_groups(
                                curResult["resource"])) == clean_proper_name:
                        isSame = True
                        break
                if isSame:
                    sickrage.srCore.srLogger.debug(
                        "This proper is already in history, skipping it")
                    continue

                # get the episode object
                epObj = curProper.show.getEpisode(curProper.season,
                                                  curProper.episode)

                # make the result object
                result = curProper.provider.getResult([epObj])
                result.show = curProper.show
                result.url = curProper.url
                result.name = curProper.name
                result.quality = curProper.quality
                result.release_group = curProper.release_group
                result.version = curProper.version
                result.content = curProper.content

                # snatch it
                snatchEpisode(result, SNATCHED_PROPER)
                time.sleep(cpu_presets[sickrage.srCore.srConfig.CPU_PRESET])
コード例 #13
0
 def _test(self):
     for test_string in test_strings:
         from sickrage.core.helpers import remove_non_release_groups
         self.assertEqual(remove_non_release_groups(test_string),
                          test_result)
コード例 #14
0
ファイル: __init__.py プロジェクト: TATUMTOT/SickRage
 def release_name(name):
     if name:
         name = remove_non_release_groups(remove_extension(name))
     return name