def docu_play(self, url): control.moderator() try: docu_page = client.request(url) docu_item = client.parseDOM(docu_page, 'meta', attrs={'itemprop':'embedUrl'}, ret='content')[0] if 'http:' not in docu_item and 'https:' not in docu_item: docu_item = 'https:' + docu_item url = docu_item docu_title = client.parseDOM(docu_page, 'meta', attrs={'property':'og:title'}, ret='content')[0].encode('utf-8', 'ignore').decode('utf-8').replace("&","&").replace(''',"'").replace('"','"').replace(''',"'").replace('–',' - ').replace('’',"'").replace('‘',"'").replace('&','&').replace('â','') if 'youtube' in url: if 'videoseries' not in url: video_id = client.parseDOM(docu_page, 'div', attrs={'class':'youtube-player'}, ret='data-id')[0] url = 'plugin://plugin.video.youtube/play/?video_id=%s' % video_id else: pass elif 'dailymotion' in url: video_id = client.parseDOM(docu_page, 'div', attrs={'class':'youtube-player'}, ret='data-id')[0] url = self.getDailyMotionStream(video_id) else: log_utils.log('Play Documentary: Unknown Host: ' + str(url)) control.infoDialog('Unknown Host - Report To Developer: ' + str(url), sound=True, icon='INFO') control.execute('PlayMedia(%s)' % url) # item = xbmcgui.ListItem(str(docu_title), iconImage='DefaultVideo.png', thumbnailImage='DefaultVideo.png') # item.setInfo(type='Video', infoLabels={'Title': str(docu_title), 'Plot': str(docu_title)}) # item.setProperty('IsPlayable','true') # item.setPath(url) # control.resolve(int(sys.argv[1]), True, item) except Exception as e: log_utils.log('docu_play: Exception - ' + str(e)) pass
def play(self, title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select): try: url = None control.moderator() items = self.getSources(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered) select = control.setting( 'hosts.mode') if select == None else select title = tvshowtitle if not tvshowtitle == None else title if control.window.getProperty('PseudoTVRunning') == 'True': return control.resolve( int(sys.argv[1]), True, control.item(path=str(self.sourcesDirect(items)))) if len(items) > 0: if select == '1' and 'plugin' in control.infoLabel( 'Container.PluginName'): control.window.clearProperty(self.itemProperty) control.window.setProperty(self.itemProperty, json.dumps(items)) control.window.clearProperty(self.metaProperty) control.window.setProperty(self.metaProperty, meta) control.sleep(200) return control.execute( 'Container.Update(%s?action=addItem&title=%s)' % (sys.argv[0], urllib.quote_plus(title))) elif select == '0' or select == '1': url = self.sourcesDialog(items) else: url = self.sourcesDirect(items) if url == None: return self.errorForSources() try: meta = json.loads(meta) except: pass from resources.lib.modules.player import player player().run(title, year, season, episode, imdb, tvdb, url, meta) except: pass
def podcast_play(self, action, url): control.moderator() try: if 'podcastOne' in action: ep_page = client.request(url) episode_item = client.parseDOM(ep_page, 'div', attrs={'class': 'media-player'})[0] episode_item2 = client.parseDOM(ep_page, 'div', attrs={'class': 'letestepi'})[0] ep_icon = client.parseDOM(episode_item2, 'img', attrs={'class': 'img-responsive'}, ret='src')[0] ep_title = client.parseDOM(ep_page, 'title')[0].replace( 'PodcastOne: ', '') play_url = re.compile( 'href="(.+?)"', re.DOTALL).findall(episode_item)[0].replace( "\n", "").replace('/downloadsecurity?url=', '') url = self.pco_play_link % play_url elif 'podbay' in action: ep_page = client.request(url) ep_icon = client.parseDOM(ep_page, 'meta', attrs={'property': 'og:image'}, ret='content')[0] ep_title = client.parseDOM(ep_page, 'meta', attrs={'property': 'og:title'}, ret='content')[0].encode( 'utf-8', 'ignore').decode('utf-8') url = client.parseDOM( ep_page, 'a', attrs={'class': 'btn btn-mini btn-primary'}, ret='href')[0] item = xbmcgui.ListItem(label=ep_title, path=url, iconImage=ep_icon, thumbnailImage=ep_icon) item.setInfo(type="Video", infoLabels={"Title": ep_title}) xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item) except Exception as e: log_utils.log('podcast_play:Exception - ' + str(e)) pass
def play(self, title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select): try: url = None control.moderator() items = self.getSources(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered) select = control.setting('hosts.mode') if select == None else select title = tvshowtitle if not tvshowtitle == None else title if control.window.getProperty('PseudoTVRunning') == 'True': return control.resolve(int(sys.argv[1]), True, control.item(path=str(self.sourcesDirect(items)))) if len(items) > 0: if select == '1' and 'plugin' in control.infoLabel('Container.PluginName'): control.window.clearProperty(self.itemProperty) control.window.setProperty(self.itemProperty, json.dumps(items)) control.window.clearProperty(self.metaProperty) control.window.setProperty(self.metaProperty, meta) control.sleep(200) return control.execute('Container.Update(%s?action=addItem&title=%s)' % (sys.argv[0], urllib.quote_plus(title))) elif select == '0' or select == '1': url = self.sourcesDialog(items) else: url = self.sourcesDirect(items) if url == None: return self.errorForSources() try: meta = json.loads(meta) except: pass from resources.lib.modules.player import player player().run(title, year, season, episode, imdb, tvdb, url, meta) except: pass
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 os,sys,urlparse from resources.lib.modules import control from resources.lib.modules import trakt sysaddon = sys.argv[0] ; syshandle = int(sys.argv[1]) ; control.moderator() 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: def root(self): self.addDirectoryItem(32001, 'movieNavigator', 'movies.png', 'DefaultMovies.png')
from resources.lib.modules import cache from resources.lib.modules import metacache from resources.lib.modules import playcount from resources.lib.modules import workers from resources.lib.modules import views from resources.lib.modules import utils from resources.lib.modules import log_utils from resources.lib.modules import imdb_lists import os,sys,re,json,urllib,urlparse,datetime params = dict(urlparse.parse_qsl(sys.argv[2].replace('?',''))) if len(sys.argv) > 1 else dict() action = params.get('action') control.moderator() class tvshows: def __init__(self): self.list = [] self.imdb_link = 'http://www.imdb.com' self.trakt_link = 'http://api.trakt.tv' self.tvmaze_link = 'http://www.tvmaze.com' self.tvdb_key = 'MTQ4RENEM0JENjIzMjE4RA==' self.datetime = (datetime.datetime.utcnow() - datetime.timedelta(hours = 5)) self.trakt_user = control.setting('trakt.user').strip() self.imdb_user = control.setting('imdb.user').replace('ur', '') self.fanart_tv_user = control.setting('fanart.tv.user') self.user = control.setting('fanart.tv.user') + str('')
from resources.lib.modules import cleangenre from resources.lib.modules import control from resources.lib.modules import client from resources.lib.modules import metacache from resources.lib.modules import workers from resources.lib.modules import trakt import sys,re,json,urllib,urlparse,datetime params = dict(urlparse.parse_qsl(sys.argv[2].replace('?',''))) if len(sys.argv) > 1 else dict() action = params.get('action') control.moderator() class channels: def __init__(self): self.list = [] ; self.items = [] self.uk_datetime = self.uk_datetime() self.systime = (self.uk_datetime).strftime('%Y%m%d%H%M%S%f') self.tm_img_link = 'https://image.tmdb.org/t/p/w%s%s' self.lang = control.apiLanguage()['trakt'] self.sky_now_link = 'http://epgservices.sky.com/5.1.1/api/2.0/channel/json/%s/now/nn/0' self.sky_programme_link = 'http://tv.sky.com/programme/channel/%s/%s/%s.json'
def tvDownloader(self, title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select): xbmc.log('ENTRY -> plexpvr tvDownloader()', xbmc.LOGNOTICE) xbmc.log(' title: %s' % (title), xbmc.LOGNOTICE) xbmc.log(' year: %s' % (year), xbmc.LOGNOTICE) xbmc.log(' imdb: %s' % (imdb), xbmc.LOGNOTICE) xbmc.log(' tvdb: %s' % (tvdb), xbmc.LOGNOTICE) xbmc.log(' Season: %s' % (season), xbmc.LOGNOTICE) xbmc.log(' Episode: %s' % (episode), xbmc.LOGNOTICE) xbmc.log('*** tvDownloader *** year %s' % year, xbmc.LOGDEBUG) xbmc.log('*** tvDownloader *** imdb %s' % imdb, xbmc.LOGDEBUG) xbmc.log('*** tvDownloader *** tvdb %s' % tvdb, xbmc.LOGDEBUG) xbmc.log('*** tvDownloader *** season %s' % season, xbmc.LOGDEBUG) xbmc.log('*** tvDownloader *** episode %s' % episode, xbmc.LOGDEBUG) xbmc.log('*** tvDownloader *** tvshowtitle %s' % tvshowtitle, xbmc.LOGDEBUG) #xbmc.log('*** tvDownloader *** control %s' % control, xbmc.LOGWARNING) url = None control.moderator() xbmc.log( '*** ALERT *** Getting Sources %s Season: %s Episode: %s' % (tvshowtitle, season, episode), xbmc.LOGDEBUG) #This forces the sources() is done on a background tread xbmc.log('Setting Exodus setting progress.dialog: 1', xbmc.LOGDEBUG) control.setSetting(id='progress.dialog', value='1') items = sources().getSources(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered) #labels = [i['label'] for i in items] xbmc.log( '*** tvDownloader *** tvshowtitle %s item size %s' % (tvshowtitle, len(items)), xbmc.LOGWARNING) #downloadSource=None #for i in range(len(items)): # try: # if i < 3: # finalSource=items[i] # if finalSource['url'].endswith(".mp4"): # downloadSource=finalSource # break # xbmc.log('*** tvDownloader *** finalSource %s' % finalSource, xbmc.LOGWARNING) # xbmc.log('*** tvDownloader *** finalSource[quality] %s' % finalSource['quality'], xbmc.LOGWARNING) # else: # finalSource=items[i] # if finalSource['url'].endswith(".mp4"): # downloadSource=finalSource # break # xbmc.log('*** tvDownloader *** finalSource %s' % finalSource, xbmc.LOGWARNING) # xbmc.log('*** tvDownloader *** finalSource[quality] %s' % finalSource['quality'], xbmc.LOGWARNING) # # if downloadSource == None: # downloadSource = items[0] # # xbmc.log('*** tvDownloader *** downloadSource %s' % downloadSource, xbmc.LOGWARNING) # except: # pass for i in range(len(items)): try: downloadSource = items[i] xbmc.log( '*** tvDownloader *** downloadSource %s' % downloadSource, xbmc.LOGDEBUG) downloadResults = self.tvDownloaderForSource( downloadSource, title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select) if downloadResults == True: break except: pass xbmc.log('EXIT <- plexpvr.py tvDownloader()', xbmc.LOGNOTICE)