Esempio n. 1
0
def search_episode(info):
    title= ' S%02dE%02d' % (info['season'], info['episode'])
    if settings.time_noti > 0 : provider.notify(message='Searching: ' + info['title'].encode("utf-8").title() +
                                 title +'...', header=None, time=settings.time_noti, image=settings.icon)
    url_search = "%s/show/%s" % (settings.url ,info['imdb_id'])
    provider.log.info(url_search)
    response = provider.GET(url_search)
    results=[]
    if  str(response.data)!='':
        filters.use_TV()
        filters.information()
        items = provider.parse_json(response.data)
        for episode in items['episodes']:
            if (episode['episode']==info['episode'] and episode['season']==info['season']):
                for resolution in episode['torrents']:
                    resASCII =resolution.encode('utf-8')
                    name = resASCII + ' - ' + items['title'] + ' - ' + episode['title'].encode('utf-8') + ' - ' + 'S%02dE%02d'% (info['season'], info['episode'])
                    if filters.included(resASCII, filters.quality_allow) and not filters.included(resASCII, filters.quality_deny):
                        res_val=values3[resASCII]
                        magnet = episode['torrents'][resolution]['url']
                        if magnet[:4].lower()=='http':
                            magnet = common.TorrentToMagnet(magnet,items['title'],info['season'],info['episode'])
                        if magnet is not None:
                            info_magnet = common.Magnet(magnet)
                            results.append({'name': name + ' - ' + settings.name_provider, 'uri': magnet})
                    else:
                        provider.log.warning(name + ' ***Blocked File by Keyword, Name or Size***')
    return results
Esempio n. 2
0
def search_episode(info):
    title= ' S%02dE%02d' % (info['episode'],info['season'])
    if settings.time_noti > 0 : provider.notify(message='Searching: ' + info['title'].encode("utf-8").title() +
                                 title +'...', header=None, time=settings.time_noti, image=settings.icon)
    url_search = "%s/show/%s" % (settings.url ,info['imdb_id'])
    provider.log.info(url_search)
    response = provider.GET(url_search)
    results=[]
    if  str(response.data)!='':
        filters.use_TV()
        filters.information()
        items = provider.parse_json(response.data)
        for episode in items['episodes']:
            if (episode['episode']==info['episode'] and episode['season']==info['season']):
                for resolution in episode['torrents']:
                    resASCII =resolution.encode('utf-8')
                    name = resASCII + ' - ' + items['title'] + ' - ' + episode['title'].encode('utf-8') + ' - ' + 'S%02dE%02d'% (info['season'], info['episode'])
                    if filters.included(resASCII, filters.quality_allow) and not filters.included(resASCII, filters.quality_deny):
                        res_val=values3[resASCII]
                        magnet = episode['torrents'][resolution]['url']
                        info_magnet = common.Magnet(magnet)
                        results.append({'name': name + ' - ' + settings.name_provider,
                                        'uri': magnet})
                    else:
                        provider.log.warning(name + ' ***Blocked File by Keyword, Name or Size***')
    return results
Esempio n. 3
0
def findID(query="", year=""):
    response = provider.GET("%s/search?q=%s" % (settings.url, query))
    answer = provider.parse_json(response.data)
    result = "0"
    if len(answer) > 0:
        for item in answer["data"]:
            result = item["id"]
            if item["year"] == year:
                break
    return result
Esempio n. 4
0
def extract_magnets_json(data):
    results = []
    items = provider.parse_json(data)
    if len(items['sources']) > 0:
        filters.information()
        for item in items['sources']:
            resASCII = item['def']
            name = items['name'] + filters.title + ' - ' + resASCII + 'p - ' + settings.name_provider
            filters.title = items['name']
            if filters.verify(name, None):
                results.append({'name': name, 'uri': item['url']})
            else:
                provider.log.warning(filters.reason)
    return results
def translator(imdb_id, language):
    import unicodedata
    url_themoviedb = "http://api.themoviedb.org/3/find/%s?api_key=9f4da017d29142fbadf3d21a37e59704" \
                     "&language=%s&external_source=imdb_id" % (imdb_id, language)
    response = provider.GET(url_themoviedb)
    if response != (None, None):
        movie = provider.parse_json(response.data)
        title0 = movie['movie_results'][0]['title'].replace(u'\xf1', '*')
        title_normalize = unicodedata.normalize('NFKD', title0)
        title = title_normalize.encode('ascii', 'ignore').replace(':', '')
        title = title.decode('utf-8').replace('*', u'\xf1').encode('utf-8')
    else:
        title = 'themoviedb.org is unreachable'
    return title
def translator(imdb_id, language):
    import unicodedata
    url_themoviedb = "http://api.themoviedb.org/3/find/%s?api_key=9f4da017d29142fbadf3d21a37e59704" \
                     "&language=%s&external_source=imdb_id" % (imdb_id, language)
    response = provider.GET(url_themoviedb)
    if response != (None, None):
        movie = provider.parse_json(response.data)
        title0 = movie['movie_results'][0]['title'].replace(u'\xf1', '*')
        title_normalize = unicodedata.normalize('NFKD', title0)
        title = title_normalize.encode('ascii', 'ignore').replace(':', '')
        title = title.decode('utf-8').replace('*', u'\xf1').encode('utf-8')
    else:
        title = 'themoviedb.org is unreachable'
    return title
