本文整理汇总了Python中resources.lib.sources.sources函数的典型用法代码示例。如果您正苦于以下问题:Python sources函数的具体用法?Python sources怎么用?Python sources使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sources函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add
def add(self, tvshowtitle, year, imdb, tmdb, tvdb, tvrage, range=False):
if not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'):
control.infoDialog(control.lang(30421).encode('utf-8'), time=10000000)
self.infoDialog = True
from resources.lib.indexers import episodes
items = episodes.episodes().get(tvshowtitle, year, imdb, tmdb, tvdb, tvrage, idx=False)
try: items = [{'name': i['name'], 'title': i['title'], 'year': i['year'], 'imdb': i['imdb'], 'tmdb': i['tmdb'], 'tvdb': i['tvdb'], 'tvrage': i['tvrage'], 'season': i['season'], 'episode': i['episode'], 'tvshowtitle': i['tvshowtitle'], 'alter': i['alter'], 'date': i['premiered']} for i in items]
except: items = []
try:
if not self.dupe_setting == 'true': raise Exception()
if items == []: raise Exception()
id = [items[0]['imdb'], items[0]['tvdb']]
if not items[0]['tmdb'] == '0': id += [items[0]['tmdb']]
lib = control.jsonrpc('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties" : ["imdbnumber", "title", "year"]}, "id": 1}')
lib = unicode(lib, 'utf-8', errors='ignore')
lib = json.loads(lib)['result']['tvshows']
lib = [i['title'].encode('utf-8') for i in lib if str(i['imdbnumber']) in id or (i['title'].encode('utf-8') == items[0]['tvshowtitle'] and str(i['year']) == items[0]['year'])][0]
lib = control.jsonrpc('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"filter":{"and": [{"field": "tvshow", "operator": "is", "value": "%s"}]}, "properties": ["season", "episode"]}, "id": 1}' % lib)
lib = unicode(lib, 'utf-8', errors='ignore')
lib = json.loads(lib)['result']['episodes']
lib = ['S%02dE%02d' % (int(i['season']), int(i['episode'])) for i in lib]
items = [i for i in items if not 'S%02dE%02d' % (int(i['season']), int(i['episode'])) in lib]
except:
pass
for i in items:
try:
if xbmc.abortRequested == True: return sys.exit()
if self.check_setting == 'true':
if i['episode'] == '1':
self.block = True
from resources.lib.sources import sources
src = sources().getSources(i['name'], i['title'], i['year'], i['imdb'], i['tmdb'], i['tvdb'], i['tvrage'], i['season'], i['episode'], i['tvshowtitle'], i['alter'], i['date'])
if len(src) > 0: self.block = False
if self.block == True: raise Exception()
if int(self.date) <= int(re.sub('[^0-9]', '', str(i['date']))):
from resources.lib.sources import sources
src = sources().getSources(i['name'], i['title'], i['year'], i['imdb'], i['tmdb'], i['tvdb'], i['tvrage'], i['season'], i['episode'], i['tvshowtitle'], i['alter'], i['date'])
if not len(src) > 0: raise Exception()
self.strmFile(i)
except:
pass
if range == True: return
if self.infoDialog == True:
control.infoDialog(control.lang(30423).encode('utf-8'), time=1)
if self.library_setting == 'true' and not control.condVisibility('Library.IsScanningVideo'):
control.execute('UpdateLibrary(video)')
示例2: getConstants
def getConstants(self):
self.itemProperty = 'plugin.video.flixnet.container.items'
self.metaProperty = 'plugin.video.flixnet.container.meta'
from resources.lib.sources import sources as sources
from resources.lib.sources_de import sources as sources_de
from resources.lib.sources_fr import sources as sources_fr
from resources.lib.sources_pt import sources as sources_pt
from resources.lib.sources_pl import sources as sources_pl
from resources.lib.sources_ko import sources as sources_ko
self.sourceDict = sources() + sources_de() + sources_fr() + sources_pt() + sources_pl() + sources_ko()
try:
self.hostDict = urlresolver.relevant_resolvers(order_matters=True)
self.hostDict = [i.domains for i in self.hostDict if not '*' in i.domains]
self.hostDict = [i.lower() for i in reduce(lambda x, y: x+y, self.hostDict)]
self.hostDict = [x for y,x in enumerate(self.hostDict) if x not in self.hostDict[:y]]
except:
self.hostDict = []
self.hostprDict = ['1fichier.com', 'oboom.com', 'rapidgator.net', 'rg.to', 'uploaded.net', 'uploaded.to', 'ul.to', 'filefactory.com', 'nitroflare.com', 'turbobit.net', 'uploadrocket.net']
self.hostcapDict = ['hugefiles.net', 'kingfiles.net', 'openload.io', 'openload.co', 'oload.tv', 'thevideo.me', 'vidup.me', 'streamin.to', 'torba.se']
self.hosthqDict = ['openload.io', 'openload.co', 'oload.tv', 'thevideo.me', 'rapidvideo.com', 'raptu.com', 'filez.tv']
self.hostblockDict = []
self.debridDict = debrid.debridDict()
示例3: _resolve
def _resolve(self, source, clean = True, info = False, internal = True):
# Resolves the link using the providers and urlresolver.
from resources.lib.sources import sources # Must be imported here due to circular imports.
self.mLink = sources().sourcesResolve(source, info = info, internal = internal)
if clean and self.mLink:
self.mLink, self.mHeadersPost = self._linkClean(self.mLink)
return self.mLink
示例4: add
def add(self, name, title, year, imdb, tmdb, range=False):
if not control.condVisibility("Window.IsVisible(infodialog)") and not control.condVisibility("Player.HasVideo"):
control.infoDialog(control.lang(30421).encode("utf-8"), time=10000000)
self.infoDialog = True
try:
if not self.dupe_setting == "true":
raise Exception()
id = [imdb, tmdb] if not tmdb == "0" else [imdb]
lib = control.jsonrpc(
'{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["imdbnumber", "originaltitle", "year"]}, "id": 1}'
% (year, str(int(year) + 1), str(int(year) - 1))
)
lib = unicode(lib, "utf-8", errors="ignore")
lib = json.loads(lib)["result"]["movies"]
lib = [
i
for i in lib
if str(i["imdbnumber"]) in id
or (i["originaltitle"].encode("utf-8") == title and str(i["year"]) == year)
][0]
except:
lib = []
try:
if not lib == []:
raise Exception()
if self.check_setting == "true":
from resources.lib.sources import sources
src = sources().checkSources(name, title, year, imdb, tmdb, "0", "0", None, None, None, "0", None)
if src == False:
raise Exception()
self.strmFile({"name": name, "title": title, "year": year, "imdb": imdb, "tmdb": tmdb})
except:
pass
if range == True:
return
if self.infoDialog == True:
control.infoDialog(control.lang(30423).encode("utf-8"), time=1)
if self.library_setting == "true" and not control.condVisibility("Library.IsScanningVideo"):
control.execute("UpdateLibrary(video)")
示例5: getConstants
def getConstants(self):
from resources.lib.sources import sources as sources
self.sourceDict = sources()
try:
self.hostDict = urlresolver.relevant_resolvers(order_matters=True)
self.hostDict = [i.domains for i in self.hostDict if not '*' in i.domains]
self.hostDict = [i.lower() for i in reduce(lambda x, y: x+y, self.hostDict)]
self.hostDict = [x for y,x in enumerate(self.hostDict) if x not in self.hostDict[:y]]
except:
self.hostDict = []
self.hostprDict = ['1fichier.com', 'oboom.com', 'rapidgator.net', 'rg.to', 'uploaded.net', 'uploaded.to', 'ul.to', 'filefactory.com', 'nitroflare.com', 'turbobit.net', 'uploadrocket.net']
self.hostcapDict = ['hugefiles.net', 'kingfiles.net', 'openload.io', 'openload.co', 'thevideo.me', 'vidup.me', 'streamin.to', 'torba.se']
self.hostblockDict = []
示例6: get_sources
def get_sources(self, url, hosthdDict, hostDict, locDict):
try:
self.sources = []
if url == None: return self.sources
url = url.replace('\'', '')
url = re.sub(r'[^a-zA-Z0-9\s]+', ' ', url).lower().strip()
url = re.sub('\s\s+' , ' ', url)
url = url.replace(' ' , '-')
query = urlparse.urljoin(self.base_link, url)
result = client.source(query)
if result == None: raise Exception()
fmt = re.compile('url *: *[\'|\"](.+?)[\'|\"]').findall(result)
fmt = fmt[0] if len(fmt) > 0 else ''
fmt = re.sub('(.+)(\d{4}|s\d*e\d*)-', '', fmt.lower())
fmt = re.split('-', fmt.replace('/' , ''))
if any(x in ['dvdscr', 'r5', 'r6', 'camrip', 'tsrip', 'hdcam', 'hdts', 'dvdcam', 'dvdts', 'cam', 'ts'] for x in fmt): raise Exception()
elif '1080p' in fmt: quality = '1080p'
elif '720p' in fmt: quality = 'HD'
else: raise Exception()
hostdirhdDict = sources.sources().hostdirhdDict
links = client.parseDOM(result, 'a', attrs = {'rel': 'nofollow'})
links = [i for i in links if i.startswith('http')]
links = [(i, quality, hostdirhdDict) for i in links]
threads = []
for i in links: threads.append(workers.Thread(self.check, i))
[i.start() for i in threads]
for i in range(0, 10 * 2):
is_alive = [x.is_alive() for x in threads]
if all(x == False for x in is_alive): break
time.sleep(0.5)
return self.sources
except:
return self.sources
示例7: get
def get(self):
try :
name=None
title=None
year=None
imdb=None
tmdb=None
tvdb=None
tvrage=None
season=None
episode=None
tvshowtitle=None
alter=None
date=None
meta=None
sourceList = cache.get(sources().getSources, 2, name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta)
self.list.extend(sourceList)
self.list = sorted(self.list, key=lambda k: k['name'])
self.channelDirectory(self.list)
except :
pass
示例8: sources
from resources.lib.indexers import tvshows
from resources.lib.indexers import livetv
#import json
#from resources.lib.sources import sources
#from resources.lib.libraries import downloader
#url = 'http://openload.co/stream/P-irqGW8ylM~1462390526~159.63.0.0~tNX8w6cV?mime=true|User-Agent=Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0'
#try: downloader.download(name, image, url)
#except: pass
#livetv.channels().get()
#tvshows.tvshows().get(url, provider=provider, network=name)
#movies.movies().get(url, provider=provider, lang=lang)
#episodes.episodes().get(tvshowtitle, year, imdb, tmdb, tvdb, tvrage, season, episode, provider=provider, url=url)
sources().addItem(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta)
#sources().play(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta, url)
#sources().playItem(content, name, year, imdb, tvdb, source)
#print re.compile()
#from resources.lib.sources.ditto_live import source
#source().getLiveSource()
'''import json, urllib
source = {"provider":provider, "url":url, "quality":'HD', "label":provider, "source":provider}
tmp=json.dumps([source])
print tmp
tmp= urllib.quote_plus(tmp)
print tmp
tmp = urllib.unquote_plus(tmp)
print json.loads(tmp)'''
示例9: sources
elif action == 'tvshowToLibrary':
from resources.lib.libraries import libtools
libtools.libtvshows().add(tvshowtitle, year, imdb, tmdb, tvdb, service)
elif action == 'tvshowsToLibrary':
from resources.lib.libraries import libtools
libtools.libtvshows().range(url)
elif action == 'updateLibrary':
from resources.lib.libraries import libtools
libtools.libepisodes().update(query)
elif action == 'resolve':
from resources.lib.sources import sources
from resources.lib.libraries import control
url = sources().sourcesResolve(url, provider)
control.addItem(handle=int(sys.argv[1]), url=url, listitem=control.item(name))
control.directory(int(sys.argv[1]))
elif action == 'download':
from resources.lib.sources import sources
from resources.lib.libraries import simpledownloader
url = sources().sourcesResolve(url, provider)
simpledownloader.download(name, image, url)
elif action == 'play':
from resources.lib.sources import sources
sources().play(name, title, service, meta, url)
elif action == 'sources':
from resources.lib.sources import sources
示例10: sources
elif action == 'tvshowsToLibrary':
from resources.lib.libraries import libtools
libtools.libtvshows().range(url, query)
elif action == 'updateLibrary':
from resources.lib.libraries import libtools
libtools.libepisodes().update(query)
elif action == 'service':
from resources.lib.libraries import libtools
libtools.libepisodes().service()
elif action == 'play':
from resources.lib.sources import sources
sources().play(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, url)
elif action == 'sources':
from resources.lib.sources import sources
sources().addItem(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta)
elif action == 'playItem':
from resources.lib.sources import sources
sources().playItem(content, name, imdb, tvdb, url, source, provider)
elif action == 'alterSources':
from resources.lib.sources import sources
sources().alterSources(url, meta)
elif action == 'clearSources':
from resources.lib.sources import sources
示例11: addDownload
def addDownload(name, url, image, provider=None):
try:
def download(): return []
result = cache.get(download, 600000000, table='rel_dl')
result = [i['name'] for i in result]
except:
pass
if name in result:
return control.infoDialog('Item Already In Your Queue', name)
try:
if not provider == None:
from resources.lib.sources import sources
url = sources().sourcesResolve(url, provider)
if url == None: raise Exception()
#legacy issue, will be removed later
if 'afdah.org' in url and not '</source>' in url: url += '<source>afdah</source>'
if '</source>' in url:
source = re.compile('<source>(.+?)</source>').findall(url)[0]
url = re.compile('(.+?)<source>').findall(url)[0]
for i in ['_mv', '_tv', '_mv_tv']:
try: call = __import__('resources.lib.sources.%s%s' % (source, i), globals(), locals(), ['object'], -1).source()
except: pass
from resources.lib import sources ; d = sources.sources()
url = call.get_sources(url, d.hosthdfullDict, d.hostsdfullDict, d.hostlocDict)
if type(url) == list:
url = sorted(url, key=lambda k: k['quality'])
url = url[0]['url']
url = call.resolve(url)
from resources.lib import resolvers
url = resolvers.request(url)
if type(url) == list:
url = sorted(url, key=lambda k: k['quality'])
url = url[0]['url']
if url == None: raise Exception()
except:
return control.infoDialog('Unplayable stream')
pass
try:
u = url.split('|')[0]
try: headers = dict(urlparse.parse_qsl(url.rsplit('|', 1)[1]))
except: headers = dict('')
ext = os.path.splitext(urlparse.urlparse(u).path)[1][1:].lower()
if ext == 'm3u8': raise Exception()
#if not ext in ['mp4', 'mkv', 'flv', 'avi', 'mpg']: ext = 'mp4'
dest = name + '.' + ext
req = urllib2.Request(u, headers=headers)
resp = urllib2.urlopen(req, timeout=30)
size = int(resp.headers['Content-Length'])
size = ' %.2f GB' % (float(size) / 1073741824)
no = control.yesnoDialog(dest, 'Complete file is' + size, 'Continue with download?', name + ' - ' + 'Confirm Download', 'Confirm', 'Cancel')
if no: return
except:
return control.infoDialog('Unable to download')
pass
def download(): return [{'name': name, 'url': url, 'image': image}]
result = cache.get(download, 600000000, table='rel_dl')
result = [i for i in result if not i['url'] == url]
def download(): return result + [{'name': name, 'url': url, 'image': image}]
result = cache.get(download, 0, table='rel_dl')
control.infoDialog('Item Added to Queue', name)
示例12: resolveUrl
def resolveUrl(name, url, audio, image, fanart, playable, content):
try:
if '.f4m'in url:
label = cleantitle(name)
ext = url.split('?')[0].split('&')[0].split('|')[0].rsplit('.')[-1].replace('/', '').lower()
if not ext == 'f4m': raise Exception()
from resources.lib.libraries.f4mproxy.F4mProxy import f4mProxyHelper
return f4mProxyHelper().playF4mLink(url, label, None, None,'',image)
#legacy issue, will be removed later
if 'afdah.org' in url and not '</source>' in url: url += '<source>afdah</source>'
if '</source>' in url:
source = re.compile('<source>(.+?)</source>').findall(url)[0]
url = re.compile('(.+?)<source>').findall(url)[0]
for i in ['_mv', '_tv', '_mv_tv']:
try: call = __import__('resources.lib.sources.%s%s' % (source, i), globals(), locals(), ['object'], -1).source()
except: pass
from resources.lib import sources ; d = sources.sources()
url = call.get_sources(url, d.hosthdfullDict, d.hostsdfullDict, d.hostlocDict)
if type(url) == list and len(url) == 1:
url = url[0]['url']
elif type(url) == list:
url = sorted(url, key=lambda k: k['quality'])
for i in url: i.update((k, '720p') for k, v in i.iteritems() if v == 'HD')
for i in url: i.update((k, '480p') for k, v in i.iteritems() if v == 'SD')
q = [i['quality'].upper() for i in url]
u = [i['url'] for i in url]
select = control.selectDialog(q)
if select == -1: return
url = u[select]
url = call.resolve(url)
from resources.lib import resolvers
url = resolvers.request(url)
if type(url) == list and len(url) == 1:
url = url[0]['url']
elif type(url) == list:
url = sorted(url, key=lambda k: k['quality'])
for i in url: i.update((k, '720p') for k, v in i.iteritems() if v == 'HD')
for i in url: i.update((k, '480p') for k, v in i.iteritems() if v == 'SD')
q = [i['quality'].upper() for i in url]
u = [i['url'] for i in url]
select = control.selectDialog(q)
if select == -1: return
url = u[select]
if url == None: raise Exception()
except:
return control.infoDialog('Unplayable stream')
pass
if playable == 'true':
item = control.item(path=url)
return control.resolve(int(sys.argv[1]), True, item)
else:
label = cleantitle(name)
item = control.item(path=url, iconImage=image, thumbnailImage=image)
item.setInfo( type='Video', infoLabels = {'title': label} )
control.playlist.clear()
control.player.play(url, item)
示例13: getOneStrm
def getOneStrm(all_strms):
if not all_strms:
return False
first_strm_name = sorted(all_strms.keys())[0]
ep = all_strms[first_strm_name]
title = ep["title"]
year = ep["year"]
imdb = ep["imdb"]
tvdb = ep["tvdb"]
tmdb = ep["tmdb"]
tvrage = ep["tvrage"]
date = ep["date"]
season = ep["season"]
episode = ep["episode"]
show = ep["tvshowtitle"]
name = ep["name"]
downloaded_filename_base = (
getGenesisSetting("tv_downloads") + first_strm_name[len(getGenesisSetting("tv_library")) :]
)
try:
xbmcvfs.mkdirs(os.path.dirname(downloaded_filename_base))
except:
pass
all_strms.pop(first_strm_name, None)
try:
state().setProperty(curr_download_prop, os.path.basename(str(first_strm_name)))
except:
state().setProperty(next_download_prop, "None")
try:
state().setProperty(next_download_prop, os.path.basename(str(sorted(all_strms.keys())[0])))
except:
state().setProperty(next_download_prop, "None")
try:
state().setProperty(queue_length, str(len(all_strms.keys())))
except:
state().setProperty(queue_length, "0")
src = sources.sources()
has_sources = src.checkSources(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, show, "0", date)
if not has_sources:
xbmc.log(msg="Genesis Prefetch: No sources for " + name, level=xbmc.LOGNOTICE)
return False
source_names = src.sourcesFilter()
extra_filtered_sources = []
# Drop LQ/MQ links. We want decent quality for the prefetch.
for s in source_names:
if s["label"].find("LQ") >= 0 or s["label"].find("MQ") >= 0:
continue
else:
extra_filtered_sources.append(s)
sources_dict = {}
# This part needs to be put into threads per URL.
# Gets so slow that we can't use opened connections and need to open again.
for single_source in extra_filtered_sources:
src.sources = [single_source]
url = src.sourcesDirect()
if not url:
continue
try:
(main_url, headers) = parseGenesisUrl(url)
u = download.getResponse(main_url, headers, 0, "")
if not u:
continue
meta = u.info()
try:
content_type = meta.getheaders("Content-Type")[0]
except:
content_type = None
if content_type == "text/html" or content_type == "text/plain":
continue
h = meta.getheaders("Content-Length")
try:
file_size = int(h[0])
except:
continue
extension = ".mp4"
for ext in [".mp4", ".flv", ".avi", ".mkv"]:
if url.lower().find(ext) > 0:
extension = ext
sources_dict[main_url] = (file_size, u, extension, main_url, headers)
except Exception as e:
xbmc.log(msg="Genesis Prefetch: FETCH HEADERS EXCEPTION: " + str(e), level=xbmc.LOGNOTICE)
continue
# Pick largest file, because quality.
sorted_by_size = sorted(sources_dict.values(), key=lambda tup: tup[0], reverse=True)
for (file_size, u, extension, url, headers) in sorted_by_size:
file_name = downloaded_filename_base + extension
#.........这里部分代码省略.........
示例14: sources
elif action == 'tvshows':
from resources.lib.indexers import tvshows
tvshows.tvshows().get(url, provider=provider, network=name)
elif action == 'seasons':
from resources.lib.indexers import episodes
episodes.seasons().get(tvshowtitle, year, imdb, tmdb, tvdb, tvrage)
elif action == 'episodes':
from resources.lib.indexers import episodes
episodes.episodes().get(tvshowtitle, year, imdb, tmdb, tvdb, tvrage, season, episode, provider=provider, url=url)
elif action == 'sources':
from resources.lib.sources import sources
sources().addItem(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta)
elif action == 'download':
import json
from resources.lib.sources import sources
from resources.lib.libraries import downloader
try: downloader.download(name, image, sources().sourcesResolve(json.loads(source)[0]))
except: pass
elif action == 'play':
from resources.lib.sources import sources
sources().play(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta, url)
elif action == 'playItem':
from resources.lib.sources import sources
sources().playItem(content, name, year, imdb, tvdb, source)
示例15: sources
elif action == 'tvshows':
from resources.lib.indexers import tvshows
tvshows.tvshows().get(url, provider=provider, network=name)
elif action == 'seasons':
from resources.lib.indexers import episodes
episodes.seasons().get(tvshowtitle, year, imdb, tmdb, tvdb, tvrage)
elif action == 'episodes':
from resources.lib.indexers import episodes
episodes.episodes().get(tvshowtitle, year, imdb, tmdb, tvdb, tvrage, season, episode, provider=provider, url=url)
elif action == 'sources':
from resources.lib.sources import sources
sources().addItem(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta)
elif action == 'play':
from resources.lib.sources import sources
sources().play(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta, url)
elif action == 'playItem':
from resources.lib.sources import sources
sources().playItem(content, name, year, imdb, tvdb, source)
elif action == 'trailer':
from resources.lib.libraries import trailer
trailer.trailer().play(name, url)
elif action == 'addView':
from resources.lib.libraries import views