예제 #1
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 = make_session()
예제 #2
0
파일: anidb.py 프로젝트: fernandog/Medusa
    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)
예제 #3
0
파일: imdb.py 프로젝트: fernandog/Medusa
    def __init__(self):
        """Initialize class."""
        self.cache_subfolder = __name__.split(
            '.')[-1] if '.' in __name__ else __name__
        self.session = helpers.make_session()
        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),
        }
예제 #4
0
    def __init__(self, name):
        """Initialize the class."""
        self.name = name

        self.anime_only = False
        self.bt_cache_urls = [
            'http://itorrents.org/torrent/{info_hash}.torrent',
            'https://torrentproject.se/torrent/{info_hash}.torrent',
            'http://reflektor.karmorra.info/torrent/{info_hash}.torrent',
            'http://thetorrent.org/torrent/{info_hash}.torrent',
            'https://torcache.pro/{info_hash}.torrent',
            'http://piratepublic.com/download.php?id={info_hash}',
            'http://www.legittorrents.info/download.php?id={info_hash}',
            'https://torrent.cd/torrents/download/{info_hash}/.torrent',
            'https://asnet.pw/download/{info_hash}/',
        ]
        self.cache = tv.Cache(self)
        self.enable_backlog = False
        self.enable_manualsearch = False
        self.enable_daily = False
        self.enabled = False
        self.headers = {'User-Agent': UA_POOL.random}
        self.proper_strings = ['PROPER|REPACK|REAL|RERIP']
        self.provider_type = None
        self.public = False
        self.search_fallback = False
        self.search_mode = None
        self.session = make_session()
        self.show = None
        self.supports_absolute_numbering = False
        self.supports_backlog = True
        self.url = ''
        self.urls = {}
        # Ability to override the search separator. As for example anizb is using '*' instead of space.
        self.search_separator = ' '

        # Use and configure the attribute enable_cookies to show or hide the cookies input field per provider
        self.enable_cookies = False
        self.cookies = ''

        # Paramaters for reducting the daily search results parsing
        self.max_recent_items = 5
        self.stop_at = 3
예제 #5
0
    def test_search():  # pylint: disable=too-many-locals
        url = 'http://kickass.to/'
        search_url = 'http://kickass.to/usearch/American%20Dad%21%20S08%20-S08E%20category%3Atv/?field=seeders&sorder=desc'

        html = getURL(search_url, session=make_session(), returns='text')
        if not html:
            return

        soup = BeautifulSoup(html, 'html5lib')

        torrent_table = soup.find('table', attrs={'class': 'data'})
        torrent_rows = torrent_table.find_all('tr') if torrent_table else []

        # cleanup memory
        soup.clear(True)

        # Continue only if one Release is found
        if len(torrent_rows) < 2:
            print("The data returned does not contain any torrents")
            return

        for row in torrent_rows[1:]:
            try:
                link = urljoin(url, (row.find('div', {
                    'class': 'torrentname'
                }).find_all('a')[1])['href'])
                _id = row.get('id')[-7:]
                title = (row.find('div', {'class': 'torrentname'}).find_all('a')[1]).text \
                    or (row.find('div', {'class': 'torrentname'}).find_all('a')[2]).text
                url = row.find('a', 'imagnet')['href']
                verified = True if row.find('a', 'iverify') else False
                trusted = True if row.find('img',
                                           {'alt': 'verified'}) else False
                seeders = int(row.find_all('td')[-2].text)
                leechers = int(row.find_all('td')[-1].text)
                print((link, _id, verified, trusted, seeders, leechers))
            except (AttributeError, TypeError):
                continue

            print(title)
예제 #6
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 = helpers.make_session()
        self.session.auth = (self.username, self.password)
예제 #7
0
# coding=utf-8

import logging

from medusa import helpers
from medusa.logger.adapters.style import BraceAdapter


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

meta_session = helpers.make_session()


def getShowImage(url, imgNum=None):
    if url is None:
        return None

    # if they provided a fanart number try to use it instead
    if imgNum is not None:
        tempURL = url.split('-')[0] + '-' + str(imgNum) + '.jpg'
    else:
        tempURL = url

    log.debug(u'Fetching image from {url}', {'url': tempURL})

    image_data = helpers.get_url(tempURL, session=meta_session, returns='content')
    if image_data is None:
        log.warning(u'There was an error trying to retrieve the image, aborting')
        return
예제 #8
0
파일: boxcar2.py 프로젝트: fernandog/Medusa
 def __init__(self):
     """Initialize the class."""
     self.session = make_session()
     self.url = 'https://new.boxcar.io/api/notifications'
예제 #9
0
 def __init__(self):
     self.session = helpers.make_session()