コード例 #1
0
    def __init__(self):
        """Class retrieves a specified recommended show list from Trakt.

        List of returned shows is mapped to a RecommendedShow object
        """
        self.cache_subfolder = __name__.split(
            '.')[-1] if '.' in __name__ else __name__
        self.session = helpers.make_session()
        self.recommender = "Anidb Popular"
        self.base_url = 'https://anidb.net/perl-bin/animedb.pl?show=anime&aid={aid}'
        self.anidb = Anidb(cache_dir=app.CACHE_DIR)
コード例 #2
0
ファイル: anidb.py プロジェクト: reconman/Medusa
    def fetch_popular_shows(self, list_type=REQUEST_HOT):
        """Get popular show information from IMDB."""
        series = []
        result = []

        try:
            series = Anidb(cache_dir=join(app.CACHE_DIR,
                                          'simpleanidb')).get_list(list_type)
        except GeneralError as error:
            log.warning('Could not connect to AniDB service: {0}', error)

        for show in series:
            try:
                recommended_show = self._create_recommended_show(series=show)
                if recommended_show:
                    recommended_show.save_to_db()
                    result.append(recommended_show)
            except MissingTvdbMapping:
                log.info(
                    'Could not parse AniDB show {0}, missing tvdb mapping',
                    show.title)
            except Exception:
                log.warning('Could not parse AniDB show, with exception: {0}',
                            traceback.format_exc())

        return result
コード例 #3
0
    def fetch_popular_shows(self, list_type=REQUEST_HOT):
        """Get popular show information from IMDB."""
        series = []
        result = []

        try:
            series = Anidb(cache_dir=app.CACHE_DIR).get_list(list_type)
        except GeneralError as error:
            log.warning('Could not connect to AniDB service: {0}', error)

        for show in series:
            try:
                recommended_show = self._create_recommended_show(
                    show, storage_key=b'anidb_{0}'.format(show.aid))
                if recommended_show:
                    result.append(recommended_show)
            except MissingTvdbMapping:
                log.info(
                    'Could not parse AniDB show {0}, missing tvdb mapping',
                    show.title)
            except Exception:
                log.warning('Could not parse AniDB show, with exception: {0}',
                            traceback.format_exc())

        # Update the dogpile index. This will allow us to retrieve all stored dogpile shows from the dbm.
        update_recommended_series_cache_index(
            'anidb', [binary_type(s.series_id) for s in result])

        return result
コード例 #4
0
 def __init__(self):
     """Initialize the trakt recommended list object."""
     self.cache_subfolder = __name__.split(
         '.')[-1] if '.' in __name__ else __name__
     self.session = requests.Session()
     self.recommender = "Trakt Popular"
     self.default_img_src = 'http://www.trakt.tv/assets/placeholders/thumb/poster-2d5709c1b640929ca1ab60137044b152.png'
     self.anidb = Anidb(cache_dir=app.CACHE_DIR)
コード例 #5
0
 def __init__(self):
     """Initialize the trakt recommended list object."""
     self.cache_subfolder = __name__.split(
         '.')[-1] if '.' in __name__ else __name__
     self.recommender = "Trakt Popular"
     self.default_img_src = 'trakt-default.png'
     self.anidb = Anidb(cache_dir=app.CACHE_DIR)
     self.tvdb_api_v2 = indexerApi(INDEXER_TVDBV2).indexer()
コード例 #6
0
 def __init__(self):
     """Initialize the trakt recommended list object."""
     self.cache_subfolder = __name__.split(
         '.')[-1] if '.' in __name__ else __name__
     self.session = requests.Session()
     self.recommender = "Trakt Popular"
     self.default_img_src = 'trakt-default.png'
     self.anidb = Anidb(cache_dir=app.CACHE_DIR)
     self.tvdb_api_v2 = get_tvdbv2_api()
