def letter(self, letter): type = self.get("type") if letter == "%23": letter = 1 if type == 'series': obj = http.get("%s/?type=series&letter=%s&lang=%s" % (const.SERVICE_URL, letter, const.LANG)) for video in obj: self.item_list.append( DirectoryItem( "%s [%s]" % (video['title'], const.LANG_CODES[video['lang']]), "?mode=seasons&title=%s" % (video['urlTerm']), "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm']) ) ) elif type == 'movies' or type == 'documentations': obj = http.get("%s/?type=%s&letter=%s&lang=%s" % (const.SERVICE_URL, type, letter, const.LANG)) for video in obj: self.item_list.append( VideoItem( "%s [%s]" % (video['title'], const.LANG_CODES[video['lang']]), "?mode=play&title=" + video['urlTerm'], "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm']) ) ) pass
def search(self): type = self.get("type") dialog = xbmcgui.Dialog() d = dialog.input('Search', type=xbmcgui.INPUT_ALPHANUM) if type == "series" and d: obj = http.get("%s/search.php?type=series&title=%s&lang=%s" % (const.SERVICE_URL, d, const.LANG)) for video in obj: self.item_list.append( DirectoryItem( "%s [%s]" % (video['title'], const.LANG_CODES[video['lang']]), "?mode=seasons&title=%s" % (video['urlTerm']), "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm']))) if (type == 'documentations' or type == 'movies') and d: obj = http.get("%s/search.php?type=%s&title=%s&lang=%s" % (const.SERVICE_URL, type, d, const.LANG)) for video in obj: self.item_list.append( VideoItem( "%s [%s]" % (video['title'], const.LANG_CODES[video['lang']]), "?mode=play&title=" + video['urlTerm'], "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm']))) pass
def letter(self, letter): type = self.get("type") if letter == "%23": letter = 1 if type == 'series': obj = http.get("%s/?type=series&letter=%s&lang=%s" % (const.SERVICE_URL, letter, const.LANG)) for video in obj: self.item_list.append( DirectoryItem( "%s [%s]" % (video['title'], const.LANG_CODES[video['lang']]), "?mode=seasons&title=%s" % (video['urlTerm']), "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm']))) elif type == 'movies' or type == 'documentations': obj = http.get("%s/?type=%s&letter=%s&lang=%s" % (const.SERVICE_URL, type, letter, const.LANG)) for video in obj: self.item_list.append( VideoItem( "%s [%s]" % (video['title'], const.LANG_CODES[video['lang']]), "?mode=play&title=" + video['urlTerm'], "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm']))) pass
def search(self): type = self.get("type") dialog = xbmcgui.Dialog() d = dialog.input('Search', type=xbmcgui.INPUT_ALPHANUM) if type == "series" and d: obj = http.get("%s/search.php?type=series&title=%s&lang=%s" % (const.SERVICE_URL, d, const.LANG)) for video in obj: self.item_list.append( DirectoryItem( "%s [%s]" % (video['title'], const.LANG_CODES[video['lang']]), "?mode=seasons&title=%s" % (video['urlTerm']), "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm']) ) ) if (type == 'documentations' or type == 'movies') and d: obj = http.get("%s/search.php?type=%s&title=%s&lang=%s" % (const.SERVICE_URL, type, d, const.LANG)) for video in obj: self.item_list.append( VideoItem( "%s [%s]" % (video['title'], const.LANG_CODES[video['lang']]), "?mode=play&title=" + video['urlTerm'], "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm']) ) ) pass
def seasons(self): obj = http.get('%s/seasons.php?title=%s' % (const.SERVICE_URL, self.get('title'))) for season in obj['seasons']: self.item_list.append( DirectoryItem("Season %s" % season, "?mode=episodes&title=%s&season=%s" % (self.get('title'), season)) ) pass
def new(self): obj = http.get("%s/categories.php?category=neu" % const.SERVICE_URL) for video in obj: self.item_list.append( DirectoryItem(video['title'], "?mode=seasons&title=%s" % video['urlTerm'], "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm'])) ) self.change_view_mode() pass
def seasons(self): obj = http.get('%s/series/getSeasons.php?title=%s' % (const.SERVICE_URL, self.get('title'))) for season in obj['seasons']: self.item_list.append( DirectoryItem( "Season %s" % season, "?mode=episodes&title=%s&season=%s" % (self.get('title'), season))) pass
def search(self): dialog = xbmcgui.Dialog() d = dialog.input('Search', type=xbmcgui.INPUT_ALPHANUM) obj = http.get("%s/search.php?term=%s" % (const.SERVICE_URL, d)) for video in obj: self.item_list.append( DirectoryItem(video['title'], "?mode=seasons&title=%s" % video['urlTerm'], "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm'])) ) self.change_view_mode() pass
def play(self): # find a working mirror try: res = StreamcloudResolver() file_url = None mirror_count = 1 switch = False x = 1 while x <= mirror_count: url = res.get_mirror_url(self.get('title'), x, self.get('season'), self.get('episode')) obj = http.get(url) if obj is not None and 'Stream' in obj: m = re.search('<a href="(.+?)"', str(obj['Stream'])) file_url = res.get_media_url(m.group(1)) if res.canceled is True: raise Exception('CANCELED') if file_url is None and switch is False: c = re.search('<b>Mirror</b>: \d+/(\d+)', str(obj['Replacement'])) if c: mirror_count = int(c.group(1)) switch = True if file_url: self.play_video(file_url) break x += 1 if not file_url: raise Exception('FILE_NOT_FOUND') except Exception, e: print 'StreamCloud Error occurred: %s' % e if str(e) == 'FILE_NOT_FOUND': http.post( "%s/report.php" % const.SERVICE_URL, { 'type': 'unknown', 'title': self.get('title'), 'message': '404' }) dialog = xbmcgui.Dialog() dialog.ok("StreamCloud", "File Not Found or removed")
def browse(self, letter): if letter == "%23": letter = 1 obj = http.get("%s/search.php?letter=%s" % (const.SERVICE_URL, letter)) for video in obj: self.item_list.append( DirectoryItem(video['title'], "?mode=seasons&title=%s" % video['urlTerm'], "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm'])) ) self.change_view_mode() pass
def list(self, params): letter = params('letter') obj = http.get("%s/?type=movies&letter=%s&lang=%s" % (const.SERVICE_URL, letter, const.LANG)) for video in obj: self.item_list.append( VideoItem( "%s [%s]" % (video['title'], const.LANG_CODES[video['lang']]), "?view=player&action=start&title=" + video['urlTerm'], "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm']) ) ) return self.item_list
def play(self): # find a working mirror try: res = StreamcloudResolver() file_url = None mirror_count = 1 switch = False x = 1 while x <= mirror_count: url = res.get_mirror_url(self.get('title'), x, self.get('season'), self.get('episode')) obj = http.get(url) if obj is not None and 'Stream' in obj: m = re.search('<a href="(.+?)"', str(obj['Stream'])) file_url = res.get_media_url(m.group(1)) if res.canceled is True: raise Exception('CANCELED') if file_url is None and switch is False: c = re.search('<b>Mirror</b>: \d+/(\d+)', str(obj['Replacement'])) if c: mirror_count = int(c.group(1)) switch = True if file_url: self.play_video(file_url) break x += 1 if not file_url: raise Exception('FILE_NOT_FOUND') except Exception, e: print 'StreamCloud Error occurred: %s' % e if str(e) == 'FILE_NOT_FOUND': http.post( "%s/report.php" % const.SERVICE_URL, {'type': 'unknown', 'title': self.get('title'), 'message': '404'} ) dialog = xbmcgui.Dialog() dialog.ok("StreamCloud", "File Not Found or removed")
def list(self, params): letter = params('letter') obj = http.get("%s/?type=movies&letter=%s&lang=%s" % (const.SERVICE_URL, letter, const.LANG)) for video in obj: self.item_list.append( VideoItem( "%s [%s]" % (video['title'], const.LANG_CODES[video['lang']]), "?view=player&action=start&title=" + video['urlTerm'], "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm']))) return self.item_list
def seasons(self, params): print 'series->seasons' print '%s/series/getSeasons.php?title=%s' % (const.SERVICE_URL, params('title')) obj = http.get('%s/series/getSeasons.php?title=%s' % (const.SERVICE_URL, params('title'))) for season in obj['seasons']: self.item_list.append( DirectoryItem( "Season %s" % season, "?view=series&action=episodes&title=%s&season=%s" % (params('title'), season) ) ) return self.item_list
def search(self, params): dialog = xbmcgui.Dialog() d = dialog.input('Search', type=xbmcgui.INPUT_ALPHANUM) obj = http.get("%s/search.php?type=series&title=%s&lang=%s" % (const.SERVICE_URL, d, const.LANG)) for video in obj: self.item_list.append( DirectoryItem( "%s [%s]" % (video['title'], const.LANG_CODES[video['lang']]), "?view=series&action=seasons&title=%s" % video['urlTerm'], "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm']) ) ) return self.item_list
def list(self, params): letter = params('letter') if letter == "%23": letter = 1 obj = http.get("%s/?type=series&letter=%s&lang=%s" % (const.SERVICE_URL, letter, const.LANG)) for video in obj: self.item_list.append( DirectoryItem( "%s [%s]" % (video['title'], const.LANG_CODES[video['lang']]), "?view=series&action=seasons&title=%s" % (video['urlTerm']), "%s/thumbs/%s.jpg" % (const.SERVICE_URL, video['urlTerm']) ) ) return self.item_list
def episodes(self): try: obj = http.get( "%s/series/getEpisodes.php?title=%s&season=%s" % (const.SERVICE_URL, self.get('title'), self.get('season'))) if len(obj['episodes']): for episode in obj['episodes']: self.item_list.append( VideoItem( "Episode %s" % episode, "?mode=play&title=%s&season=%s&episode=%s" % (self.get('title'), self.get('season'), episode))) else: raise Exception('Episodes not found') except Exception, e: print 'StreamCloud Error occurred: %s' % e dialog = xbmcgui.Dialog() dialog.ok("Error", "No Episodes hosted by StreamCloud in this Season")
def episodes(self): try: obj = http.get("%s/series/getEpisodes.php?title=%s&season=%s" % (const.SERVICE_URL, self.get('title'), self.get('season'))) if len(obj['episodes']): for episode in obj['episodes']: self.item_list.append( VideoItem( "Episode %s" % episode, "?mode=play&title=%s&season=%s&episode=%s" % (self.get('title'), self.get('season'), episode) ) ) else: raise Exception('Episodes not found') except Exception, e: print 'StreamCloud Error occurred: %s' % e dialog = xbmcgui.Dialog() dialog.ok("Error", "No Episodes hosted by StreamCloud in this Season")
def get_media_url(self, params): try: res = StreamcloudResolver() file_url = None mirror_count = 1 switch = False x = 1 while x <= mirror_count: url = res.get_mirror_url(params('title'), x, params('season'), params('episode')) obj = http.get(url) if obj is not None and 'Stream' in obj: m = re.search('<a href="(.+?)"', str(obj['Stream'])) file_url = res.get_media_url(m.group(1)) if res.canceled is True: raise Exception('CANCELED') if file_url is None and switch is False: c = re.search('<b>Mirror</b>: \d+/(\d+)', str(obj['Replacement'])) if c: mirror_count = int(c.group(1)) switch = True if file_url: return file_url x += 1 if not file_url: raise Exception('FILE_NOT_FOUND') except Exception, e: print 'StreamCloud Error occurred: %s' % e if str(e) == 'FILE_NOT_FOUND': dialog = xbmcgui.Dialog() dialog.ok("StreamCloud", "File Not Found or removed")
def play(self): # find a working mirror try: host = http.get("%s/stream.php?title=%s&season=%s&episode=%s" % (const.SERVICE_URL, self.get('title'), self.get('season'), self.get('episode'))) res = StreamcloudResolver() media_url = res.get_media_url(host['url']) if res.canceled is True: raise Exception('CANCELED') if media_url: self.play_video(media_url) if not media_url: raise Exception('FILE_NOT_FOUND') except Exception, e: print 'StreamCloud Error occurred: %s' % e if str(e) == 'FILE_NOT_FOUND': dialog = xbmcgui.Dialog() dialog.ok("StreamCloud", "File Not Found or removed")