Exemple #1
0
 def __init__(self):
     """Initialize class."""
     self.cache_subfolder = __name__.split('.')[-1] if '.' in __name__ else __name__
     self.session = MedusaSession()
     self.imdb_api = Imdb(session=self.session)
     self.recommender = 'IMDB Popular'
     self.default_img_src = 'poster.png'
Exemple #2
0
 def __init__(self):
     self.session = MedusaSession()
     self.session.headers.update({
         'X-Plex-Device-Name': 'Medusa',
         'X-Plex-Product': 'Medusa Notifier',
         'X-Plex-Client-Identifier': common.USER_AGENT,
         'X-Plex-Version': app.APP_VERSION,
     })
Exemple #3
0
 def __init__(self):
     self.headers = {
         'X-Plex-Device-Name': 'Medusa',
         'X-Plex-Product': 'Medusa Notifier',
         'X-Plex-Client-Identifier': common.USER_AGENT,
         'X-Plex-Version': '2016.02.10'
     }
     self.session = MedusaSession()
Exemple #4
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 = MedusaSession()
        self.recommender = 'Anidb Popular'
        self.base_url = 'https://anidb.net/perl-bin/animedb.pl?show=anime&aid={aid}'
        self.default_img_src = 'poster.png'
Exemple #5
0
 def __init__(self, recommender=None, source=None, cache_subfoler=None):
     """Recommended show base class (AnidbPopular, TraktPopular, etc)."""
     self.session = MedusaSession()
     self.recommender = recommender
     self.source = source
     self.cache_subfolder = 'recommended'
     self.default_img_src = 'poster.png'
     self.mapped_indexer = None
     self.mapped_series_id = None
     self.mapped_indexer_name = None
Exemple #6
0
    def __init__(self):
        self.updater = None
        self.install_type = None
        self.amActive = False
        self.install_type = self.find_install_type()
        if self.install_type == 'git':
            self.updater = GitUpdateManager()
        elif self.install_type == 'source':
            self.updater = SourceUpdateManager()

        self.session = MedusaSession()
Exemple #7
0
    def __init__(self):
        """Class retrieves a specified recommended show list from Anilist.

        List of returned shows is mapped to a RecommendedShow object
        """
        super(AniListPopular, self).__init__()
        self.cache_subfolder = AniListPopular.CACHE_SUBFOLDER
        self.recommender = AniListPopular.TITLE
        self.source = EXTERNAL_ANILIST
        self.base_url = AniListPopular.BASE_URL
        self.session = MedusaSession()
Exemple #8
0
    def __init__(self):
        self.github_org = self.get_github_org()
        self.github_repo = self.get_github_repo()

        self.branch = app.BRANCH
        if app.BRANCH == '':
            self.branch = self._find_installed_branch()

        self._cur_commit_hash = app.CUR_COMMIT_HASH
        self._newest_commit_hash = None
        self._num_commits_behind = 0
        self._num_commits_ahead = 0

        self.session = MedusaSession()
Exemple #9
0
    def __init__(self, rec_show_prov, show_id, title, indexer, indexer_id,
                 **show_attr):
        """Create a show recommendation

        :param rec_show_prov: Recommended shows provider. Used to keep track of the provider,
                              which facilitated the recommended shows list.
        :param show_id: as provided by the list provider
        :param title: of the show as displayed in the recommended show page
        :param indexer: used to map the show to
        :param indexer_id: a mapped indexer_id for indexer
        :param rating: of the show in percent
        :param votes: number of votes
        :param image_href: the href when clicked on the show image (poster)
        :param image_src: the local url to the "cached" image (poster)
        :param default_img_src: a default image when no poster available
        """
        self.recommender = rec_show_prov.recommender
        self.cache_subfolder = rec_show_prov.cache_subfolder or 'recommended'
        self.default_img_src = getattr(rec_show_prov, 'default_img_src', '')

        self.show_id = show_id
        self.title = title
        self.indexer = int(indexer)
        try:
            self.indexer_id = int(indexer_id)
        except ValueError:
            raise MissingTvdbMapping('Could not parse the indexer_id [%s]' %
                                     indexer_id)

        self.rating = show_attr.get('rating') or 0

        self.votes = show_attr.get('votes')
        if self.votes and not isinstance(self.votes, int):
            trans_mapping = {ord(c): None for c in ['.', ',']}
            self.votes = int(
                self.votes.decode('utf-8').translate(trans_mapping))

        self.image_href = show_attr.get('image_href')
        self.image_src = show_attr.get('image_src')
        self.ids = show_attr.get('ids', {})
        self.is_anime = False

        # Check if the show is currently already in the db
        self.show_in_list = self.indexer_id in {
            show.indexerid
            for show in app.showList if show.indexerid
        }
        self.session = MedusaSession()
