def root(self): self.addDirectoryItem(32001, 'movieNavigator', 'movies.png', 'DefaultMovies.png') self.addDirectoryItem(32002, 'tvNavigator', 'tvshows.png', 'DefaultTVShows.png') if not control.setting('lists.widget') == '0': self.addDirectoryItem(32003, 'mymovieNavigator', 'mymovies.png', 'DefaultVideoPlaylists.png') self.addDirectoryItem(32004, 'mytvNavigator', 'mytvshows.png', 'DefaultVideoPlaylists.png') if not control.setting('movie.widget') == '0': self.addDirectoryItem(32005, 'movieWidget', 'latest-movies.png', 'DefaultRecentlyAddedMovies.png') if (traktIndicators == True and not control.setting('tv.widget.alt') == '0') or (traktIndicators == False and not control.setting('tv.widget') == '0'): self.addDirectoryItem(32006, 'tvWidget', 'latest-episodes.png', 'DefaultRecentlyAddedEpisodes.png') self.addDirectoryItem(32007, 'channels', 'channels.png', 'DefaultMovies.png') self.addDirectoryItem(32008, 'toolNavigator', 'tools.png', 'DefaultAddonProgram.png') downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False if downloads == True: self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png', 'DefaultFolder.png') self.addDirectoryItem(32010, 'searchNavigator', 'search.png', 'DefaultFolder.png') self.endDirectory()
def root(self): self.addDirectoryItem(30001, 'movieNavigator', 'movies.png', 'DefaultMovies.png') self.addDirectoryItem(30002, 'tvNavigator', 'tvshows.png', 'DefaultTVShows.png') self.addDirectoryItem(30003, 'channels', 'channels.png', 'DefaultMovies.png') if not control.setting('lists.widget') == '0': self.addDirectoryItem(30004, 'myNavigator', 'userlists.png', 'DefaultVideoPlaylists.png') if not control.setting('movie.widget') == '0': self.addDirectoryItem(30005, 'movieWidget', 'latest-movies.png', 'DefaultRecentlyAddedMovies.png', queue=True) if (traktIndicators == True and not control.setting('tv.widget.alt') == '0') or (traktIndicators == False and not control.setting('tv.widget') == '0'): self.addDirectoryItem(30006, 'tvWidget', 'latest-episodes.png', 'DefaultRecentlyAddedEpisodes.png', queue=True) if not control.setting('calendar.widget') == '0': self.addDirectoryItem(30007, 'calendars', 'calendar.png', 'DefaultRecentlyAddedEpisodes.png') self.addDirectoryItem(30008, 'toolNavigator', 'tools.png', 'DefaultAddonProgram.png') downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False if downloads == True: self.addDirectoryItem(30010, 'downloadNavigator', 'downloads.png', 'DefaultFolder.png') self.addDirectoryItem(30009, 'searchNavigator', 'search.png', 'DefaultFolder.png') self.endDirectory() from resources.lib.modules import cache from resources.lib.modules import changelog cache.get(changelog.get, 600000000, control.addonInfo('version'), table='changelog')
def addDirectory(self, items, queue=False): if items == None or len(items) == 0: return sysaddon = sys.argv[0] isPlayable = False if control.setting('autoplay') == 'false' and control.setting('hosts.mode') == '1' else True addonFanart, addonThumb, artPath = control.addonFanart(), control.addonThumb(), control.artPath() for i in items: try: try: name = control.lang(i['name']).encode('utf-8') except: name = i['name'] if i['image'].startswith('http://'): thumb = i['image'] elif not artPath == None: thumb = os.path.join(artPath, i['image']) else: thumb = addonThumb url = '%s?action=%s' % (sysaddon, i['action']) try: url += '&url=%s' % urllib.quote_plus(i['url']) except: pass cm = [] if queue == True and isPlayable == True: cm.append((control.lang(30202).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon)) item = control.item(label=name, iconImage=thumb, thumbnailImage=thumb) item.addContextMenuItems(cm, replaceItems=False) if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart) control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True) except: pass control.directory(int(sys.argv[1]), cacheToDisc=True)
def main_menu(): upgrade_warning = control.setting("upgrade.warning") if upgrade_warning is "": import xbmcgui xbmcgui.Dialog().ok("Masterani Redux Warning", " \n\nIt has come to our attention that the addon stopped working for some people. During our investigation in the matter," " we found that security upgrades rendered Kodi 16 unable to fetch the required data.\n\n" "If the addon is unable to load anything, you are affected by this. Please update your Kodi to the latest version.") control.setSetting("upgrade.warning", "shown") lastvisited = control.setting("anime.lastvisited") if int(lastvisited) != 0: add_last_visited(lastvisited) add_favorites() items = [ {'name': "Recent", 'action': "recent"}, {'name': "Popular Today", 'action': "popular"}, {'name': "Anime", 'action': "list"}, {'name': "Search", 'action': 'search'}, {'name': "Tools", 'action': "tools"} ] add_directory(items)
def getTraktCredentialsInfo(): enabled = control.setting('accounts.informants.trakt.enabled') == 'true' user = control.setting('accounts.informants.trakt.user').strip() token = control.setting('accounts.informants.trakt.token') refresh = control.setting('accounts.informants.trakt.refresh') if (not enabled or user == '' or token == '' or refresh == ''): return False return True
def log(msg, level=LOGNOTICE): debug_enabled = control.setting('addon_debug') debug_log = control.setting('debug.location') print DEBUGPREFIX + ' Debug Enabled?: ' + str(debug_enabled) print DEBUGPREFIX + ' Debug Log?: ' + str(debug_log) if not control.setting('addon_debug') == 'true': return try: if isinstance(msg, unicode): msg = '%s (ENCODED)' % (msg.encode('utf-8')) if not control.setting('debug.location') == '0': log_file = os.path.join(LOGPATH, 'placenta.log') if not os.path.exists(log_file): f = open(log_file, 'w'); f.close() with open(log_file, 'a') as f: line = '[%s %s] %s: %s' % (datetime.now().date(), str(datetime.now().time())[:8], DEBUGPREFIX, msg) f.write(line.rstrip('\r\n')+'\n') else: print '%s: %s' % (DEBUGPREFIX, msg) except Exception as e: try: xbmc.log('Logging Failure: %s' % (e), level) except: pass
def __init__(self): self.language = ['en'] self.domains = ['moviesplanet.is'] self.base_link = 'http://www.moviesplanet.is' self.search_link = '/ajax/search.php' self.user = control.setting('moviesplanet.user') self.password = control.setting('moviesplanet.pass')
def __init__(self): self.language = ['en'] self.domains = ['streamlord.com'] self.base_link = 'http://www.streamlord.com' self.search_link = '/search2.php' self.user = control.setting('streamlord.user') self.password = control.setting('streamlord.pass')
def root(self): self.addDirectoryItem('Created by JP Hightek', 'ShowChangelog', 'icon.png', 'DefaultFolder.png') self.addDirectoryItem('Genesis Reborn Custom Viewtype', 'viewsNavigator', 'icon.png', 'DefaultAddonProgram.png') self.addDirectoryItem('Genesis Reborn Movies', 'movieNavigator', 'movies.png', 'DefaultMovies.png') self.addDirectoryItem('Genesis Reborn TV Shows', 'tvNavigator', 'channels.png', 'DefaultTVShows.png') self.addDirectoryItem('My Genesis Reborn Library', 'libraryNavigator', 'tools.png', 'DefaultAddonProgram.png') if not control.setting('lists.widget') == '0': self.addDirectoryItem('My Genesis Reborn Movies (Trakt/Imdb)', 'mymovieNavigator', 'mymovies.png', 'DefaultVideoPlaylists.png') self.addDirectoryItem('My Genesis Reborn TV Shows (Trakt/Imdb)', 'mytvNavigator', 'mymovies.png', 'DefaultVideoPlaylists.png') if not control.setting('movie.widget') == '0': self.addDirectoryItem('Genesis Reborn New Movies', 'movieWidget', 'latest-movies.png', 'DefaultRecentlyAddedMovies.png') if (traktIndicators == True and not control.setting('tv.widget.alt') == '0') or (traktIndicators == False and not control.setting('tv.widget') == '0'): self.addDirectoryItem('Genesis Reborn New TV Shows', 'tvshows&url=premiere', 'years.png', 'DefaultRecentlyAddedEpisodes.png') self.addDirectoryItem('Genesis Reborn Channels', 'channels', 'channels.png', 'DefaultMovies.png') self.addDirectoryItem('Genesis Reborn Tools', 'toolNavigator', 'tools.png', 'DefaultAddonProgram.png') downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False if downloads == True: self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png', 'DefaultFolder.png') self.addDirectoryItem('Genesis Reborn Search Menu', 'searchNavigator', 'search.png', 'DefaultFolder.png') self.addDirectoryItem('Join The Private Facebook Group Called - Jesus Box Media Support & Addons', 'ShowChangelog', 'icon.png', 'DefaultFolder.png') self.endDirectory()
def gettoken(self): atime=control.setting("authtime") currentauth=control.setting("currentauth") refreshtoken=True import time now=time.time() try: if not currentauth=="" and not atime=="" and now-float(atime)<(2*60*60): #2 hours return currentauth except: pass if refreshtoken: c_url = "https://api.mobdro.sx/utils/auth" c_headers = {"User-Agent":"Dalvik/1.6.0 (Linux; U; Android 4.2.2;)"} c_data = {'signature':"577195216"} c_data = urllib.urlencode(c_data) # Fetch channel list req = urllib2.Request(c_url, c_data, c_headers) response = urllib2.urlopen(req) response = response.read() results = json.loads(response) token=results["token"] control.set_setting("authtime",str(now)) control.set_setting("currentauth",token) return token
def __init__(self): self.priority = 1 self.language = ['en'] self.domains = ['xmovies8.es'] self.base_link = 'https://xmovies8.es' self.search_link = '/ajax/search.php' self.user = control.setting('moviesplanet.user') self.password = control.setting('moviesplanet.pass')
def __init__(self): self.priority = 1 self.language = ['en'] self.domains = ['gostream.is','gomovies.to','gomovies.sc'] self.base_link = 'https://www3.gomovies.sc/' self.search_link = '/searching-for/%s/' self.user = control.setting('gostream.user') self.password = control.setting('gostream.pass')
def __init__(self): self.library_folder = os.path.join(xbmc.translatePath(control.setting("movie_library")), "") self.check_setting = control.setting("check_movie_link") or "false" self.library_setting = control.setting("update_library") or "true" self.dupe_setting = control.setting("check_library") or "true" self.infoDialog = False
def __init__(self): self.library_folder = os.path.join(control.transPath(control.setting('library.movie')), '') self.check_setting = control.setting('library.check_movie') or 'false' self.library_setting = control.setting('library.update') or 'true' self.dupe_setting = control.setting('library.check') or 'true' self.silentDialog = False self.infoDialog = False
def __init__(self): self.priority = 1 self.language = ['en'] self.domains = ['xmovies8.es'] self.base_link = 'https://xmovies8.es' self.search_link = '/movie/search/%s' self.user = control.setting('gostream.user') self.password = control.setting('gostream.pass')
def account_filter(self, result): if (control.setting('ustvnow_email') == '' or control.setting('ustvnow_pass') == ''): result = re.sub('http(?:s|)://(?:www\.|)ustvnow\.com/.+?<','<', result) if (control.setting('streamlive_user') == '' or control.setting('streamlive_pass') == ''): result = re.sub('http(?:s|)://(?:www\.|)streamlive\.to/.+?<','<', result) return result
def __init__(self): self.pack = True # Checked by provider.py self.priority = 0 self.language = ['un'] self.domains = ['nzbfinder.ws'] self.base_link = 'https://nzbfinder.ws' self.search_link = '/api?t=search&q=%s&extended=1&o=json&apikey=%s' self.enabled = control.setting('accounts.providers.nzbfinder.enabled') == 'true' self.api = control.setting('accounts.providers.nzbfinder.api')
def __init__(self): self.priority = 1 self.language = ['pl'] self.domains = ['segos.es'] self.base_link = 'https://segos.es' self.search_link = '/?search=%s' self.user_name = control.setting('segos.username') self.user_pass = control.setting('segos.password')
def download(name, image, url): from resources.lib.modules import control if url == None: return control.infoDialog(control.lang(30501).encode('utf-8')) try: headers = dict(urlparse.parse_qsl(url.rsplit('|', 1)[1])) except: headers = dict('') url = url.split('|')[0] content = re.compile('(.+?)\sS(\d*)E\d*$').findall(name) transname = name.translate(None, '\/:*?"<>|').strip('.') levels =['../../../..', '../../..', '../..', '..'] if len(content) == 0: dest = control.setting('movie.download.path') dest = control.transPath(dest) for level in levels: try: control.makeFile(os.path.abspath(os.path.join(dest, level))) except: pass control.makeFile(dest) dest = os.path.join(dest, transname) control.makeFile(dest) else: dest = control.setting('tv.download.path') dest = control.transPath(dest) for level in levels: try: control.makeFile(os.path.abspath(os.path.join(dest, level))) except: pass control.makeFile(dest) transtvshowtitle = content[0][0].translate(None, '\/:*?"<>|').strip('.') dest = os.path.join(dest, transtvshowtitle) control.makeFile(dest) dest = os.path.join(dest, 'Season %01d' % int(content[0][1])) control.makeFile(dest) ext = os.path.splitext(urlparse.urlparse(url).path)[1][1:] if not ext in ['mp4', 'mkv', 'flv', 'avi', 'mpg']: ext = 'mp4' dest = os.path.join(dest, transname + '.' + ext) sysheaders = urllib.quote_plus(json.dumps(headers)) sysurl = urllib.quote_plus(url) systitle = urllib.quote_plus(name) sysimage = urllib.quote_plus(image) sysdest = urllib.quote_plus(dest) script = inspect.getfile(inspect.currentframe()) cmd = 'RunScript(%s, %s, %s, %s, %s, %s)' % (script, sysurl, sysdest, systitle, sysimage, sysheaders) xbmc.executebuiltin(cmd)
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.priority = 1 self.language = ['en'] self.domains = ['streamlord.com'] self.base_link = 'http://www.streamlord.com' self.search_link = '/search2.php' # [BUBBLESCODE] self.enabled = control.setting('accounts.providers.streamlord.enabled') == 'true' self.user = control.setting('accounts.providers.streamlord.user') self.password = control.setting('accounts.providers.streamlord.pass')
def downloads(self): movie_downloads = control.setting('movie.download.path') tv_downloads = control.setting('tv.download.path') if len(control.listDir(movie_downloads)[0]) > 0: self.addDirectoryItem(32001, movie_downloads, 'movies.png', 'DefaultMovies.png', isAction=False) if len(control.listDir(tv_downloads)[0]) > 0: self.addDirectoryItem(32002, tv_downloads, 'tvshows.png', 'DefaultTVShows.png', isAction=False) self.endDirectory()
def __init__(self): self.priority = 1 self.language = ['de'] self.domains = ['serienstream.to'] self.base_link = 'https://serienstream.to' self.search_link = '/ajax/search' self.login = control.setting('serienstream.user') self.password = control.setting('serienstream.pass') self.cookie = '' self.user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'
def __init__(self): self.priority = 1 self.language = ['en'] self.domains = ['moviesplanet.is','moviesplanet.tv'] self.base_link = 'https://www.moviesplanet.tv' self.search_link = '/ajax/search.php' # [BUBBLESCODE] self.enabled = control.setting('accounts.providers.moviesplanet.enabled') == 'true' self.user = control.setting('accounts.providers.moviesplanet.user') self.password = control.setting('accounts.providers.moviesplanet.pass')
def __init__(self): self.priority = 1 self.language = ['de'] self.domains = ['seriesever.net'] self.base_link = 'http://seriesever.net' self.search_link = 'service/search?q=%s' self.part_link = 'service/get_video_part' self.login_link = 'service/login' self.user = control.setting('seriesever.user') self.password = control.setting('seriesever.pass')
def __init__(self): self.pack = False # Checked by provider.py self.priority = 0 self.language = ['un'] self.domains = ['api.nzbgeek.info'] self.base_link = 'https://api.nzbgeek.info' self.search_link = '/api?o=json&apikey=%s&minsize=%d' self.movie_link = '&t=movie&imdbid=%s' self.show_link = '&t=tvsearch&tvdbid=%s&season=%d&ep=%d' self.enabled = control.setting('accounts.providers.nzbgeek.enabled') == 'true' self.api = control.setting('accounts.providers.nzbgeek.api')
def channels(self, url): self.url = 'http://vaughnlive.tv/browse/%s&a=mvn&b=%s'%(url,time.time()) if url == 'following': if control.setting('vaughn_user')!='' and control.setting('vaughn_password')!='': return self.get_followed() else: return [] html = client.request(self.url,referer=self.base) channels = re.findall('href=[\"\']([^\"\']+)[\"\'] target=[\"\']_top[\"\']><img src=[\"\']([^\"\']+)[\"\']',html) events = self.__prepare_channels(channels) return events
def __init__(self): self.library_folder = os.path.join(control.transPath(control.setting('library.tv')),'') self.library_setting = control.setting('library.update') or 'true' self.include_unknown = control.setting('library.include_unknown') 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 auth(): email = control.setting("kitsu.user") password = control.setting("kitsu.pass") resp = requests.post("https://kitsu.io/api/oauth/token", params={"grant_type": "password", "username": email, "password": password}) print resp token = json.loads(resp.text)['access_token'] control.setSetting("kitsu.token", token) useridScrobble_resp = requests.get('https://kitsu.io/api/edge/users?filter[self]=true', headers=kitsu_headers()) userid = json.loads(useridScrobble_resp.text)['data'][0]['id'] control.setSetting("kitsu.userid", userid)
def resolve(url): expires = int(control.setting('hrti_expire')) stream_token = control.setting('hrti_token') if expires - int(time.time())<0: stream_token,expires = getToken() if stream_token=='x': return '' control.set_setting('hrti_expire',expires) control.set_setting('hrti_token',stream_token) url += '&token=%s&token_expiration=%s|User-Agent=Mozilla/5.0'%(stream_token,expires) return url
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/>. ''' from schism_commons import quality_tag, google_tag, parseDOM, replaceHTMLCodes, cleantitle_get, cleantitle_get_2, cleantitle_query, get_size, cleantitle_get_full import re, urllib, urlparse, hashlib, random, string, json, base64 from resources.lib.modules import control from resources.lib.modules import cleantitle from resources.lib.modules.common import random_agent import requests from BeautifulSoup import BeautifulSoup alluc_debrid = control.setting('alluc_debrid') alluc_status = control.setting('enable_alluc') alluc_user = control.setting('alluc_username') alluc_pw = control.setting('alluc_password') max_items = int(control.setting('alluc_max_results')) host_string = 'host%3Arapidgator.net%2Cuploaded.net%2Cfilefactory.com' max_result_string = '&count=%s' % max_items # %s&query=%s+host%3Arapidgator.net%2Cuploaded.net%2Cfilefactory.com&count=%s' class source: def __init__(self): self.base_link = 'https://www.alluc.ee' if alluc_debrid == 'true': self.api_link = 'http://www.alluc.ee/api/search/download/?user=%s&password=%s&query=%s' else:
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, os, sys, urllib, urllib2, urlparse, time, threading from resources.lib.modules import control from resources.lib.modules 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)
def getTraktIndicatorsInfo(): indicators = control.setting('indicators') if getTraktCredentialsInfo( ) == False else control.setting('indicators.alt') indicators = True if indicators == '1' else False return indicators
def timeoutsyncTVShows(): timeout = cache.timeout(syncTVShows, control.setting('trakt.user').strip()) return timeout
def sourcesDialog(self, items): try: labels = [i['label'] for i in items] select = control.selectDialog(labels) if select == -1: return 'close://' next = [y for x, y in enumerate(items) if x >= select] prev = [y for x, y in enumerate(items) if x < select][::-1] items = [items[select]] items = [i for i in items + next + prev][:40] header = control.addonInfo('name') header2 = header.upper() progressDialog = control.progressDialog if control.setting( 'progress.dialog') == '0' else control.progressDialogBG progressDialog.create(header, '') progressDialog.update(0) block = None for i in range(len(items)): try: if items[i]['source'] == block: raise Exception() w = workers.Thread(self.sourcesResolve, items[i]) w.start() try: if progressDialog.iscanceled(): break progressDialog.update( int((100 / float(len(items))) * i), str(items[i]['label']), str(' ')) except: progressDialog.update( int((100 / float(len(items))) * i), str(header2), str(items[i]['label'])) m = '' for x in range(3600): try: if xbmc.abortRequested == True: return sys.exit() if progressDialog.iscanceled(): return progressDialog.close() except: pass 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 k = control.condVisibility( 'Window.IsActive(yesnoDialog)') if k: m += '1' m = m[-1] if (w.is_alive() == False or x > 30) and not k: break time.sleep(0.5) for x in range(30): try: if xbmc.abortRequested == True: return sys.exit() if progressDialog.iscanceled(): return progressDialog.close() except: pass if m == '': break 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'] try: progressDialog.close() except: pass control.execute('Dialog.Close(virtualkeyboard)') control.execute('Dialog.Close(yesnoDialog)') return self.url except: pass try: progressDialog.close() except: pass except: try: progressDialog.close() except: pass
(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, urllib, urlparse, random from resources.lib.modules import control from resources.lib.modules import cleantitle from resources.lib.modules import client debridstatus = control.setting('debridsources') from schism_commons import quality_tag, google_tag, parseDOM, replaceHTMLCodes, cleantitle_get, cleantitle_get_2, cleantitle_query, get_size, cleantitle_get_full class source: def __init__(self): self.domains = ['dailyreleases.net'] self.base_link = 'http://dailyreleases.net' self.search_link = '/?s=%s+%s' def movie(self, imdb, title, year): self.genesisreborn_url = [] try: if not debridstatus == 'true': raise Exception() self.genesisreborn_url = [] # print ("DAILYRLS INIT")
# -*- coding: utf-8 -*- import os, sys import xbmc, xbmcaddon, xbmcgui from resources.lib.modules import control from resources.lib.modules import trakt sysaddon = sys.argv[0] syshandle = int(sys.argv[1]) artPath = control.artPath() addonFanart = control.addonFanart() imdbCredentials = False if control.setting('imdb.user') == '' else True traktCredentials = trakt.getTraktCredentialsInfo() traktIndicators = trakt.getTraktIndicatorsInfo() queueMenu = control.lang(32065).encode('utf-8') class navigator: ADDON_ID = xbmcaddon.Addon().getAddonInfo('id') HOMEPATH = xbmc.translatePath('special://home/') ADDONSPATH = os.path.join(HOMEPATH, 'addons') THISADDONPATH = os.path.join(ADDONSPATH, ADDON_ID) LOCALNEWS = os.path.join(THISADDONPATH, 'changelog.txt') def root(self): self.addDirectoryItem('Entertainment', 'entertainment', 'channels.png', 'DefaultTvshows.png') self.addDirectoryItem('Movies', 'movies', 'channels.png', 'DefaultTvshows.png')
# -*- coding: utf-8 -*- ''' Venom Add-on ''' import re import requests from resources.lib.modules import control from resources.lib.modules import cache from resources.lib.modules import client from resources.lib.modules import metacache from resources.lib.modules import workers from resources.lib.modules import log_utils API_key = control.setting('tmdb.api.key') if API_key == '' or API_key is None: API_key = '3320855e65a9758297fec4f7c9717698' disable_fanarttv = control.setting('disable.fanarttv') base_link = 'https://api.themoviedb.org/3/' poster_path = 'https://image.tmdb.org/t/p/w300' fanart_path = 'https://image.tmdb.org/t/p/w1280' def get_request(url): try: try: response = requests.get(url) except requests.exceptions.SSLError:
def play_source(self, title, year, season, episode, imdb, tvdb, url, meta, select=None): try: if url is None: control.cancelPlayback() raise Exception control.sleep(200) self.media_type = 'movie' if season is None or episode is None else 'episode' self.title = title self.year = str(year) if self.media_type == 'movie': self.name = urllib.quote_plus(title) + urllib.quote_plus( ' (%s)' % self.year) self.season = None self.episode = None elif self.media_type == 'episode': self.name = urllib.quote_plus(title) + urllib.quote_plus( ' S%02dE%02d' % (int(season), int(episode))) self.season = '%01d' % int(season) self.episode = '%01d' % int(episode) self.name = urllib.unquote_plus(self.name) self.DBID = None self.imdb = imdb if imdb is not None else '0' self.tvdb = tvdb if tvdb is not None else '0' self.ids = {'imdb': self.imdb, 'tvdb': self.tvdb} self.ids = dict( (k, v) for k, v in self.ids.iteritems() if v != '0') self.meta = meta self.offset = Bookmarks().get(self.name, self.year) poster, thumb, season_poster, fanart, banner, clearart, clearlogo, discart, meta = self.getMeta( meta) item = control.item(path=url) if self.media_type == 'episode': if control.setting('disable.player.art') == 'true': item.setArt({ 'thumb': thumb, 'tvshow.poster': season_poster, 'season.poster': season_poster, 'tvshow.fanart': fanart }) else: item.setArt({ 'tvshow.clearart': clearart, 'tvshow.clearlogo': clearlogo, 'tvshow.discart': discart, 'thumb': thumb, 'tvshow.poster': season_poster, 'season.poster': season_poster, 'tvshow.fanart': fanart }) else: if control.setting('disable.player.art') == 'true': item.setArt({ 'thumb': thumb, 'poster': poster, 'fanart': fanart }) else: item.setArt({ 'clearart': clearart, 'clearlogo': clearlogo, 'discart': discart, 'thumb': thumb, 'poster': poster, 'fanart': fanart }) if self.media_type == 'episode': self.episodeIDS = meta.get('episodeIDS', '0') item.setUniqueIDs(self.episodeIDS) else: item.setUniqueIDs(self.ids) if 'castandart' in meta: item.setCast(meta.get('castandart', '')) item.setInfo(type='video', infoLabels=control.metadataClean(meta)) if 'plugin' not in control.infoLabel( 'Container.PluginName') or select != '1': if control.window.getProperty('infodialogs.active'): control.closeAll() control.resolve(syshandle, True, item) elif select == '1': control.closeAll() control.player.play(url, item) self.keepAlive() control.window.setProperty('script.trakt.ids', json.dumps(self.ids)) control.window.clearProperty('script.trakt.ids') except: log_utils.error() return control.cancelPlayback()
pass from resources.lib.modules import cleantitle, control, playcount, log_utils try: sysaddon = sys.argv[0] syshandle = int(sys.argv[1]) except: pass try: from sqlite3 import dbapi2 as database except: from pysqlite2 import dbapi2 as database notificationSound = False if control.setting( 'notification.sound') == 'false' else True class Player(xbmc.Player): def __init__(self): xbmc.Player.__init__(self) self.play_next_triggered = False self.media_type = None self.offset = '0' self.media_length = 0 self.current_time = 0 self.meta = {} self.playback_started = False self.scrobbled = False self.playback_resumed = False self.av_started = False
def __getTrakt(url, post=None): try: url = urlparse.urljoin(BASE_URL, url) post = json.dumps(post) if post else None headers = { 'Content-Type': 'application/json', 'trakt-api-key': V2_API_KEY, 'trakt-api-version': 2 } if getTraktCredentialsInfo(): headers.update({ 'Authorization': 'Bearer %s' % control.setting('trakt.token') }) result = client.request(url, post=post, headers=headers, output='extended', error=True) resp_code = result[1] resp_header = result[2] result = result[0] if resp_code in [ '500', '502', '503', '504', '520', '521', '522', '524' ]: log_utils.log('Temporary Trakt Error: %s' % resp_code, log_utils.LOGWARNING) return elif resp_code in ['404']: log_utils.log('Object Not Found : %s' % resp_code, log_utils.LOGWARNING) return if resp_code not in ['401', '405']: return result, resp_header oauth = urlparse.urljoin(BASE_URL, '/oauth/token') opost = { 'client_id': V2_API_KEY, 'client_secret': CLIENT_SECRET, 'redirect_uri': REDIRECT_URI, 'grant_type': 'refresh_token', 'refresh_token': control.setting('trakt.refresh') } result = client.request(oauth, post=json.dumps(opost), headers=headers) result = utils.json_loads_as_str(result) token, refresh = result['access_token'], result['refresh_token'] control.setSetting(id='trakt.token', value=token) control.setSetting(id='trakt.refresh', value=refresh) headers['Authorization'] = 'Bearer %s' % token result = client.request(url, post=post, headers=headers, output='extended', error=True) return result[0], result[2] except Exception as e: log_utils.log('Unknown Trakt Error: %s' % e, log_utils.LOGWARNING) pass
""" Venom """ import re import requests import threading from resources.lib.modules import control from resources.lib.modules import cache from resources.lib.modules import client from resources.lib.modules import metacache from resources.lib.modules import workers from resources.lib.modules import log_utils API_key = control.setting('tm.user') if API_key == '' or API_key is None: API_key = '3320855e65a9758297fec4f7c9717698' disable_fanarttv = control.setting('disable.fanarttv') base_link = 'https://api.themoviedb.org' poster_path = 'https://image.tmdb.org/t/p/w300' fanart_path = 'https://image.tmdb.org/t/p/w1280' def get_request(url): try: try: response = requests.get(url) except requests.exceptions.SSLError:
def sources(self, url, hostDict, hostprDict): try: sources = [] if url is None: return sources data = urlparse.parse_qs(url) data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data]) title = data['tvshowtitle'] if 'tvshowtitle' in data else data[ 'title'] hdlr = 's%02de%02d' % (int(data['season']), int( data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s s%02de%02d' % ( data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % ( data['title'], data['year']) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query) url = self.search_link % urllib.quote_plus(query) url = urlparse.urljoin(self.base_link, url).replace('++', '+') r = client.request(url, headers=self.headers) posts = client.parseDOM(r, "div", attrs={"class": "content-fill"}) hostDict = hostprDict + hostDict items = [] for post in posts: try: u = client.parseDOM(post, 'a', ret='href') for i in u: name = str(i) items.append(name) except: pass for item in items: try: i = str(item) i = urlparse.urljoin(self.base_link, i) r = client.request(i, headers=self.headers) u = client.parseDOM(r, "div", attrs={"class": "dl-links"}) for t in u: url = re.compile( 'a href="javascript: dl(.+?)" rel=".+?"').findall( t)[0] url = url.split("('")[1].split("')")[0] if any(x in url for x in ['.rar', '.zip', '.iso']): raise Exception() quality, info = source_utils.get_release_quality( url, url) valid, host = source_utils.is_host_valid(url, hostDict) info = ' | '.join(info) if control.setting('deb.rd_check') == 'true': check = rd_check.rd_deb_check(url) if check: info = 'RD Checked' + ' | ' + info sources.append({ 'source': host, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True }) else: sources.append({ 'source': host, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True }) except: pass return sources except Exception: failure = traceback.format_exc() log_utils.log('---Link4file Testing - Exception: \n' + str(failure)) return sources
def playItem(self, title, source): try: meta = control.window.getProperty(self.metaProperty) meta = json.loads(meta) year = meta['year'] if 'year' in meta else None season = meta['season'] if 'season' in meta else None episode = meta['episode'] if 'episode' in meta else None imdb = meta['imdb'] if 'imdb' in meta else None tvdb = meta['tvdb'] if 'tvdb' in meta else None next = [] prev = [] total = [] for i in range(1, 1000): 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('?', ''))) u = json.loads(u['source'])[0] next.append(u) except: break for i in range(-1000, 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('?', ''))) u = json.loads(u['source'])[0] prev.append(u) except: break items = json.loads(source) items = [i for i in items + next + prev][:40] header = control.addonInfo('name') header2 = header.upper() progressDialog = control.progressDialog if control.setting( 'progress.dialog') == '0' else control.progressDialogBG progressDialog.create(header, '') progressDialog.update(0) block = None for i in range(len(items)): try: try: if progressDialog.iscanceled(): break progressDialog.update( int((100 / float(len(items))) * i), str(items[i]['label']), str(' ')) except: progressDialog.update( int((100 / float(len(items))) * i), str(header2), str(items[i]['label'])) if items[i]['source'] == block: raise Exception() w = workers.Thread(self.sourcesResolve, items[i]) w.start() offset = 60 * 2 if items[i].get( 'source') in self.hostcapDict else 0 m = '' for x in range(3600): try: if xbmc.abortRequested == True: return sys.exit() if progressDialog.iscanceled(): return progressDialog.close() except: pass k = control.condVisibility( 'Window.IsActive(virtualkeyboard)') if k: m += '1' m = m[-1] if (w.is_alive() == False or x > 30 + offset) and not k: break k = control.condVisibility( 'Window.IsActive(yesnoDialog)') if k: m += '1' m = m[-1] if (w.is_alive() == False or x > 30 + offset) and not k: break time.sleep(0.5) for x in range(30): try: if xbmc.abortRequested == True: return sys.exit() if progressDialog.iscanceled(): return progressDialog.close() except: pass if m == '': break 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: progressDialog.close() except: pass control.sleep(200) control.execute('Dialog.Close(virtualkeyboard)') control.execute('Dialog.Close(yesnoDialog)') from resources.lib.modules.player import player player().run(title, year, season, episode, imdb, tvdb, self.url, meta) return self.url except: pass try: progressDialog.close() except: pass self.errorForSources() except: pass
def channelDirectory(self, items): if items == None or len(items) == 0: control.idle() sys.exit() sysaddon = sys.argv[0] syshandle = int(sys.argv[1]) addonPoster, addonBanner = control.addonPoster(), control.addonBanner() addonFanart, settingFanart = control.addonFanart(), control.setting( 'fanart') try: isOld = False control.item().getArt('type') except: isOld = True isPlayable = 'true' if not 'plugin' in control.infoLabel( 'Container.PluginName') else 'false' playbackMenu = control.lang(32063).encode('utf-8') if control.setting( 'hosts.mode') == '2' else control.lang(32064).encode('utf-8') queueMenu = control.lang(32065).encode('utf-8') refreshMenu = control.lang(32072).encode('utf-8') for i in items: try: label = '[B]%s[/B] : %s (%s)' % (i['channel'].upper(), i['title'], i['year']) sysname = urllib.quote_plus('%s (%s)' % (i['title'], i['year'])) systitle = urllib.quote_plus(i['title']) imdb, tmdb, year = i['imdb'], i['tmdb'], i['year'] meta = dict((k, v) for k, v in i.iteritems() if not v == '0') meta.update({ 'code': imdb, 'imdbnumber': imdb, 'imdb_id': imdb }) meta.update({'tmdb_id': tmdb}) meta.update({'mediatype': 'movie'}) meta.update({ 'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname) }) #meta.update({'trailer': 'plugin://script.extendedinfo/?info=playtrailer&&id=%s' % imdb}) meta.update({'playcount': 0, 'overlay': 6}) try: meta.update( {'genre': cleangenre.lang(meta['genre'], self.lang)}) except: pass sysmeta = urllib.quote_plus(json.dumps(meta)) url = '%s?action=play&title=%s&year=%s&imdb=%s&meta=%s&t=%s' % ( sysaddon, systitle, year, imdb, sysmeta, self.systime) sysurl = urllib.quote_plus(url) cm = [] cm.append( (queueMenu, 'RunPlugin(%s?action=queueItem)' % sysaddon)) cm.append( (refreshMenu, 'RunPlugin(%s?action=refresh)' % sysaddon)) cm.append((playbackMenu, 'RunPlugin(%s?action=alterSources&url=%s&meta=%s)' % (sysaddon, sysurl, sysmeta))) if isOld == True: cm.append( (control.lang2(19033).encode('utf-8'), 'Action(Info)')) item = control.item(label=label) art = {} if 'poster2' in i and not i['poster2'] == '0': art.update({ 'icon': i['poster2'], 'thumb': i['poster2'], 'poster': i['poster2'] }) elif 'poster' in i and not i['poster'] == '0': art.update({ 'icon': i['poster'], 'thumb': i['poster'], 'poster': i['poster'] }) else: art.update({ 'icon': addonPoster, 'thumb': addonPoster, 'poster': addonPoster }) art.update({'banner': addonBanner}) if settingFanart == 'true' and 'fanart' in i and not i[ 'fanart'] == '0': item.setProperty('Fanart_Image', i['fanart']) elif not addonFanart == None: item.setProperty('Fanart_Image', addonFanart) item.setArt(art) item.addContextMenuItems(cm) item.setProperty('IsPlayable', isPlayable) item.setInfo(type='Video', infoLabels=meta) video_streaminfo = {'codec': 'h264'} item.addStreamInfo('video', video_streaminfo) control.addItem(handle=syshandle, url=url, listitem=item, isFolder=False) except: pass control.content(syshandle, 'files') control.directory(syshandle, cacheToDisc=True)
def addItem(self, title): control.playlist.clear() items = control.window.getProperty(self.itemProperty) items = json.loads(items) if items == None or len(items) == 0: control.idle() sys.exit() meta = control.window.getProperty(self.metaProperty) meta = json.loads(meta) sysaddon = sys.argv[0] syshandle = int(sys.argv[1]) downloads = True if control.setting('downloads') == 'true' and not ( control.setting('movie.download.path') == '' or control.setting('tv.download.path') == '') else False systitle = sysname = urllib.quote_plus(title) if 'tvshowtitle' in meta and 'season' in meta and 'episode' in meta: sysname += urllib.quote_plus( ' S%02dE%02d' % (int(meta['season']), int(meta['episode']))) elif 'year' in meta: sysname += urllib.quote_plus(' (%s)' % meta['year']) poster = meta['poster3'] if 'poster3' in meta else '0' if poster == '0': poster = meta['poster'] if 'poster' in meta else '0' fanart = meta['fanart2'] if 'fanart2' in meta else '0' if fanart == '0': fanart = meta['fanart'] if 'fanart' in meta else '0' thumb = meta['thumb'] if 'thumb' in meta else '0' if thumb == '0': thumb = poster if thumb == '0': thumb = fanart banner = meta['banner'] if 'banner' in meta else '0' if banner == '0': banner = poster if poster == '0': poster = control.addonPoster() if banner == '0': banner = control.addonBanner() if not control.setting('fanart') == 'true': fanart = '0' if fanart == '0': fanart = control.addonFanart() if thumb == '0': thumb = control.addonFanart() sysimage = urllib.quote_plus(poster.encode('utf-8')) downloadMenu = control.lang(32403).encode('utf-8') for i in range(len(items)): try: label = items[i]['label'] syssource = urllib.quote_plus(json.dumps([items[i]])) sysurl = '%s?action=playItem&title=%s&source=%s' % ( sysaddon, systitle, syssource) cm = [] if downloads == True: cm.append(( downloadMenu, 'RunPlugin(%s?action=download&name=%s&image=%s&source=%s)' % (sysaddon, sysname, sysimage, syssource))) item = control.item(label=label) item.setArt({ 'icon': thumb, 'thumb': thumb, 'poster': poster, 'banner': banner }) item.setProperty('Fanart_Image', fanart) video_streaminfo = {'codec': 'h264'} item.addStreamInfo('video', video_streaminfo) item.addContextMenuItems(cm) item.setInfo(type='Video', infoLabels=meta) control.addItem(handle=syshandle, url=sysurl, listitem=item, isFolder=False) except: pass control.content(syshandle, 'files') control.directory(syshandle, cacheToDisc=True)
# -*- coding: utf-8 -*- from resources.lib.modules import control from resources.lib.modules import updater updateService = control.setting('library.update') control.setSetting(id='first.start', value='true') # FORCE NEW CACHE if updateService != 'false': control.execute( 'RunPlugin(plugin://plugin.video.premiumizer/?action=service)') # class Service(): # def __init__(self, *args): # addonName = 'Premiumize Transfers' # def ServiceEntryPoint(self): # monitor = xbmc.Monitor() # while not monitor.abortRequested(): # # check every 5 mins # if monitor.waitForAbort(100): # # Abort was requested while waiting. We should exit # break # control.execute('RunPlugin(plugin://plugin.video.premiumizer/?action=transferMonitor)') # if transferMonitor !='false': Service().ServiceEntryPoint()
def sourcesFilter(self): provider = control.setting('hosts.sort.provider') quality = control.setting('hosts.quality') if quality == '': quality = '0' captcha = control.setting('hosts.captcha') random.shuffle(self.sources) if provider == 'true': self.sources = sorted(self.sources, key=lambda k: k['provider']) for i in self.sources: if 'checkquality' in i and i['checkquality'] == True: if not i['source'].lower() in self.hosthqDict and i[ 'quality'] not in ['SD', 'SCR', 'CAM']: i.update({'quality': 'SD'}) local = [ i for i in self.sources if 'local' in i and i['local'] == True ] for i in local: i.update({'language': self._getPrimaryLang() or 'en'}) self.sources = [i for i in self.sources if not i in local] filter = [] filter += [i for i in self.sources if i['direct'] == True] filter += [i for i in self.sources if i['direct'] == False] self.sources = filter filter = [] for d in debrid.debrid_resolvers: valid_hoster = set([i['source'] for i in self.sources]) valid_hoster = [i for i in valid_hoster if d.valid_url('', i)] filter += [ dict(i.items() + [('debrid', d.name)]) for i in self.sources if i['source'] in valid_hoster ] filter += [ i for i in self.sources if not i['source'].lower() in self.hostprDict and i['debridonly'] == False ] self.sources = filter filter = [] filter += local if quality in ['0']: filter += [ i for i in self.sources if i['quality'] == '4K' and 'debrid' in i ] if quality in ['0', '1']: filter += [ i for i in self.sources if i['quality'] == '1440p' and 'debrid' in i ] if quality in ['0', '1', '2']: filter += [ i for i in self.sources if i['quality'] == '1080p' and 'debrid' in i ] if quality in ['0', '1', '2', '3']: filter += [ i for i in self.sources if i['quality'] == 'HD' and 'debrid' in i ] if quality in ['0']: filter += [ i for i in self.sources if i['quality'] == '4K' and not 'debrid' in i and 'memberonly' in i ] if quality in ['0', '1']: filter += [ i for i in self.sources if i['quality'] == '1440p' and not 'debrid' in i and 'memberonly' in i ] if quality in ['0', '1', '2']: filter += [ i for i in self.sources if i['quality'] == '1080p' and not 'debrid' in i and 'memberonly' in i ] if quality in ['0', '1', '2', '3']: filter += [ i for i in self.sources if i['quality'] == 'HD' and not 'debrid' in i and 'memberonly' in i ] if quality in ['0']: filter += [ i for i in self.sources if i['quality'] == '4K' and not 'debrid' in i and not 'memberonly' in i ] if quality in ['0', '1']: filter += [ i for i in self.sources if i['quality'] == '1440p' and not 'debrid' in i and not 'memberonly' in i ] if quality in ['0', '1', '2']: filter += [ i for i in self.sources if i['quality'] == '1080p' and not 'debrid' in i and not 'memberonly' in i ] if quality in ['0', '1', '2', '3']: filter += [ i for i in self.sources if i['quality'] == 'HD' and not 'debrid' in i and not 'memberonly' in i ] #filter += [i for i in self.sources if i['quality'] == 'SD'] #if len(filter) < 10: filter += [i for i in self.sources if i['quality'] == 'SCR'] #if len(filter) < 10: filter += [i for i in self.sources if i['quality'] == 'CAM'] filter += [ i for i in self.sources if i['quality'] in ['SD', 'SCR', 'CAM'] ] self.sources = filter if not captcha == 'true': filter = [ i for i in self.sources if i['source'].lower() in self.hostcapDict and not 'debrid' in i ] self.sources = [i for i in self.sources if not i in filter] filter = [ i for i in self.sources if i['source'].lower() in self.hostblockDict and not 'debrid' in i ] self.sources = [i for i in self.sources if not i in filter] multi = [i['language'] for i in self.sources] multi = [x for y, x in enumerate(multi) if x not in multi[:y]] multi = True if len(multi) > 1 else False if multi == True: self.sources = [ i for i in self.sources if not i['language'] == 'en' ] + [i for i in self.sources if i['language'] == 'en'] self.sources = self.sources[:2000] for i in range(len(self.sources)): u = self.sources[i]['url'] p = self.sources[i]['provider'] q = self.sources[i]['quality'] s = self.sources[i]['source'] s = s.rsplit('.', 1)[0] l = self.sources[i]['language'] try: f = (' | '.join([ '[I]%s [/I]' % info.strip() for info in self.sources[i]['info'].split('|') ])) except: f = '' try: d = self.sources[i]['debrid'] except: d = self.sources[i]['debrid'] = '' if not d == '': label = '%02d | [B]%s[/B] | ' % (int(i + 1), d) #if not d == '': label = '%02d | [B]%s[/B] | [B]%s[/B] | ' % (int(i+1), p, d) else: label = '%02d | [B]%s[/B] | ' % (int(i + 1), p) if multi == True and not l == 'en': label += '[B]%s[/B] | ' % l if q in ['4K', '1440p', '1080p', 'HD']: label += '%s | %s | [B][I]%s [/I][/B]' % (s, f, q) elif q == 'SD': label += '%s | %s' % (s, f) else: label += '%s | %s | [I]%s [/I]' % (s, f, q) label = label.replace('| 0 |', '|').replace(' | [I]0 [/I]', '') label = label.replace('[I]HEVC [/I]', 'HEVC') label = re.sub('\[I\]\s+\[/I\]', ' ', label) label = re.sub('\|\s+\|', '|', label) label = re.sub('\|(?:\s+|)$', '', label) self.sources[i]['label'] = label.upper() return self.sources
def setView(content, viewType): ''' Why recode whats allready written and works well, Thanks go to Eldrado for it ''' if content: xbmcplugin.setContent(int(sys.argv[1]), content) if control.setting('auto-view') == 'true': print control.setting(viewType) if control.setting(viewType) == 'Info': VT = '504' elif control.setting(viewType) == 'Info2': VT = '503' elif control.setting(viewType) == 'Info3': VT = '515' elif control.setting(viewType) == 'Fanart': VT = '508' elif control.setting(viewType) == 'Poster Wrap': VT = '501' elif control.setting(viewType) == 'Big List': VT = '51' elif control.setting(viewType) == 'Low List': VT = '724' elif control.setting(viewType) == 'List': VT = '50' elif control.setting(viewType) == 'Default Menu View': VT = control.setting('default-view1') elif control.setting(viewType) == 'Default TV Shows View': VT = control.setting('default-view2') elif control.setting(viewType) == 'Default Episodes View': VT = control.setting('default-view3') elif control.setting(viewType) == 'Default Movies View': VT = control.setting('default-view4') elif control.setting(viewType) == 'Default Docs View': VT = control.setting('default-view5') elif control.setting(viewType) == 'Default Cartoons View': VT = control.setting('default-view6') elif control.setting(viewType) == 'Default Anime View': VT = control.setting('default-view7') print viewType print VT xbmc.executebuiltin("Container.SetViewMode(%s)" % (int(VT)))
def cachesyncTVShows(timeout=0): indicators = cache.get(syncTVShows, timeout, control.setting('trakt.user').strip()) return indicators
def tvDirectory(items): if items == None or len(items) == 0: control.idle() sys.exit() sysaddon = sys.argv[0] syshandle = int(sys.argv[1]) addonPoster, addonBanner = control.addonPoster(), control.addonBanner() addonFanart, settingFanart = control.addonFanart(), control.setting( 'fanart') traktCredentials = trakt.getTraktCredentialsInfo() try: isOld = False control.item().getArt('type') except: isOld = True indicators = playcount.getTVShowIndicators( refresh=True ) if action == 'tvshows' else playcount.getTVShowIndicators() flatten = True if control.setting('flatten.tvshows') == 'true' else False watchedMenu = control.lang(32068) if trakt.getTraktIndicatorsInfo( ) == True else control.lang(32066) unwatchedMenu = control.lang(32069) if trakt.getTraktIndicatorsInfo( ) == True else control.lang(32067) queueMenu = control.lang(32065) traktManagerMenu = control.lang(32070) nextMenu = control.lang(32053) playRandom = control.lang(32535) addToLibrary = control.lang(32551) remoteManagerMenu = 'Remote Library' for i in items: try: label = i['title'] systitle = sysname = urllib.parse.quote_plus(i['originaltitle']) sysimage = urllib.parse.quote_plus(i['poster']) imdb, tvdb, year = i['imdb'], i['tvdb'], i['year'] meta = dict((k, v) for k, v in i.items() if not v == '0') meta.update({'code': imdb, 'imdbnumber': imdb, 'imdb_id': imdb}) meta.update({'tvdb_id': tvdb}) meta.update({'mediatype': 'tvshow'}) meta.update({ 'trailer': '%s?action=trailer&name=%s' % (sysaddon, urllib.parse.quote_plus(label)) }) if not 'duration' in i: meta.update({'duration': '60'}) elif i['duration'] == '0': meta.update({'duration': '60'}) try: meta.update({'duration': str(int(meta['duration']) * 60)}) except: pass try: meta.update( {'genre': cleangenre.lang(meta['genre'], self.lang)}) except: pass try: overlay = int(playcount.getTVShowOverlay(indicators, tvdb)) # #print ("realizer OVERLAY", label, overlay) if overlay == 7: meta.update({'playcount': 1, 'overlay': 7}) else: meta.update({'playcount': 0, 'overlay': 6}) except: pass sysmeta = urllib.parse.quote_plus(json.dumps(meta)) if flatten == True: url = '%s?action=episodes&tvshowtitle=%s&year=%s&imdb=%s&tvdb=%s' % ( sysaddon, systitle, year, imdb, tvdb) else: url = '%s?action=seasons&tvshowtitle=%s&year=%s&imdb=%s&tvdb=%s&meta=%s' % ( sysaddon, systitle, year, imdb, tvdb, sysmeta) cm = [] cm.append(( playRandom, 'RunPlugin(%s?action=random&rtype=season&tvshowtitle=%s&year=%s&imdb=%s&tvdb=%s)' % (sysaddon, urllib.parse.quote_plus(systitle), urllib.parse.quote_plus(year), urllib.parse.quote_plus(imdb), urllib.parse.quote_plus(tvdb)))) cm.append((queueMenu, 'RunPlugin(%s?action=queueItem)' % sysaddon)) cm.append(( watchedMenu, 'RunPlugin(%s?action=tvPlaycount&name=%s&imdb=%s&tvdb=%s&season=0&query=7)' % (sysaddon, systitle, imdb, tvdb))) cm.append(( unwatchedMenu, 'RunPlugin(%s?action=tvPlaycount&name=%s&imdb=%s&tvdb=%s&season=0&query=6)' % (sysaddon, systitle, imdb, tvdb))) cm.append(( remoteManagerMenu, 'RunPlugin(%s?action=remoteManager&imdb=%s&tvdb=%s&meta=%s&content=tv)' % (sysaddon, imdb, tvdb, sysmeta))) if not action == 'tvFavourites': cm.append(( 'Add to Watchlist', 'RunPlugin(%s?action=addFavourite&meta=%s&content=tvshows)' % (sysaddon, sysmeta))) if action == 'tvFavourites': cm.append(( 'Remove From Watchlist', 'RunPlugin(%s?action=deleteFavourite&meta=%s&content=tvshows)' % (sysaddon, sysmeta))) # if not action == 'tvdbFav':cm.append(('Add To Tvdb', 'RunPlugin(%s?action=tvdbAdd&tvshowtitle=%s&tvdb=%s)' % (sysaddon, systitle, tvdb))) # if action == 'tvdbFav': cm.append(('Remove From Tvdb', 'RunPlugin(%s?action=tvdbRemove&tvdb=%s)' % (sysaddon, tvdb))) if traktCredentials == True: cm.append(( traktManagerMenu, 'RunPlugin(%s?action=traktManager&name=%s&tvdb=%s&content=tvshow)' % (sysaddon, sysname, tvdb))) if isOld == True: cm.append((control.lang2(19033), 'Action(Info)')) cm.append(( addToLibrary, 'RunPlugin(%s?action=tvshowToLibrary&tvshowtitle=%s&year=%s&imdb=%s&tvdb=%s&icon=%s)' % (sysaddon, systitle, year, imdb, tvdb, i['poster']))) item = control.item(label=label) art = {} if 'poster' in i and not i['poster'] == '0': art.update({ 'icon': i['poster'], 'thumb': i['poster'], 'poster': i['poster'] }) #elif 'poster2' in i and not i['poster2'] == '0': #art.update({'icon': i['poster2'], 'thumb': i['poster2'], 'poster': i['poster2']}) else: art.update({ 'icon': addonPoster, 'thumb': addonPoster, 'poster': addonPoster }) if 'banner' in i and not i['banner'] == '0': art.update({'banner': i['banner']}) #elif 'banner2' in i and not i['banner2'] == '0': #art.update({'banner': i['banner2']}) elif 'fanart' in i and not i['fanart'] == '0': art.update({'banner': i['fanart']}) else: art.update({'banner': addonBanner}) if 'clearlogo' in i and not i['clearlogo'] == '0': art.update({'clearlogo': i['clearlogo']}) if 'clearart' in i and not i['clearart'] == '0': art.update({'clearart': i['clearart']}) if settingFanart == 'true' and 'fanart' in i and not i[ 'fanart'] == '0': item.setProperty('Fanart_Image', i['fanart']) #elif settingFanart == 'true' and 'fanart2' in i and not i['fanart2'] == '0': #item.setProperty('Fanart_Image', i['fanart2']) elif not addonFanart == None: item.setProperty('Fanart_Image', addonFanart) item.setArt(art) item.addContextMenuItems(cm) item.setInfo(type='Video', infoLabels=meta) video_streaminfo = {'codec': 'h264'} item.addStreamInfo('video', video_streaminfo) control.addItem(handle=syshandle, url=url, listitem=item, isFolder=True) except: pass control.content(syshandle, 'tvshows') control.directory(syshandle, cacheToDisc=True)
def movieDirectory(items): if items == None or len(items) == 0: control.idle() sys.exit() sysaddon = sys.argv[0] syshandle = int(sys.argv[1]) addonPoster, addonBanner = control.addonPoster(), control.addonBanner() addonFanart, settingFanart = control.addonFanart(), control.setting( 'fanart') traktCredentials = trakt.getTraktCredentialsInfo() try: isOld = False control.item().getArt('type') except: isOld = True isPlayable = 'true' if not 'plugin' in control.infoLabel( 'Container.PluginName') else 'false' indicators = playcount.getMovieIndicators( refresh=True) if action == 'movies' else playcount.getMovieIndicators( ) playbackMenu = control.lang(32063) if control.setting( 'hosts.mode') == '2' else control.lang(32064) watchedMenu = control.lang(32066) unwatchedMenu = control.lang(32067) queueMenu = control.lang(32065) traktManagerMenu = control.lang(32070) remoteManagerMenu = 'Remote Library' nextMenu = control.lang(32053) addToLibrary = control.lang(32551) for i in items: try: label = '%s' % (i['title']) imdb, tmdb, title, year = i['imdb'], i['tmdb'], i[ 'originaltitle'], i['year'] sysname = urllib.parse.quote_plus('%s (%s)' % (title, year)) systitle = urllib.parse.quote_plus(title) meta = dict((k, v) for k, v in i.items() if not v == '0') meta.update({'code': imdb, 'imdbnumber': imdb, 'imdb_id': imdb}) meta.update({'tmdb_id': tmdb}) meta.update({'mediatype': 'movie'}) meta.update({ 'trailer': '%s?action=trailer&name=%s' % (sysaddon, urllib.parse.quote_plus(label)) }) #meta.update({'trailer': 'plugin://script.extendedinfo/?info=playtrailer&&id=%s' % imdb}) if not 'duration' in i: meta.update({'duration': '120'}) elif i['duration'] == '0': meta.update({'duration': '120'}) try: meta.update({'duration': str(int(meta['duration']) * 60)}) except: pass try: meta.update( {'genre': cleangenre.lang(meta['genre'], self.lang)}) except: pass poster = [ i[x] for x in ['poster3', 'poster', 'poster2'] if i.get(x, '0') != '0' ] poster = poster[0] if poster else addonPoster meta.update({'poster': poster}) #print(("MOVIE DIRECTORY META", meta)) sysmeta = urllib.parse.quote_plus(json.dumps(meta)) url = '%s?action=play&title=%s&year=%s&imdb=%s&meta=%s' % ( sysaddon, systitle, year, imdb, sysmeta) sysurl = urllib.parse.quote_plus(url) path = '%s?action=play&title=%s&year=%s&imdb=%s' % ( sysaddon, systitle, year, imdb) #print(("MOVIE DIRECTORY 2", i)) cm = [] cm.append((queueMenu, 'RunPlugin(%s?action=queueItem)' % sysaddon)) try: overlay = int(playcount.getMovieOverlay(indicators, imdb)) if overlay == 7: cm.append(( 'Marks As Unwatched', 'RunPlugin(%s?action=moviePlaycount&imdb=%s&query=6)' % (sysaddon, imdb))) meta.update({'playcount': 1, 'overlay': 7}) else: cm.append(( 'Marks As Watched', 'RunPlugin(%s?action=moviePlaycount&imdb=%s&query=7)' % (sysaddon, imdb))) meta.update({'playcount': 0, 'overlay': 6}) except: pass cm.append(( remoteManagerMenu, 'RunPlugin(%s?action=remoteManager&imdb=%s&tmdb=%s&meta=%s&content=movie)' % (sysaddon, imdb, tmdb, sysmeta))) if traktCredentials == True: cm.append(( traktManagerMenu, 'RunPlugin(%s?action=traktManager&name=%s&imdb=%s&content=movie)' % (sysaddon, sysname, imdb))) cm.append((playbackMenu, 'RunPlugin(%s?action=alterSources&url=%s&meta=%s)' % (sysaddon, sysurl, sysmeta))) if isOld == True: cm.append((control.lang2(19033), 'Action(Info)')) cm.append(( addToLibrary, 'RunPlugin(%s?action=movieToLibrary&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s&icon=%s)' % (sysaddon, sysname, systitle, year, imdb, tmdb, poster))) item = control.item(label=label) art = {} art.update({'icon': poster, 'thumb': poster, 'poster': poster}) if 'banner' in i and not i['banner'] == '0': art.update({'banner': i['banner']}) else: art.update({'banner': addonBanner}) if 'clearlogo' in i and not i['clearlogo'] == '0': art.update({'clearlogo': i['clearlogo']}) if 'clearart' in i and not i['clearart'] == '0': art.update({'clearart': i['clearart']}) if settingFanart == 'true' and 'fanart2' in i and not i[ 'fanart2'] == '0': item.setProperty('Fanart_Image', i['fanart2']) elif settingFanart == 'true' and 'fanart' in i and not i[ 'fanart'] == '0': item.setProperty('Fanart_Image', i['fanart']) elif not addonFanart == None: item.setProperty('Fanart_Image', addonFanart) #print(("MOVIE DIRECTORY 4", i)) item.setArt(art) #print(("MOVIE DIRECTORY 5", i)) item.addContextMenuItems(cm) #print(("MOVIE DIRECTORY 6", i)) item.setProperty('IsPlayable', isPlayable) #print(("MOVIE DIRECTORY 7", meta)) item.setInfo(type='Video', infoLabels=meta) #print(("MOVIE DIRECTORY 8", i)) video_streaminfo = {'codec': 'h264'} item.addStreamInfo('video', video_streaminfo) #print(("MOVIE DIRECTORY FINAL", i)) control.addItem(handle=syshandle, url=url, listitem=item, isFolder=False) except: pass control.content(syshandle, 'movies') control.directory(syshandle, cacheToDisc=True)
def getSources(self, title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, timeout=30): progressDialog = control.progressDialog if control.setting( 'progress.dialog') == '0' else control.progressDialogBG progressDialog.create(control.addonInfo('name'), '') progressDialog.update(0) self.prepareSources() sourceDict = self.sourceDict content = 'movie' if tvshowtitle == None else 'episode' if content == 'movie': sourceDict = [(i[0], i[1], getattr(i[1], 'movie', None)) for i in sourceDict] genres = trakt.getGenre('movie', 'imdb', imdb) else: sourceDict = [(i[0], i[1], getattr(i[1], 'tvshow', None)) for i in sourceDict] genres = trakt.getGenre('show', 'tvdb', tvdb) sourceDict = [(i[0], i[1], i[2]) for i in sourceDict if not hasattr(i[1], 'genre_filter') or not i[1].genre_filter or any(x in i[1].genre_filter for x in genres)] sourceDict = [(i[0], i[1]) for i in sourceDict if not i[2] == None] language = self.getLanguage() sourceDict = [(i[0], i[1], i[1].language) for i in sourceDict] sourceDict = [(i[0], i[1]) for i in sourceDict if any(x in i[2] for x in language)] try: sourceDict = [(i[0], i[1], control.setting('provider.' + i[0])) for i in sourceDict] except: sourceDict = [(i[0], i[1], 'true') for i in sourceDict] sourceDict = [(i[0], i[1]) for i in sourceDict if not i[2] == 'false'] sourceDict = [(i[0], i[1], i[1].priority) for i in sourceDict] threads = [] if content == 'movie': title = self.getTitle(title) localtitle = self.getLocalTitle(title, imdb, tvdb, content) aliases = self.getAliasTitles(imdb, localtitle, content) for i in sourceDict: threads.append( workers.Thread(self.getMovieSource, title, localtitle, aliases, year, imdb, i[0], i[1])) else: tvshowtitle = self.getTitle(tvshowtitle) localtvshowtitle = self.getLocalTitle(tvshowtitle, imdb, tvdb, content) aliases = self.getAliasTitles(imdb, localtvshowtitle, content) for i in sourceDict: threads.append( workers.Thread(self.getEpisodeSource, title, year, imdb, tvdb, season, episode, tvshowtitle, localtvshowtitle, aliases, premiered, i[0], i[1])) s = [i[0] + (i[1], ) for i in zip(sourceDict, threads)] s = [(i[3].getName(), i[0], i[2]) for i in s] mainsourceDict = [i[0] for i in s if i[2] == 0] sourcelabelDict = dict([(i[0], i[1].upper()) for i in s]) [i.start() for i in threads] string1 = control.lang(32404).encode('utf-8') string2 = control.lang(32405).encode('utf-8') string3 = control.lang(32406).encode('utf-8') try: timeout = int(control.setting('scrapers.timeout.1')) except: pass for i in range(0, (timeout * 2) + 60): try: if xbmc.abortRequested == True: return sys.exit() try: info = [ sourcelabelDict[x.getName()] for x in threads if x.is_alive() == True ] except: info = [] timerange = int(i * 0.5) try: if progressDialog.iscanceled(): break except: pass try: string4 = "We are searching multiple scrapers and gathering links for: [COLOR red][B]%s (%s)[/COLOR][/B] - Time Elapsed: [COLOR ghostwhite]%s Seconds[/COLOR]" % ( title, year, str(timerange)) string5 = '' progressDialog.update( int((100 / float(len(threads))) * len([x for x in threads if x.is_alive() == False])), str(string4), str(string5)) except: pass is_alive = [x.is_alive() for x in threads] if all(x == False for x in is_alive): break if timerange >= timeout: is_alive = [ x for x in threads if x.is_alive() == True and x.getName() in mainsourceDict ] if not is_alive: break time.sleep(0.5) except: pass try: progressDialog.close() except: pass self.sourcesFilter() return self.sources
def getTraktCredentialsInfo(): user = control.setting('trakt.user').strip() token = control.setting('trakt.token') refresh = control.setting('trakt.refresh') if (user == '' or token == '' or refresh == ''): return False return True
premiered = params.get('premiered') type = params.get('type') url = params.get('url') image = params.get('image') meta = params.get('meta') art = params.get('art') select = params.get('select') query = params.get('query') source = params.get('source') content = params.get('content') table = params.get('table') list_name = params.get('list_name') windowedtrailer = params.get('windowedtrailer') windowedtrailer = int(windowedtrailer) if windowedtrailer in ("0", "1") else 0 notificationSound = False if control.setting( 'notification.sound') == 'false' else True if action is None: from resources.lib.menus import navigator from resources.lib.modules import cache run = control.setting('first.info') if run == '': run = 'true' #clean install scenerio if cache._find_cache_version(): run = 'true' if run == 'true': control.execute( 'RunPlugin(plugin://plugin.video.firefly/?action=cleanSettings)') from resources.lib.modules import changelog changelog.get() control.setSetting(id='first.info', value='false')
def __init__(self): self.token = control.setting('alldebrid.token') self.timeout = 15.0 self.server_notifications = True
def sourcesDirect(self, items): filter = [ i for i in items if i['source'].lower() in self.hostcapDict and i['debrid'] == '' ] items = [i for i in items if not i in filter] filter = [ i for i in items if i['source'].lower() in self.hostblockDict and i['debrid'] == '' ] items = [i for i in items if not i in filter] items = [ i for i in items if ('autoplay' in i and i['autoplay'] == True) or not 'autoplay' in i ] if control.setting('autoplay.sd') == 'true': items = [ i for i in items if not i['quality'] in ['4K', '1440p', '1080p', 'HD'] ] u = None header = control.addonInfo('name') header2 = header.upper() try: control.sleep(1000) progressDialog = control.progressDialog if control.setting( 'progress.dialog') == '0' else control.progressDialogBG progressDialog.create(header, '') progressDialog.update(0) except: pass for i in range(len(items)): try: if progressDialog.iscanceled(): break progressDialog.update(int((100 / float(len(items))) * i), str(items[i]['label']), str(' ')) except: progressDialog.update(int((100 / float(len(items))) * i), str(header2), str(items[i]['label'])) try: if xbmc.abortRequested == True: return sys.exit() url = self.sourcesResolve(items[i]) if u == None: u = url if not url == None: break except: pass try: progressDialog.close() except: pass return u
import requests import sys try: #Py2 from urllib import quote_plus except ImportError: #Py3 from urllib.parse import quote_plus from resources.lib.modules import cache from resources.lib.modules import control from resources.lib.modules import log_utils from resources.lib.modules.source_utils import supported_video_extensions base_url = 'https://api.alldebrid.com/v4/' user_agent = 'Venom%20for%20Kodi' ad_icon = control.joinPath(control.artPath(), 'alldebrid.png') addonFanart = control.addonFanart() store_to_cloud = control.setting('alldebrid.saveToCloud') == 'true' class AllDebrid: name = "AllDebrid" def __init__(self): self.token = control.setting('alldebrid.token') self.timeout = 15.0 self.server_notifications = True def _get(self, url, url_append=''): response = None try: if self.token == '': return None
def download(name, image, url): if url == None: return from resources.lib.modules import control try: headers = dict(urlparse.parse_qsl(url.rsplit('|', 1)[1])) except: headers = dict('') url = url.split('|')[0] content = re.compile('(.+?)\sS(\d*)E\d*$').findall(name) transname = name.translate(None, '\/:*?"<>|').strip('.') levels = ['../../../..', '../../..', '../..', '..'] if len(content) == 0: dest = control.setting('movie.download.path') dest = control.transPath(dest) for level in levels: try: control.makeFile(os.path.abspath(os.path.join(dest, level))) except: pass control.makeFile(dest) dest = os.path.join(dest, transname) control.makeFile(dest) else: dest = control.setting('tv.download.path') dest = control.transPath(dest) for level in levels: try: control.makeFile(os.path.abspath(os.path.join(dest, level))) except: pass control.makeFile(dest) transtvshowtitle = content[0][0].translate(None, '\/:*?"<>|').strip('.') dest = os.path.join(dest, transtvshowtitle) control.makeFile(dest) dest = os.path.join(dest, 'Season %01d' % int(content[0][1])) control.makeFile(dest) ext = os.path.splitext(urlparse.urlparse(url).path)[1][1:] if not ext in ['mp4', 'mkv', 'flv', 'avi', 'mpg']: ext = 'mp4' dest = os.path.join(dest, transname + '.' + ext) sysheaders = urllib.quote_plus(json.dumps(headers)) sysurl = urllib.quote_plus(url) systitle = urllib.quote_plus(name) sysimage = urllib.quote_plus(image) sysdest = urllib.quote_plus(dest) script = inspect.getfile(inspect.currentframe()) cmd = 'RunScript(%s, %s, %s, %s, %s, %s)' % ( script, sysurl, sysdest, systitle, sysimage, sysheaders) xbmc.executebuiltin(cmd)
from resources.lib.modules import utils from resources.lib.modules import control from resources.lib.api import trakt from resources.lib.modules import client from resources.lib.modules import playcount from resources.lib.modules.log_utils import debug import requests params = dict(urlparse.parse_qsl(sys.argv[2].replace( '?', ''))) if len(sys.argv) > 1 else dict() action = params.get('action') addonPoster, addonBanner = control.addonPoster(), control.addonBanner() addonFanart, settingFanart = control.addonFanart(), control.setting('fanart') traktCredentials = trakt.getTraktCredentialsInfo() DBURL = control.setting('remotedb.url') def manager(imdb, tmdbtvdb, meta, content): try: if DBURL == None or DBURL == '': control.infoDialog('RemoteDB Address is Empty...', time=3000) return HOSTDB = str(DBURL) DBLINK = str(HOSTDB) + "/library.php?action=%s" # #print("DATABASE REMOTE", DBLINK) if imdb == '' or imdb == '0' or imdb == None: raise Exception()