コード例 #1
0
def _get_anidb_exceptions():
    anidb_exceptions = {}

    if should_refresh('anidb'):
        logger.log('Checking for scene exceptions updates from AniDB')

        for show in app.showList:
            if all([show.name, show.is_anime, show.indexer == INDEXER_TVDBV2]):
                try:
                    anime = adba.Anime(None, name=show.name, tvdbid=show.indexerid, autoCorrectName=True)
                except ValueError as error:
                    logger.log("Couldn't update scene exceptions for {0}, AniDB doesn't have this show.".format
                               (show.name), logger.DEBUG)
                    continue
                except Exception as error:
                    logger.log('Checking AniDB scene exceptions update failed for {0}. Error: {1}'.format
                               (show.name, error), logger.ERROR)
                    continue

                if anime and anime.name != show.name:
                    anidb_exceptions[INDEXER_TVDBV2] = {}
                    anidb_exceptions[INDEXER_TVDBV2][text_type(show.indexerid)] = [{anime.name.decode('utf-8'): -1}]

        set_last_refresh('anidb')

    return anidb_exceptions
コード例 #2
0
def get_release_groups_for_anime(series_name):
    """Get release groups for an anidb anime."""
    groups = []
    if set_up_anidb_connection():
        try:
            anime = adba.Anime(app.ADBA_CONNECTION, name=series_name, cache_path=join(app.CACHE_DIR, 'adba'))
            groups = anime.get_groups()
        except Exception as error:
            log.warning(u'Unable to retrieve Fansub Groups from AniDB. Error: {error}', {'error': error.message})
            raise AnidbAdbaConnectionException(error)

    return groups
コード例 #3
0
ファイル: __init__.py プロジェクト: robertodr/nixconf
 def doNameSearch(self, results, name, connection):
     fileInfo = adba.Anime(connection,
                           name=name,
                           paramsA=[
                               "english_name", "kanji_name", "romaji_name",
                               "year", "aid"
                           ])
     try:
         Log("Trying to lookup %s by name on anidb" % name)
         fileInfo.load_data()
     except Exception, e:
         Log("Could not load anime data, msg: " + str(e))
         raise e
コード例 #4
0
ファイル: anidb.py プロジェクト: yinghuodt007/SiCKRAGE
def get_release_groups_for_anime(series_name):
    """Get release groups for an anidb anime."""
    groups = []

    if set_up_anidb_connection():
        try:
            anime = adba.Anime(sickrage.app.adba_connection, name=series_name)
            groups = anime.get_groups()
        except Exception as error:
            sickrage.app.log.warning(
                'Unable to retrieve Fansub Groups from AniDB. Error: {}'.
                format(error))
            raise AnidbAdbaConnectionException(error)

    return groups
コード例 #5
0
def _anidb_exceptions_fetcher():
    if shouldRefresh('anidb'):
        logger.log("Checking for scene exception updates for AniDB")
        for show in sickbeard.showList:
            if show.is_anime and show.indexer == 1:
                try:
                    anime = adba.Anime(None, name=show.name, tvdbid=show.indexerid, autoCorrectName=True)
                except Exception:
                    continue
                else:
                    if anime.name and anime.name != show.name:
                        anidb_exception_dict[show.indexerid] = [{anime.name: -1}]

        setLastRefresh('anidb')
    return anidb_exception_dict
コード例 #6
0
    def run(self):
        if not connection.authed():
            log_function("authenticating in thread: " + self.getName())
            if (user and pw):
                connection.auth(user, pw)
        else:
            log_function(self.name +
                         "no need to authenticate some one else did it")

        if (self.animeName != ""):
            anime = adba.Anime(connection,
                               name=self.animeName,
                               paramsA=['aid'])
            anime.load_data()
            log_function("the id to " + self.animeName + " is " +
                         str(anime.aid))
        else:
            log_function("not looking up anything you gave me no anime name")
