示例#1
0
    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().checkSources(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 src == True: 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().checkSources(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 src == False: 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
0
    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)')
示例#3
0
    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()
示例#4
0
    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
0
    def get(self, url=None):
        try:

            if url == None:
                self.list = self.getGenre()
            else:
                name = None
                title = None
                year = None
                imdb = None
                tvdb = None
                season = None
                episode = None
                tvshowtitle = None
                date = None
                meta = {'genre': url}

                sourceList = sources().getSources(name, title, year, imdb,
                                                  tvdb, season, episode,
                                                  tvshowtitle, date, meta)

                sourceList = dict(
                    (item['name'], item) for item in sourceList).values()

                self.list.extend(sourceList)
                self.list = sorted(self.list, key=lambda k: k['name'])

                if not url == None:
                    self.channelDirectory(self.list)
                else:
                    self.channelDirectory(self.list,
                                          action='desiLiveNavigator')
        except Exception as e:
            logger.error(e, __name__)
            pass
示例#6
0
    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().getSources(name, title, year, imdb, tmdb, '0', '0', None, None, None, '0', None)
                if not len(src) > 0: 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)')
示例#7
0
    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 = []

        self.debridDict = debrid.debridDict()
示例#8
0
    def getConstants(self):
        self.itemProperty = 'plugin.video.temptv.container.items'

        self.metaProperty = 'plugin.video.temptv.container.meta'

        from resources.lib.sources import 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',
            'uploadgig.com', 'ul.to', 'filefactory.com', 'nitroflare.com', 'turbobit.net', 'uploadrocket.net',
            'multiup.org']

        self.hostcapDict = [
            'hugefiles.net', 'kingfiles.net', 'openload.io', 'openload.co', 'oload.tv', 'thevideo.me',
            'vidup.me', 'streamin.to', 'torba.se', 'flashx.tv', 'vshare.eu', 'vshare.io']

        self.hosthqDict = [
            'gvideo', 'google.com', 'openload.io', 'openload.co', 'oload.tv', 'thevideo.me',
            'rapidvideo.com', 'raptu.com', 'filez.tv', 'uptobox.com', 'uptobox.com', 'uptostream.com',
            'xvidstage.com', 'streamango.com', 'vev.io']

        self.hostblockDict = []
示例#9
0
	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
示例#10
0
def scrape_next_episode(tvshowtitle, year, imdb, tvdb, lang, season=None, episode=None):

	from resources.lib.sources import sources
	from resources.lib.indexers import episodes
	
	title = tvshowtitle
	
	next_episode = episodes.seasons().tvdb_list(tvshowtitle, year, imdb, tvdb, 'en', limit='nextepisode', season=season, episode=episode)

	premiered     = next_episode[0]['premiered']
	new_season    = next_episode[0]['season']
	new_episode   = next_episode[0]['episode']
	meta = []
	select = '3'
		
	sources().smartplay(title, year, imdb, tvdb, '0', new_season, new_episode, tvshowtitle, premiered, '', autoplay=False, background=True)
	return next_episode[0]
示例#11
0
def init():

    del initA[:]
    del initBool[:]

    init = sources()
    initA.append(init)

    return "Interface Framework Initialized"
示例#12
0
    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
示例#13
0
    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()
示例#14
0
 def test_getLiveSources(self):
     from resources.lib.sources import sources
     name = None
     title = None
     year = None
     imdb = None
     tvdb = None
     season = None
     episode = None
     tvshowtitle = None
     date = None
     meta = None
     sourceList = sources().getSources(name, title, year, imdb, tvdb,
                                       season, episode, tvshowtitle, date,
                                       meta)
示例#15
0
def check_sources(title,
                  year,
                  imdb,
                  tvdb=None,
                  season=None,
                  episode=None,
                  tvshowtitle=None,
                  premiered=None):
    try:
        from resources.lib.sources import sources
        src = sources().checkSources(title, year, imdb, tvdb, season, episode,
                                     tvshowtitle, premiered)
        return src  #and len(src) > 5
    except:
        return False
示例#16
0
    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)")
示例#17
0
    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 = []
    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
示例#19
0
 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
示例#20
0
 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
示例#21
0
    from resources.lib.indexers import tvshows
    #analytics.sendAnalytics('%s-%s' % (action, name))
    tvshows.tvshows().get(url, provider=provider, network=name)

elif action == 'seasons':
    from resources.lib.indexers import episodes
    episodes.seasons().get(tvshowtitle, year, imdb, tvdb)

elif action == 'episodes':
    from resources.lib.indexers import episodes
    #analytics.sendAnalytics('%s-%s' % (action, tvshowtitle))
    episodes.episodes().get(tvshowtitle, year, imdb, tvdb, season, episode, provider=provider, url=url)

elif action == 'addItem':
    from resources.lib.sources import sources
    sources().addItem(title, content)

elif action == 'download':
    import json
    from resources.lib.sources import sources
    from aftershock.common 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, tvdb, season, episode, tvshowtitle, date, meta, url, select)

elif action == 'playItem':
    from resources.lib.sources import sources
    sources().playItem(content, title, source)