Esempio n. 7
0
def search(query):
    query += ' ' + settings.extra  # add the extra information
    query = filters.type_filtering(query, '+')  # check type filter and set-up filters.title
    browser.open("%s?get_token=get_token&app_id=script.pulsar.rarbg-mc" % settings.url)
    items = provider.parse_json(browser.content)
    url_search = "%s?mode=search&search_string=%s&app_id=script.pulsar.rarbg-mc&token=%s" % (settings.url, query, items["token"])  # change in each provider
    provider.log.info(url_search)
    if browser.open(url_search):
        results = extract_torrents(browser.content)
    else:
        provider.log.error('>>>>>>>%s<<<<<<<' % browser.status)
        provider.notify(message=browser.status, header=None, time=5000, image=settings.icon)
        results = []
    return results
Esempio n. 8
0
def extract_magnets_json(data):
    results = []
    items = provider.parse_json(data)
    if items['data']['movie_count'] > 0:
        filters.information()
        for movie in items['data']['movies'][0]['torrents']:
            resASCII =movie['quality'].encode('utf-8')
            name = movie['size'] + ' - ' + items['data']['movies'][0]['title'] + ' - ' + resASCII + ' - ' + settings.name_provider
            filters.title = items['data']['movies'][0]['title']
            if filters.verify(name ,movie['size']):
                results.append({'name': name, 'uri': movie['url'], 'info_hash': movie['hash']})
            else:
                provider.log.warning(filters.reason)
    return results
def search(query):
    url_search = "http://getstrike.net/api/torrents/search/?q=%s" % (query)
    provider.log.info(url_search)
    response = provider.GET(url_search)
    results = []
    if str(response.data) != '':
        items = provider.parse_json(response.data)
        nbrTorrents = items[0]['results']
        for torrent in range(0, nbrTorrents):
            hash = items[1][torrent]['torrent_hash']
            name = items[1][torrent]['torrent_title']
            link = items[1][torrent]['download_link']
            magnet = 'magnet:?xt=urn:btih:%s' % (hash)
            results.append({'name': name, 'uri': magnet, 'info_hash': hash})
    return results
Esempio n. 10
0
def search(query):
	query = query.replace(' ', '%20')
	url_search = "https://getstrike.net/api/v2/torrents/search/?phrase=%s" % (query)
	provider.log.info(url_search)
	response = provider.GET(url_search)
	results=[]
	if response != (None, None):
		items = provider.parse_json(response.data)
		nbrTorrents = items['results']
		for torrent in range(0, nbrTorrents):
			hash = items['torrents'][torrent]['torrent_hash']
			name = items['torrents'][torrent]['torrent_title']
			magnet = items['torrents'][torrent]['magnet_uri']
			results.append({'name': name, 'uri': magnet, 'info_hash': hash})
	return results
Esempio n. 11
0
def search(query):
    url_search = "http://getstrike.net/api/torrents/search/?q=%s" % (query)
    provider.log.info(url_search)
    response = provider.GET(url_search)
    results = []
    if str(response.data) != "":
        items = provider.parse_json(response.data)
        nbrTorrents = items[0]["results"]
        for torrent in range(0, nbrTorrents):
            hash = items[1][torrent]["torrent_hash"]
            name = items[1][torrent]["torrent_title"]
            link = items[1][torrent]["download_link"]
            magnet = "magnet:?xt=urn:btih:%s" % (hash)
            results.append({"name": name, "uri": magnet, "info_hash": hash})
    return results
Esempio n. 12
0
def extract_torrents(data):
    try:
        cont = 0
        results = []
        items = provider.parse_json(data)
        if not items.has_key("error"):
            for item in items["torrent_results"]:
                name = item["filename"] + ' - ' + settings.name_provider
                torrent = item["download"]
                if filters.verify(name, None):
                    results.append({"name": name, "uri": torrent})  # return le torrent)
                    cont+= 1
                else:
                    provider.log.warning(filters.reason)
                if cont == settings.max_magnets:  # limit magnets
                    break
            provider.log.info('>>>>>>' + str(cont) + ' torrents sent to Pulsar<<<<<<<')
        return results
    except:
        provider.log.error('>>>>>>>ERROR parsing data<<<<<<<')
        provider.notify(message='ERROR parsing data', header=None, time=5000, image=settings.icon)
Esempio n. 13
0
def search_episode(info):
    filters.use_TV()
    filters.title = ' S%02dE%02d' % (info['season'], info['episode'])
    if settings.time_noti > 0: provider.notify(message='Searching: ' + info['title'].encode("utf-8").title() +
                                                       filters.title + '...', header=None, time=settings.time_noti,
                                               image=settings.icon)
    id = findID(info["title"])
    if id == "0":
        return []
    else:
        url_search = "%s/tvshows/%s" % (settings.url, id)
        provider.log.info(url_search)
        response = provider.GET(url_search)
        try:
            id = provider.parse_json(response.data)["seasons"][info['season'] - 1]['episodes'][info['episode'] - 1]['id']
            url_search = "%s/episodes/%s" % (settings.url, id)
            provider.log.info(url_search)
            response = provider.GET(url_search)
            return extract_magnets_json(response.data)
        except:
            provider.log.info("No episode available")
            return []