コード例 #7
0
ファイル: scene_exceptions.py プロジェクト: ptitmicki/Medusa
def _get_anidb_exceptions(force):
    anidb_exceptions = defaultdict(dict)
    # AniDB exceptions use TVDB as indexer
    exceptions = anidb_exceptions[INDEXER_TVDBV2]

    if force or should_refresh('anidb'):
        logger.info('Checking for scene exceptions updates from AniDB')

        for show in app.showList:
            if all([show.name, show.is_anime, show.indexer == INDEXER_TVDBV2]):
                try:
                    anime = adba.Anime(
                        None,
                        name=show.name,
                        tvdbid=show.indexerid,
                        autoCorrectName=True,
                        cache_path=join(app.CACHE_DIR, 'adba')
                    )
                except ValueError as error:
                    logger.debug(
                        "Couldn't update scene exceptions for {show},"
                        " AniDB doesn't have this show. Error: {msg}".format(
                            show=show.name, msg=error,
                        )
                    )
                    continue
                except Exception as error:
                    logger.error(
                        'Checking AniDB scene exceptions update failed'
                        ' for {show}. Error: {msg}'.format(
                            show=show.name, msg=error,
                        )
                    )
                    continue

                if anime and anime.name != show.name:
                    series_id = int(show.series_id)
                    exceptions[series_id] = [{anime.name.decode('utf-8'): -1}]

        set_last_refresh('anidb')

    return anidb_exceptions
コード例 #8
0
ファイル: __init__.py プロジェクト: robertodr/nixconf
    def getAnimeInfo(self,
                     connection,
                     aid,
                     metadata,
                     movie=False,
                     force=False):

        Log("Loading metadata for anime aid " + aid)

        anime = adba.Anime(connection,
                           aid=metadata.id,
                           paramsA=[
                               "epno", "english_name", "kanji_name",
                               "romaji_name", "year", "picname", "url",
                               "rating", "episodes", "highest_episode_number",
                               "air_date"
                           ])
        try:
            anime.load_data()
        except Exception, e:
            Log("Could not load anime info, msg: " + str(e))
            raise e
コード例 #9
0
ファイル: anime.py プロジェクト: swipswaps/SickGear
def create_anidb_obj(**kwargs):

    return adba.Anime(sickbeard.ADBA_CONNECTION,
                      cache_path=anidb_cache_dir(),
                      **kwargs)
コード例 #10
0
ファイル: groupstatus_test.py プロジェクト: lad1337/adba
# make a connection object
# log = True great for testing not so great for a running system (default is False)
connection = adba.Connection(log=True)

# we can always ping to see if we can reach the server
try:
    connection.ping()
except Exception, e:
    print("exception msg: " + str(e))
    print "if we cant even ping stop right here"
    exit()

# ok lets try to authenticate. we need username and pw for that
try:
    connection.auth(user, pw)
    pass
except Exception, e:
    print("exception msg: " + str(e))

animeList = ["Bleach", "Naruto Shippuuden", "Blue Exorcist"]

for animeName in animeList:
    print("########################### " + animeName +
          " ###########################")
    anime = adba.Anime(connection, name=animeName, paramsA=['aid'], load=True)
    groups = anime.get_groups()
    for group in groups:
        print(u"- " + str(group))

connection.logout()
コード例 #11
0
ファイル: adbaanimeinfocli.py プロジェクト: labrys/adba
except Exception as e:
    print('Exception: %s', e)
    sys.exit(1)

if connection.authed():
    try:
        maper = adba.aniDBmaper.AniDBMaper()
        animeFieldsWanted = maper.getAnimeMapA()
        # animeFieldsWanted=animeFieldsWanted[0:-1]
        animeMaper = [
            field for field in animeFieldsWanted
            if field not in blacklistFields
        ]
        # print(animeFieldsWanted)
        animeInfo = adba.Anime(connection,
                               aid=args.AID,
                               load=True,
                               paramsA=animeMaper)
        # print(animeInfo.rawData)
        for field in animeMaper:
            if field == 'related_aid_list':
                relatedDict = {
                    value: ""
                    for key, value in relIDtoRelation.items()
                }

                relatedAids = getattr(animeInfo, field)
                relatedAidTypes = getattr(animeInfo, 'related_aid_type')
                try:
                    for i in range(len(relatedAids)):
                        curID = relatedAids[i]
                        curRelation = relIDtoRelation[relatedAidTypes[i]]