示例#22
0
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)
示例#23
0
    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().checkSources(
                            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 src == True:
                            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().checkSources(
                        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 src == False:
                        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)")
name = params.get('name')
premiered = params.get('premiered')
query = params.get('query')
season = params.get('season')
select = params.get('select')
source = params.get('source')
title = params.get('title')
tmdb = params.get('tmdb')
tvdb = params.get('tvdb')
tvshowtitle = params.get('tvshowtitle')
url = params.get('url')
year = params.get('year')

if action == None: navigator.navigator().root()
elif action == 'addFavourite': favourites.addFavourite(meta, content)
elif action == 'addItem': sources().addItem(title)
elif action == 'addView': views.addView(content)
elif action == 'alterSources': sources().alterSources(url, meta)
elif action == 'artwork': control.artwork()
elif action == 'authTrakt': trakt.authTrakt()
elif action == 'backupwatchlist':
    fn = os.path.join(datapath, 'favourites.db')
    if os.path.exists(fn):
        backupdir = control.setting('remote_path')
        if not backupdir == '':
            to_backup = xbmc.translatePath(
                os.path.join('special://', 'profile/addon_data/'))
            rootlen = len(datapath)
            backup_ui_zip = xbmc.translatePath(
                os.path.join(backupdir, 'master.reborn_watchlist.zip'))
            zipobj = zipfile.ZipFile(backup_ui_zip, 'w', zipfile.ZIP_DEFLATED)
示例#25
0
    from resources.lib.modules import trakt
    trakt.manager(name, imdb, tvdb, content)

elif action == 'authTrakt':
    from resources.lib.modules import trakt
    trakt.authTrakt()

elif action == 'rdAuthorize':
    from resources.lib.modules import debrid
    debrid.rdAuthorize()

elif action == 'download':
    import json
    from resources.lib.sources import sources
    from resources.lib.modules import downloader
    try: downloader.download(name, image, sources().sourcesResolve(json.loads(source)[0], True))
    except: pass

elif action == 'play':
    from resources.lib.sources import sources
    sources().play(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select)
elif action == 'play_library':
    from resources.lib.sources import sources
    sources().play_library(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select)

elif action == 'addItem':
    from resources.lib.sources import sources
    sources().addItem(title)
	
elif action == 'movieFavourites':
    from resources.lib.indexers import movies
示例#26
0
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
示例#27
0
elif action == 'episodePlaycount':
	from resources.lib.modules import playcount
	playcount.episodes(imdb, tvdb, season, episode, query)

elif action == 'tvPlaycount':
	from resources.lib.modules import playcount
	playcount.tvshows(name, imdb, tvdb, season, query)

elif action == 'trailer':
	from resources.lib.modules import trailer
	trailer.trailer().play(name, url)

elif action == 'play':
	from resources.lib.sources import sources
	sources(type = type, kids = kids).play(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select)

elif action == 'addItem':
	from resources.lib.sources import sources
	sources(type = type, kids = kids).addItem()

elif action == 'playItem':
	from resources.lib.extensions import interface
	from resources.lib.sources import sources
	interface.Loader.show() # Immediately show the loader, since slow system will take long to show it in playItem().
	downloadType = params.get('downloadType')
	downloadId = params.get('downloadId')
	handleMode = params.get('handleMode')
	sources(type = type, kids = kids).playItem(source = source, metadata = metadata, downloadType = downloadType, downloadId = downloadId, handleMode = handleMode)

elif action == 'playLocal':
示例#28
0
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
        try:
            if download.doDownload(url, headers, downloaded_filename_base + ".temp_dl", title, ""):
                xbmcvfs.rename(downloaded_filename_base + ".temp_dl", file_name)
                return True
        except Exception as e:
            xbmc.log(msg="Genesis Prefetch: DOWNLOAD EXCEPTION: " + str(e), level=xbmc.LOGNOTICE)
            continue
    return False
示例#29
0
    def tvDownloader(self, title, year, imdb, tvdb, season, episode,
                     tvshowtitle, premiered, meta, select):
        xbmc.log('ENTRY -> plexpvr tvDownloader()', xbmc.LOGNOTICE)
        xbmc.log('    title: %s' % (title), xbmc.LOGNOTICE)
        xbmc.log('    year: %s' % (year), xbmc.LOGNOTICE)
        xbmc.log('    imdb: %s' % (imdb), xbmc.LOGNOTICE)
        xbmc.log('    tvdb: %s' % (tvdb), xbmc.LOGNOTICE)
        xbmc.log('    Season: %s' % (season), xbmc.LOGNOTICE)
        xbmc.log('    Episode: %s' % (episode), xbmc.LOGNOTICE)

        xbmc.log('*** tvDownloader *** year %s' % year, xbmc.LOGDEBUG)
        xbmc.log('*** tvDownloader *** imdb %s' % imdb, xbmc.LOGDEBUG)
        xbmc.log('*** tvDownloader *** tvdb %s' % tvdb, xbmc.LOGDEBUG)
        xbmc.log('*** tvDownloader *** season %s' % season, xbmc.LOGDEBUG)
        xbmc.log('*** tvDownloader *** episode %s' % episode, xbmc.LOGDEBUG)
        xbmc.log('*** tvDownloader *** tvshowtitle %s' % tvshowtitle,
                 xbmc.LOGDEBUG)

        #xbmc.log('*** tvDownloader *** control %s' % control, xbmc.LOGWARNING)

        url = None

        control.moderator()

        xbmc.log(
            '*** ALERT *** Getting Sources %s Season: %s Episode: %s' %
            (tvshowtitle, season, episode), xbmc.LOGDEBUG)

        #This forces the sources() is done on a background tread
        xbmc.log('Setting Exodus setting progress.dialog: 1', xbmc.LOGDEBUG)
        control.setSetting(id='progress.dialog', value='1')

        items = sources().getSources(title, year, imdb, tvdb, season, episode,
                                     tvshowtitle, premiered)
        #labels = [i['label'] for i in items]
        xbmc.log(
            '*** tvDownloader *** tvshowtitle %s item size %s' %
            (tvshowtitle, len(items)), xbmc.LOGWARNING)

        #downloadSource=None
        #for i in range(len(items)):
        #    try:
        #        if i < 3:
        #            finalSource=items[i]
        #            if finalSource['url'].endswith(".mp4"):
        #                downloadSource=finalSource
        #                break
        #            xbmc.log('*** tvDownloader *** finalSource %s' % finalSource, xbmc.LOGWARNING)
        #            xbmc.log('*** tvDownloader *** finalSource[quality] %s' % finalSource['quality'], xbmc.LOGWARNING)
        #        else:
        #            finalSource=items[i]
        #            if finalSource['url'].endswith(".mp4"):
        #                downloadSource=finalSource
        #                break
        #            xbmc.log('*** tvDownloader *** finalSource %s' % finalSource, xbmc.LOGWARNING)
        #            xbmc.log('*** tvDownloader *** finalSource[quality] %s' % finalSource['quality'], xbmc.LOGWARNING)
        #
        #        if downloadSource == None:
        #            downloadSource = items[0]
        #
        #        xbmc.log('*** tvDownloader *** downloadSource %s' % downloadSource, xbmc.LOGWARNING)
        #    except:
        #       pass

        for i in range(len(items)):
            try:
                downloadSource = items[i]
                xbmc.log(
                    '*** tvDownloader *** downloadSource %s' % downloadSource,
                    xbmc.LOGDEBUG)
                downloadResults = self.tvDownloaderForSource(
                    downloadSource, title, year, imdb, tvdb, season, episode,
                    tvshowtitle, premiered, meta, select)
                if downloadResults == True:
                    break
            except:
                pass

        xbmc.log('EXIT <- plexpvr.py tvDownloader()', xbmc.LOGNOTICE)
示例#30
0
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)
示例#31
0
    from resources.lib.modules import trakt
    trakt.manager(name, imdb, tvdb, content)

elif action == 'authTrakt':
    from resources.lib.modules import trakt
    trakt.authTrakt()

