def handlerAutoPlay(): autoplayIndex = int(_params['autoplayIndex']) autoplay = util.fileToObj(_path + '/autoplay') for i in range(autoplayIndex, len(autoplay)): _params.update(autoplay[i]) handlerPlay() if i < len(autoplay) - 1: if xbmcgui.Dialog().yesno(heading='Playing next', line1=' ', line3=autoplay[i + 1]['name'], yeslabel='Stop', nolabel='Play', autoclose=5000): break
def getDownloads(): if not os.path.isfile(_downloads): return {} downloads = util.fileToObj(_downloads) hashStrings = [] data = transmission.get(_transmissionUrl) for row in data: hashStrings.append(row['hashString']) changed = False for id in downloads.keys(): for hashString in downloads[id]['torrents'].keys(): if hashString not in hashStrings: del downloads[id]['torrents'][hashString] changed = True if not downloads[id]['torrents']: del downloads[id] if changed: setDownloads(downloads) return downloads
def handlerListEpisodes(): xbmcplugin.setContent(_handleId, 'movies') watchlog.init(_watchlogPath,_path + '/watchlog.db') if os.path.isfile(_episodesRefreshFlag): os.remove(_episodesRefreshFlag) episodes = util.fileToObj(_path + '/' + 'content') else: handler = getattr(__import__(_params['archive']), 'getEpisodes' ) episodes = handler(_params['urlProgram']) util.objToFile(episodes, _path + '/' + 'content') for episode in episodes: infoLabels = {} contextMenuItems = [] if watchlog.isWatched(_watchlogPath, _baseUrl, episode['name']): infoLabels['playcount'] = 1 contextCmd = 'RunPlugin(' + _baseUrl+'?' + urllib.urlencode({'handler': 'Watched', 'item': episode['name'], 'watched': 'false'}) + ')' contextMenuItems.append(('UnWatched',contextCmd)) else: infoLabels['playcount'] = 0 contextCmd = 'RunPlugin(' + _baseUrl+'?' + urllib.urlencode({'handler': 'Watched', 'item': episode['name'], 'watched': 'true'}) + ')' contextMenuItems.append(('Watched',contextCmd)) item = xbmcgui.ListItem(episode['name']) item.setArt({'thumb': episode["thumb"], 'poster': episode["thumb"], 'fanart': episode["thumb"]}) if 'duration' in episode.keys(): infoLabels['duration'] = float(episode['duration']) if 'description' in episode.keys(): infoLabels['plot'] = episode['description'] item.setProperty("IsPlayable","true") item.setInfo( type="Video", infoLabels=infoLabels ) item.addContextMenuItems(contextMenuItems, replaceItems=True) params = { 'handler': 'PlayEpisode', 'archive': _params['archive'], 'url': episode['url'], 'name': episode['name'] } url = _baseUrl+'?' + urllib.urlencode(params) xbmcplugin.addDirectoryItem(handle=_handleId, url=url, isFolder=True, listitem=item) xbmcplugin.endOfDirectory(_handleId)
def getLibrary(): path = _dataFolder + '/library' if not os.path.isfile(path): return [] return util.fileToObj(path)
def getFolder(name): folders = util.fileToObj(_folders) return folders.get(name, 'None')