def furkPacks(self, name, file_id, highlight=None, download=False): from apis.furk_api import FurkAPI kodi_utils.show_busy_dialog() t_files = FurkAPI().t_files(file_id) t_files = [i for i in t_files if 'video' in i['ct'] and 'bitrate' in i] t_files.sort(key=lambda k: k['name'].lower()) kodi_utils.hide_busy_dialog() if download: return t_files default_furk_icon = kodi_utils.translate_path( 'special://home/addons/script.tikiart/resources/media/furk.png') list_items = [{ 'line1': '%.2f GB | %s' % (float(item['size']) / 1073741824, clean_file_name(item['name']).upper()), 'icon': default_furk_icon } for item in t_files] kwargs = { 'items': json.dumps(list_items), 'heading': name, 'highlight': highlight, 'enumerate': 'true', 'multi_choice': 'false', 'multi_line': 'false' } chosen_result = kodi_utils.select_dialog(t_files, **kwargs) if chosen_result is None: return None link = chosen_result['url_dl'] name = chosen_result['name'] return FenPlayer().run(link, 'video')
def debridPacks(self, debrid_provider, name, magnet_url, info_hash, highlight=None, download=False): if debrid_provider == 'Real-Debrid': from apis.real_debrid_api import RealDebridAPI as debrid_function icon = 'realdebrid.png' elif debrid_provider == 'Premiumize.me': from apis.premiumize_api import PremiumizeAPI as debrid_function icon = 'premiumize.png' elif debrid_provider == 'AllDebrid': from apis.alldebrid_api import AllDebridAPI as debrid_function icon = 'alldebrid.png' kodi_utils.show_busy_dialog() try: debrid_files = debrid_function().display_magnet_pack( magnet_url, info_hash) except: debrid_files = None kodi_utils.hide_busy_dialog() if not debrid_files: return kodi_utils.notification(32574) debrid_files.sort(key=lambda k: k['filename'].lower()) if download: return debrid_files, debrid_function default_debrid_icon = kodi_utils.translate_path( 'special://home/addons/script.tikiart/resources/media/%s' % icon) list_items = [{ 'line1': '%.2f GB | %s' % (float(item['size']) / 1073741824, clean_file_name(item['filename']).upper()), 'icon': default_debrid_icon } for item in debrid_files] kwargs = { 'items': json.dumps(list_items), 'heading': name, 'highlight': highlight, 'enumerate': 'true', 'multi_choice': 'false', 'multi_line': 'false' } chosen_result = kodi_utils.select_dialog(debrid_files, **kwargs) if chosen_result is None: return None url_dl = chosen_result['link'] if debrid_provider in ('Real-Debrid', 'AllDebrid'): link = debrid_function().unrestrict_link(url_dl) elif debrid_provider == 'Premiumize.me': link = debrid_function().add_headers_to_url(url_dl) name = chosen_result['filename'] return FenPlayer().run(link, 'video')
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 resolve_sources(self, item, meta, cache_item=False): try: if 'cache_provider' in item: cache_provider = item['cache_provider'] if meta['vid_type'] == 'episode': title, season, episode = meta['ep_name'], meta.get( 'season'), meta.get('episode') else: title, season, episode = self._get_search_title( meta), None, None if cache_provider in ('Real-Debrid', 'Premiumize.me', 'AllDebrid'): url = resolver.resolve_cached_torrents( cache_provider, item['url'], item['hash'], title, season, episode) return url if 'Uncached' in cache_provider: if cache_item: if not 'package' in item: title, season, episode = None, None, None url = resolver.resolve_uncached_torrents( item['debrid'], item['url'], item['hash'], title, season, episode) if not url: return None if url == 'cache_pack_success': return return FenPlayer().run(url) else: url = 'uncached' return url return None if item.get('scrape_provider', None) in default_internal_scrapers: url = resolver.resolve_internal_sources( item['scrape_provider'], item['id'], item['url_dl'], item.get('direct_debrid_link', False)) return url if item.get('debrid') in ( 'Real-Debrid', 'Premiumize.me', 'AllDebrid') and not item['source'].lower() == 'torrent': url = resolver.resolve_debrid(item['debrid'], item['provider'], item['url']) if url is not None: return url else: return None else: url = item['url'] return url except: return
def browse_audio_album(t_files=None, name=None): def build_list_object(): try: cm = [] url_params = {'mode': 'media_play', 'url': item['url_dl'], 'rootname': 'music'} url = build_url(url_params) track_name = clean_file_name(batch_replace(to_utf8(item['name']), formats)).upper() listitem = xbmcgui.ListItem(track_name) down_file_params = {'mode': 'download_file', 'name': item['name'], 'url': item['url_dl'], 'image': default_furk_icon, 'db_type': 'audio'} cm.append(("[B]Download File[/B]",'XBMC.RunPlugin(%s)' % build_url(down_file_params))) listitem.addContextMenuItems(cm) listitem.setArt({'icon': default_furk_icon, 'poster': default_furk_icon, 'thumb': default_furk_icon, 'fanart': fanart, 'banner': default_furk_icon}) xbmcplugin.addDirectoryItem(__handle__, url, listitem, isFolder=True) except: pass from modules.utils import batch_replace formats = ('.3gp', ''),('.aac', ''),('.flac', ''),('.m4a', ''),('.mp3', ''),('.ogg', ''),('.raw', ''),('.wav', ''),('.wma', ''),('.webm', ''),('.ra', ''),('.rm', '') params = dict(parse_qsl(sys.argv[2].replace('?',''))) seperate = False if not t_files: seperate = True t_fs = window.getProperty('furk_t_files_json') t_files = json.loads(t_fs) t_files = [i for i in t_files if 'audio' in i['ct']] if seperate: if dialog.yesno("Fen Music Player", 'Browse Songs or Play Full Album?', '', '', 'Play Now','Browse'): for item in t_files: item_path = clean_file_name(item['path']) if item_path == params.get('item_path'): build_list_object() xbmcplugin.setContent(__handle__, 'files') xbmcplugin.endOfDirectory(__handle__) setView('view.furk_files') else: from modules.player import FenPlayer FenPlayer().playAudioAlbum(t_files, from_seperate=True) else: for item in t_files: build_list_object() xbmcplugin.setContent(__handle__, 'files') xbmcplugin.endOfDirectory(__handle__) setView('view.premium')
def furk_tfile_audio(): window.clearProperty('furk_t_files_json') params = dict(parse_qsl(sys.argv[2].replace('?',''))) excludes = ['', 'cover', 'covers', 'scan', 'scans', 'playlists'] t_files = Furk.t_files(params.get('id')) item_path_list = sorted(list(set([clean_file_name(i['path']) for i in t_files if clean_file_name(i['path']).lower() not in excludes]))) if not item_path_list: if dialog.yesno("Fen Music Player", 'Browse Songs or Play Full Album?', '', '', 'Play Now','Browse'): return browse_audio_album(t_files, params.get('name')) from modules.player import FenPlayer FenPlayer().playAudioAlbum(t_files, params.get('name')) return browse_audio_album(t_files, params.get('name')) for x in item_path_list: url_params = {'mode': 'furk.browse_audio_album', 'item_path': x} url = build_url(url_params) listitem = xbmcgui.ListItem(x.upper()) listitem.setArt({'icon': default_furk_icon, 'poster': default_furk_icon, 'thumb': default_furk_icon, 'fanart': fanart, 'banner': default_furk_icon}) xbmcplugin.addDirectoryItem(__handle__, url, listitem, isFolder=True) t_files_json = json.dumps(t_files) window.setProperty('furk_t_files_json', str(t_files_json)) xbmcplugin.setContent(__handle__, 'files') xbmcplugin.endOfDirectory(__handle__) setView('view.premium')
def play_file(self, results, source={}, autoplay=False, background=False): def _resolve_dialog(): self.url = None for count, item in enumerate(items, 1): try: self.caching_confirmed = False if not background: try: if self.progress_dialog.iscanceled(): break if kodi_utils.monitor.abortRequested() is True: break name = item['name'].replace('.', ' ').replace( '-', ' ').upper() percent = int(count / float(total_items) * 100) self.progress_dialog.update( line % ('', name, ''), percent) except: pass url = self.resolve_sources(item, self.meta) if url == 'uncached': url = _uncached_confirm(item) if url is None: return if url: self.url = url break except: pass self._kill_progress_dialog() def _uncached_confirm(item): if not kodi_utils.confirm_dialog(text=ls(32831) % item['debrid'].upper()): return None else: self.caching_confirmed = True return item try: self._kill_progress_dialog() if autoplay: items = [ i for i in results if not 'Uncached' in i.get('cache_provider', '') ] if self.filters_ignored: kodi_utils.notification(32686) else: results = [ i for i in results if not 'Uncached' in i.get('cache_provider', '') or i == source ] source_index = results.index(source) leading_index = max(source_index - 20, 0) items_prev = results[leading_index:source_index] trailing_index = 41 - len(items_prev) items_next = results[source_index + 1:source_index + trailing_index] items = [source] + items_next + items_prev total_items = len(items) line = '%s[CR]%s[CR]%s' if not background: self._make_progress_dialog() _resolve_dialog() if background: return self.url if self.caching_confirmed: return self.resolve_sources(self.url, self.meta, cache_item=True) return FenPlayer().run(self.url) except: pass
literal_eval(params.get('autoplay', 'None'))) elif mode == 'play_display_results': from modules.sources import Sources Sources().display_results() elif mode == 'play_file': from modules.sources import Sources Sources().play_file(params['title'], params['source']) elif mode == 'play_auto': from modules.sources import Sources Sources().play_auto() elif mode == 'play_auto_nextep': from modules.sources import Sources Sources().play_auto_nextep() elif mode == 'media_play': from modules.player import FenPlayer FenPlayer().run() elif mode == 'play_trailer': from modules.nav_utils import play_trailer play_trailer(params.get('url'), params.get('all_trailers', [])) elif 'choice' in mode: if mode == 'scraper_color_choice': from modules.utils import scraper_color_choice scraper_color_choice() elif mode == 'external_color_choice': from modules.utils import external_color_choice external_color_choice() elif mode == 'next_episode_color_choice': from modules.next_episode import next_episode_color_choice next_episode_color_choice() elif mode == 'next_episode_options_choice': from modules.next_episode import next_episode_options_choice
def execute_nextep(meta, nextep_settings): def _get_nextep_params(): nextep_params = nextep_playback_info(meta) return nextep_params def _get_nextep_url(): Sources().playback_prep(nextep_params) return kodi_utils.get_property('fen_nextep_url') 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 _continue_action(): if run_popup: action = open_window(('windows.next_episode', 'NextEpisode'), 'next_episode.xml', meta=nextep_meta, function='next_ep') else: action = 'close' return action def _control(): confirm_threshold = False final_action = 'cancel' while player.isPlayingVideo(): try: total_time = player.getTotalTime() curr_time = player.getTime() remaining_time = round(total_time - curr_time) if remaining_time <= nextep_threshold_check: if not confirm_threshold: confirm_threshold = _confirm_threshold() if not confirm_threshold: final_action = 'cancel' break if remaining_time <= display_nextep_popup: final_action = _continue_action() break kodi_utils.sleep(200) except: pass return final_action kodi_utils.clear_property('fen_nextep_url') player = FenPlayer() run_popup, display_nextep_popup = nextep_settings[ 'run_popup'], nextep_settings['window_time'] nextep_prep, nextep_threshold_check = nextep_settings[ 'start_prep'], nextep_settings['threshold_check'] nextep_meta, nextep_params = _get_nextep_params() if nextep_params == 'error': return kodi_utils.notification(32574, 3000) elif nextep_params == 'no_next_episode': return nextep_url = _get_nextep_url() if not nextep_url: return kodi_utils.notification(32760, 3000) action = _control() if action == 'cancel': return kodi_utils.notification(32736, 3000) elif action == 'play': player.stop() elif action == 'close': if not run_popup: kodi_utils.notification( '%s %s S%02dE%02d' % (ls(32801), nextep_meta['title'], nextep_meta['season'], nextep_meta['episode']), 6500, nextep_meta['poster']) while player.isPlayingVideo(): kodi_utils.sleep(100) kodi_utils.sleep(1000) player.run(nextep_url)
def routing(argv2): params = dict(parse_qsl(argv2.replace('?',''))) mode = params.get('mode', 'navigator.main') if 'navigator.' in mode: from indexers.navigator import Navigator exec('Navigator(params).%s()' % mode.split('.')[1]) elif 'discover.' in mode: if mode in ('discover.remove_from_history', 'discover.remove_all_history'): if mode == 'discover.remove_from_history': from indexers.discover import remove_from_history params['silent'] = False remove_from_history(params) elif mode == 'discover.remove_all_history': from indexers.discover import remove_all_history params['silent'] = True remove_all_history(params) else: from indexers.discover import Discover exec('Discover(params).%s()' % mode.split('.')[1]) elif 'furk.' in mode: if mode == 'furk.browse_packs': from modules.sources import Sources Sources().furkPacks(params['file_name'], params['file_id'], params['highlight']) elif mode == 'furk.add_to_files': from indexers.furk import add_to_files add_to_files(params['item_id']) elif mode == 'furk.remove_from_files': from indexers.furk import remove_from_files remove_from_files(params['item_id']) elif mode == 'furk.remove_from_downloads': from indexers.furk import remove_from_downloads remove_from_downloads(params['item_id']) elif mode == 'furk.remove_from_files': from indexers.furk import add_uncached_file add_uncached_file(params['id']) elif mode == 'furk.myfiles_protect_unprotect': from indexers.furk import myfiles_protect_unprotect myfiles_protect_unprotect(params['action'], params['name'], params['item_id']) elif mode == 'furk.browse_audio_album': from indexers.furk import browse_audio_album browse_audio_album(params.get('t_file', None), params.get('item_path', None)) else: from modules.utils import manual_function_import function = manual_function_import('indexers.furk', mode.split('.')[-1]) function(params) elif 'easynews.' in mode: from modules.utils import manual_function_import function = manual_function_import('indexers.easynews', mode.split('.')[-1]) function(params) elif '_play' in mode or 'play_' in mode and not 'autoplay' in mode: if mode == 'play_media': from modules.sources import Sources if 'params' in params: import json params = json.loads(params['params']) Sources().playback_prep(params) elif mode == 'play_display_results': from modules.sources import Sources Sources().display_results() elif mode == 'play_file': from modules.sources import Sources Sources().play_file(params['title'], params['source']) elif mode == 'media_play': from modules.player import FenPlayer FenPlayer().run(params.get('url', None), params.get('media_type', None)) elif mode == 'play_fetch_random': from modules.random_play import play_fetch_random play_fetch_random(params['tmdb_id']) elif 'choice' in mode: from indexers import dialogs if mode == 'scraper_color_choice': dialogs.scraper_color_choice(params['setting']) elif mode == 'scraper_dialog_color_choice': dialogs.scraper_dialog_color_choice(params['setting']) elif mode == 'scraper_quality_color_choice': dialogs.scraper_quality_color_choice(params['setting']) elif mode == 'imdb_images_choice': dialogs.imdb_images_choice(params['imdb_id'], params['rootname']) elif mode == 'set_quality_choice': dialogs.set_quality_choice(params['quality_setting']) elif mode == 'results_sorting_choice': dialogs.results_sorting_choice() elif mode == 'results_layout_choice': dialogs.results_layout_choice() elif mode == 'options_menu_choice': dialogs.options_menu(params) elif mode == 'meta_language_choice': dialogs.meta_language_choice() elif mode == 'extras_menu_choice': dialogs.extras_menu(params) elif mode == 'enable_scrapers_choice': dialogs.enable_scrapers_choice() elif mode == 'favorites_choice': dialogs.favorites_choice(params) elif mode == 'trakt_manager_choice': dialogs.trakt_manager_choice(params) elif mode == 'folder_scraper_manager_choice': dialogs.folder_scraper_manager_choice() elif mode == 'set_language_filter_choice': dialogs.set_language_filter_choice(params['filter_setting']) elif mode == 'media_extra_info_choice': dialogs.media_extra_info(params['media_type'], params['meta']) elif mode == 'extras_lists_choice': dialogs.extras_lists_choice() elif 'trakt.' in mode or 'trakt_' in mode: if mode == 'get_trakt_my_calendar': from indexers.episodes_single import get_trakt_my_calendar get_trakt_my_calendar(params) elif 'trakt.list' in mode: from modules.utils import manual_function_import function = manual_function_import('indexers.trakt_lists', mode.split('.')[-1]) function(params) elif 'trakt.' in mode: from modules.utils import manual_function_import function = manual_function_import('apis.trakt_api', mode.split('.')[-1]) function(params) else: from apis.trakt_api import hide_unhide_trakt_items hide_unhide_trakt_items(params['action'], params['media_type'], params['media_id'], params['section']) elif 'build' in mode: if mode == 'build_movie_list': from indexers.movies import Movies Movies(params).fetch_list() elif mode == 'build_tvshow_list': from indexers.tvshows import TVShows TVShows(params).fetch_list() elif mode == 'build_season_list': from indexers.seasons import build_season_list build_season_list(params) elif mode == 'build_episode_list': from indexers.episodes import build_episode_list build_episode_list(params) elif mode == 'build_next_episode': from indexers.episodes_single import build_next_episode build_next_episode() elif mode == 'build_in_progress_episode': from indexers.episodes_single import build_in_progress_episode build_in_progress_episode() elif mode == 'build_navigate_to_page': from modules.nav_utils import build_navigate_to_page build_navigate_to_page(params) elif mode == 'build_next_episode_manager': from indexers.next_episode import build_next_episode_manager build_next_episode_manager(params) elif mode == 'imdb_build_user_lists': from indexers.imdb import imdb_build_user_lists imdb_build_user_lists(params.get('db_type')) elif mode == 'build_popular_people': from indexers.people import popular_people popular_people() elif mode == 'imdb_build_keyword_results': from indexers.imdb import imdb_build_keyword_results imdb_build_keyword_results(params['db_type'], params['query']) elif 'favourites' in mode: from modules.favourites import Favourites exec('Favourites(params).%s()' % mode) elif 'watched_unwatched' in mode: if mode == 'mark_as_watched_unwatched_episode': from modules.watched_status import mark_as_watched_unwatched_episode mark_as_watched_unwatched_episode(params) elif mode == 'mark_as_watched_unwatched_season': from modules.watched_status import mark_as_watched_unwatched_season mark_as_watched_unwatched_season(params) elif mode == 'mark_as_watched_unwatched_tvshow': from modules.watched_status import mark_as_watched_unwatched_tvshow mark_as_watched_unwatched_tvshow(params) elif mode == 'mark_as_watched_unwatched_movie': from modules.watched_status import mark_as_watched_unwatched_movie mark_as_watched_unwatched_movie(params) elif mode == 'watched_unwatched_erase_bookmark': from modules.watched_status import erase_bookmark erase_bookmark(params.get('db_type'), params.get('tmdb_id'), params.get('season', ''), params.get('episode', ''), params.get('refresh', 'false')) elif 'myaccounts' in mode: action = mode.split('.')[1] if action == 'open': from modules.nav_utils import open_MyAccounts open_MyAccounts(params) else: from modules.nav_utils import sync_MyAccounts sync_MyAccounts() elif 'toggle' in mode: if mode == 'toggle_jump_to': from modules.nav_utils import toggle_jump_to toggle_jump_to() elif mode == 'toggle_provider': from modules.utils import toggle_provider toggle_provider() elif mode == 'toggle_language_invoker': from modules.nav_utils import toggle_language_invoker toggle_language_invoker() elif 'history' in mode: if mode == 'search_history': from indexers.history import search_history search_history(params) elif mode == 'clear_search_history': from modules.history import clear_search_history clear_search_history() elif mode == 'remove_from_history': from modules.history import remove_from_search_history remove_from_search_history(params) elif 'real_debrid' in mode: if mode == 'real_debrid.rd_torrent_cloud': from indexers.real_debrid import rd_torrent_cloud rd_torrent_cloud() if mode == 'real_debrid.rd_downloads': from indexers.real_debrid import rd_downloads rd_downloads() elif mode == 'real_debrid.browse_rd_cloud': from indexers.real_debrid import browse_rd_cloud browse_rd_cloud(params['id']) elif mode == 'real_debrid.resolve_rd': from indexers.real_debrid import resolve_rd resolve_rd(params) elif mode == 'real_debrid.rd_account_info': from indexers.real_debrid import rd_account_info rd_account_info() elif mode == 'real_debrid.delete': from indexers.real_debrid import rd_delete rd_delete(params.get('id'), params.get('cache_type')) elif mode == 'real_debrid.delete_download_link': from indexers.real_debrid import delete_download_link delete_download_link(params['download_id']) elif 'premiumize' in mode: if mode == 'premiumize.pm_torrent_cloud': from indexers.premiumize import pm_torrent_cloud pm_torrent_cloud(params.get('id', None), params.get('folder_name', None)) elif mode == 'premiumize.pm_transfers': from indexers.premiumize import pm_transfers pm_transfers() elif mode == 'premiumize.pm_account_info': from indexers.premiumize import pm_account_info pm_account_info() elif mode == 'premiumize.rename': from indexers.premiumize import pm_rename pm_rename(params.get('file_type'), params.get('id'), params.get('name')) elif mode == 'premiumize.delete': from indexers.premiumize import pm_delete pm_delete(params.get('file_type'), params.get('id')) elif 'alldebrid' in mode: if mode == 'alldebrid.ad_torrent_cloud': from indexers.alldebrid import ad_torrent_cloud ad_torrent_cloud(params.get('id', None)) elif mode == 'alldebrid.browse_ad_cloud': from indexers.alldebrid import browse_ad_cloud browse_ad_cloud(params['folder']) elif mode == 'alldebrid.resolve_ad': from indexers.alldebrid import resolve_ad resolve_ad(params) elif mode == 'alldebrid.ad_account_info': from indexers.alldebrid import ad_account_info ad_account_info() elif 'people_search' in mode: from indexers import people if 'person_data_dialog' in mode: people.person_data_dialog(params) elif '.search' in mode: people.person_search(params.get('actor_name', None)) elif '_settings' in mode: if mode == 'open_settings': from modules.nav_utils import open_settings open_settings(params.get('query')) elif mode == 'clean_settings': from modules.nav_utils import clean_settings clean_settings() elif mode == 'erase_all_settings': from modules.nav_utils import erase_all_settings erase_all_settings() elif mode == 'external_settings': from modules.nav_utils import open_settings open_settings(params.get('query', '0.0'), params.get('ext_addon')) elif mode == 'clear_settings_window_properties': from modules.kodi_utils import clear_settings_window_properties clear_settings_window_properties() elif '_cache' in mode: from modules import nav_utils if mode == 'clear_cache': nav_utils.clear_cache(params.get('cache')) elif mode == 'clear_all_cache': nav_utils.clear_all_cache() elif '_image' in mode: from indexers.images import Images Images().run(params) elif 'service_functions' in mode: from services import service_functions exec('service_functions.%s().run()' % mode.split('.')[1]) elif '_text' in mode: if mode == 'show_text': from modules.kodi_utils import show_text show_text(params.get('heading'), params.get('text', None), params.get('file', None), params.get('font_size', 'small')) elif mode == 'show_text_media': from modules.kodi_utils import show_text_media show_text(params.get('heading'), params.get('text', None), params.get('file', None), params.get('meta'), {}) elif '_view' in mode: from modules import kodi_utils if mode == 'choose_view': kodi_utils.choose_view(params['view_type'], params.get('content', '')) elif mode == 'set_view': kodi_utils.set_view(params['view_type']) ##EXTRA modes## elif mode == 'manual_add_magnet_to_cloud': from modules.debrid import manual_add_magnet_to_cloud manual_add_magnet_to_cloud(params) elif mode == 'debrid.browse_packs': from modules.sources import Sources Sources().debridPacks(params['provider'], params['name'], params['magnet_url'], params['info_hash'], params['highlight']) elif mode == 'get_search_term': from modules.nav_utils import get_search_term get_search_term(params) elif mode == 'link_folders': from modules.nav_utils import link_folders link_folders(params['service'], params['folder_name'], params['action']) elif mode == 'downloader': from modules.downloader import runner runner(params) elif mode == 'clean_databases': from caches import clean_databases clean_databases() elif mode == 'refresh_artwork': from modules.nav_utils import refresh_artwork refresh_artwork()
def resolve_easynews(params): url_dl = params['url_dl'] resolved_link = EasyNews.resolve_easynews(url_dl) if params.get('play', 'false') != 'true': return resolved_link from modules.player import FenPlayer FenPlayer().run(resolved_link, 'video')
def resolve_rd(params): url = params['url'] resolved_link = RealDebrid.unrestrict_link(url) if params.get('play', 'false') != 'true': return resolved_link from modules.player import FenPlayer FenPlayer().run(resolved_link, 'video')
def browse_audio_album(t_files, item_path=None): def build_list_object(): try: cm = [] url_params = { 'mode': 'media_play', 'url': item['url_dl'], 'media_type': 'music' } url = build_url(url_params) track_name = clean_file_name( batch_replace(to_utf8(item['name']), formats)).upper() listitem = make_listitem() listitem.setLabel(track_name) down_file_params = { 'mode': 'downloader', 'name': item['name'], 'url': item['url_dl'], 'action': 'audio', 'image': default_furk_icon } cm.append( (ls(32747), 'RunPlugin(%s)' % build_url(down_file_params))) listitem.addContextMenuItems(cm) listitem.setArt({ 'icon': default_furk_icon, 'poster': default_furk_icon, 'thumb': default_furk_icon, 'fanart': fanart, 'banner': default_furk_icon }) kodi_utils.add_item(__handle__, url, listitem, True) except: pass from modules.utils import batch_replace __handle__ = int(argv[1]) seperate = False if not t_files: seperate = True t_fs = kodi_utils.get_property('furk_t_files_json') t_files = json.loads(t_fs) t_files = [i for i in t_files if 'audio' in i['ct']] line = '%s[CR]%s[CR]%s' if seperate: if kodi_utils.confirm_dialog(text=32763, ok_label=32838, cancel_label=32764, top_space=True): for item in t_files: t_path = clean_file_name(item['path']) if t_path == item_path: build_list_object() kodi_utils.set_content(__handle__, 'files') kodi_utils.end_directory(__handle__) kodi_utils.set_view_mode('view.premium') else: from modules.player import FenPlayer FenPlayer().playAudioAlbum(t_files, from_seperate=True) else: for item in t_files: build_list_object() kodi_utils.set_content(__handle__, 'files') kodi_utils.end_directory(__handle__) kodi_utils.set_view_mode('view.premium')