Exemple #10
0
    def __init__(self):
        """Initialize class."""
        self.cache_subfolder = __name__.split('.')[-1] if '.' in __name__ else __name__
        self.session = MedusaSession()
        self.recommender = 'IMDB Popular'
        self.default_img_src = 'poster.png'
        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),
        }
Exemple #11
0
    def __init__(self, name, host=None, username=None, password=None):
        """Constructor.

        :param name:
        :type name: string
        :param host:
        :type host: string
        :param username:
        :type username: string
        :param password:
        :type password: string
        """
        self.name = name
        self.username = app.TORRENT_USERNAME if username is None else username
        self.password = app.TORRENT_PASSWORD if password is None else password
        self.host = app.TORRENT_HOST if host is None else host
        self.rpcurl = app.TORRENT_RPCURL
        self.url = None
        self.response = None
        self.auth = None
        self.last_time = time.time()
        self.session = MedusaSession()
        self.session.auth = (self.username, self.password)
Exemple #12
0
}

indexerConfig = {
    INDEXER_TVDBV2: {
        'enabled':
        True,
        'id':
        INDEXER_TVDBV2,
        'name':
        'TVDBv2',
        'module':
        TVDBv2,
        'api_params': {
            'language': 'en',
            'use_zip': True,
            'session': MedusaSession(cache_control={'cache_etags': False}),
        },
        'xem_origin':
        'tvdb',
        'icon':
        'thetvdb16.png',
        'scene_loc':
        '{base_url}/scene_exceptions/scene_exceptions_tvdb.json'.format(
            base_url=BASE_PYMEDUSA_URL),
        'base_url':
        'https://api.thetvdb.com/',
        'show_url':
        'http://thetvdb.com/?tab=series&id=',
        'mapped_to':
        'tvdb_id',  # The attribute to which other indexers can map there thetvdb id to
        'identifier':
Exemple #13
0
 def __init__(self):
     self.session = MedusaSession()
Exemple #14
0
 def __init__(self):
     self.lock = threading.Lock()
     self.amActive = False
     self.session = MedusaSession()
Exemple #15
0
 def __init__(self):
     """Init method."""
     self.session = MedusaSession()
     self.url = 'https://joinjoaomgcd.appspot.com/_ah/api/messaging/v1/sendPush?'
Exemple #16
0
 def __init__(self):
     """Initialize the class."""
     self.session = MedusaSession()
     self.url = 'https://new.boxcar.io/api/notifications'
Exemple #17
0
 def __init__(self):
     self.session = MedusaSession()
     self.url = 'https://api.pushbullet.com/v2/'
Exemple #18
0
 def __init__(self):
     self.lock = threading.Lock()
     self.amActive = False
     self.session = MedusaSession()
     self.update_cache = UpdateCache()
Exemple #19
0
)
from medusa.cache import recommended_series_cache
from medusa.helpers import ensure_list
from medusa.imdb import Imdb
from medusa.indexers.utils import indexer_id_to_name, indexer_name_mapping
from medusa.logger.adapters.style import BraceAdapter
from medusa.session.core import MedusaSession

from simpleanidb import Anidb

from six import PY2, ensure_text, text_type

log = BraceAdapter(logging.getLogger(__name__))
log.logger.addHandler(logging.NullHandler())

session = MedusaSession()


class LazyApi(object):
    """Decorators to lazily construct API classes."""

    imdb_api = None
    anidb_api = None

    @classmethod
    def load_anidb_api(cls, func):
        """
        Decorate a function to lazy load the anidb_api.

        We need to do this, because we're passing the Medusa cache location to the lib. As the module is imported before
        the app.CACHE_DIR location has been read, we can't initialize it at module level.
Exemple #20
0
 def __init__(self):
     """Show updatere constructor."""
     self.lock = threading.Lock()
     self.amActive = False
     self.session = MedusaSession()
     self.update_cache = UpdateCache()