def delete_image(self): image_url = self.params['image_url'] thumb_url = self.params['thumb_url'] folder_path = self.params['folder_path'] delete_file(thumb_url) delete_file(image_url) set_property('fen.home_window.delete_image_finished', 'true')
def _process_internal_results(self): for i in self.internal_scrapers: win_property = kodi_utils.get_property('%s.internal_results' % i) if win_property in ('checked', '', None): continue try: sources = json.loads(win_property) except: continue kodi_utils.set_property('%s.internal_results' % i, 'checked') self._sources_quality_count(sources)
def furk_tfile_audio(params): __handle__ = int(argv[1]) kodi_utils.clear_property('furk_t_files_json') excludes = ('', 'cover', 'covers', 'scan', 'scans', 'playlists') t_files = Furk.t_files(params.get('item_id')) item_path_list = list( set([ clean_file_name(i['path']) for i in t_files if clean_file_name(i['path']).lower() not in excludes ])) item_path_list.sort() line = '%s[CR]%s[CR]%s' if not item_path_list: if kodi_utils.confirm_dialog(text=32763, ok_label=32652, cancel_label=32764, top_space=True): return browse_audio_album(t_files, params.get('name')) from modules.player import FenPlayer FenPlayer().playAudioAlbum(t_files) return browse_audio_album(t_files, __handle__) def _builder(): for x in item_path_list: try: url_params = { 'mode': 'furk.browse_audio_album', 'item_path': x, 'handle': __handle__ } url = build_url(url_params) listitem = make_listitem() listitem.setLabel(x.upper()) listitem.setArt({ 'icon': default_furk_icon, 'poster': default_furk_icon, 'thumb': default_furk_icon, 'fanart': fanart, 'banner': default_furk_icon }) yield (url, listitem, True) except: pass t_files_json = json.dumps(t_files) kodi_utils.set_property('furk_t_files_json', str(t_files_json)) kodi_utils.add_items(__handle__, list(_builder())) kodi_utils.set_content(__handle__, 'files') kodi_utils.end_directory(__handle__) kodi_utils.set_view_mode('view.premium')
def playback_prep(self, params=None): self._clear_properties() if params: self.params = params self.prescrape = self.params.get('prescrape', self.prescrape) == 'true' self.background = self.params.get('background', 'false') == 'true' if self.background: kodi_utils.hide_busy_dialog() else: kodi_utils.show_busy_dialog() self.disabled_ignored = self.params.get( 'disabled_ignored', self.disabled_ignored) == 'true' self.from_library = self.params.get('library', 'False') == 'True' self.vid_type = self.params['vid_type'] self.tmdb_id = self.params['tmdb_id'] self.ep_name = self.params.get('ep_name') self.plot = self.params.get('plot') self.custom_title = self.params.get('custom_title', None) self.custom_year = self.params.get('custom_year', None) if 'autoplay' in self.params: self.autoplay = self.params.get('autoplay', 'False') == 'True' else: self.autoplay = settings.auto_play(self.vid_type) if 'season' in self.params: self.season = int(self.params['season']) else: self.season = '' if 'episode' in self.params: self.episode = int(self.params['episode']) else: self.episode = '' if 'meta' in self.params: self.meta = json.loads(self.params['meta']) else: self._grab_meta() self.active_internal_scrapers = settings.active_internal_scrapers() self.active_external = 'external' in self.active_internal_scrapers self.provider_sort_ranks = settings.provider_sort_ranks() self.sleep_time = settings.display_sleep_time() self.scraper_settings = settings.scraping_settings() self.include_prerelease_results = settings.include_prerelease_results() self.ignore_filters = settings.ignore_results_filter() self.filter_hevc = settings.filter_status('hevc') self.filter_hdr = settings.filter_status('hdr') self.filter_dv = settings.filter_status('dv') self.hybrid_allowed = self.filter_hdr in (0, 2) self.sort_function = settings.results_sort_order() self.display_uncached_torrents = settings.display_uncached_torrents() self.quality_filter = self._quality_filter() self.filter_size = get_setting('results.filter.size', '0') == 'true' self.include_unknown_size = get_setting( 'results.include.unknown.size') == 'true' self.include_3D_results = get_setting('include_3d_results') == 'true' self._update_meta() self._search_info() kodi_utils.set_property('fen_playback_meta', json.dumps(self.meta)) self.get_sources()
def set_memory_cache(self, db_type, meta, expires, tmdb_id): try: if db_type in ('movie', 'tvshow'): string = '%s_%s_%s' % (str(db_type), 'tmdb_id', str(meta['tmdb_id'])) cachedata = (expires, meta) else: # season string = 'meta_season_%s' % str(tmdb_id) cachedata = (expires, meta) try: cachedata_repr = repr(cachedata).encode('utf-8') except: cachedata_repr = repr(cachedata) set_property(string, cachedata_repr) except: pass
def process_internal_results(self): if self.internal_prescraped and not self.processed_prescrape: self.process_quality_count(self.prescrape_sources, internal=True) self.processed_prescrape = True for i in self.internal_scrapers: win_property = kodi_utils.get_property('%s.internal_results' % i) if win_property in ('checked', '', None): continue try: internal_sources = json.loads(win_property) except: continue kodi_utils.set_property('%s.internal_results' % i, 'checked') self.processed_internal_scrapers_append(i) self.process_quality_count(internal_sources, internal=True) return [ i for i in self.internal_scrapers if not i in self.processed_internal_scrapers ]
def make_settings_dict(): import xml.etree.ElementTree as ET settings_dict = None try: test_path = translate_path( 'special://profile/addon_data/plugin.video.fen/') profile_dir = 'special://profile/addon_data/plugin.video.fen/%s' if not path_exists(test_path): make_directorys(test_path) settings_xml = translate_path(profile_dir % 'settings.xml') root = ET.parse(settings_xml).getroot() settings_dict = {} for item in root: setting_id = item.get('id') setting_value = item.text if setting_value is None: setting_value = '' dict_item = {setting_id: setting_value} settings_dict.update(dict_item) set_property('fen_settings', json.dumps(settings_dict)) except: pass return settings_dict
def _confirm_threshold(): nextep_threshold = nextep_settings['threshold'] if nextep_threshold == 0: return True try: current_number = int( kodi_utils.get_property('fen_total_autoplays')) except: current_number = 1 if current_number == nextep_threshold: current_number = 1 kodi_utils.set_property('fen_total_autoplays', str(current_number)) if open_window(('windows.next_episode', 'NextEpisode'), 'next_episode.xml', meta=nextep_meta, function='confirm'): return True else: kodi_utils.notification(32736, 1500) return False else: current_number += 1 kodi_utils.set_property('fen_total_autoplays', str(current_number)) return True
def _set_property(self): return kodi_utils.set_property(self.window_id, json.dumps(self.discover_params))
def play_execute_nextep(self, results): nextep_url = self.play_file(results, autoplay=True, background=True) kodi_utils.set_property('fen_nextep_url', nextep_url)
def sync_MyAccounts(silent=False): import myaccounts from modules.settings_reader import get_setting, set_setting all_acct = myaccounts.getAll() try: trakt_acct = all_acct.get('trakt') if trakt_acct.get('username') not in ('', None): if get_setting('trakt_user') != trakt_acct.get('username'): set_setting('trakt_indicators_active', 'true') set_setting('watched_indicators', '1') kodi_utils.set_property('fen_refresh_trakt_info', 'true') else: set_setting('trakt_indicators_active', 'false') set_setting('watched_indicators', '0') set_setting('trakt_user', trakt_acct.get('username')) except: pass try: fu_acct = all_acct.get('furk') set_setting('furk_login', fu_acct.get('username')) set_setting('furk_password', fu_acct.get('password')) if fu_acct.get('api_key') != '': set_setting('furk_api_key', fu_acct.get('api_key')) elif get_setting('furk_api_key') != '': kodi_utils.ext_addon('script.module.myaccounts').setSetting( 'furk.api.key', get_setting('furk_api_key')) except: pass try: en_acct = all_acct.get('easyNews') set_setting('easynews_user', en_acct.get('username')) set_setting('easynews_password', en_acct.get('password')) except: pass try: tmdb_acct = all_acct.get('tmdb') tmdb_key = tmdb_acct.get('api_key') if not tmdb_key: tmdb_key = '050ee5c6c85883b200be501c878a2aed' set_setting('tmdb_api', tmdb_key) except: pass try: fanart_acct = all_acct.get('fanart_tv') fanart_key = fanart_acct.get('api_key') if not fanart_key: fanart_key = 'fe073550acf157bdb8a4217f215c0882' set_setting('fanart_client_key', fanart_key) except: pass try: imdb_acct = all_acct.get('imdb') set_setting('imdb_user', imdb_acct.get('user')) except: pass try: rd_acct = all_acct.get('realdebrid') if get_setting('rd.username') != rd_acct.get('username'): set_setting('rd.username', rd_acct.get('username')) set_setting('rd.client_id', rd_acct.get('client_id')) set_setting('rd.refresh', rd_acct.get('refresh')) set_setting('rd.secret', rd_acct.get('secret')) set_setting('rd.token', rd_acct.get('token')) set_setting('rd.auth', rd_acct.get('token')) except: pass try: pm_acct = all_acct.get('premiumize') set_setting('pm.token', pm_acct.get('token')) if get_setting('pm.account_id') != pm_acct.get('username'): set_setting('pm.account_id', pm_acct.get('username')) except: pass try: ad_acct = all_acct.get('alldebrid') set_setting('ad.token', ad_acct.get('token')) if get_setting('ad.account_id') != ad_acct.get('username'): set_setting('ad.account_id', ad_acct.get('username')) except: pass if not silent: kodi_utils.notification(33030, time=1500)
def internal_results(provider, sources): kodi_utils.set_property('%s.internal_results' % provider, json.dumps(sources))
def _set_property(setting_id, setting_value): kodi_utils.set_property('fen_%s' % setting_id, setting_value)
def set_home_property(self, prop, value): kodi_utils.set_property('fen.home_window.%s' % prop, value)