elif action == 'rdAuthorize':
    from resources.lib.modules import debrid
    debrid.rdAuthorize()

elif action == 'download':
    import json
    from resources.lib.sources import sources
    from resources.lib.modules import downloader
    try: downloader.download(name, image, sources().sourcesResolve(json.loads(source)[0], True))
    except: pass

elif action == 'play':
    from resources.lib.modules import control
    select = control.setting('hosts.mode')
    if select == '3' and 'plugin' in control.infoLabel('Container.PluginName'):
		from resources.lib.sources import sources
		sources().play_dialog(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select)
    elif select == '4' and 'plugin' in control.infoLabel('Container.PluginName'):
		from resources.lib.sources import sources
		sources().play_dialog_list(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select)
    else:
		from resources.lib.sources import sources
		sources().play(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select)
		
示例#32
0
    def process(self, url, direct=True):
        try:
            dialog = None
            dialog = control.progressDialog
            dialog.create(control.addonInfo('name'),
                          control.lang(30726).encode('utf-8'))
            dialog.update(0)
        except:
            pass

        try:
            if not '</regex>' in url: raise Exception()
            from resources.lib.modules import regex
            u = regex.resolve(url)
            if not u == None: url = u
        except:
            pass

        try:
            if not url.startswith('rtmp'): raise Exception()
            if len(re.compile('\s*timeout=(\d*)').findall(url)) == 0:
                url += ' timeout=10'
            try:
                dialog.close()
            except:
                pass
            return url
        except:
            pass

        try:
            if not '.m3u8' in url: raise Exception()
            ext = url.split('?')[0].split('&')[0].split('|')[0].rsplit(
                '.')[-1].replace('/', '').lower()
            if not ext == 'm3u8': raise Exception()
            try:
                dialog.close()
            except:
                pass
            return url
        except:
            pass

        try:
            preset = re.findall('<preset>(.+?)</preset>', url)[0]

            title, year, imdb = re.findall(
                '<title>(.+?)</title>', url)[0], re.findall(
                    '<year>(.+?)</year>',
                    url)[0], re.findall('<imdb>(.+?)</imdb>', url)[0]

            try:
                tvdb, tvshowtitle, premiered, season, episode = re.findall(
                    '<tvdb>(.+?)</tvdb>', url)[0], re.findall(
                        '<tvshowtitle>(.+?)</tvshowtitle>',
                        url)[0], re.findall('<premiered>(.+?)</premiered>',
                                            url)[0], re.findall(
                                                '<season>(.+?)</season>',
                                                url)[0], re.findall(
                                                    '<episode>(.+?)</episode>',
                                                    url)[0]
            except:
                tvdb = tvshowtitle = premiered = season = episode = None

            direct = False

            presetDict = [
                'primewire_mv_tv', 'watchfree_mv_tv', 'movie25_mv',
                'watchseries_tv', 'dizibox_tv', 'dizigold_tv', 'dizilab_tv',
                'miradetodo_mv', 'onemovies_mv_tv', 'onlinedizi_tv',
                'pelispedia_mv_tv', 'pubfilm_mv_tv', 'putlocker_mv_tv',
                'sezonlukdizi_tv', 'usmovies_mv', 'usseries_tv', 'watch1080_mv'
            ]

            if preset == 'searchsd':
                presetDict = [
                    'primewire_mv_tv', 'watchfree_mv_tv', 'movie25_mv',
                    'watchseries_tv'
                ]

            from resources.lib.sources import sources

            try:
                dialog.update(0,
                              control.lang(30726).encode('utf-8'),
                              control.lang(30731).encode('utf-8'))
            except:
                pass

            u = sources().getSources(title,
                                     year,
                                     imdb,
                                     tvdb,
                                     season,
                                     episode,
                                     tvshowtitle,
                                     premiered,
                                     presetDict=presetDict,
                                     progress=False,
                                     timeout=20)

            try:
                dialog.update(50,
                              control.lang(30726).encode('utf-8'),
                              control.lang(30731).encode('utf-8'))
            except:
                pass

            u = sources().sourcesDirect(u, progress=False)

            if not u == None:
                try:
                    dialog.close()
                except:
                    pass
                return u
        except:
            pass

        try:
            from resources.lib.sources import sources

            u = sources().getURISource(url)

            if not u == False: direct = False
            if u == None or u == False or u == []: raise Exception()

            try:
                dialog.update(50,
                              control.lang(30726).encode('utf-8'),
                              control.lang(30731).encode('utf-8'))
            except:
                pass

            u = sources().sourcesDirect(u, progress=False)

            if not u == None:
                try:
                    dialog.close()
                except:
                    pass
                return u
        except:
            pass

        try:
            if not '.google.com' in url: raise Exception()
            from resources.lib.modules import directstream
            u = directstream.google(url)[0]['url']
            try:
                dialog.close()
            except:
                pass
            return u
        except:
            pass

        try:
            import urlresolver

            try:
                hmf = urlresolver.HostedMediaFile(url=url,
                                                  include_disabled=True,
                                                  include_universal=False)
            except:
                hmf = urlresolver.HostedMediaFile(url=url)

            if hmf.valid_url() == False: raise Exception()

            direct = False
            u = hmf.resolve()
            if 'plugin://plugin.video.youtube' in u: raise Exception()

            if not u == False:
                try:
                    dialog.close()
                except:
                    pass
                return u
        except:
            pass

        try:
            try:
                headers = dict(urlparse.parse_qsl(url.rsplit('|', 1)[1]))
            except:
                headers = dict('')
            if not url.startswith('http'): raise Exception()
            result = client.request(url.split('|')[0],
                                    headers=headers,
                                    output='headers',
                                    timeout='20')
            if 'Content-Type' in result and not 'html' in result[
                    'Content-Type']:
                raise Exception()

            import liveresolver
            if liveresolver.isValid(url) == True: direct = False
            u = liveresolver.resolve(url)

            if not u == None:
                try:
                    dialog.close()
                except:
                    pass
                return u
        except:
            pass

        if direct == True: return url

        try:
            dialog.close()
        except:
            pass