コード例 #7
0
ファイル: imdb.py プロジェクト: DazzFX/SickRage-1
    def __init__(self):
        """Constructor for ImdbPopular."""
        self.cache_subfolder = __name__.split('.')[-1] if '.' in __name__ else __name__
        self.session = helpers.make_session()
        self.recommender = 'IMDB Popular'
        self.default_img_src = ''
        self.anidb = Anidb(cache_dir=app.CACHE_DIR)

        # Use akas.imdb.com, just like the imdb lib.
        self.url = 'http://akas.imdb.com/search/title'

        self.params = {
            'at': 0,
            'sort': 'moviemeter',
            'title_type': 'tv_series',
            'year': '%s,%s' % (date.today().year - 1, date.today().year + 1),
        }
コード例 #8
0
ファイル: recommended.py プロジェクト: sinnlosername/Medusa
 def func_wrapper(*args, **kwargs):
     if cls.anidb_api is None:
         cls.anidb_api = Anidb(cache_dir=join(app.CACHE_DIR, 'simpleanidb'))
     return func(*args, **kwargs)
コード例 #9
0
class AnidbPopular(object):  # pylint: disable=too-few-public-methods
    def __init__(self):
        """Class retrieves a specified recommended show list from Trakt.

        List of returned shows is mapped to a RecommendedShow object
        """
        self.cache_subfolder = __name__.split(
            '.')[-1] if '.' in __name__ else __name__
        self.session = helpers.make_session()
        self.recommender = "Anidb Popular"
        self.base_url = 'https://anidb.net/perl-bin/animedb.pl?show=anime&aid={aid}'
        self.default_img_src = 'poster.png'
        self.anidb = Anidb(cache_dir=app.CACHE_DIR)

    def _create_recommended_show(self, show_obj):
        """Create the RecommendedShow object from the returned showobj"""
        try:
            tvdb_id = self.anidb.aid_to_tvdb_id(show_obj.aid)
        except Exception:
            logger.warning("Couldn't map aid [%s] to tvdbid ", show_obj.aid)
            return None

        # If the anime can't be mapped to a tvdb_id, return none, and move on to the next.
        if not tvdb_id:
            return tvdb_id

        rec_show = RecommendedShow(
            self, show_obj.aid, show_obj.title, 1, tvdb_id, **{
                'rating': show_obj.rating_permanent,
                'votes': show_obj.count_permanent,
                'image_href': self.base_url.format(aid=show_obj.aid),
                'ids': {
                    'tvdb': tvdb_id,
                    'aid': show_obj.aid
                }
            })

        # Check cache or get and save image
        use_default = self.default_img_src if not show_obj.picture.url else None
        rec_show.cache_image(show_obj.picture.url, default=use_default)

        # By default pre-configure the show option anime = True
        rec_show.is_anime = True

        return rec_show

    def fetch_popular_shows(self, list_type=REQUEST_HOT):
        """Get popular show information from IMDB"""
        shows = []
        result = []

        try:
            shows = self.anidb.get_list(list_type)
        except GeneralError as e:
            logger.warning('Could not connect to Anidb service: %s', e)

        for show in shows:
            try:
                recommended_show = self._create_recommended_show(show)
                if recommended_show:
                    result.append(recommended_show)
            except MissingTvdbMapping:
                logger.info(
                    'Could not parse Anidb show %s, missing tvdb mapping',
                    show.title)
            except Exception:
                logger.warning(
                    'Could not parse Anidb show, with exception: %s',
                    traceback.format_exc())

        return result
コード例 #10
0
ファイル: recommended.py プロジェクト: thomas2902/Medusa
 def func_wrapper(aid):
     global anidb_api
     if anidb_api is None:
         anidb_api = Anidb(cache_dir=app.CACHE_DIR)
     return func(aid)
コード例 #11
0
 def func_wrapper(*args, **kwargs):
     if cls.anidb_api is None:
         cls.anidb_api = Anidb(cache_dir=app.CACHE_DIR)
     return func(*args, **kwargs)