def upgradeDB(): # Load DB # DB upgrades per version if control.setting('lastVersion') == '1.0.0-beta' and control.addonInfo( 'version') == '1.0.0': episodeDB = episodes.Episode(control.episodesFile) showDB = shows.Show(control.showsFile) libraryDB = library.Library(control.libraryFile) control.showNotification('Upgrading databases...', control.lang(50002)) logger.logDebug( episodeDB.upgrade([ 'ALTER TABLE `EPISODE` ADD COLUMN `TYPE` TEXT', 'UPDATE `EPISODE` SET TYPE = \'episode\' WHERE TYPE IS NULL' ])) logger.logDebug( showDB.upgrade([ 'ALTER TABLE `SHOW` ADD COLUMN `TYPE` TEXT', 'UPDATE `SHOW` SET TYPE = \'show\' WHERE TYPE IS NULL' ])) elif control.setting('lastVersion') in ( '1.0.0', '1.0.1', '1.1.0') and control.addonInfo('version') == '1.2.0': # Check if installation is complete logger.logNotice('Checking installation') tools.checkInstallDB(True)
def addCategoryItem(name, action, image, isFolder=True): u = sys.argv[0]+"?action="+str(action) image = control.addonInfo('path') + '/art/' + image item = control.item(name, iconImage=image, thumbnailImage=image) item.addContextMenuItems([], replaceItems=False) item.setProperty('Fanart_Image', control.addonInfo('fanart')) control.addItem(handle=int(sys.argv[1]),url=u,listitem=item,isFolder=isFolder)
def addDirectoryItem(name, url, action, image, image2, fanart, content, data, tvshow='0', totalItems=0, isFolder=True): if not str(image).lower().startswith('http'): image = control.addonInfo('icon') if not str(image2).lower().startswith('http'): image2 = control.addonInfo('icon') if not str(fanart).lower().startswith('http'): fanart = control.addonInfo('fanart') if content in ['movies', 'episodes']: playable = 'true' else: playable = 'false' sysaddon = sys.argv[0] if url.startswith('$base64'): import base64 ; url = base64.b64decode(re.compile('\$base64\[(.+?)\]$').findall(url)[0]) u = '%s?name=%s&url=%s&tvdb=&imdb=&source=GVideo&provider=Mpie&content=%s&action=playItem' % (sysaddon, urllib.quote_plus(name), urllib.quote_plus(url), str(content)) cm = [] if content == 'movies': cm.append((control.lang(30708).encode('utf-8'), 'XBMC.Action(Info)')) elif content in ['tvshows', 'seasons']: cm.append((control.lang(30709).encode('utf-8'), 'XBMC.Action(Info)')) elif content == 'episodes': cm.append((control.lang(30710).encode('utf-8'), 'XBMC.Action(Info)')) if content == 'movies' and not isFolder == True: downloadFile = name try: downloadFile = '%s (%s)' % (data['title'], data['year']) except: pass cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(downloadFile), urllib.quote_plus(url), urllib.quote_plus(image)))) elif content == 'episodes' and not isFolder == True: downloadFile = name try: downloadFile = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) except: pass cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(downloadFile), urllib.quote_plus(url), urllib.quote_plus(image)))) if content == 'movies': cm.append((control.lang(30711).encode('utf-8'), 'RunPlugin(%s?action=addView&content=movies)' % sysaddon)) elif content == 'tvshows': cm.append((control.lang(30712).encode('utf-8'), 'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon)) elif content == 'seasons': cm.append((control.lang(30713).encode('utf-8'), 'RunPlugin(%s?action=addView&content=seasons)' % sysaddon)) elif content == 'episodes': cm.append((control.lang(30714).encode('utf-8'), 'RunPlugin(%s?action=addView&content=episodes)' % sysaddon)) item = control.item(name, iconImage='DefaultFolder.png', thumbnailImage=image) try: item.setArt({'poster': image2, 'tvshow.poster': image2, 'season.poster': image2, 'banner': image, 'tvshow.banner': image, 'season.banner': image}) except: pass item.addContextMenuItems(cm, replaceItems=False) item.setProperty('Fanart_Image', fanart) if playable == 'true': item.setProperty('IsPlayable', 'true') item.setInfo(type='Video', infoLabels=data) control.addItem(handle=int(sys.argv[1]),url=u,listitem=item,totalItems=totalItems,isFolder=isFolder)
def addCategoryItem(name, action, image, isFolder=True): u = '%s?action=%s' % (sys.argv[0], str(action)) image = control.addonInfo('path') + '/resources/media/phstreams/' + image item = control.item(name, iconImage=image, thumbnailImage=image) item.addContextMenuItems([], replaceItems=False) item.setProperty('Fanart_Image', control.addonInfo('fanart')) control.addItem(handle=int(sys.argv[1]), url=u, listitem=item, isFolder=isFolder)
def sourcesDirect(self): self.sources = [i for i in self.sources if not i['source'] in self.hostcapDict] self.sources = [i for i in self.sources if not (i['quality'] in ['1080p', 'HD'] and i['source'] in self.hosthdDict and not i['source'] in self.rdDict + self.pzDict)] self.sources = [i for i in self.sources if not i['source'] in ['easynews', 'furk', 'vk']] if control.setting("playback_auto_sd") == 'true': self.sources = [i for i in self.sources if not i['quality'] in ['1080p', 'HD']] u = None self.progressDialog = control.progressDialog self.progressDialog.create(control.addonInfo('name'), '') self.progressDialog.update(0) for i in range(len(self.sources)): try: self.progressDialog.update(int((100 / float(len(self.sources))) * i), str(self.sources[i]['label']), str(' ')) if self.progressDialog.iscanceled(): return self.progressDialog.close() if xbmc.abortRequested == True: return sys.exit() url = self.sourcesResolve(self.sources[i]['url'], self.sources[i]['provider']) if url == None: raise Exception() if u == None: u = url self.selectedSource = self.sources[i]['label'] return url except: pass return u
def sourcesDialog(self): try: sources = [{'label': '00 | [B]%s[/B]' % control.lang(30509).encode('utf-8').upper()}] + self.sources labels = [i['label'] for i in sources] select = control.selectDialog(labels) if select == 0: return self.sourcesDirect() if select == -1: return 'close://' items = [self.sources[select-1]] next = [y for x,y in enumerate(self.sources) if x >= select] prev = [y for x,y in enumerate(self.sources) if x < select][::-1] source, quality = items[0]['source'], items[0]['quality'] items = [i for i in items+next+prev if i['quality'] == quality and i['source'] == source][:10] items += [i for i in next+prev if i['quality'] == quality and not i['source'] == source][:10] import xbmc dialog = control.progressDialog dialog.create(control.addonInfo('name'), '') dialog.update(0) block = None for i in range(len(items)): try: dialog.update(int((100 / float(len(items))) * i), str(items[i]['label'])) if items[i]['source'] == block: raise Exception() w = workers.Thread(self.sourcesResolve, items[i]['url'], items[i]['provider']) w.start() for x in range(0, 15 * 2): if dialog.iscanceled(): return dialog.close() if xbmc.abortRequested == True: return sys.exit() if w.is_alive() == False: break time.sleep(0.5) if w.is_alive() == True: block = items[i]['source'] if self.url == None: raise Exception() try: dialog.close() except: pass self.selectedSource = items[i]['label'] return self.url except: pass try: dialog.close() except: pass except: return
def sourcesDirect(self): u = None self.progressDialog = control.progressDialog self.progressDialog.create(control.addonInfo('name'), '') self.progressDialog.update(0) for i in range(len(self.sources)): try: if self.progressDialog.iscanceled(): break self.progressDialog.update( int((100 / float(len(self.sources))) * i), str(self.sources[i]['label']), str(' ')) if xbmc.abortRequested == True: return sys.exit() url = self.sourcesResolve(self.sources[i]['url'], self.sources[i]['provider']) if url == None: raise Exception() if u == None: u = url self.selectedSource = self.sources[i]['label'] self.progressDialog.close() return url except: pass try: self.progressDialog.close() except: pass return u
def img_parser(self, image, referer): try: if not image.startswith('http:'): image = 'http:' + image d = control.windowDialog result = client.request(image, referer=referer, close=False) for match in re.finditer("<img\s+src='([^']+)'\s+width='(\d+)'\s+height='(\d+)'", result): img_url, width, height = match.groups() img_url = client.replaceHTMLCodes(img_url) width = int(width) height = int(height) if width > 0 and height > 0: left = (1280 - width) / 2 f = control.image(left, 0, width, height, img_url) d.addControl(f) else: client.request(img_url, referer=image, close=False) d.show() control.dialog.ok(control.addonInfo('name'), str('Continue to Video'), '') match = re.search("href='([^']+)", result) if match and random.randint(0, 100) < 5: client.request(match.group(1)) try: d.removeControl(f) ; d.close() except: return except: try: d.removeControl(f) ; d.close() except: return
def root(self): self.addDirectoryItem('Movies', 'movieNavigator', 'root_movies.jpg', 'DefaultMovies.png') self.addDirectoryItem('Series', 'tvNavigator', 'root_shows.jpg', 'DefaultMovies.png') self.addDirectoryItem('Thai Live TV', 'thaiLiveTV', 'root_livetv.jpg', 'DefaultMovies.png') self.addDirectoryItem('Thai Shows', 'thaiShows', 'root_thai.jpg', 'DefaultMovies.png') self.addDirectoryItem('Thai Shows 2', 'thaiShows2', 'root_thai.jpg', 'DefaultMovies.png') self.addDirectoryItem('Live TV', 'liveTV', 'root_livetv.png', 'DefaultMovies.png') self.addDirectoryItem('Bollywood', 'bollywood', 'bollywood.jpg', 'DefaultMovies.png') self.addDirectoryItem('Cartoons', 'cartoons', 'cartoons.png', 'DefaultMovies.png') self.addDirectoryItem(30119, 'clearSources', 'experiment.jpg', 'DefaultAddonProgram.png') #self.addDirectoryItem('1080P Movies', '1080p', 'hd-logo.png', 'DefaultMovies.png') #self.addDirectoryItem('Experiment', 'thaiShows2', 'experiment.jpg', 'DefaultMovies.png') #self.addDirectoryItem('Working on DooFree 3.0 to make things faster', '', '', 'DefaultMovies.png') ''' if (traktMode == True and not control.setting('tv_alt_widget') == '0') or (traktMode == False and not control.setting('tv_widget') == '0'): self.addDirectoryItem(30006, 'tvWidget', 'calendarsAdded.jpg', 'DefaultRecentlyAddedEpisodes.png') ''' self.endDirectory() views.setView('movies', {'skin.confluence': 500}) from resources.lib.libraries import cache from resources.lib.libraries import changelog cache.get(changelog.get, 600000000, control.addonInfo('version'))
def wizja_userstatus(): s = webClient() r = s.get('http://wizja.tv/users/index.php').text #print ('result :#%s#' % r) if 'login_input_username' in r: control.log('NIEZALOGOWANY') return 'NIEZALOGOWANY' if 'Zalogowany jako' in r: control.log('ZALOGOWANY') # no premium if '<font color=ff0000>Brak premium' in r: control.log('WIZJA.TV FREE PREMIUM: %s' % '') control.infoDialog(control.lang(30490).encode('utf-8'), time=6000) control.dialog.ok( control.addonInfo('name') + ' - WIZJA TV', control.lang(30490).encode('utf-8'), '') return 'FREE' else: try: premium = re.findall('Premium aktywne do (\d{4}.*?)</font>', r)[0] control.set_setting('wizja.expire', premium) control.infoDialog('Premium Wizja.tv do: ' + premium.encode('utf-8'), time=2000) return 'PREMIUM%s' % premium except: pass return 'PREMIUM%s' return True
def root(self): self.addDirectoryItem(30001, 'movieNavigator', 'movies.jpg', 'DefaultMovies.png') self.addDirectoryItem(30002, 'tvNavigator', 'tvshows.jpg', 'DefaultTVShows.png') self.addDirectoryItem(30003, 'channels', 'channels.jpg', 'DefaultMovies.png') self.addDirectoryItem(30004, 'myNavigator', 'myspecto.jpg', 'DefaultVideoPlaylists.png') if not control.setting('movie_widget') == '0': self.addDirectoryItem(30005, 'movieWidget', 'moviesAdded.jpg', 'DefaultRecentlyAddedMovies.png') if (traktMode == True and not control.setting('tv_alt_widget') == '0') or (traktMode == False and not control.setting('tv_widget') == '0'): #self.addDirectoryItem(30006, 'tvWidget', 'calendarsAdded.jpg', 'DefaultRecentlyAddedEpisodes.png') self.addDirectoryItem(30006, 'calendar&url=added', 'calendarsAdded.jpg', 'DefaultRecentlyAddedEpisodes.png') if not control.setting('calendar_widget') == '0': self.addDirectoryItem(30007, 'calendars', 'calendar.jpg', 'DefaultRecentlyAddedEpisodes.png') self.addDirectoryItem(30008, 'toolNavigator', 'tools.jpg', 'DefaultAddonProgram.png') self.addDirectoryItem(30009, 'searchNavigator', 'search.jpg', 'DefaultFolder.png') self.endDirectory() if ntptime.checkDate(): control.log('Error date time setup') msg = control.lang(32020).encode('utf-8') msg1 ='Go to settings, set your correct date and time'.encode('utf-8') msg = 'You have to set your clock in your tv box.'.encode('utf-8') control.dialog.ok(control.addonInfo('name'),'',msg, msg1 ) from resources.lib.libraries import cache from resources.lib.libraries import changelog
def root(self): self.addDirectoryItem(30001, 'movieNavigator', 'movies.jpg', 'DefaultMovies.png') self.addDirectoryItem(30002, 'tvNavigator', 'tvshows.jpg', 'DefaultTVShows.png') self.addDirectoryItem(30003, 'channels', 'channels.jpg', 'DefaultMovies.png') self.addDirectoryItem(30004, 'myNavigator', 'myspecto.jpg', 'DefaultVideoPlaylists.png') if not control.setting('movie_widget') == '0': self.addDirectoryItem(30005, 'movieWidget', 'moviesAdded.jpg', 'DefaultRecentlyAddedMovies.png') if (traktMode == True and not control.setting('tv_alt_widget') == '0') or (traktMode == False and not control.setting('tv_widget') == '0'): #self.addDirectoryItem(30006, 'tvWidget', 'calendarsAdded.jpg', 'DefaultRecentlyAddedEpisodes.png') self.addDirectoryItem(30006, 'calendar&url=added', 'calendarsAdded.jpg', 'DefaultRecentlyAddedEpisodes.png') if not control.setting('calendar_widget') == '0': self.addDirectoryItem(30007, 'calendars', 'calendar.jpg', 'DefaultRecentlyAddedEpisodes.png') self.addDirectoryItem(30008, 'toolNavigator', 'tools.jpg', 'DefaultAddonProgram.png') self.addDirectoryItem(30009, 'searchNavigator', 'search.jpg', 'DefaultFolder.png') self.endDirectory() from resources.lib.libraries import cache from resources.lib.libraries import changelog cache.get(changelog.get, 600000000, control.addonInfo('version'), table='changelog')
def img_parser(self, image, referer): try: if not image.startswith('http:'): image = 'http:' + image result = client.request(image, referer=referer) image, width, height = re.compile("<img\s+src='([^']+)'\s+width='(\d+)'\s+height='(\d+)'").findall(result)[0] click = re.compile("href='([^']+)").findall(result)[0] image = client.replaceHTMLCodes(image) image = image.encode('utf-8') width, height = int(width), int(height) left = (1280 - width) / 2 if width <= 0 or height <= 0: raise Exception() f = control.image(left,0,width,height, image) d = control.windowDialog d.addControl(f) d.show() client.request(image, referer=referer) control.dialog.ok(control.addonInfo('name'), str('Continue to Video'), '') if random.randint(0, 100) < 5: client.request(click, referer=referer) try: d.removeControl(f) ; d.close() except: return except: try: d.removeControl(f) ; d.close() except: return
def sourcesDirect(self): u = None self.progressDialog = control.progressDialog self.progressDialog.create(control.addonInfo('name'), '') self.progressDialog.update(0) for i in range(len(self.sources)): try: if self.progressDialog.iscanceled(): break self.progressDialog.update(int((100 / float(len(self.sources))) * i), str(self.sources[i]['label']), str(' ')) if xbmc.abortRequested == True: return sys.exit() url = self.sourcesResolve(self.sources[i]['url'], self.sources[i]['provider']) if url == None: raise Exception() if u == None: u = url self.selectedSource = self.sources[i]['label'] self.progressDialog.close() return url except: pass try: self.progressDialog.close() except: pass return u
def tvshows(tvshowtitle, year, imdb, tvdb, season, watched): traktMode = False if trakt.getTraktCredentials() == False else True watched = int(watched) try: if traktMode == True: raise Exception() from metahandler import metahandlers from resources.lib.indexers import episodes metaget = metahandlers.MetaData(preparezip=False) dialog = control.progressDialog dialog.create(control.addonInfo('name'), str(tvshowtitle)) dialog.update(0, str(tvshowtitle), control.lang(30451).encode('utf-8') + '...') metaget.get_meta('tvshow', '', imdb_id=imdb) items = episodes.episodes().get(tvshowtitle, year, imdb, '0', tvdb, '0', idx=False) try: items = [i for i in items if int('%01d' % int(season)) == int('%01d' % int(i['season']))] except: pass items = [ {'name': i['name'], 'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode']))} for i in items] for i in range(len(items)): if xbmc.abortRequested == True: return sys.exit() if dialog.iscanceled(): return dialog.close() dialog.update(int((100 / float(len(items))) * i), str(tvshowtitle), str(items[i]['name'])) season, episode = items[i]['season'], items[i]['episode'] metaget.get_episode_meta('', imdb, season, episode) metaget.change_watched('episode', '', imdb, season=season, episode=episode, year='', watched=watched) try: dialog.close() except: pass except: try: dialog.close() except: pass try: if traktMode == False: raise Exception() if watched == 7: trakt.markTVShowAsWatched(tvdb) else: trakt.markTVShowAsNotWatched(tvdb) trakt.syncTVShows() except: pass control.refresh()
def GETLINKS(url, name, iconimage): storedname = name resolved = None randomitem = [] link = open_url(url) match = re.compile( '<a href="(.+?)" rel="nofollow" title="(.+?)" target="_blank">' ).findall(link) match2 = re.compile( '<a href=".+?" rel="nofollow" title="(.+?)" target="_blank">').findall( link) # match2.group() originalep = name autoplay = selfAddon.getSetting('enable_autoplay') for url, name in match: url = "http://www.watchfree.to" + url randomitem.append([url, name]) index = random.randrange(1, len(randomitem)) playrandom = randomitem[index][0] for url, name in match: if xbmc.Player().isPlaying(): return if autoplay == 'false': url = "http://www.watchfree.to" + url url2 = "autoplay" host = url.split('/')[2].replace('www.', '').capitalize() addLink(originalep + ' >>> ', url, 100, icon5, fanart) else: if not xbmc.Player().isPlaying(): try: stdurl = url url = "http://www.watchfree.to" + url index = random.randrange(1, len(match)) playrandom = randomitem[index][0] progressDialog = control.progressDialog progressDialog.create(control.addonInfo('name'), '') progressDialog.update(0, 'Trying: sources', 'Please wait...') req = urllib2.Request(playrandom) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) response = urllib2.urlopen(req) link = response.geturl() xbmc.sleep(1000) liz = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=icon) liz.setInfo(type="Video", infoLabels={"Title": storedname}) stream_url = urlresolver.HostedMediaFile(link).resolve() xbmc.Player().play(stream_url, liz, False) xbmc.sleep(1000) addDir('Testlog:' + url, '', 8, '', '') except: addDir(url + ' not working', '', 8, '', '') addDir('Press Here to Exit', '', 8, '', '')
def __init__(self): self.library_folder = os.path.join(control.transPath(control.setting('tv_library')),'') self.library_setting = control.setting('update_library') or 'true' self.property = '%s_service_property' % control.addonInfo('name').lower() self.datetime = (datetime.datetime.utcnow() - datetime.timedelta(hours = 5)) self.date = (self.datetime - datetime.timedelta(hours = 24)).strftime('%Y%m%d') self.infoDialog = False
def __init__(self): self.library_folder = os.path.join(control.transPath(control.setting("tv_library")), "") self.library_setting = control.setting("update_library") or "true" self.property = "%s_service_property" % control.addonInfo("name").lower() self.datetime = datetime.datetime.utcnow() - datetime.timedelta(hours=5) self.date = (self.datetime - datetime.timedelta(hours=24)).strftime("%Y%m%d") self.infoDialog = False
def sourcesDirect(self): self.sources = [ i for i in self.sources if not i['source'] in self.hostcapDict ] self.sources = [ i for i in self.sources if not ( i['quality'] in ['1080p', 'HD'] and i['source'] in self. hosthdDict and not i['source'] in self.rdDict + self.pzDict) ] self.sources = [ i for i in self.sources if not i['source'] in ['easynews', 'furk', 'vk'] ] if control.setting("playback_auto_sd") == 'true': self.sources = [ i for i in self.sources if not i['quality'] in ['1080p', 'HD'] ] u = None self.progressDialog = control.progressDialog self.progressDialog.create(control.addonInfo('name'), '') self.progressDialog.update(0) for i in range(len(self.sources)): try: if self.progressDialog.iscanceled(): break self.progressDialog.update( int((100 / float(len(self.sources))) * i), str(self.sources[i]['label']), str(' ')) if xbmc.abortRequested == True: return sys.exit() url = self.sourcesResolve(self.sources[i]['url'], self.sources[i]['provider']) if url == None: raise Exception() if u == None: u = url self.selectedSource = self.sources[i]['label'] self.progressDialog.close() return url except: pass try: self.progressDialog.close() except: pass return u
def sourcesDialog(self): try: sources = [{'label': '00 | [B]%s[/B]' % control.lang(30509).encode('utf-8').upper()}] + self.sources labels = [i['label'] for i in sources] select = control.selectDialog(labels) if select == 0: return self.sourcesDirect() if select == -1: return 'close://' items = [self.sources[select-1]] next = [y for x,y in enumerate(self.sources) if x >= select] prev = [y for x,y in enumerate(self.sources) if x < select][::-1] source, quality = items[0]['source'], items[0]['quality'] items = [i for i in items+next+prev if i['quality'] == quality and i['source'] == source][:10] items += [i for i in next+prev if i['quality'] == quality and not i['source'] == source][:10] self.progressDialog = control.progressDialog self.progressDialog.create(control.addonInfo('name'), '') self.progressDialog.update(0) block = None for i in range(len(items)): try: self.progressDialog.update(int((100 / float(len(items))) * i), str(items[i]['label']), str(' ')) if items[i]['source'] == block: raise Exception() w = workers.Thread(self.sourcesResolve, items[i]['url'], items[i]['provider']) w.start() for x in range(0, 15 * 2): if self.progressDialog.iscanceled(): return self.progressDialog.close() if xbmc.abortRequested == True: return sys.exit() if w.is_alive() == False: break time.sleep(0.5) if w.is_alive() == True: block = items[i]['source'] if self.url == None: raise Exception() self.selectedSource = items[i]['label'] return self.url except: pass except: return
def tvshows(tvshowtitle, imdb, tvdb, season, watched): try: import sys,xbmc if not trakt.getTraktIndicatorsInfo() == False: raise Exception() from metahandler import metahandlers from resources.lib.indexers import episodes metaget = metahandlers.MetaData(preparezip=False) name = control.addonInfo('name') dialog = control.progressDialogBG dialog.create(str(name), str(tvshowtitle)) dialog.update(0, str(name), str(tvshowtitle)) metaget.get_meta('tvshow', name='', imdb_id=imdb) items = episodes.episodes().get(tvshowtitle, '0', imdb, tvdb, '0','0', idx=False) try: items = [i for i in items if int('%01d' % int(season)) == int('%01d' % int(i['season']))] except: pass items = [{'label': '%s S%02dE%02d' % (tvshowtitle, int(i['season']), int(i['episode'])), 'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode']))} for i in items] for i in range(len(items)): if xbmc.abortRequested == True: return sys.exit() dialog.update(int((100 / float(len(items))) * i), str(name), str(items[i]['label'])) season, episode = items[i]['season'], items[i]['episode'] metaget.get_episode_meta('', imdb_id=imdb, season=season, episode=episode) metaget.change_watched('episode', '', imdb_id=imdb, season=season, episode=episode, watched=int(watched)) try: dialog.close() except: pass except Exception as e: control.log('playcount %s' % e) try: dialog.close() except: pass try: if trakt.getTraktIndicatorsInfo() == False: raise Exception() if int(watched) == 7: trakt.markTVShowAsWatched(tvdb) else: trakt.markTVShowAsNotWatched(tvdb) trakt.cachesyncTVShows() except: pass control.refresh()
def tvshows(tvshowtitle, year, imdb, tvdb, season, watched): traktMode = False if trakt.getTraktCredentials() == False else True watched = int(watched) try: if traktMode == True: raise Exception() from metahandler import metahandlers from resources.lib.indexers import episodes metaget = metahandlers.MetaData(preparezip=False) dialog = control.progressDialog dialog.create(control.addonInfo('name'), str(tvshowtitle)) dialog.update(0, str(tvshowtitle), control.lang(30451).encode('utf-8') + '...') metaget.get_meta('tvshow', '', imdb_id=imdb) items = episodes.episodes().get(tvshowtitle, year, imdb, '0', tvdb, '0', idx=False) try: items = [i for i in items if int('%01d' % int(season)) == int('%01d' % int(i['season']))] except: pass items = [{'name': i['name'], 'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode']))} for i in items] for i in range(len(items)): if xbmc.abortRequested == True: return sys.exit() if dialog.iscanceled(): return dialog.close() dialog.update(int((100 / float(len(items))) * i), str(tvshowtitle), str(items[i]['name'])) season, episode = items[i]['season'], items[i]['episode'] metaget.get_episode_meta('', imdb, season, episode) metaget.change_watched('episode', '', imdb, season=season, episode=episode, year='', watched=watched) try: dialog.close() except: pass except: try: dialog.close() except: pass try: if traktMode == False: raise Exception() if watched == 7: trakt.markTVShowAsWatched(tvdb) else: trakt.markTVShowAsNotWatched(tvdb) trakt.syncTVShows() except: pass control.refresh()
def GETLINKS(url,name,iconimage): storedname = name resolved=None randomitem = [] link=open_url(url) match=re.compile('<a href="(.+?)" rel="nofollow" title="(.+?)" target="_blank">').findall(link) match2=re.compile('<a href=".+?" rel="nofollow" title="(.+?)" target="_blank">').findall(link) # match2.group() originalep = name autoplay = selfAddon.getSetting('enable_autoplay') for url,name in match: url = "http://www.watchfree.to" + url randomitem.append([url, name]) index = random.randrange(1, len(randomitem)) playrandom = randomitem[index][0] for url,name in match: if xbmc.Player().isPlaying(): return if autoplay=='false': url = "http://www.watchfree.to" + url url2 = "autoplay" host=url.split('/')[2].replace('www.','').capitalize() addLink(originalep +' >>> ' ,url,100,icon5,fanart) else: if not xbmc.Player().isPlaying(): try: stdurl = url url = "http://www.watchfree.to" + url index = random.randrange(1, len(match)) playrandom = randomitem[index][0] progressDialog = control.progressDialog progressDialog.create(control.addonInfo('name'), '') progressDialog.update(0, 'Trying: sources', 'Please wait...') req = urllib2.Request(playrandom) req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') response = urllib2.urlopen(req) link=response.geturl() xbmc.sleep(1000) liz=xbmcgui.ListItem(name, iconImage=icon,thumbnailImage=icon); liz.setInfo( type="Video", infoLabels={ "Title": storedname } ) stream_url = urlresolver.HostedMediaFile(link).resolve() xbmc.Player ().play(stream_url, liz, False) xbmc.sleep(1000) addDir('Testlog:'+url,'',8,'','') except:addDir(url +' not working','',8,'','') addDir('Press Here to Exit','',8,'','')
def img_parser(self, image, referer): try: if not image.startswith('http:'): image = 'http:' + image d = control.windowDialog result = client.request(image, referer=referer, close=False) for match in re.finditer( "<img\s+src='([^']+)'\s+width='(\d+)'\s+height='(\d+)'", result): img_url, width, height = match.groups() img_url = client.replaceHTMLCodes(img_url) width = int(width) height = int(height) if width > 0 and height > 0: left = (1280 - width) / 2 f = control.image(left, 0, width, height, img_url) d.addControl(f) else: client.request(img_url, referer=image, close=False) d.show() control.dialog.ok(control.addonInfo('name'), str('Continue to Video'), '') match = re.search("href='([^']+)", result) if match and random.randint(0, 100) < 5: result = client.request(match.group(1), close=False) match = re.search("location=decode\('([^']+)", result) client.request(match.group(1)) try: d.removeControl(f) d.close() except: return except: try: d.removeControl(f) d.close() except: return
def root(self): self.addDirectoryItem(30860, 'movieLangNavigator', 'movies.png', 'DefaultMovies.png') self.addDirectoryItem(90114, 'desiLiveNavigator', 'live.png', 'DefaultMovies.png') self.addDirectoryItem(30861, 'desiTVNavigator', 'tv.png', 'DefaultMovies.png') self.addDirectoryItem(90116, 'openSettings&query=0.0', 'settings.png', 'DefaultMovies.png') self.addDirectoryItem(90117, 'clearCache', 'clearcache.png', 'DefaultMovies.png') self.endDirectory() from resources.lib.libraries import cache from resources.lib.libraries import changelog cache.get(changelog.get, 600000000, control.addonInfo('version'), table='changelog')
def root(self): self.addDirectoryItem(30001, 'movieNavigator', 'movies.jpg', 'DefaultMovies.png') self.addDirectoryItem(30002, 'tvNavigator', 'tvshows.jpg', 'DefaultTVShows.png') self.addDirectoryItem(30003, 'channels', 'channels.jpg', 'DefaultMovies.png') self.addDirectoryItem(30004, 'myNavigator', 'mygenesis.jpg', 'DefaultVideoPlaylists.png') if not control.setting('movie_widget') == '0': self.addDirectoryItem(30005, 'movieWidget', 'moviesAdded.jpg', 'DefaultRecentlyAddedMovies.png') if (traktMode == True and not control.setting('tv_alt_widget') == '0') or (traktMode == False and not control.setting('tv_widget') == '0'): self.addDirectoryItem(30006, 'tvWidget', 'calendarsAdded.jpg', 'DefaultRecentlyAddedEpisodes.png') if not control.setting('calendar_widget') == '0': self.addDirectoryItem(30007, 'calendars', 'calendar.jpg', 'DefaultRecentlyAddedEpisodes.png') self.addDirectoryItem(30008, 'toolNavigator', 'tools.jpg', 'DefaultAddonProgram.png') self.addDirectoryItem(30009, 'searchNavigator', 'search.jpg', 'DefaultFolder.png') self.endDirectory() from resources.lib.libraries import cache from resources.lib.libraries import changelog cache.get(changelog.get, 600000000, control.addonInfo('version'), table='changelog')
def upgradeDB(): logger.logNotice( 'Updating from version %s to %s' % (control.setting('lastVersion'), control.addonInfo('version'))) if control.setting('lastVersion') in (''): # Check if installation is complete logger.logNotice('Checking installation') tools.checkInstallDB(True) tools.checkInstallDB() episodeDB = episodes.Episode(control.episodesFile) showDB = shows.Show(control.showsFile) showViews = logger.logInfo( episodeDB.execute([ 'select showid, sum(views) from EPISODE where views > 0 group by showid' ])) updateQueries = [] if (showViews and len(showViews) > 0): for data in showViews[0]: updateQueries.append('UPDATE SHOW SET VIEWS = %d WHERE ID = %d' % (int(data[1]), int(data[0]))) showDB.executeUpdate(logger.logInfo(updateQueries))
def playItem(self, content, name, year, imdb, tvdb, source): try: control.resolve(int(sys.argv[1]), True, control.item(path='')) control.execute('Dialog.Close(okdialog)') next = [] ; prev = [] ; total = [] meta = None for i in range(1,10000): try: u = control.infoLabel('ListItem(%s).FolderPath' % str(i)) if u in total: raise Exception() total.append(u) u = dict(urlparse.parse_qsl(u.replace('?',''))) if 'meta' in u: meta = u['meta'] u = json.loads(u['source'])[0] next.append(u) except: break for i in range(-10000,0)[::-1]: try: u = control.infoLabel('ListItem(%s).FolderPath' % str(i)) if u in total: raise Exception() total.append(u) u = dict(urlparse.parse_qsl(u.replace('?',''))) if 'meta' in u: meta = u['meta'] u = json.loads(u['source'])[0] prev.append(u) except: break items = json.loads(source) source, quality = items[0]['source'], items[0]['quality'] items = [i for i in items+next+prev if i['quality'] == quality and i['source'] == source][:10] items += [i for i in next+prev if i['quality'] == quality and not i['source'] == source][:10] self.progressDialog = control.progressDialog self.progressDialog.create(control.addonInfo('name'), '') self.progressDialog.update(0) block = None for i in range(len(items)): try: self.progressDialog.update(int((100 / float(len(items))) * i), str(items[i]['label']), str(' ')) if items[i]['source'] == block: raise Exception() w = workers.Thread(self.sourcesResolve, items[i]['url'], items[i]['provider']) w.start() m = '' for x in range(3600): if self.progressDialog.iscanceled(): return self.progressDialog.close() if xbmc.abortRequested == True: return sys.exit() k = control.condVisibility('Window.IsActive(virtualkeyboard)') if k: m += '1'; m = m[-1] if (w.is_alive() == False or x > 30) and not k: break time.sleep(1) for x in range(30): if m == '': break if self.progressDialog.iscanceled(): return self.progressDialog.close() if xbmc.abortRequested == True: return sys.exit() if w.is_alive() == False: break time.sleep(1) if w.is_alive() == True: block = items[i]['source'] if self.url == None: raise Exception() try: self.progressDialog.close() except: pass control.sleep(200) if control.setting('playback_info') == 'true': control.infoDialog(items[i]['label'], heading=name) from resources.lib.libraries.player import player player().run(content, name, self.url, year, imdb, tvdb, meta) return self.url except: pass try: self.progressDialog.close() except: pass raise Exception() except: control.infoDialog(control.lang(30501).encode('utf-8')) pass
def addItem(self, name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta): try: if imdb == '0': imdb = '0000000' imdb = 'tt' + re.sub('[^0-9]', '', str(imdb)) content = 'movie' if tvshowtitle == None else 'episode' self.sources = self.getSources(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date) if self.sources == []: raise Exception() self.progressDialog = control.progressDialog self.progressDialog.create(control.addonInfo('name'), '') self.progressDialog.update(0, control.lang(30515).encode('utf-8'), str(' ')) self.sources = self.sourcesFilter() infoMenu = control.lang(30502).encode('utf-8') if content == 'movie' else control.lang(30503).encode('utf-8') sysmeta = urllib.quote_plus(meta) sysaddon = sys.argv[0] meta = json.loads(meta) poster = meta['poster'] if 'poster' in meta else '0' banner = meta['banner'] if 'banner' in meta else '0' thumb = meta['thumb'] if 'thumb' in meta else poster fanart = meta['fanart'] if 'fanart' in meta else '0' if poster == '0': poster = control.addonPoster() if banner == '0' and poster == '0': banner = control.addonBanner() elif banner == '0': banner = poster if thumb == '0' and fanart == '0': thumb = control.addonFanart() elif thumb == '0': thumb = fanart if control.setting('fanart') == 'true' and not fanart == '0': pass else: fanart = control.addonFanart() for i in range(len(self.sources)): try: if self.progressDialog.iscanceled(): break self.progressDialog.update(int((100 / float(len(self.sources))) * i)) url, label, provider = self.sources[i]['url'], self.sources[i]['label'], self.sources[i]['provider'] sysname, sysurl, sysimage, sysprovider = urllib.quote_plus(name), urllib.quote_plus(url), urllib.quote_plus(poster), urllib.quote_plus(provider) syssource = urllib.quote_plus(json.dumps([self.sources[i]])) if i == 0: query = 'action=playItem&content=%s&name=%s&year=%s&imdb=%s&tvdb=%s&source=%s&meta=%s' % (content, sysname, year, imdb, tvdb, syssource, sysmeta) else: query = 'action=playItem&content=%s&name=%s&year=%s&imdb=%s&tvdb=%s&source=%s' % (content, sysname, year, imdb, tvdb, syssource) cm = [] cm.append((control.lang(30504).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon)) cm.append((control.lang(30505).encode('utf-8'), 'RunPlugin(%s?action=download&name=%s&image=%s&url=%s&provider=%s)' % (sysaddon, sysname, sysimage, sysurl, sysprovider))) cm.append((infoMenu, 'Action(Info)')) cm.append((control.lang(30506).encode('utf-8'), 'RunPlugin(%s?action=refresh)' % sysaddon)) cm.append((control.lang(30507).encode('utf-8'), 'RunPlugin(%s?action=openSettings)' % sysaddon)) cm.append((control.lang(30508).encode('utf-8'), 'RunPlugin(%s?action=openPlaylist)' % sysaddon)) item = control.item(label=label, iconImage='DefaultVideo.png', thumbnailImage=thumb) try: item.setArt({'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner}) except: pass item.setInfo(type='Video', infoLabels = meta) if not fanart == None: item.setProperty('Fanart_Image', fanart) item.setProperty('Video', 'true') #item.setProperty('IsPlayable', 'true') item.addContextMenuItems(cm, replaceItems=True) control.addItem(handle=int(sys.argv[1]), url='%s?%s' % (sysaddon, query), listitem=item, isFolder=False) except: pass control.directory(int(sys.argv[1]), cacheToDisc=True) try: self.progressDialog.close() except: pass except: control.infoDialog(control.lang(30501).encode('utf-8')) try: self.progressDialog.close() except: pass
def playItem(self, content, name, imdb, tvdb, source): try: next = [] prev = [] total = [] for i in range(1, 10000): try: u = control.infoLabel("ListItem(%s).FolderPath" % str(i)) if u in total: raise Exception() total.append(u) u = json.loads(dict(urlparse.parse_qsl(u.replace("?", "")))["source"])[0] next.append(u) except: break for i in range(-10000, 0)[::-1]: try: u = control.infoLabel("ListItem(%s).FolderPath" % str(i)) if u in total: raise Exception() total.append(u) u = json.loads(dict(urlparse.parse_qsl(u.replace("?", "")))["source"])[0] prev.append(u) except: break items = json.loads(source) source, quality = items[0]["source"], items[0]["quality"] items = [i for i in items + next + prev if i["quality"] == quality and i["source"] == source][:10] items += [i for i in next + prev if i["quality"] == quality and not i["source"] == source][:10] import xbmc dialog = control.progressDialog dialog.create(control.addonInfo("name"), "") dialog.update(0) block = None for i in range(len(items)): try: dialog.update(int((100 / float(len(items))) * i), str(items[i]["label"])) if items[i]["source"] == block: raise Exception() w = workers.Thread(self.sourcesResolve, items[i]["url"], items[i]["provider"]) w.start() for x in range(0, 15 * 2): if dialog.iscanceled(): return dialog.close() if xbmc.abortRequested == True: return sys.exit() if w.is_alive() == False: break time.sleep(0.5) if w.is_alive() == True: block = items[i]["source"] if self.url == None: raise Exception() try: dialog.close() except: pass if control.setting("playback_info") == "true": control.infoDialog(items[i]["label"], heading=name) from resources.lib.libraries.player import player player().run(content, name, self.url, imdb, tvdb) return self.url except: pass try: dialog.close() except: pass raise Exception() except: control.infoDialog(control.lang(30501).encode("utf-8")) pass
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ''' import xbmc import re,sys,urllib,urlparse,base64,urllib2 from resources.lib.libraries import control from resources.lib.libraries import client from resources.lib.libraries import cloudflare mediaPath = control.addonInfo('path') + '/resources/media/phtoons/' def CartoonDirectory(): addDirectoryItem('Cartoon Crazy', 'CartoonCrazy', '0', mediaPath+'CartoonCrazy-icon.png', mediaPath+'CartoonCrazy-fanart.jpg') addDirectoryItem('Anime Crazy','AnimeCrazy', '0', mediaPath+'Anime-icon.png', mediaPath+'Anime-fanart.jpg') endCategory() def CartoonCrazy(image, fanart): addDirectoryItem('[B]SEARCH[/B]', 'CCsearch', '0', mediaPath+'CCsearch.png', fanart, '') try: url = 'http://kisscartoon.me/CartoonList/'
def addItem(self, name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta): try: if imdb == '0': imdb = '0000000' imdb = 'tt' + re.sub('[^0-9]', '', str(imdb)) content = 'movie' if tvshowtitle == None else 'episode' self.sources = self.getSources(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date) if self.sources == []: raise Exception() self.progressDialog = control.progressDialog self.progressDialog.create(control.addonInfo('name'), '') self.progressDialog.update(0, control.lang(30515).encode('utf-8'), str(' ')) self.sources = self.sourcesFilter() infoMenu = control.lang(30502).encode( 'utf-8') if content == 'movie' else control.lang(30503).encode( 'utf-8') sysmeta = urllib.quote_plus(meta) sysaddon = sys.argv[0] meta = json.loads(meta) poster = meta['poster'] if 'poster' in meta else '0' banner = meta['banner'] if 'banner' in meta else '0' thumb = meta['thumb'] if 'thumb' in meta else poster fanart = meta['fanart'] if 'fanart' in meta else '0' if poster == '0': poster = control.addonPoster() if banner == '0' and poster == '0': banner = control.addonBanner() elif banner == '0': banner = poster if thumb == '0' and fanart == '0': thumb = control.addonFanart() elif thumb == '0': thumb = fanart if control.setting('fanart') == 'true' and not fanart == '0': pass else: fanart = control.addonFanart() for i in range(len(self.sources)): try: if self.progressDialog.iscanceled(): break self.progressDialog.update( int((100 / float(len(self.sources))) * i)) url, label, provider = self.sources[i][ 'url'], self.sources[i]['label'], self.sources[i][ 'provider'] sysname, sysurl, sysimage, sysprovider = urllib.quote_plus( name), urllib.quote_plus(url), urllib.quote_plus( poster), urllib.quote_plus(provider) syssource = urllib.quote_plus(json.dumps([self.sources[i] ])) if i == 0: query = 'action=playItem&content=%s&name=%s&year=%s&imdb=%s&tvdb=%s&source=%s&meta=%s' % ( content, sysname, year, imdb, tvdb, syssource, sysmeta) else: query = 'action=playItem&content=%s&name=%s&year=%s&imdb=%s&tvdb=%s&source=%s' % ( content, sysname, year, imdb, tvdb, syssource) cm = [] cm.append((control.lang(30504).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon)) cm.append(( control.lang(30505).encode('utf-8'), 'RunPlugin(%s?action=download&name=%s&image=%s&url=%s&provider=%s)' % (sysaddon, sysname, sysimage, sysurl, sysprovider))) cm.append((infoMenu, 'Action(Info)')) cm.append((control.lang(30506).encode('utf-8'), 'RunPlugin(%s?action=refresh)' % sysaddon)) cm.append((control.lang(30507).encode('utf-8'), 'RunPlugin(%s?action=openSettings)' % sysaddon)) cm.append((control.lang(30508).encode('utf-8'), 'RunPlugin(%s?action=openPlaylist)' % sysaddon)) item = control.item(label=label, iconImage='DefaultVideo.png', thumbnailImage=thumb) try: item.setArt({ 'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner }) except: pass item.setInfo(type='Video', infoLabels=meta) if not fanart == None: item.setProperty('Fanart_Image', fanart) item.setProperty('Video', 'true') #item.setProperty('IsPlayable', 'true') item.addContextMenuItems(cm, replaceItems=True) control.addItem(handle=int(sys.argv[1]), url='%s?%s' % (sysaddon, query), listitem=item, isFolder=False) except: pass control.directory(int(sys.argv[1]), cacheToDisc=True) try: self.progressDialog.close() except: pass except: control.infoDialog(control.lang(30501).encode('utf-8')) try: self.progressDialog.close() except: pass
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ import re, os, sys, urllib, json, datetime, subprocess from jars import FuckNeulionClient from resources.lib.libraries import control from resources.lib.libraries import client import xbmc addonPath = control.addonPath addonFanart = control.addonInfo("fanart") addonIcon = os.path.join(addonPath, "resources/media/nhlcom/hockey.jpg") jarFile = os.path.join(addonPath, "jars/FuckNeulionV2.jar") def nhlDirectory(): dt = procTimezone(5) datex = int(dt.strftime("%Y%m%d")) url = "http://live.nhl.com/GameData/SeasonSchedule-20152016.json" result = client.request(url) items = json.loads(result) items = sorted(items, key=lambda k: k["est"]) addDirectoryItem(control.lang(30751).encode("utf-8"), "Scoreboard", "nhlScoreboard", "0", "0")
import datetime import json import os import re import subprocess import sys import urllib import xbmc from jars import FuckNeulionClient from resources.lib.libraries import client from resources.lib.libraries import control addonPath = control.addonPath addonFanart = control.addonInfo('fanart') addonIcon = os.path.join(addonPath, 'resources/media/nhlcom/hockey.jpg') jarFile = os.path.join(addonPath, 'jars/FuckNeulionV2.jar') def nhlDirectory(): dt = procTimezone(5) datex = int(dt.strftime('%Y%m%d')) url = 'http://live.nhl.com/GameData/SeasonSchedule-20152016.json' result = client.request(url) items = json.loads(result) items = sorted(items, key=lambda k: k['est']) addDirectoryItem(
GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ import StringIO import cProfile import json import pstats import time import xbmc from resources.lib.libraries import control from xbmc import LOGDEBUG, LOGNOTICE, LOGWARNING # @UnusedImport name = control.addonInfo('name') def log(msg, level=LOGDEBUG): req_level = level # override message level to force logging when addon logging turned on if control.setting('addon_debug') == 'true' and level == LOGDEBUG: level = LOGNOTICE try: if isinstance(msg, unicode): msg = '%s (ENCODED)' % (msg.encode('utf-8')) xbmc.log('[%s] %s' % (name, msg), level) except Exception as e:
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ''' import re,os,sys,urllib,urllib2,urlparse,time,threading from resources.lib.libraries import control from resources.lib.libraries import cache import pyxbmct.addonwindow as pyxbmct downloadPath = control.setting('download_folder') property = control.addonInfo('id') + '.downloader' def downloader(): thumb = control.addonThumb() ; fanart = control.addonFanart() status = control.window.getProperty(property + '.status') if not downloadPath == '': item = control.item('[COLOR FF00b8ff]Downloads[/COLOR]', iconImage=thumb, thumbnailImage=thumb) item.addContextMenuItems([], replaceItems=True) item.setProperty('fanart_image', fanart) control.addItem(handle=int(sys.argv[1]), url=downloadPath, listitem=item, isFolder=True) if status == 'downloading':
def sourcesDialog(self): try: sources = [{"label": "00 | [B]%s[/B]" % control.lang(30509).encode("utf-8").upper()}] + self.sources labels = [i["label"] for i in sources] select = control.selectDialog(labels) if select == 0: return self.sourcesDirect() if select == -1: return "close://" items = [self.sources[select - 1]] next = [y for x, y in enumerate(self.sources) if x >= select] prev = [y for x, y in enumerate(self.sources) if x < select][::-1] source, quality = items[0]["source"], items[0]["quality"] items = [i for i in items + next + prev if i["quality"] == quality and i["source"] == source][:10] items += [i for i in next + prev if i["quality"] == quality and not i["source"] == source][:10] import xbmc dialog = control.progressDialog dialog.create(control.addonInfo("name"), "") dialog.update(0) block = None for i in range(len(items)): try: dialog.update(int((100 / float(len(items))) * i), str(items[i]["label"])) if items[i]["source"] == block: raise Exception() w = workers.Thread(self.sourcesResolve, items[i]["url"], items[i]["provider"]) w.start() for x in range(0, 15 * 2): if dialog.iscanceled(): return dialog.close() if xbmc.abortRequested == True: return sys.exit() if w.is_alive() == False: break time.sleep(0.5) if w.is_alive() == True: block = items[i]["source"] if self.url == None: raise Exception() try: dialog.close() except: pass self.selectedSource = items[i]["label"] return self.url except: pass try: dialog.close() except: pass except: return
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ''' import re,os,sys,urllib,json,datetime,subprocess from jars import FuckNeulionClient from resources.lib.libraries import control from resources.lib.libraries import client import xbmc addonPath = control.addonPath addonFanart = control.addonInfo('fanart') addonIcon = os.path.join(addonPath, 'resources/media/nhlcom/hockey.jpg') jarFile = os.path.join(addonPath, 'jars/FuckNeulionV2.jar') def nhlDirectory(): dt = procTimezone(5) datex = int(dt.strftime('%Y%m%d')) url = 'http://live.nhl.com/GameData/SeasonSchedule-20152016.json' result = client.request(url) items = json.loads(result) items = sorted(items, key=lambda k: k['est']) addDirectoryItem(control.lang(30751).encode('utf-8'), 'Scoreboard', 'nhlScoreboard', '0', '0')
year = params.get('year') show = params.get('show') episode = params.get('episode') url = params.get('url') image = params.get('image') caller = params.get('caller', 'addon') thumbnail = urllib.unquote_plus(params.get('thumbnail', '')) # if caller == 'addon' and control.setting('addonNewInstall') == 'true' and control.setting('lastVersion') != control.addonInfo('version'): if caller == 'addon' and control.setting('lastVersion') != control.addonInfo( 'version'): from resources import upgrade control.showMessage( control.lang(57023) % control.addonInfo('version'), control.lang(50002)) upgrade.upgradeDB() upgrade.upgradeSettings() control.setSetting('lastVersion', control.addonInfo('version')) if mode == None: from resources.lib.indexers import navigator navigator.navigator().root() elif mode == config.SUBCATEGORIES: from resources.lib.indexers import navigator navigator.navigator().showSubCategories(url) elif mode == config.SUBCATEGORYSHOWS:
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ''' import xbmc import re, sys, urllib, urlparse, base64 from resources.lib.libraries import control from resources.lib.libraries import client from resources.lib.libraries import cloudflare mediaPath = control.addonInfo('path') + '/resources/media/phtoons/' def CartoonDirectory(): addDirectoryItem('Cartoon Crazy', 'CartoonCrazy', '0', mediaPath + 'CartoonCrazy-icon.png', mediaPath + 'CartoonCrazy-fanart.jpg') endCategory() def CartoonCrazy(image, fanart): addDirectoryItem('[B]SEARCH[/B]', 'CCsearch', '0', mediaPath + 'CCsearch.png', fanart, '') try:
def getSources(self, name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date): sourceDict = [] for package, name, is_pkg in pkgutil.walk_packages(__path__): sourceDict.append((name, is_pkg)) sourceDict = [i[0] for i in sourceDict if i[1] == False] content = 'movie' if tvshowtitle == None else 'episode' if content == 'movie': sourceDict = [i for i in sourceDict if i.endswith(('_mv', '_mv_tv'))] try: sourceDict = [(i, control.setting(re.sub('_mv_tv$|_mv$|_tv$', '', i))) for i in sourceDict] except: sourceDict = [(i, 'true') for i in sourceDict] else: sourceDict = [i for i in sourceDict if i.endswith(('_tv', '_mv_tv'))] try: sourceDict = [(i, control.setting(re.sub('_mv_tv$|_mv$|_tv$', '', i) + '_tv')) for i in sourceDict] except: sourceDict = [(i, 'true') for i in sourceDict] threads = [] control.makeFile(control.dataPath) self.sourceFile = control.sourcescacheFile sourceDict = [i[0] for i in sourceDict if i[1] == 'true'] if content == 'movie': title = cleantitle.normalize(title) for source in sourceDict: threads.append(workers.Thread(self.getMovieSource, title, year, imdb, re.sub('_mv_tv$|_mv$|_tv$', '', source), __import__(source, globals(), locals(), [], -1).source())) else: tvshowtitle = cleantitle.normalize(tvshowtitle) season, episode = alterepisode.alterepisode().get(imdb, tmdb, tvdb, tvrage, season, episode, alter, title, date) for source in sourceDict: threads.append(workers.Thread(self.getEpisodeSource, title, year, imdb, tvdb, season, episode, tvshowtitle, date, re.sub('_mv_tv$|_mv$|_tv$', '', source), __import__(source, globals(), locals(), [], -1).source())) try: timeout = int(control.setting('sources_timeout_40')) except: timeout = 40 [i.start() for i in threads] control.idle() sourceLabel = [re.sub('_mv_tv$|_mv$|_tv$', '', i) for i in sourceDict] sourceLabel = [re.sub('v\d+$', '', i).upper() for i in sourceLabel] self.progressDialog = control.progressDialog self.progressDialog.create(control.addonInfo('name'), '') self.progressDialog.update(0) string1 = control.lang(30512).encode('utf-8') string2 = control.lang(30513).encode('utf-8') string3 = control.lang(30514).encode('utf-8') for i in range(0, timeout * 2): try: if xbmc.abortRequested == True: return sys.exit() try: info = [sourceLabel[int(re.sub('[^0-9]', '', str(x.getName()))) - 1] for x in threads if x.is_alive() == True] except: info = [] if len(info) > 5: info = len(info) self.progressDialog.update(int((100 / float(len(threads))) * len([x for x in threads if x.is_alive() == False])), str('%s: %s %s' % (string1, int(i * 0.5), string2)), str('%s: %s' % (string3, str(info).translate(None, "[]'")))) if self.progressDialog.iscanceled(): break is_alive = [x.is_alive() for x in threads] if all(x == False for x in is_alive): break time.sleep(0.5) except: pass self.progressDialog.close() return self.sources
def upgradeSettings(): if control.addonInfo('version') == '1.5.0': control.setSetting('proxyStreamingUrl', 'http://%s:%s/?url=%s%s') control.showMessage(control.lang(57047), control.lang(50002))
def addDirectory(self, items, content=None): if items == None or len(items) == 0: return sysaddon = sys.argv[0] sysicon = os.path.join(control.addonInfo('path'), 'resources', 'media') sysimage = control.addonInfo('icon') sysfanart = control.addonInfo('fanart') for i in items: try: try: label = control.lang(i['title']).encode('utf-8') except: label = i['title'] if 'image' in i and not i['image'] == '0': image = i['image'] elif 'icon' in i and not i['icon'] == '0': image = os.path.join(sysicon, i['icon']) else: image = sysimage fanart = i['fanart'] if 'fanart' in i and not i['fanart'] == '0' else sysfanart isFolder = False if 'isFolder' in i and not i['isFolder'] == '0' else True url = '%s?action=%s' % (sysaddon, i['action']) try: url += '&url=%s' % urllib.quote_plus(i['url']) except: pass try: url += '&tvshowtitle=%s' % urllib.quote_plus(i['tvshowtitle']) except: pass try: url += '&title=%s' % urllib.quote_plus(i['title']) except: pass try: url += '&image=%s' % urllib.quote_plus(i['image']) except: pass try: url += '&fanart=%s' % urllib.quote_plus(i['fanart']) except: pass meta = dict((k,v) for k, v in i.iteritems() if not v == '0') try: meta.update({'duration': str(int(meta['duration']) * 60)}) except: pass item = control.item(label=label, iconImage=image, thumbnailImage=image) try: item.setArt({'poster': image, 'tvshow.poster': image, 'season.poster': image, 'banner': image, 'tvshow.banner': image, 'season.banner': image}) except: pass item.setProperty('Fanart_Image', fanart) item.addContextMenuItems([]) item.setInfo(type='Video', infoLabels = meta) if isFolder == False: item.setProperty('IsPlayable', 'true') control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=isFolder) except: pass try: i = items[0] if i['next'] == '': raise Exception() url = '%s?action=%s&url=%s' % (sysaddon, i['nextaction'], urllib.quote_plus(i['next'])) icon = i['nexticon'] if 'nexticon' in i else os.path.join(sysicon, 'next.png') fanart = i['nextfanart'] if 'nextfanart' in i else sysfanart item = control.item(label=control.lang(30500).encode('utf-8'), iconImage=icon, thumbnailImage=icon) item.setProperty('Fanart_Image', fanart) control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True) except: pass if not content == None: control.content(int(sys.argv[1]), content) #control.do_block_check(False) control.directory(int(sys.argv[1]), cacheToDisc=True)
(at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ''' import re, sys, urllib, urlparse from resources.lib.libraries import control from resources.lib.libraries import client mediaPath = control.addonInfo('path') + '/resources/media/phradios/' base_url = sys.argv[0] args = urlparse.parse_qs(sys.argv[2][1:]) def radioDirectory(): addCategoryItem('1FM', 'radio1fm', '1fm-icon.png', '1fm-fanart.jpg') addCategoryItem('181FM', 'radio181fm', '181fm-icon.png', '181fm-fanart.jpg') addCategoryItem('RadioTunes', 'radiotunes', 'radiotunes-icon.png', 'radiotunes-fanart.jpg') addCategoryItem('KickinRadio', 'Kickinradio', 'Kickin-icon.png', 'Kickin-fanart.jpg') endCategory()
along with this program. If not, see <http://www.gnu.org/licenses/>. Original Code by Gerrikss(structure this page only) Modified by and ported for PHOENIX by VinMan_JSV 2016 ''' ### Thanks to Gerikss for the structure of code ### Ported to Phoenix by VinMan_JSV 2016 import cookielib, calendar, time, json, xbmc import re,sys,urllib,urlparse,base64,urllib2 from resources.lib.libraries import control from resources.lib.libraries import client from datetime import datetime, timedelta mediaPath = control.addonInfo('path') + '/resources/media/phhuddle/' display_status = 'true' display_start_time = 'true' logos ={'nba': mediaPath+'nba.png', 'nhl': mediaPath+'nhl.png', 'nfl': mediaPath+'nfl.png', 'mlb': mediaPath+'mlb.png', 'MMA': mediaPath+'mma.png'} back = {'nba':mediaPath+'NBA-Globe.jpg', 'nhl':mediaPath+'NHL.jpg', 'nfl':mediaPath+'NFL.jpg', 'MMA':mediaPath+'mma.jpg'} def HuddleDirectory(): addDirectoryItem('[COLOR=FF00FF00][B] NHL [/B][/COLOR]','Huddle_Main', '0', mediaPath+'nhl.png', mediaPath+'Huddle-fanart.jpg',url='nhl') addDirectoryItem('[COLOR=FF00FF00][B] NBA [/B][/COLOR]','Huddle_Main', '0', mediaPath+'nba.png', mediaPath+'Huddle-fanart.jpg',url='nba') addDirectoryItem('[COLOR=FF00FF00][B] NFL [/B][/COLOR]','Huddle_Main', '0', mediaPath+'nfl.png', mediaPath+'Huddle-fanart.jpg',url='nfl')
def playItem(self, content, name, year, imdb, tvdb, source): try: control.resolve(int(sys.argv[1]), True, control.item(path='')) control.execute('Dialog.Close(okdialog)') next = [] prev = [] total = [] meta = None for i in range(1, 10000): try: u = control.infoLabel('ListItem(%s).FolderPath' % str(i)) if u in total: raise Exception() total.append(u) u = dict(urlparse.parse_qsl(u.replace('?', ''))) if 'meta' in u: meta = u['meta'] u = json.loads(u['source'])[0] next.append(u) except: break for i in range(-10000, 0)[::-1]: try: u = control.infoLabel('ListItem(%s).FolderPath' % str(i)) if u in total: raise Exception() total.append(u) u = dict(urlparse.parse_qsl(u.replace('?', ''))) if 'meta' in u: meta = u['meta'] u = json.loads(u['source'])[0] prev.append(u) except: break items = json.loads(source) source, quality = items[0]['source'], items[0]['quality'] items = [ i for i in items + next + prev if i['quality'] == quality and i['source'] == source ][:10] items += [ i for i in next + prev if i['quality'] == quality and not i['source'] == source ][:10] self.progressDialog = control.progressDialog self.progressDialog.create(control.addonInfo('name'), '') self.progressDialog.update(0) block = None for i in range(len(items)): try: self.progressDialog.update( int((100 / float(len(items))) * i), str(items[i]['label']), str(' ')) if items[i]['source'] == block: raise Exception() w = workers.Thread(self.sourcesResolve, items[i]['url'], items[i]['provider']) w.start() m = '' for x in range(3600): if self.progressDialog.iscanceled(): return self.progressDialog.close() if xbmc.abortRequested == True: return sys.exit() k = control.condVisibility( 'Window.IsActive(virtualkeyboard)') if k: m += '1' m = m[-1] if (w.is_alive() == False or x > 30) and not k: break time.sleep(1) for x in range(30): if m == '': break if self.progressDialog.iscanceled(): return self.progressDialog.close() if xbmc.abortRequested == True: return sys.exit() if w.is_alive() == False: break time.sleep(1) if w.is_alive() == True: block = items[i]['source'] if self.url == None: raise Exception() try: self.progressDialog.close() except: pass control.sleep(200) if control.setting('playback_info') == 'true': control.infoDialog(items[i]['label'], heading=name) from resources.lib.libraries.player import player player().run(content, name, self.url, year, imdb, tvdb, meta) return self.url except: pass try: self.progressDialog.close() except: pass raise Exception() except: control.infoDialog(control.lang(30501).encode('utf-8')) pass
def sourcesDialog(self): try: sources = [{ 'label': '00 | [B]%s[/B]' % control.lang(30509).encode('utf-8').upper() }] + self.sources labels = [i['label'] for i in sources] select = control.selectDialog(labels) if select == 0: return self.sourcesDirect() if select == -1: return 'close://' items = [self.sources[select - 1]] next = [y for x, y in enumerate(self.sources) if x >= select] prev = [y for x, y in enumerate(self.sources) if x < select][::-1] source, quality = items[0]['source'], items[0]['quality'] items = [ i for i in items + next + prev if i['quality'] == quality and i['source'] == source ][:10] items += [ i for i in next + prev if i['quality'] == quality and not i['source'] == source ][:10] self.progressDialog = control.progressDialog self.progressDialog.create(control.addonInfo('name'), '') self.progressDialog.update(0) block = None for i in range(len(items)): try: if self.progressDialog.iscanceled(): break self.progressDialog.update( int((100 / float(len(items))) * i), str(items[i]['label']), str(' ')) if items[i]['source'] == block: raise Exception() w = workers.Thread(self.sourcesResolve, items[i]['url'], items[i]['provider']) w.start() m = '' for x in range(3600): if self.progressDialog.iscanceled(): return self.progressDialog.close() if xbmc.abortRequested == True: return sys.exit() k = control.condVisibility( 'Window.IsActive(virtualkeyboard)') if k: m += '1' m = m[-1] if (w.is_alive() == False or x > 30) and not k: break time.sleep(1) for x in range(30): if m == '': break if self.progressDialog.iscanceled(): return self.progressDialog.close() if xbmc.abortRequested == True: return sys.exit() if w.is_alive() == False: break time.sleep(1) if w.is_alive() == True: block = items[i]['source'] if self.url == None: raise Exception() self.selectedSource = items[i]['label'] self.progressDialog.close() return self.url except: pass try: self.progressDialog.close() except: pass except: try: self.progressDialog.close() except: pass
def playItem(self, content, name, imdb, tvdb, source): try: next = [] prev = [] total = [] for i in range(1, 10000): try: u = control.infoLabel('ListItem(%s).FolderPath' % str(i)) if u in total: raise Exception() total.append(u) u = json.loads( dict(urlparse.parse_qsl(u.replace('?', '')))['source'])[0] next.append(u) except: break for i in range(-10000, 0)[::-1]: try: u = control.infoLabel('ListItem(%s).FolderPath' % str(i)) if u in total: raise Exception() total.append(u) u = json.loads( dict(urlparse.parse_qsl(u.replace('?', '')))['source'])[0] prev.append(u) except: break items = json.loads(source) source, quality = items[0]['source'], items[0]['quality'] items = [ i for i in items + next + prev if i['quality'] == quality and i['source'] == source ][:10] items += [ i for i in next + prev if i['quality'] == quality and not i['source'] == source ][:10] import xbmc dialog = control.progressDialog dialog.create(control.addonInfo('name'), '') dialog.update(0) block = None for i in range(len(items)): try: dialog.update(int((100 / float(len(items))) * i), str(items[i]['label'])) if items[i]['source'] == block: raise Exception() w = workers.Thread(self.sourcesResolve, items[i]['url'], items[i]['provider']) w.start() for x in range(0, 15 * 2): if dialog.iscanceled(): return dialog.close() if xbmc.abortRequested == True: return sys.exit() if w.is_alive() == False: break time.sleep(0.5) if w.is_alive() == True: block = items[i]['source'] if self.url == None: raise Exception() try: dialog.close() except: pass if control.setting('playback_info') == 'true': control.infoDialog(items[i]['label'], heading=name) from resources.lib.libraries.player import player player().run(content, name, self.url, imdb, tvdb) return self.url except: pass try: dialog.close() except: pass raise Exception() except: control.infoDialog(control.lang(30501).encode('utf-8')) pass
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ''' import re,sys,urllib,urlparse from resources.lib.libraries import control from resources.lib.libraries import client from resources.lib.indexers import phhuddle mediaPath = control.addonInfo('path') + '/resources/media/phradios/' base_url = sys.argv[0] args = urlparse.parse_qs(sys.argv[2][1:]) def radioDirectory(): addCategoryItem('1FM', 'radio1fm', '1fm-icon.png', '1fm-fanart.jpg') addCategoryItem('181FM', 'radio181fm', '181fm-icon.png', '181fm-fanart.jpg') addCategoryItem('KickinRadio','Kickinradio', 'Kickin-icon.png', 'Kickin-fanart.jpg') endCategory() def radio1fm(image, fanart): try: url = 'http://1.fm/home/showstations?stations=showall'
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ''' import re, os, sys, urllib, urllib2, urlparse, time, threading from resources.lib.libraries import control from resources.lib.libraries import cache import pyxbmct.addonwindow as pyxbmct downloadPath = control.setting('downloadPath') property = control.addonInfo('id') + '.downloader' def downloader(): thumb = control.addonThumb() fanart = control.addonFanart() status = control.window.getProperty(property + '.status') if not downloadPath == '': item = control.item('[COLOR FF00b8ff]Downloads[/COLOR]', iconImage=thumb, thumbnailImage=thumb) item.addContextMenuItems([], replaceItems=True) item.setProperty('fanart_image', fanart) control.addItem(handle=int(sys.argv[1]),
def getSources(self, name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date): sourceDict = [] for package, name, is_pkg in pkgutil.walk_packages(__path__): sourceDict.append((name, is_pkg)) sourceDict = [i[0] for i in sourceDict if i[1] == False] content = 'movie' if tvshowtitle == None else 'episode' if content == 'movie': sourceDict = [ i for i in sourceDict if i.endswith(('_mv', '_mv_tv')) ] try: sourceDict = [ (i, control.setting(re.sub('_mv_tv$|_mv$|_tv$', '', i))) for i in sourceDict ] except: sourceDict = [(i, 'true') for i in sourceDict] else: sourceDict = [ i for i in sourceDict if i.endswith(('_tv', '_mv_tv')) ] try: sourceDict = [(i, control.setting( re.sub('_mv_tv$|_mv$|_tv$', '', i) + '_tv')) for i in sourceDict] except: sourceDict = [(i, 'true') for i in sourceDict] threads = [] control.makeFile(control.dataPath) self.sourceFile = control.sourcescacheFile sourceDict = [i[0] for i in sourceDict if i[1] == 'true'] if content == 'movie': title = cleantitle.normalize(title) for source in sourceDict: threads.append( workers.Thread( self.getMovieSource, title, year, imdb, re.sub('_mv_tv$|_mv$|_tv$', '', source), __import__(source, globals(), locals(), [], -1).source())) else: tvshowtitle = cleantitle.normalize(tvshowtitle) season, episode = alterepisode.alterepisode().get( imdb, tmdb, tvdb, tvrage, season, episode, alter, title, date) for source in sourceDict: threads.append( workers.Thread( self.getEpisodeSource, title, year, imdb, tvdb, season, episode, tvshowtitle, date, re.sub('_mv_tv$|_mv$|_tv$', '', source), __import__(source, globals(), locals(), [], -1).source())) try: timeout = int(control.setting('sources_timeout_40')) except: timeout = 40 [i.start() for i in threads] control.idle() sourceLabel = [re.sub('_mv_tv$|_mv$|_tv$', '', i) for i in sourceDict] sourceLabel = [re.sub('v\d+$', '', i).upper() for i in sourceLabel] self.progressDialog = control.progressDialog self.progressDialog.create(control.addonInfo('name'), '') self.progressDialog.update(0) string1 = control.lang(30512).encode('utf-8') string2 = control.lang(30513).encode('utf-8') string3 = control.lang(30514).encode('utf-8') for i in range(0, timeout * 2): try: if xbmc.abortRequested == True: return sys.exit() try: info = [ sourceLabel[int(re.sub('[^0-9]', '', str(x.getName()))) - 1] for x in threads if x.is_alive() == True ] except: info = [] if len(info) > 5: info = len(info) self.progressDialog.update( int((100 / float(len(threads))) * len([x for x in threads if x.is_alive() == False])), str('%s: %s %s' % (string1, int(i * 0.5), string2)), str('%s: %s' % (string3, str(info).translate(None, "[]'")))) if self.progressDialog.iscanceled(): break is_alive = [x.is_alive() for x in threads] if all(x == False for x in is_alive): break time.sleep(0.5) except: pass self.progressDialog.close() return self.sources
def addDirectoryItem(name, url, action, image, image2, fanart, audio, content, data, tvshow='0', totalItems=0, isFolder=True): if not str(image).lower().startswith('http'): image = control.addonInfo('icon') if not str(image2).lower().startswith('http'): image2 = control.addonInfo('icon') if not str(fanart).lower().startswith('http'): fanart = control.addonInfo('fanart') if content in ['movies', 'episodes']: playable = 'true' else: playable = 'false' sysaddon = sys.argv[0] u = '%s?name=%s&url=%s&audio=%s&image=%s&fanart=%s&playable=%s&tvshow=%s&content=%s&action=%s' % ( sysaddon, urllib.quote_plus(name), urllib.quote_plus(url), urllib.quote_plus(audio), urllib.quote_plus(image), urllib.quote_plus(fanart), urllib.quote_plus(playable), str(tvshow), str(content), str(action)) cm = [] if content in ['movies', 'tvshows']: data.update({ 'trailer': '%s?action=trailer&name=%s' % (sysaddon, urllib.quote_plus(name)) }) cm.append((control.lang(30707).encode('utf-8'), 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, urllib.quote_plus(name)))) if not 'plot' in data: data.update({'plot': control.lang(30706).encode('utf-8')}) if content == 'movies': cm.append((control.lang(30708).encode('utf-8'), 'XBMC.Action(Info)')) elif content in ['tvshows', 'seasons']: cm.append((control.lang(30709).encode('utf-8'), 'XBMC.Action(Info)')) elif content == 'episodes': cm.append((control.lang(30710).encode('utf-8'), 'XBMC.Action(Info)')) if content == 'movies' and not isFolder == True: downloadFile = name try: downloadFile = '%s (%s)' % (data['title'], data['year']) except: pass cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(downloadFile), urllib.quote_plus(url), urllib.quote_plus(image)))) elif content == 'episodes' and not isFolder == True: downloadFile = name try: downloadFile = '%s S%02dE%02d' % ( data['tvshowtitle'], int(data['season']), int(data['episode'])) except: pass cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(downloadFile), urllib.quote_plus(url), urllib.quote_plus(image)))) if content == 'movies': cm.append((control.lang(30711).encode('utf-8'), 'RunPlugin(%s?action=addView&content=movies)' % sysaddon)) elif content == 'tvshows': cm.append((control.lang(30712).encode('utf-8'), 'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon)) elif content == 'seasons': cm.append((control.lang(30713).encode('utf-8'), 'RunPlugin(%s?action=addView&content=seasons)' % sysaddon)) elif content == 'episodes': cm.append((control.lang(30714).encode('utf-8'), 'RunPlugin(%s?action=addView&content=episodes)' % sysaddon)) item = control.item(name, iconImage='DefaultFolder.png', thumbnailImage=image) try: item.setArt({ 'poster': image2, 'tvshow.poster': image2, 'season.poster': image2, 'banner': image, 'tvshow.banner': image, 'season.banner': image }) except: pass item.addContextMenuItems(cm, replaceItems=False) item.setProperty('Fanart_Image', fanart) if playable == 'true': item.setProperty('IsPlayable', 'true') item.setInfo(type='Video', infoLabels=data) control.addItem(handle=int(sys.argv[1]), url=u, listitem=item, totalItems=totalItems, isFolder=isFolder)
def addDirectoryItem(name, url, action, image, image2, fanart, audio, content, data, tvshow='0', totalItems=0, isFolder=True): if not str(image).lower().startswith('http'): image = control.addonInfo('icon') if not str(image2).lower().startswith('http'): image2 = control.addonInfo('icon') if not str(fanart).lower().startswith('http'): fanart = control.addonInfo('fanart') if content in ['movies', 'episodes']: playable = 'true' else: playable = 'false' sysaddon = sys.argv[0] u=sysaddon+"?name="+urllib.quote_plus(name)+"&url="+urllib.quote_plus(url)+"&audio="+urllib.quote_plus(audio)+"&image="+urllib.quote_plus(image)+"&fanart="+urllib.quote_plus(fanart)+"&playable="+urllib.quote_plus(playable)+"&tvshow="+str(tvshow)+"&content="+str(content)+"&action="+str(action) cm = [] if content in ['movies', 'tvshows']: data.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, urllib.quote_plus(name))}) cm.append(('[COLOR gold]Watch Trailer[/COLOR]', 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, urllib.quote_plus(name)))) if not 'plot' in data: data.update({'plot': 'Discover Great Streaming Playlists!'}) if content == 'movies': cm.append(('[COLOR gold]Movie Information[/COLOR]', 'XBMC.Action(Info)')) elif content in ['tvshows', 'seasons']: cm.append(('[COLOR gold]TV Show Information[/COLOR]', 'XBMC.Action(Info)')) elif content == 'episodes': cm.append(('[COLOR gold]Episode Information[/COLOR]', 'XBMC.Action(Info)')) if content == 'movies' and not isFolder == True: downloadFile = name try: downloadFile = '%s (%s)' % (data['title'], data['year']) except: pass cm.append(('[COLOR gold]Download This File[/COLOR]', 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(downloadFile), urllib.quote_plus(url), urllib.quote_plus(image)))) elif content == 'episodes' and not isFolder == True: downloadFile = name try: downloadFile = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) except: pass cm.append(('[COLOR gold]Download This File[/COLOR]', 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(downloadFile), urllib.quote_plus(url), urllib.quote_plus(image)))) if content == 'movies': cm.append(('[COLOR gold]Set Movies view[/COLOR]', 'RunPlugin(%s?action=addView&content=movies)' % sysaddon)) elif content == 'tvshows': cm.append(('[COLOR gold]Set TV Shows view[/COLOR]', 'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon)) elif content == 'seasons': cm.append(('[COLOR gold]Set Seasons view[/COLOR]', 'RunPlugin(%s?action=addView&content=seasons)' % sysaddon)) elif content == 'episodes': cm.append(('[COLOR gold]Set Episodes view[/COLOR]', 'RunPlugin(%s?action=addView&content=episodes)' % sysaddon)) item = control.item(name, iconImage='DefaultFolder.png', thumbnailImage=image) try: item.setArt({'poster': image2, 'tvshow.poster': image2, 'season.poster': image2, 'banner': image, 'tvshow.banner': image, 'season.banner': image}) except: pass item.addContextMenuItems(cm, replaceItems=False) item.setProperty('Fanart_Image', fanart) if playable == 'true': item.setProperty('IsPlayable', 'true') item.setInfo(type='Video', infoLabels=data) control.addItem(handle=int(sys.argv[1]),url=u,listitem=item,totalItems=totalItems,isFolder=isFolder)
start = time.time() control.run(config.CHECKLIBRARYUPDATES, 'service') time.sleep(10) def shutdown(self): self._status = False if __name__ == "__main__": httpPort = int(control.setting('proxyPort')) server = SocketServer.TCPServer(('', httpPort), ProxyHandler) server_thread = threading.Thread(target=server.serve_forever) server_thread.start() xbmc.log('[%s] Service: starting HTTP proxy server on port %s' % (control.addonInfo('name'), httpPort), level=xbmc.LOGNOTICE) libActive = True if control.setting( 'libraryAutoUpdate') == 'true' else False if libActive == True: libChecker = LibraryChecker() libSchedTask = threading.Thread(target=libChecker.checkLibraryUpdates) libSchedTask.start() xbmc.log('[%s] Service: starting TFC.tv library checker' % control.addonInfo('name'), level=xbmc.LOGNOTICE) monitor = xbmc.Monitor()
def tvshows(tvshowtitle, imdb, tvdb, season, watched): try: import sys, xbmc if not trakt.getTraktIndicatorsInfo() == False: raise Exception() from metahandler import metahandlers from resources.lib.indexers import episodes metaget = metahandlers.MetaData(preparezip=False) name = control.addonInfo('name') dialog = control.progressDialogBG dialog.create(str(name), str(tvshowtitle)) dialog.update(0, str(name), str(tvshowtitle)) metaget.get_meta('tvshow', name='', imdb_id=imdb) items = episodes.episodes().get(tvshowtitle, '0', imdb, tvdb, '0', '0', idx=False) try: items = [ i for i in items if int('%01d' % int(season)) == int('%01d' % int(i['season'])) ] except: pass items = [{ 'label': '%s S%02dE%02d' % (tvshowtitle, int(i['season']), int(i['episode'])), 'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode'])) } for i in items] for i in range(len(items)): if xbmc.abortRequested == True: return sys.exit() dialog.update(int((100 / float(len(items))) * i), str(name), str(items[i]['label'])) season, episode = items[i]['season'], items[i]['episode'] metaget.get_episode_meta('', imdb_id=imdb, season=season, episode=episode) metaget.change_watched('episode', '', imdb_id=imdb, season=season, episode=episode, watched=int(watched)) try: dialog.close() except: pass except Exception as e: control.log('playcount %s' % e) try: dialog.close() except: pass try: if trakt.getTraktIndicatorsInfo() == False: raise Exception() if int(watched) == 7: trakt.markTVShowAsWatched(tvdb) else: trakt.markTVShowAsNotWatched(tvdb) trakt.cachesyncTVShows() except: pass control.refresh()
elif action == 'radioResolve': from resources.lib.indexers import phradios phradios.radioResolve(name, url, image) elif action == 'radio1fm': from resources.lib.indexers import phradios phradios.radio1fm(image, fanart) elif action == 'radio181fm': from resources.lib.indexers import phradios phradios.radio181fm(image, fanart) elif ('HH') in action: from resources.lib.libraries import control mediaPath = control.addonInfo('path') + '/resources/lib/indexers/phhuddle.py' print action file = open(mediaPath, 'r') getter = file.read() file.close() list = re.findall('(HH.+?\(url\))', getter) for item in list: test = 'phhuddle.'+ item if item[:-5] == action: from resources.lib.indexers import phhuddle exec test elif action == 'Kickinradio': from resources.lib.indexers import phradios phradios.Kickinradio(image, fanart)