def __init__(self): self._settings = {} self.service = 'furk' self.name = 'furk.net' self.referrer = 'http://furk.net' self.base_url = 'https://www.furk.net/api' self.api_key = "" self.username = plugin.get_setting(self.service + '_username') self.password = plugin.get_setting(self.service + '_password') self.require_auth = True self.skip_pretest = True self.get_debrid_hosts()
def __init__(self): self._settings = {} self.service = 'alluc_api' self.name = 'alluc.ee' self.referrer = 'http://www.alluc.ee' self.base_url = 'http://www.alluc.ee' self.username = plugin.get_setting(self.service + '_username') self.password = plugin.get_setting(self.service + '_password') self.language = plugin.get_setting(self.service + '_language') self.max_results = 50 self.require_auth = True self.domains = None self.get_debrid_hosts()
def prepair_query(self, media, *args, **kwards): self.max_results = int(plugin.get_setting( 'max_results')) if plugin.get_setting('max_results') != '' else 100 uri = "?%s" params = {"from": 0, "count": self.max_results, "getmeta": 0} params['user'] = self.username params['password'] = self.password if media == 'tvshow': params['query'] = "%s S%sE%s" % args elif media == 'quick': params['query'] = args[0] else: params['query'] = "%s %s" % args if self.language: params['query'] = params['query'] + ' lang:' + self.language return uri % urllib.urlencode(params)
def onClick(self, controlID): if controlID == CONTROLS.CLOSE: self._close() elif controlID == CONTROLS.SHOWS: liz = self.getControl(CONTROLS.SHOWS).getSelectedItem() params = { "mode": "play_episode", "media_type": "stream", "showtitle": liz.getProperty('showtitle'), "display": liz.getProperty('showtitle'), "imdb_id": liz.getProperty('imdb_id'), "slug": liz.getProperty('slug'), "season": liz.getProperty('season'), "episode": liz.getProperty('episode'), "year": 2001 } plugin.set_property('Resume.Page', PLUGIN_URL) plugin.set_property('Resume.imdb_id', liz.getProperty('imdb_id')) plugin_url = plugin.build_plugin_url(params) self.close() if plugin.get_setting('custom_stream_dialog') == 'true': plugin.execute_url(plugin_url) else: plugin.play_url(plugin_url)
def onInit(self): lists = trakt.get_custom_lists() items = [] default_list = plugin.get_setting('default_list') for li in lists: icon = 'checked.png' if li['ids']['slug'] == default_list else '' liz = xbmcgui.ListItem(li['name'], iconImage=icon) liz.setProperty("slug", li['ids']['slug']) items.append(liz) self.getControl(CONTROLS.LISTS).addItems(items)
def validate_transmogrifier(): try: installed = plugin.get_condition_visiblity( 'System.HasAddon(service.transmogrifier)') == 1 if installed: return plugin.get_setting( 'enable_transmogrifier', addon_id='service.transmogrifier') == "true" else: return False except: return False
def start(self): if not str2bool(plugin.get_setting('enable_playback_service')): return monitor = xbmc.Monitor() self.log("DHCR Service Starting...") self.startup_log() if plugin.get_setting('enable_fanart_proxy') == 'true': CONTROL_PORT = int(plugin.get_setting('control_port')) if plugin.get_setting('network_bind') == 'Localhost': address = "127.0.0.1" else: address = "0.0.0.0" self.log("Launching Fanart WebInterface on: %s:%s" % (address, CONTROL_PORT)) server_class = ThreadedHTTPServer httpd = server_class((address, CONTROL_PORT), RequestHandler) webserver = Thread(target=httpd.serve_forever) webserver.start() info = Thread(target=infoMonitor) info.start() if is_depricated: while not xbmc.abortRequested: if self.isPlaying() and self.__tracking: self.__current_time = self.getTime() self.__total_time = self.getTotalTime() xbmc.sleep(1000) else: while not monitor.abortRequested(): if monitor.waitForAbort(1): break if self.isPlaying() and self.__tracking: self.__current_time = self.getTime() self.__total_time = self.getTotalTime() self.log("Service stopping...")
import re import json import urllib import urllib2 from dudehere.routines import * from dudehere.routines import plugin from dudehere.routines.trakt import TraktAPI base_url = "http://%s:6544" % plugin.get_setting('mythtv_host') def search(filename): trakt = TraktAPI() pattern = '\/Default\/([^\/]+)\/.*,\s(\d+_\d+)\.pvr' match = re.search(pattern, filename) if match: title, ts = match.groups() else: plugin.log(filename) return False, False, False, False slug = False imdb_id = False response = _call('/Dvr/GetRecordedList') test = ts.replace('_', '') for r in response['ProgramList']['Programs']: if r['Title'] == title and test in r['FileName']: season = int(r['Season']) episode = int(r['Episode']) tvdb_id = r['Inetref'] imdb_id = trakt.translate_id(tvdb_id, "tvdb", "imdb", "show") break
def request(self, uri, params=None, query=None, headers=None, timeout=None, cache=False, append_base=True, get_redirect=False, test_stream=False): if plugin.get_setting("overide_scraper_%s" % self.service) == 'true': self.base_url = plugin.get_setting("base_url_scraper_%s" % self.service) self.name = plugin.get_setting("name_scraper_%s" % self.service) self.timeout = plugin.get_setting("timeout_scraper_%s" % self.service) COOKIE_JAR = vfs.join(COOKIE_PATH, self.service + '.lwp') net = NetLib(cookie_file=COOKIE_JAR) net._cjf = COOKIE_JAR net.get_redirect = get_redirect net.test_stream = test_stream if headers: if 'Referer' not in headers.keys(): headers['Referer'] = self.referrer if 'Accept' not in headers.keys(): headers['Accept'] = self.accept if 'User-Agent' not in headers.keys(): headers['User-Agent'] = self.get_user_agent() else: headers = { 'Referer': self.referrer, 'Accept': self.accept, 'User-Agent': self.user_agent } if query: uri += "?" + urllib.urlencode(query) if append_base: base_url = self.base_url url = urljoin(base_url, uri) else: url = uri if url is None: return '' if timeout is None: timeout = self.timeout if cache: cache_hash = hashlib.md5( str(url) + str(params) if params else str(url)).hexdigest() cache_file = vfs.join(CACHE_PATH, cache_hash) if vfs.exists(cache_file): temp = vfs.read_file(cache_file + '.ts') if (time.time() - vfs.get_stat(cache_file).st_ctime()) / 60 > int(temp): vfs.rm(cache_file, quiet=True) vfs.rm(cache_file + '.ts', quiet=True) else: html = zlib.decompress(vfs.read_file(cache_file)) return html if params: html = net.post(url, params, headers=headers, timeout=timeout) else: html = net.get(url, headers=headers, timeout=timeout) if cache: output = html.encode('utf-8') if type(html) == unicode else html vfs.write_file(cache_file, zlib.compress(output)) vfs.write_file(cache_file + '.ts', str(cache)) net.save_cookies(COOKIE_JAR) return html
def onInit(self): self.getControl(CONTROLS.WORKING).setVisible(True) self.getControl(CONTROLS.SHOWS).reset() resume_imdb_id = plugin.get_property('Resume.imdb_id') resume_index = None plugin.clear_property('Resume.imdb_id') default_list = plugin.get_setting("default_trakt_list") if plugin.get_arg('slug'): shows = trakt.get_progress(plugin.get_arg('slug')) elif default_list: shows = trakt.get_progress(default_list) else: lists = trakt.get_custom_lists() shows = [] for li in lists: shows += trakt.get_progress(li['ids']['slug']) total_episodes = 0 watched_episodes = 0 regex = re.compile("^(A )|(An )|(The )", re.IGNORECASE) def sort_show(show): title = regex.sub('', show['show']['title'], re.IGNORECASE) return title.lower() shows.sort(key=lambda k: sort_show(k)) for show in shows: if int(show['progress']['show']['percent']) == 1: continue liz = xbmcgui.ListItem('[B]' + show['show']['title'] + '[/B]') progress = "%s of %s" % (show['progress']['show']['watched'], show['progress']['show']['total']) percent = "progress/%s.png" % int( show['progress']['show']['percent'] * 100) if show['progress']['next']: if show['show']['ids']['imdb'] == resume_imdb_id: resume_index = self.getControl(CONTROLS.SHOWS).size() episode = show['episodes'][show['progress']['next']['season']][ show['progress']['next']['number'] - 1] next = "%sx%s - %s" % (show['progress']['next']['season'], show['progress']['next']['number'], show['progress']['next']['title']) liz.setProperty("next", next) liz.setProperty("description", episode['overview']) liz.setProperty("imdb_id", show['show']['ids']['imdb']) liz.setProperty("trakt_id", str(show['progress']['next']['ids']['trakt'])) liz.setProperty("slug", show['show']['ids']['slug']) liz.setProperty("showtitle", show['show']['title']) liz.setProperty("season", str(show['progress']['next']['season'])) liz.setProperty("episode", str(show['progress']['next']['number'])) liz.setProperty("fanart", show['show']['images']['fanart']['full']) screenshot = episode['images']['screenshot']['thumb'] if not screenshot: screenshot = 'off_air.jpg' liz.setIconImage(screenshot) else: continue liz.setProperty("seasons", "Seasons: %s" % show['season_count']) liz.setProperty("progress", progress) liz.setProperty("percent", percent) total_episodes += show['progress']['show']['total'] watched_episodes += show['progress']['show']['watched'] self.getControl(CONTROLS.SHOWS).addItem(liz) if resume_index is not None: self.getControl(CONTROLS.SHOWS).selectItem(resume_index) progress = "%s of %s" % (watched_episodes, total_episodes) self.getControl(CONTROLS.TOTALS).setLabel(progress) self.getControl(CONTROLS.WORKING).setVisible(False)
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 urllib import json import requests from dudehere.routines import * from dudehere.routines import plugin _user_agent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1' _accept = 'application/json,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' _headers = {"User-Agent": _user_agent, "Content-Type": "application/json"} TMDB_KEY = plugin.get_setting('tmdb_api_key', addon_id="script.module.dudehere.routines") TVDB_KEY = plugin.get_setting('tvdb_api_key', addon_id="script.module.dudehere.routines") FANART_KEY = plugin.get_setting('fanarttv_api_key', addon_id="script.module.dudehere.routines") DISABLE_FANART = plugin.get_setting('enable_fanart') == "false" DISABLE_FANART_SERIES = plugin.get_setting('enable_series_fanart') == "false" DISABLE_FANART_EPISODES = plugin.get_setting( 'enable_episode_fanart') == "false" DISABLE_FANART_MOVIES = plugin.get_setting('enable_movie_fanart') == "false" DISABLE_FANARTTV = plugin.get_setting('enable_fanarttv') == "false" DISABLE_TVDB = plugin.get_setting('enable_tvdb') == "false" DISABLE_TMDB = plugin.get_setting('enable_tmdb') == "false" DISABLE_TVMAZE = plugin.get_setting('enable_tvmaze') == "false" DISABLE_OIMDB = plugin.get_setting('enable_oimdbapi') == "false"