コード例 #12
0
# coding=utf-8
#
# This file is part of aDBa.
#
# aDBa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# aDBa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with aDBa.  If not, see <http://www.gnu.org/licenses/>.

from test_lib import *

####################################################
# here starts the stuff that is interesting for you
####################################################

# you only need to import the module
import adba

connection = adba.Connection()
connection.auth(user, pw)
anime = adba.Anime(connection, name="Bleach", load=True)
anime.add_notification()
コード例 #13
0
ファイル: tvdbMaper_test.py プロジェクト: labrys/adba
#
# You should have received a copy of the GNU General Public License
# along with aDBa.  If not, see <http://www.gnu.org/licenses/>.
import sys
import os
import getopt
from test_lib import *
import threading

####################################################
# here starts the stuff that is interesting for you
####################################################

# you only need to import the module
import adba

print("--- test with name ---")
anime = adba.Anime(None, name="Ao no Exorcist")
print("tvdb_id:", anime.tvdb_id)
print("anidb_id:", anime.aid)

print("--- test with aid ---")
anime = adba.Anime(None, aid=8148)
print("tvdb_id:", anime.tvdb_id)
print("name:", anime.name)

print("--- test with tvdbid ---")
anime = adba.Anime(None, tvdb_id=248035)
print("anidb_id:", anime.aid)
print("name:", anime.name)
コード例 #14
0
    def getAnimeInfo(self,
                     connection,
                     aid,
                     metadata,
                     movie=False,
                     force=False):
        """Return a Plex metadata instance for the AniDB anime `aid`.

        Returns a Plex metadata object with the following fields filled out:
            - Air date (/ Year - movies)
            - Show name, in the language indicated by the `titleKey` method
            - Rating
            - Poster
            - Show Description (via the `getDescription` method)
        """

        Log("Loading metadata for anime aid " + aid)

        anime = adba.Anime(connection,
                           aid=metadata.id,
                           paramsA=[
                               "epno", "english_name", "kanji_name",
                               "romaji_name", "year", "picname", "url",
                               "rating", "episodes", "tag_weight_list",
                               "tag_name_list", "highest_episode_number",
                               "air_date"
                           ])

        cacheKey = "aid:%s" % metadata.id
        if cacheKey not in Dict or force:
            Log("Cache miss for key %s" % cacheKey)
            anime.load_data()
            Dict[cacheKey] = anime.dataDict

            if cacheKey + ":desc" in Dict:
                Log("Cleaning up key %s:desc" % cacheKey)
                del Dict[cacheKey + ":desc"]
        else:
            Log("Loading anime info from cache key %s" % cacheKey)
            anime.dataDict = Dict[cacheKey]

        if movie and "year" in anime.dataDict:
            year = str(anime.dataDict['year'])
            if year.find('-') > -1:
                year = year[:year.find('-')]
            try:
                metadata.year = int(year)
            except:
                pass

        if "rating" in anime.dataDict:
            metadata.rating = float(anime.dataDict['rating']) / 100

        (metadata.title, metadata.title_sort) = self.getTitles(anime.dataDict)

        metadata.originally_available_at = self.getDate(
            anime.dataDict['air_date'])

        if "tag_name_list" in anime.dataDict and \
                anime.dataDict["tag_name_list"]:
            min_weight = int(float(Prefs["tag_min_weight"]) * 200)
            weights = anime.dataDict["tag_weight_list"].split(",")
            genres = anime.dataDict["tag_name_list"].split(",")

            # Can't assign containers in Plex API
            for (genre, weight) in zip(genres, weights):
                if int(weight) >= min_weight:
                    metadata.genres.add(genre)
                else:
                    Log("Skipping tag '%s': Weight is %i, minimum "
                        "weight is %i." % (genre, int(weight), min_weight))

        if "picname" in anime.dataDict:
            picUrl = ANIDB_PIC_URL_BASE + anime.dataDict['picname']
            poster = Proxy.Media(HTTP.Request(picUrl).content)
            metadata.posters[picUrl] = poster

        metadata.summary = self.getDescription(connection, metadata.id, 0)