def resetTorrentSettings(): if Dialog().yesno(30013, 30014): # Network __addon__.setSetting("listen_port", '6881') __addon__.setSetting("use_random_port", 'true') __addon__.setSetting("encryption", '1') __addon__.setSetting("connections_limit", '200') # Peers __addon__.setSetting("torrent_connect_boost", '50') __addon__.setSetting("connection_speed", '50') __addon__.setSetting("peer_connect_timeout", '15') __addon__.setSetting("min_reconnect_time", '60') __addon__.setSetting("max_failcount", '3') # Features __addon__.setSetting("enable_tcp", 'true') __addon__.setSetting("enable_dht", 'true') __addon__.setSetting("enable_lsd", 'true') __addon__.setSetting("enable_utp", 'true') __addon__.setSetting("enable_scrape", 'false') __addon__.setSetting("enable_upnp", 'true') __addon__.setSetting("enable_natpmp", 'true') # Additional __addon__.setSetting("trackers", '') __addon__.setSetting("dht_routers", '') notify(30314)
def player(self, subtitle=None, quality=None, **params): log("(Main) Creating player options") if settings.addon.handle > -1: xbmcplugin.endOfDirectory(settings.addon.handle, True, False, False) item = self.getSelectedItem() free_space = self._calculate_free_space() if not quality: waring = [] for _q in self.mediaSettings.qualities: if params.get(_q): if params['%ssize' %_q] > free_space: if _q == '3D' and self.mediaSettings.play3d == 1 and not Dialog().yesno(line2=30011, lineStr1=' ', headingStr=item['info']['title']): continue quality = _q break waring = waring+[_q] if waring: if not quality: raise Notify('There is not enough free space in %s' %self.mediaSettings.download_path, 30323, level=NOTIFYLEVEL.ERROR) if len(waring) > 1: notify(message=__addon__.getLocalizedString(30325) %(", ".join(waring), waring.pop()), level=NOTIFYLEVEL.WARNING) else: notify(message=__addon__.getLocalizedString(30326) %waring[0], level=NOTIFYLEVEL.WARNING) log('(Main) There must be a minimum of %s to play. %s available in %s' %(shortenBytes(params['%ssize' %quality]), shortenBytes(free_space), self.mediaSettings.download_path), LOGLEVEL.NOTICE) elif not params.get(quality): raise Error('%s quality was not found' %quality, 30023) elif params['%ssize' %quality] < free_space: raise Notify('There is not enough free space in %s' %self.mediaSettings.download_path, 30323, level=NOTIFYLEVEL.ERROR) TorrentPlayer().playTorrentFile(self.mediaSettings, build_magnetFromMeta(params[quality], "quality %s" %quality), item, subtitle)
def clear_cache(self, **params): def _run(path): for x in os.listdir(path): if x in ['.', '..']: continue _path = os.path.join(path, x) if os.path.isfile(_path): os.remove(_path) elif os.path.isdir(_path): _run(_path) os.rmdir(_path) if Dialog().yesno(30033): _run(settings.addon.cache_path) notify(30301)
def clearCache(): if Dialog().yesno(30033): clear_cache() notify(30301)
def clearMediaCache(): if Dialog().yesno(30033): cleanDebris() notify(30301)