def play_track(object_id, song_url): if song_url == None or object_id == None: xbmc.log("AmpachePlugin::play_track object or song null", xbmc.LOGNOTICE) return old_object_id = None #check if we need the song infolabels ( object_id cached is different from #object_id of the song, for instance as kore app call the song try: plugin_url = xbmc.getInfoLabel('ListItem.FileNameAndPath') params = ut.get_params(plugin_url) old_object_id = int(params["object_id"]) xbmc.log( "AmpachePlugin::play_track old_object_id " + str(old_object_id), xbmc.LOGDEBUG) except: pass liz = xbmcgui.ListItem() try: if old_object_id == None or old_object_id != object_id: ampConn = ampache_connect.AmpacheConnect() xbmc.log("AmpachePlugin::play_track refresh infoLabels", xbmc.LOGDEBUG) ampConn.filter = object_id elem = ampConn.ampache_http_request("song") for thisnode in elem: node = thisnode fillListItemWithSongInfo(liz, node) liz.setProperty("IsPlayable", "true") except: pass liz.setPath(song_url) #rating = xbmc.getInfoLabel('ListItem.UserRating') xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=liz)
elif params['mode'] == 'pplr': videos=scraper.get_all_movies_views() for vid in videos: video = scraper.get_video_information(vid) try: add_video(video) except TypeError: print_video_error(video) elif params['mode'] == 'alpha': videos=scraper.get_all_movies_alpha() for vid in videos: video = scraper.get_video_information(vid) try: add_video(video) except TypeError: print_video_error(video) elif params['mode'] == 'play_video': utils.play_video(params['url']) subtitles=scraper.get_video_subtitle(params['srt']) player = xbmc.Player() while not xbmc.Player().isPlaying(): xbmc.sleep(10000) player.setSubtitles(subtitles) utils.end_directory() if __name__ == '__main__': params = utils.get_params() main(params)
from resources.lib.utils import log, notify, get_params, get_video_path, get_languages_dict __addon__ = xbmcaddon.Addon() __author__ = __addon__.getAddonInfo('author') __scriptid__ = __addon__.getAddonInfo('id') __scriptname__ = __addon__.getAddonInfo('name') __version__ = __addon__.getAddonInfo('version') __language__ = __addon__.getLocalizedString __cwd__ = xbmc.translatePath(__addon__.getAddonInfo('path')).decode("utf-8") __profile__ = xbmc.translatePath(__addon__.getAddonInfo('profile')).decode("utf-8") __resource__ = xbmc.translatePath(path.join(__cwd__, 'resources', 'lib')).decode("utf-8") __temp__ = xbmc.translatePath(path.join(__profile__, 'temp', '')).decode("utf-8") params = get_params() log("BSPlayer.params", "Current Action: %s." % params['action']) if params['action'] == 'search': video_path = get_video_path() if video_path.startswith('http://') or video_path.startswith('https://'): notify(__scriptname__, __language__, 32001) log("BSPlayer.get_video_path", "Streaming not supported.") log("BSPlayer.video_path", "Current Video Path: %s." % video_path) languages = get_languages_dict(params['languages']) log("BSPlayer.languages", "Current Languages: %s." % languages) with BSPlayer() as bsp: subtitles = bsp.search_subtitles(video_path, language_ids=languages.keys()) for subtitle in sorted(subtitles, key=lambda s: s['subLang']): list_item = xbmcgui.ListItem(
from resources.lib.bsplayer import BSPlayer from resources.lib.utils import log, notify, get_params, get_video_path, get_languages_dict __addon__ = xbmcaddon.Addon() __author__ = __addon__.getAddonInfo('author') __scriptid__ = __addon__.getAddonInfo('id') __scriptname__ = __addon__.getAddonInfo('name') __version__ = __addon__.getAddonInfo('version') __language__ = __addon__.getLocalizedString __cwd__ = xbmc.translatePath(__addon__.getAddonInfo('path')) __profile__ = xbmc.translatePath(__addon__.getAddonInfo('profile')) __resource__ = xbmc.translatePath(path.join(__cwd__, 'resources', 'lib')) __temp__ = xbmc.translatePath(path.join(__profile__, 'temp', '')) params = get_params() log("BSPlayer.params", "Current Action: %s." % params['action']) if params['action'] == 'search': video_path = get_video_path() if video_path.startswith('http://') or video_path.startswith('https://'): notify(__scriptname__, __language__, 32001) log("BSPlayer.get_video_path", "Streaming not supported.") log("BSPlayer.video_path", "Current Video Path: %s." % video_path) languages = get_languages_dict(params['languages']) log("BSPlayer.languages", "Current Languages: %s." % languages) with BSPlayer() as bsp: subtitles = bsp.search_subtitles(video_path, language_ids=languages.keys()) for subtitle in sorted(subtitles, key=lambda s: s['subLang']):
for el in elements: addItem(object_type, mode, el) if (__name__ == '__main__'): name = None mode = None object_id = None title = None song_url = None handle = int(sys.argv[1]) plugin_url = sys.argv[2] params = ut.get_params(plugin_url) xbmc.log( "AmpachePlugin::init handle: " + str(handle) + " url: " + plugin_url, xbmc.LOGDEBUG) try: name = urllib.parse.unquote_plus(params["name"]) xbmc.log("AmpachePlugin::name " + name, xbmc.LOGDEBUG) except: pass try: mode = int(params["mode"]) xbmc.log("AmpachePlugin::mode " + str(mode), xbmc.LOGDEBUG) except: pass try:
tid = params['mode'].split('-') shows = scraper.get_all_shows(tid[1]) for show in shows: video = scraper.get_video_information(show) add_tv_show(video) elif 'trailer_' in params['mode']: title = params['mode'].split('_', 1) url = scraper.get_video_trailer(str(title[1])) xbmc.Player().play(url) elif params['mode'] == 'play_video': utils.play_video(params['url']) subtitles = scraper.get_video_subtitle(params['srt']) player = xbmc.Player() while not xbmc.Player().isPlaying(): xbmc.sleep(10000) player.setSubtitles(subtitles) utils.end_directory() if __name__ == '__main__': params = utils.get_params() if params.has_key('mode'): print 'Mode: ' + params['mode'] if params.has_key('title'): print 'Title: ' + params['title'] if params.has_key('mode') and params['mode'] == 'settings': open_settings() else: main(params)