示例#33
0
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)
示例#34
0
    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)'''
示例#35
0
    def update(self, query=None, info="true"):
        if not query == None:
            control.idle()

        try:

            items = []
            season, episode = [], []
            show = [os.path.join(self.library_folder, i) for i in control.listDir(self.library_folder)[0]]
            for s in show:
                try:
                    season += [os.path.join(s, i) for i in control.listDir(s)[0]]
                except:
                    pass
            for s in season:
                try:
                    episode.append([os.path.join(s, i) for i in control.listDir(s)[1] if i.endswith(".strm")][-1])
                except:
                    pass

            for file in episode:
                try:
                    file = control.openFile(file)
                    read = file.read()
                    read = read.encode("utf-8")
                    file.close()

                    if not read.startswith(sys.argv[0]):
                        raise Exception()

                    params = dict(urlparse.parse_qsl(read.replace("?", "")))

                    try:
                        tvshowtitle = params["tvshowtitle"]
                    except:
                        tvshowtitle = None
                    try:
                        tvshowtitle = params["show"]
                    except:
                        pass
                    if tvshowtitle == None or tvshowtitle == "":
                        raise Exception()

                    year, imdb, tvdb = params["year"], params["imdb"], params["tvdb"]

                    imdb = "tt" + re.sub("[^0-9]", "", str(imdb))

                    try:
                        tmdb = params["tmdb"]
                    except:
                        tmdb = "0"

                    try:
                        tvrage = params["tvrage"]
                    except:
                        tvrage = "0"

                    items.append(
                        {
                            "tvshowtitle": tvshowtitle,
                            "year": year,
                            "imdb": imdb,
                            "tmdb": tmdb,
                            "tvdb": tvdb,
                            "tvrage": tvrage,
                        }
                    )
                except:
                    pass

            items = [i for x, i in enumerate(items) if i not in items[x + 1 :]]
            if len(items) == 0:
                raise Exception()
        except:
            return

        try:
            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"]
        except:
            return

        if (
            info == "true"
            and not control.condVisibility("Window.IsVisible(infodialog)")
            and not control.condVisibility("Player.HasVideo")
        ):
            control.infoDialog(control.lang(30422).encode("utf-8"), time=10000000)
            self.infoDialog = True

        try:
            control.makeFile(control.dataPath)
            dbcon = database.connect(control.libcacheFile)
            dbcur = dbcon.cursor()
            dbcur.execute("CREATE TABLE IF NOT EXISTS tvshows (" "id TEXT, " "items TEXT, " "UNIQUE(id)" ");")
        except:
            return
        try:
            from resources.lib.indexers import episodes
        except:
            return

        for item in items:
            it = None

            if xbmc.abortRequested == True:
                return sys.exit()

            try:
                dbcur.execute("SELECT * FROM tvshows WHERE id = '%s'" % item["tvdb"])
                fetch = dbcur.fetchone()
                it = eval(fetch[1].encode("utf-8"))
            except:
                pass

            try:
                if not it == None:
                    raise Exception()

                it = episodes.episodes().get(
                    item["tvshowtitle"],
                    item["year"],
                    item["imdb"],
                    item["tmdb"],
                    item["tvdb"],
                    item["tvrage"],
                    idx=False,
                )

                status = it[0]["status"].lower()

                it = [
                    {
                        "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 it
                ]

                if status == "continuing":
                    raise Exception()
                dbcur.execute("INSERT INTO tvshows Values (?, ?)", (item["tvdb"], repr(it)))
                dbcon.commit()
            except:
                pass

            try:
                id = [item["imdb"], item["tvdb"]]
                if not item["tmdb"] == "0":
                    id += [item["tmdb"]]

                ep = [
                    x["title"].encode("utf-8")
                    for x in lib
                    if str(x["imdbnumber"]) in id
                    or (x["title"].encode("utf-8") == item["tvshowtitle"] and str(x["year"]) == item["year"])
                ][0]
                ep = control.jsonrpc(
                    '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"filter":{"and": [{"field": "tvshow", "operator": "is", "value": "%s"}]}, "properties": ["season", "episode"]}, "id": 1}'
                    % ep
                )
                ep = unicode(ep, "utf-8", errors="ignore")
                ep = json.loads(ep)["result"]["episodes"][-1]

                num = [
                    x
                    for x, y in enumerate(it)
                    if str(y["season"]) == str(ep["season"]) and str(y["episode"]) == str(ep["episode"])
                ][-1]
                it = [y for x, y in enumerate(it) if x > num]
                if len(it) == 0:
                    continue
            except:
                continue

            for i in it:
                try:
                    if xbmc.abortRequested == True:
                        return sys.exit()

                    if int(self.date) <= int(re.sub("[^0-9]", "", str(i["date"]))):
                        from resources.lib.sources import sources

                        src = sources().checkSources(
                            i["name"],
                            i["title"],
                            i["year"],
                            i["imdb"],
                            i["tmdb"],
                            i["tvdb"],
                            i["tvrage"],
                            i["season"],
                            i["episode"],
                            i["tvshowtitle"],
                            i["alter"],
                            i["date"],
                        )
                        control.log("### SOURCES SRC 10 %s | %s" % (src, i["name"]))
                        if src == False:
                            raise Exception()

                    libtvshows().strmFile(i)
                except:
                    pass

        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)")
示例#36
0
    def update(self, query, info='true'):
        if query == 'tool':
            return xbmc.executebuiltin('RunPlugin(%s?action=updateLibrary)' % sys.argv[0])

        try:
            items = []
            season, episode = [], []
            show = [os.path.join(self.library_folder, i) for i in control.listDir(self.library_folder)[0]]
            for s in show:
                try: season += [os.path.join(s, i) for i in control.listDir(s)[0]]
                except: pass
            for s in season:
                try: episode.append([os.path.join(s, i) for i in control.listDir(s)[1] if i.endswith('.strm')][-1])
                except: pass

            for file in episode:
                try:
                    file = control.openFile(file)
                    read = file.read()
                    read = read.encode('utf-8')
                    file.close()

                    if not read.startswith(sys.argv[0]): raise Exception()

                    params = dict(urlparse.parse_qsl(read.replace('?','')))

                    try: tvshowtitle = params['tvshowtitle']
                    except: tvshowtitle = None
                    try: tvshowtitle = params['show']
                    except: pass
                    if tvshowtitle == None or tvshowtitle == '': raise Exception()

                    year, imdb, tvdb = params['year'], params['imdb'], params['tvdb']

                    imdb = 'tt' + re.sub('[^0-9]', '', str(imdb))

                    try: tmdb = params['tmdb']
                    except: tmdb = '0'

                    try: tvrage = params['tvrage']
                    except: tvrage = '0'

                    items.append({'tvshowtitle': tvshowtitle, 'year': year, 'imdb': imdb, 'tmdb': tmdb, 'tvdb': tvdb, 'tvrage': tvrage})
                except:
                    pass

            items = [i for x, i in enumerate(items) if i not in items[x + 1:]]
            if len(items) == 0: raise Exception()
        except:
            return

        try:
            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']
        except:
            return

        if info == 'true' and not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'):
            control.infoDialog(control.lang(30422).encode('utf-8'), time=10000000)
            self.infoDialog = True

        try:
            control.makeFile(control.dataPath)
            dbcon = database.connect(control.libcacheFile)
            dbcur = dbcon.cursor()
            dbcur.execute("CREATE TABLE IF NOT EXISTS tvshows (""id TEXT, ""items TEXT, ""UNIQUE(id)"");")
        except:
            return
        try:
            from resources.lib.indexers import episodes
        except:
            return

        for item in items:
            it = None

            if xbmc.abortRequested == True: return sys.exit()

            try:
                dbcur.execute("SELECT * FROM tvshows WHERE id = '%s'" % item['tvdb'])
                fetch = dbcur.fetchone()
                it = eval(fetch[1].encode('utf-8'))
            except:
                pass

            try:
                if not it == None: raise Exception()

                it = episodes.episodes().get(item['tvshowtitle'], item['year'], item['imdb'], item['tmdb'], item['tvdb'], item['tvrage'], idx=False)

                status = it[0]['status'].lower()

                it = [{'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 it]

                if status == 'continuing': raise Exception()
                dbcur.execute("INSERT INTO tvshows Values (?, ?)", (item['tvdb'], repr(it)))
                dbcon.commit()
            except:
                pass

            try:
                id = [item['imdb'], item['tvdb']]
                if not item['tmdb'] == '0': id += [item['tmdb']]

                ep = [x['title'].encode('utf-8') for x in lib if str(x['imdbnumber']) in id or (x['title'].encode('utf-8') == item['tvshowtitle'] and str(x['year']) == item['year'])][0]
                ep = control.jsonrpc('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"filter":{"and": [{"field": "tvshow", "operator": "is", "value": "%s"}]}, "properties": ["season", "episode"]}, "id": 1}' % ep)
                ep = unicode(ep, 'utf-8', errors='ignore')
                ep = json.loads(ep)['result']['episodes'][-1]

                num = [x for x,y in enumerate(it) if str(y['season']) == str(ep['season']) and str(y['episode']) == str(ep['episode'])][-1]
                it = [y for x,y in enumerate(it) if x > num]
                if len(it) == 0: continue
            except:
                continue

            for i in it:
                try:
                    if xbmc.abortRequested == True: return sys.exit()

                    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) > 2: raise Exception()

                    libtvshows().strmFile(i)
                except:
                    pass

        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)')
示例#37
0
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
示例#38
0
    def process(self, url, direct=True):
        try:
            if not any(i in url for i in ['.jpg', '.png', '.gif']):
                raise Exception()
            ext = url.split('?')[0].split('&')[0].split('|')[0].rsplit(
                '.')[-1].replace('/', '').lower()
            if not ext in ['jpg', 'png', 'gif']: raise Exception()
            try:
                i = os.path.join(control.dataPath, 'img')
                control.deleteFile(i)
                f = control.openFile(i, 'w')
                f.write(client.request(url))
                f.close()
                control.execute('ShowPicture("%s")' % i)
                return False
            except:
                return
        except:
            pass

        try:
            r, x = re.findall('(.+?)\|regex=(.+?)$', url)[0]
            x = regex.fetch(x)
            r += urllib.unquote_plus(x)
            if not '</regex>' in r: raise Exception()
            u = regex.resolve(r)
            if not u == None: url = u
        except:
            pass

        try:
            if not url.startswith('rtmp'): raise Exception()
            if len(re.compile('\s*timeout=(\d*)').findall(url)) == 0:
                url += ' timeout=10'
            return url
        except:
            pass

        try:
            if not any(i in url for i in ['.m3u8', '.f4m', '.ts']):
                raise Exception()
            ext = url.split('?')[0].split('&')[0].split('|')[0].rsplit(
                '.')[-1].replace('/', '').lower()
            if not ext in ['m3u8', 'f4m', 'ts']: raise Exception()
            return url
        except:
            pass

        try:
            preset = re.findall('<preset>(.+?)</preset>', url)[0]

            if not 'search' in preset: raise Exception()

            title, year, imdb = re.findall(
                '<title>(.+?)</title>', url)[0], re.findall(
                    '<year>(.+?)</year>',
                    url)[0], re.findall('<imdb>(.+?)</imdb>', url)[0]

            try:
                tvdb, tvshowtitle, premiered, season, episode = re.findall(
                    '<tvdb>(.+?)</tvdb>', url)[0], re.findall(
                        '<tvshowtitle>(.+?)</tvshowtitle>',
                        url)[0], re.findall('<premiered>(.+?)</premiered>',
                                            url)[0], re.findall(
                                                '<season>(.+?)</season>',
                                                url)[0], re.findall(
                                                    '<episode>(.+?)</episode>',
                                                    url)[0]
            except:
                tvdb = tvshowtitle = premiered = season = episode = None

            direct = False

            quality = 'HD' if not preset == 'searchsd' else 'SD'

            from resources.lib.sources import sources

            u = sources().getSources(title, year, imdb, tvdb, season, episode,
                                     tvshowtitle, premiered, quality)

            if not u == None: return u
        except:
            pass

        try:
            from resources.lib.sources import sources

            u = sources().getURISource(url)

            if not u == False: direct = False
            if u == None or u == False: raise Exception()

            return u
        except:
            pass

        try:
            if not '.google.com' in url: raise Exception()
            from resources.lib.modules import directstream
            u = directstream.google(url)[0]['url']
            return u
        except:
            pass

        try:
            if not 'filmon.com/' in url: raise Exception()
            from resources.lib.modules import filmon
            u = filmon.resolve(url)
            return u
        except:
            pass

        try:
            import urlresolver

            hmf = urlresolver.HostedMediaFile(url=url)

            if hmf.valid_url() == False: raise Exception()

            direct = False
            u = hmf.resolve()

            if not u == False: return u
        except:
            pass

        try:
            try:
                headers = dict(urlparse.parse_qsl(url.rsplit('|', 1)[1]))
            except:
                headers = dict('')
            if not url.startswith('http'): raise Exception()
            result = client.request(url.split('|')[0],
                                    headers=headers,
                                    output='headers',
                                    timeout='20')
            if 'Content-Type' in result and not 'html' in result[
                    'Content-Type']:
                raise Exception()

            import liveresolver

            if liveresolver.isValid(url) == False: raise Exception()

            direct = False
            u = liveresolver.resolve(url)

            if not u == None: return u
        except:
            pass

        if direct == True: return url
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 = ['[B]%s[/B] | %s' % (i['source'].upper(), 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
        host = (urlparse.urlparse(url).netloc).rsplit('.', 1)[0].rsplit('.')[-1]
        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 = ['[B]%s[/B] | %s' % (host.upper(), 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(control.lang(30705).encode('utf-8'))
        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)
示例#40
0
    def process(self, url, direct=True):
        try:
            if not any(i in url for i in ['.jpg', '.png', '.gif']): raise Exception()
            ext = url.split('?')[0].split('&')[0].split('|')[0].rsplit('.')[-1].replace('/', '').lower()
            if not ext in ['jpg', 'png', 'gif']: raise Exception()
            try:
                dialog = None
                dialog = control.progressDialog
                dialog.create(control.addonInfo('name'), control.lang(30732).encode('utf-8'))
                dialog.update(0)
                i = os.path.join(control.dataPath,'img')
                control.deleteFile(i)
                f = control.openFile(i, 'w')
                f.write(client.request(url))
                f.close()
                dialog.close()
                control.execute('ShowPicture("%s")' % i)
                return True
            except:
                return
        except:
            pass

        try:
            dialog = None
            dialog = control.progressDialog
            dialog.create(control.addonInfo('name'), control.lang(30726).encode('utf-8'))
            dialog.update(0)
        except:
            pass

        try:
            if not '</regex>' in url: raise Exception()
            from resources.lib.modules import regex
            u = regex.resolve(url)
            if not u == None: url = u
        except:
            pass

        try:
            if not url.startswith('rtmp'): raise Exception()
            if len(re.compile('\s*timeout=(\d*)').findall(url)) == 0: url += ' timeout=10'
            try: dialog.close()
            except: pass
            return url
        except:
            pass

        try:
            if not any(i in url for i in ['.m3u8', '.f4m', '.ts']): raise Exception()
            ext = url.split('?')[0].split('&')[0].split('|')[0].rsplit('.')[-1].replace('/', '').lower()
            if not ext in ['m3u8', 'f4m', 'ts']: raise Exception()
            try: dialog.close()
            except: pass
            return url
        except:
            pass

        try:
            preset = re.findall('<preset>(.+?)</preset>', url)[0]

            title, year, imdb = re.findall('<title>(.+?)</title>', url)[0], re.findall('<year>(.+?)</year>', url)[0], re.findall('<imdb>(.+?)</imdb>', url)[0]

            try: tvdb, tvshowtitle, premiered, season, episode = re.findall('<tvdb>(.+?)</tvdb>', url)[0], re.findall('<tvshowtitle>(.+?)</tvshowtitle>', url)[0], re.findall('<premiered>(.+?)</premiered>', url)[0], re.findall('<season>(.+?)</season>', url)[0], re.findall('<episode>(.+?)</episode>', url)[0]
            except: tvdb = tvshowtitle = premiered = season = episode = None

            direct = False

            presetDict = ['primewire_mv_tv', 'watchfree_mv_tv', 'movie25_mv', 'watchseries_tv', 'afdah_mv', 'dtmovies_mv', 'dizibox_tv', 'dizigold_tv', 'miradetodo_mv', 'onemovies_mv_tv', 'onlinedizi_tv', 'pelispedia_mv_tv', 'pubfilm_mv_tv', 'putlocker_mv_tv', 'rainierland_mv', 'sezonlukdizi_tv', 'tunemovie_mv', 'xmovies_mv']

            if preset == 'searchsd': presetDict = ['primewire_mv_tv', 'watchfree_mv_tv', 'movie25_mv', 'watchseries_tv']

            from resources.lib.sources import sources

            try: dialog.update(0, control.lang(30726).encode('utf-8'), control.lang(30731).encode('utf-8'))
            except: pass

            u = sources().getSources(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, presetDict=presetDict, progress=False, timeout=20)

            try: dialog.update(50, control.lang(30726).encode('utf-8'), control.lang(30731).encode('utf-8'))
            except: pass

            u = sources().sourcesDirect(u, progress=False)

            if not u == None:
                try: dialog.close()
                except: pass
                return u
        except:
            pass

        try:
            from resources.lib.sources import sources

            u = sources().getURISource(url)

            if not u == False: direct = False
            if u == None or u == False or u == []: raise Exception()

            try: dialog.update(50, control.lang(30726).encode('utf-8'), control.lang(30731).encode('utf-8'))
            except: pass

            u = sources().sourcesDirect(u, progress=False)

            if not u == None:
                try: dialog.close()
                except: pass
                return u
        except:
            pass

        try:
            if not '.google.com' in url: raise Exception()
            from resources.lib.modules import directstream
            u = directstream.google(url)[0]['url']
            try: dialog.close()
            except: pass
            return u
        except:
            pass

        try:
            import urlresolver

            hmf = urlresolver.HostedMediaFile(url=url, include_disabled=True, include_universal=False)

            if hmf.valid_url() == False: raise Exception()

            direct = False ; u = hmf.resolve()
            if 'plugin://plugin.video.youtube' in u: raise Exception()

            if not u == False:
                try: dialog.close()
                except: pass
                return u
        except:
            pass


        try:
            try: headers = dict(urlparse.parse_qsl(url.rsplit('|', 1)[1]))
            except: headers = dict('')
            if not url.startswith('http'): raise Exception()
            result = client.request(url.split('|')[0], headers=headers, output='headers', timeout='20')
            if 'Content-Type' in result and not 'html' in result['Content-Type']: raise Exception()

            import liveresolver
            if liveresolver.isValid(url) == True: direct = False
            u = liveresolver.resolve(url)

            if not u == None:
                try: dialog.close()
                except: pass
                return u
        except:
            pass


        if direct == True: return url

        try: dialog.close()
        except: pass
示例#41
0
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
示例#42
0
    def update(self, query=None, info='true'):
        if not query == None: control.idle()

        try:

            items = []
            season, episode = [], []
            show = [
                os.path.join(self.library_folder, i)
                for i in control.listDir(self.library_folder)[0]
            ]
            for s in show:
                try:
                    season += [
                        os.path.join(s, i) for i in control.listDir(s)[0]
                    ]
                except:
                    pass
            for s in season:
                try:
                    episode.append([
                        os.path.join(s, i) for i in control.listDir(s)[1]
                        if i.endswith('.strm')
                    ][-1])
                except:
                    pass

            for file in episode:
                try:
                    file = control.openFile(file)
                    read = file.read()
                    read = read.encode('utf-8')
                    file.close()

                    if not read.startswith(sys.argv[0]): raise Exception()

                    params = dict(urlparse.parse_qsl(read.replace('?', '')))

                    try:
                        tvshowtitle = params['tvshowtitle']
                    except:
                        tvshowtitle = None
                    try:
                        tvshowtitle = params['show']
                    except:
                        pass
                    if tvshowtitle == None or tvshowtitle == '':
                        raise Exception()

                    year, imdb, tvdb = params['year'], params['imdb'], params[
                        'tvdb']

                    imdb = 'tt' + re.sub('[^0-9]', '', str(imdb))

                    try:
                        tmdb = params['tmdb']
                    except:
                        tmdb = '0'

                    try:
                        tvrage = params['tvrage']
                    except:
                        tvrage = '0'

                    items.append({
                        'tvshowtitle': tvshowtitle,
                        'year': year,
                        'imdb': imdb,
                        'tmdb': tmdb,
                        'tvdb': tvdb,
                        'tvrage': tvrage
                    })
                except:
                    pass

            items = [i for x, i in enumerate(items) if i not in items[x + 1:]]
            if len(items) == 0: raise Exception()
        except:
            return

        try:
            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']
        except:
            return

        if info == 'true' and not control.condVisibility(
                'Window.IsVisible(infodialog)') and not control.condVisibility(
                    'Player.HasVideo'):
            control.infoDialog(control.lang(30422).encode('utf-8'),
                               time=10000000)
            self.infoDialog = True

        try:
            control.makeFile(control.dataPath)
            dbcon = database.connect(control.libcacheFile)
            dbcur = dbcon.cursor()
            dbcur.execute("CREATE TABLE IF NOT EXISTS tvshows ("
                          "id TEXT, "
                          "items TEXT, "
                          "UNIQUE(id)"
                          ");")
        except:
            return
        try:
            from resources.lib.indexers import episodes
        except:
            return

        for item in items:
            it = None

            if xbmc.abortRequested == True: return sys.exit()

            try:
                dbcur.execute("SELECT * FROM tvshows WHERE id = '%s'" %
                              item['tvdb'])
                fetch = dbcur.fetchone()
                it = eval(fetch[1].encode('utf-8'))
            except:
                pass

            try:
                if not it == None: raise Exception()

                it = episodes.episodes().get(item['tvshowtitle'],
                                             item['year'],
                                             item['imdb'],
                                             item['tmdb'],
                                             item['tvdb'],
                                             item['tvrage'],
                                             idx=False)

                status = it[0]['status'].lower()

                it = [{
                    '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 it]

                if status == 'continuing': raise Exception()
                dbcur.execute("INSERT INTO tvshows Values (?, ?)",
                              (item['tvdb'], repr(it)))
                dbcon.commit()
            except:
                pass

            try:
                id = [item['imdb'], item['tvdb']]
                if not item['tmdb'] == '0': id += [item['tmdb']]

                ep = [
                    x['title'].encode('utf-8') for x in lib
                    if str(x['imdbnumber']) in id or (
                        x['title'].encode('utf-8') == item['tvshowtitle']
                        and str(x['year']) == item['year'])
                ][0]
                ep = control.jsonrpc(
                    '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"filter":{"and": [{"field": "tvshow", "operator": "is", "value": "%s"}]}, "properties": ["season", "episode"]}, "id": 1}'
                    % ep)
                ep = unicode(ep, 'utf-8', errors='ignore')
                ep = json.loads(ep)['result']['episodes'][-1]

                num = [
                    x for x, y in enumerate(it)
                    if str(y['season']) == str(ep['season'])
                    and str(y['episode']) == str(ep['episode'])
                ][-1]
                it = [y for x, y in enumerate(it) if x > num]
                if len(it) == 0: continue
            except:
                continue

            for i in it:
                try:
                    if xbmc.abortRequested == True: return sys.exit()

                    if int(self.date) <= int(
                            re.sub('[^0-9]', '', str(i['date']))):
                        from resources.lib.sources import sources
                        src = sources().checkSources(
                            i['name'], i['title'], i['year'], i['imdb'],
                            i['tmdb'], i['tvdb'], i['tvrage'], i['season'],
                            i['episode'], i['tvshowtitle'], i['alter'],
                            i['date'])
                        control.log('### SOURCES SRC 10 %s | %s' %
                                    (src, i['name']))
                        if src == False: raise Exception()

                    libtvshows().strmFile(i)
                except:
                    pass

        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)')
示例#43
0
    from resources.lib.modules import trakt
    trakt.manager(name, imdb, tvdb, content)

elif action == 'authTrakt':
    from resources.lib.modules import trakt
    trakt.authTrakt()

elif action == 'rdAuthorize':
    from resources.lib.modules import debrid
    debrid.rdAuthorize()

elif action == 'download':
    import json
    from resources.lib.sources import sources
    from resources.lib.modules 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(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, url)

elif action == 'sources':
    from resources.lib.sources import sources
    sources().addItem(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta)

elif action == 'playItem':
    from resources.lib.sources import sources
    sources().playItem(source)

elif action == 'alterSources':
示例#44
0
	def verifyProviders(self):
		type = 'providers'
		try:
			from resources.lib.sources import sources

			progressDialog = interface.Dialog.progress(33019, title = 33019)
			progressDialog.update(0, self.__info(type, False))

			try: timeout = tools.Settings.getInteger('providers.timeout')
			except: timeout = 30

			# Add imdb for providers like YIFY who dependt on that.
			itemsMovies = [
				{'title' : 'Titanic', 'year' : '1997', 'imdb' : 'tt0120338'},
				{'title' : 'Avatar', 'year' : '2009', 'imdb' : 'tt0499549'},
				{'title' : 'Star Wars', 'year' : '1977', 'imdb' : 'tt0076759'},
				{'title' : 'Harry Potter', 'year' : '2001', 'imdb' : 'tt0241527'},
			]
			itemsShows = [
				{'tvshowtitle' : 'The Big Bang Theory', 'season' : '10', 'episode' : '1', 'imdb' : 'tt0898266'},
				{'tvshowtitle' : 'Game of Thrones', 'season' : '6', 'episode' : '10', 'imdb' : 'tt0944947'},
				{'tvshowtitle' : 'Rick and Morty', 'season' : '2', 'episode' : '10', 'imdb' : 'tt2861424'},
				{'tvshowtitle' : 'The Sopranos', 'season' : '6', 'episode' : '1', 'imdb' : 'tt0141842'}
			]

			sourcesObject = sources()
			sourcesObject.getConstants()
			hostDict = sourcesObject.hostDict
			hostprDict = sourcesObject.hostprDict

			providers = providerx.Provider.providers(enabled = False, local = False)
			threads = []

			for provider in providers:
				items = []
				if provider['group'] == providerx.Provider.GroupMovies:
					items = itemsMovies
				elif provider['group'] == providerx.Provider.GroupTvshows:
					items = itemsShows
				else:
					items = itemsMovies[:int(len(itemsMovies)/2)] + itemsShows[:int(len(itemsShows)/2)]
				threads.append(workers.Thread(self.__verifyProvider, provider, items, hostDict, hostprDict))

			canceled = False
			[i.start() for i in threads]
			for i in range(0, timeout * max(len(itemsMovies), len(itemsShows)) * 2):
				try:
					if xbmc.abortRequested == True: return sys.exit()
					if progressDialog.iscanceled():
						canceled = True
						break
					progressDialog.update(int((len([i for i in threads if i.is_alive() == False]) / float(len(threads))) * 100), self.__info(type, False))
					if all(i == False for i in [j.is_alive() for j in threads]): break
					time.sleep(0.5)
				except:
					pass

			# Providers still running.
			for i in range(len(threads)):
				if threads[i].is_alive():
					self.__append(providers[i]['name'], self.StatusFailure)

			try: progressDialog.close()
			except: pass

			if not canceled:
				self.__showResults(type)
		except:
			tools.Logger.error()
			self.__showError(type)
示例#45
0
文件: default.py 项目: vinhcomp/xml
    from resources.lib.modules import trakt
    trakt.manager(name, imdb, tvdb, content)

elif action == 'authTrakt':
    from resources.lib.modules import trakt
    trakt.authTrakt()

elif action == 'rdAuthorize':
    from resources.lib.modules import debrid
    debrid.rdAuthorize()

elif action == 'download':
    import json
    from resources.lib.sources import sources
    from resources.lib.modules 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(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, url)

elif action == 'sources':
    from resources.lib.sources import sources
    sources().addItem(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta)

elif action == 'playItem':
    from resources.lib.sources import sources
    sources().playItem(source)

elif action == 'alterSources':
示例#46
0
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)
示例#47
0
if action == None:

    # from resources.lib.modules import changelog
    # changelog.get()

    from resources.lib.indexers import navigator
    navigator.navigator().root()

elif action == 'browse_nav':
    from resources.lib.indexers import navigator
    navigator.navigator().browse_nav()

elif action == 'play':
    from resources.lib.sources import sources
    sources().play(title, year, imdb, tvdb, season, episode, tvshowtitle,
                   premiered, meta)

elif action == 'directPlay':
    from resources.lib.sources import sources
    sources().directPlay(url, title, year, imdb, tvdb, season, episode,
                         tvshowtitle, premiered, meta, id)

elif action == 'authRealdebrid':
    from resources.lib.modules import control
    from resources.lib.api import debrid
    token = debrid.realdebrid().auth()

elif action == 'testItem':
    from resources.lib.api import fanarttv
    imdb = '121361'
    query = 'tv'
示例#48
0
name        = params.get('name')
premiered   = params.get('premiered')
query       = params.get('query')
season      = params.get('season')
select      = params.get('select')
source      = params.get('source')
title       = params.get('title')
tmdb        = params.get('tmdb')
tvdb        = params.get('tvdb')
tvshowtitle = params.get('tvshowtitle')
url         = params.get('url')
year        = params.get('year')

if   action == None                    : navigator.navigator().root()
elif action == 'addFavourite'          : favourites.addFavourite(meta, content)
elif action == 'addItem'               : sources().addItem(title)
elif action == 'addView'               : views.addView(content)
elif action == 'alterSources'          : sources().alterSources(url, meta)
elif action == 'artwork'               : control.artwork()
elif action == 'authTrakt'             : trakt.authTrakt()
elif action == 'backupwatchlist'       :
        fn                    = os.path.join(datapath, 'favourites.db')
        if os.path.exists(fn):
                backupdir         = control.setting('remote_path')
                if not backupdir == '':
                        to_backup     = xbmc.translatePath(os.path.join('special://', 'profile/addon_data/'))
                        rootlen       = len(datapath)
                        backup_ui_zip = xbmc.translatePath(os.path.join(backupdir, 'uranus_watchlist.zip'))
                        zipobj        = zipfile.ZipFile(backup_ui_zip , 'w', zipfile.ZIP_DEFLATED)
                        zipobj.write(fn, fn[rootlen:])
                        dialog.ok('Backup Watchlist', 'Backup complete', '', '')
示例#49
0
文件: downloader.py 项目: mpie/repo
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)
示例#50
0
source = params.get('source')

content = params.get('content')

if action == None:
    from resources.lib.indexers import navigator
    navigator.navigator().root()

elif action == 'play':
    from resources.lib.sources import sources
    sources().play(title,
                   year,
                   imdb,
                   tvdb,
                   season,
                   episode,
                   tvshowtitle,
                   premiered,
                   meta,
                   select=select)

elif action == 'directPlay':
    from resources.lib.sources import sources
    sources().directPlay(url,
                         title,
                         year,
                         imdb,
                         tvdb,
                         season,
                         episode,
                         tvshowtitle,
示例#51
0
elif action == 'authTrakt':
    from resources.lib.modules import trakt
    trakt.authTrakt()

elif action == 'rdAuthorize':
    from resources.lib.modules import debrid
    debrid.rdAuthorize()

elif action == 'download':
    import json
    from resources.lib.sources import sources
    from resources.lib.modules import downloader
    try:
        downloader.download(
            name, image,
            sources().sourcesResolve(json.loads(source)[0], True))
    except:
        pass

elif action == 'play':
    from resources.lib.sources import sources
    sources().play(title, year, imdb, tvdb, season, episode, tvshowtitle,
                   premiered, meta, select)

elif action == 'addItem':
    from resources.lib.sources import sources
    sources().addItem(title)

elif action == 'playItem':
    from resources.lib.sources import sources
    sources().playItem(title, source)
示例#52
0
        pass
    resolveurl.display_settings()

elif action == 'download':
    import json
    from resources.lib.modules import sources
    from resources.lib.modules import downloader
    try:
        downloader.download(
            name, image,
            sources.sources().sourcesResolve(json.loads(source)[0], True))
    except:
        pass

elif action == 'play':
    sources().play(title, year, imdb, tvdb, season, episode, tvshowtitle,
                   premiered, meta, select)

elif action == 'addItem':
    sources().addItem(title)

elif action == 'playItem':
    sources().playItem(title, source)

elif action == 'alterSources':
    sources().alterSources(url, meta)

elif action == 'clearSources':
    sources().clearSources()

elif action == 'random':
    rtype = params.get('rtype')