How to use _add_dir method in autotest

Best Python code snippet using autotest_python

navigator.py

Source:navigator.py Github

copy

Full Screen

...32 def downloads(self):33 movie_path = settings.download_directory('movie')34 episode_path = settings.download_directory('episode')35 premium_path = settings.download_directory('premium')36 self._add_dir({'mode': 'navigator.folder_navigator', 'folder_path': movie_path, 'foldername': 'Movie Downloads', 'list_name': 'Movie Downloads'}, '[B]DOWNLOADS: [/B]Movies', iconImage='movies.png')37 self._add_dir({'mode': 'navigator.folder_navigator', 'folder_path': episode_path, 'foldername': 'TV Show Downloads', 'list_name': 'TV Show Downloads'}, '[B]DOWNLOADS: [/B]TV Shows', iconImage='tvshows.png')38 self._add_dir({'mode': 'navigator.folder_navigator', 'folder_path': premium_path, 'foldername': 'Premium File Downloads', 'list_name': 'Premium File Downloads'}, '[B]DOWNLOADS: [/B]Premium Files', iconImage='tools.png')39 self._end_directory()40 def discover_main(self):41 self._add_dir({'mode': 'discover.movie', 'db_type': 'movie', 'foldername': 'Discover Movies', 'list_name': 'Discover Movies'}, '[B]DISCOVER : [/B]Movies', iconImage='tools.png')42 self._add_dir({'mode': 'discover.tvshow', 'db_type': 'tvshow', 'foldername': 'Discover TV Shows', 'list_name': 'Discover TV Shows'}, '[B]DISCOVER : [/B]TV Shows', iconImage='tools.png')43 self._add_dir({'mode': 'discover.history', 'db_type': 'movie', 'foldername': 'Discover Movie History', 'list_name': 'Discover Movie History'}, '[B]DISCOVER : [/B]Movie History', iconImage='tools.png')44 self._add_dir({'mode': 'discover.history', 'db_type': 'tvshow', 'foldername': 'Discover TV Show History', 'list_name': 'Discover TV Show History'}, '[B]DISCOVER : [/B]TV Show History', iconImage='tools.png')45 self._add_dir({'mode': 'discover.help', 'foldername': 'Discover Help', 'list_name': 'Discover Help'}, '[B]DISCOVER : [/B]Help', iconImage='tools.png')46 self._end_directory()47 def premium(self):48 enable_fu = True49 if not __addon__.getSetting('furk_api_key'):50 if not __addon__.getSetting('furk_login') or not __addon__.getSetting('furk_password'):51 enable_fu = False52 enable_en = False if '' in (__addon__.getSetting('easynews_user'), __addon__.getSetting('easynews_password')) else True53 enable_pm = False if __addon__.getSetting('pm.token') == '' else True54 if enable_fu: self._add_dir({'mode': 'navigator.furk', 'foldername': 'Furk', 'list_name': 'Furk'}, '[B]PREMIUM : [/B]Furk', iconImage='tools.png')55 if enable_en: self._add_dir({'mode': 'navigator.easynews', 'foldername': 'Easynews', 'list_name': 'Easynews'}, '[B]PREMIUM : [/B]Easynews', iconImage='tools.png')56 self._add_dir({'mode': 'navigator.real_debrid', 'foldername': 'Real Debrid', 'list_name': 'Real Debrid'}, '[B]PREMIUM : [/B]Real Debrid', iconImage='tools.png')57 self._add_dir({'mode': 'navigator.premiumize', 'foldername': 'Premiumize', 'list_name': 'Premiumize'}, '[B]PREMIUM : [/B]Premiumize', iconImage='tools.png')58 self._add_dir({'mode': 'navigator.alldebrid', 'foldername': 'All Debrid', 'list_name': 'All Debrid'}, '[B]PREMIUM : [/B]All Debrid', iconImage='tools.png')59 self._end_directory()60 def furk(self):61 self._add_dir({'mode': 'furk.my_furk_files', 'list_type': 'file_get_video', 'foldername': 'My Furk Video Files', 'list_name': 'Furk Video Files'}, '[B]FURK: [/B]Video Files', iconImage='userlists.png')62 self._add_dir({'mode': 'furk.my_furk_files', 'list_type': 'file_get_audio', 'foldername': 'My Furk Audio Files', 'list_name': 'Furk Audio Files'}, '[B]FURK: [/B]Audio Files', iconImage='userlists.png')63 self._add_dir({'mode': 'furk.my_furk_files', 'list_type': 'file_get_active', 'foldername': 'My Furk Active Downloads', 'list_name': 'My Furk Active Downloads'}, '[B]FURK: [/B]Active Downloads', iconImage='userlists.png')64 self._add_dir({'mode': 'furk.my_furk_files', 'list_type': 'file_get_failed', 'foldername': 'My Furk Failed Downloads', 'list_name': 'My Furk Failed Downloads'}, '[B]FURK: [/B]Failed Downloads', iconImage='userlists.png')65 self._add_dir({'mode': 'furk.search_furk', 'db_type': 'video', 'foldername': 'Search Furk (Video)', 'list_name': 'Furk Search Video'}, '[B]FURK: [/B]Search (Video)', iconImage='search.png')66 self._add_dir({'mode': 'furk.search_furk', 'db_type': 'audio', 'foldername': 'Search Furk (Audio)', 'list_name': 'Furk Search Audio'}, '[B]FURK: [/B]Search (Audio)', iconImage='search.png')67 self._add_dir({'mode': 'search_history', 'action': 'furk_video', 'foldername': 'Video Search History', 'list_name': 'Furk Search History (Video)'}, '[B]FURK: [/B]Search History (Video)', iconImage='search.png')68 self._add_dir({'mode': 'search_history', 'action': 'furk_audio', 'foldername': 'Audio Search History', 'list_name': 'Furk Search History (Audio)'}, '[B]FURK: [/B]Search History (Audio)', iconImage='search.png')69 self._add_dir({'mode': 'furk.account_info', 'foldername': 'Account Info', 'list_name': 'Furk Account Info'}, '[B]FURK: [/B]Account Info', iconImage='tools.png')70 self._end_directory()71 def easynews(self):72 self._add_dir({'mode': 'easynews.search_easynews', 'foldername': 'Search Easynews (Video)', 'list_name': 'Search Easynews (Video)'}, '[B]EASYNEWS : [/B]Search (Video)', iconImage='search.png')73 self._add_dir({'mode': 'search_history', 'action': 'easynews_video', 'foldername': 'Easynews Video Search History', 'list_name': 'Search History Easynews (Video)'}, '[B]EASYNEWS: [/B]Search History (Video)', iconImage='search.png')74 self._add_dir({'mode': 'easynews.account_info', 'foldername': 'Account Info', 'list_name': 'Easynews Account Info'}, '[B]EASYNEWS: [/B]Account Info', iconImage='tools.png')75 self._end_directory()76 def real_debrid(self):77 enable_rd = False if __addon__.getSetting('rd.token') == '' else True78 if enable_rd: self._add_dir({'mode': 'real_debrid.rd_torrent_cloud', 'foldername': 'Cloud Storage', 'list_name': 'Real Debrid Cloud Storage'}, '[B]Real-Debrid: [/B]Cloud Storage', iconImage='tools.png')79 if enable_rd: self._add_dir({'mode': 'real_debrid.rd_downloads', 'foldername': 'Download History', 'list_name': 'Real Debrid Download History'}, '[B]Real-Debrid: [/B]Download History', iconImage='tools.png')80 if enable_rd: self._add_dir({'mode': 'real_debrid.rd_account_info', 'foldername': 'Account Info', 'list_name': 'Real Debrid Account Info'}, '[B]Real-Debrid: [/B]Account Info', iconImage='tools.png')81 self._add_dir({'mode': 'real_debrid.authenticate', 'foldername': '(Re)Authorize Real-Debrid', 'list_name': 'Authorize Real-Debrid'}, '[B]Real-Debrid : [/B](Re)Authenticate Real-Debrid', iconImage='tools.png')82 if enable_rd: self._add_dir({'mode': 'clear_cache', 'cache': 'rd_cloud', 'foldername': 'Clear Cache', 'list_name': 'Tools Clear Real Debrid Cache'}, '[B]Real-Debrid: [/B]Clear Cloud Cache', iconImage='tools.png')83 self._end_directory()84 def premiumize(self):85 self._add_dir({'mode': 'premiumize.pm_torrent_cloud', 'foldername': 'Cloud Storage', 'list_name': 'Premiumize Cloud Storage'}, '[B]Premiumize: [/B]Cloud Storage', iconImage='tools.png')86 self._add_dir({'mode': 'premiumize.pm_transfers', 'foldername': 'Transfer History', 'list_name': 'Premiumize Transfer History'}, '[B]Premiumize: [/B]Transfer History', iconImage='tools.png')87 self._add_dir({'mode': 'premiumize.pm_account_info', 'foldername': 'Account Info', 'list_name': 'Premiumize Account Info'}, '[B]Premiumize: [/B]Account Info', iconImage='tools.png')88 self._add_dir({'mode': 'premiumize.authenticate', 'foldername': '(Re)Authorize Premiumize', 'list_name': 'Authorize Premiumize'}, '[B]Premiumize : [/B](Re)Authenticate Premiumize', iconImage='tools.png')89 self._add_dir({'mode': 'clear_cache', 'cache': 'pm_cloud', 'foldername': 'Clear Cache', 'list_name': 'Tools Clear Premiumize Cache'}, '[B]Premiumize: [/B]Clear Cloud Cache', iconImage='tools.png')90 self._end_directory()91 def alldebrid(self):92 enable_ad = False if __addon__.getSetting('ad.token') == '' else True93 if enable_ad: self._add_dir({'mode': 'alldebrid.ad_torrent_cloud', 'foldername': 'Cloud Storage', 'list_name': 'All Debrid Cloud Storage'}, '[B]All Debrid: [/B]Cloud Storage', iconImage='tools.png')94 if enable_ad: self._add_dir({'mode': 'alldebrid.ad_account_info', 'foldername': 'Account Info', 'list_name': 'All Debrid Account Info'}, '[B]All Debrid: [/B]Account Info', iconImage='tools.png')95 self._add_dir({'mode': 'alldebrid.authenticate', 'foldername': '(Re)Authorize All Debrid', 'list_name': 'Authorize All Debrid'}, '[B]All Debrid : [/B](Re)Authenticate All Debrid', iconImage='tools.png')96 if enable_ad: self._add_dir({'mode': 'clear_cache', 'cache': 'ad_cloud', 'foldername': 'Clear Cache', 'list_name': 'Tools Clear All Debrid Cache'}, '[B]All Debrid: [/B]Clear Cloud Cache', iconImage='tools.png')97 self._end_directory()98 def favourites(self):99 self._add_dir({'mode': 'build_movie_list', 'action': 'favourites_movies', 'foldername': 'Movie Favourites', 'list_name': 'Movies Favourites'}, '[B]FAVOURITES : [/B]Movies', iconImage='movies.png')100 self._add_dir({'mode': 'build_tvshow_list', 'action': 'favourites_tvshows', 'foldername': 'TV Show Favourites', 'list_name': 'TV Shows Favourites'}, '[B]FAVOURITES : [/B]TV Shows', iconImage='tvshows.png')101 self._end_directory()102 def subscriptions(self):103 self._add_dir({'mode': 'build_movie_list', 'action': 'subscriptions_movies', 'foldername': 'David Subscriptions', 'list_name': 'Movies Subscriptions'}, '[B]SUBSCRIPTIONS : [/B]Movies', iconImage='movies.png')104 self._add_dir({'mode': 'build_tvshow_list', 'action': 'subscriptions_tvshows', 'foldername': 'David Subscriptions', 'list_name': 'TV Shows Subscriptions'}, '[B]SUBSCRIPTIONS : [/B]TV Shows', iconImage='tvshows.png')105 self._end_directory()106 def kodi_library(self):107 self._add_dir({'mode': 'build_movie_list', 'action': 'kodi_library_movies', 'foldername': 'Movies Kodi Library', 'list_name': 'Movies Kodi Library'}, '[B]KODI LIBRARY : [/B]Movies', iconImage='movies.png')108 self._add_dir({'mode': 'build_tvshow_list', 'action': 'kodi_library_tvshows', 'foldername': 'TV Shows Kodi Library', 'list_name': 'TV Shows Kodi Library'}, '[B]KODI LIBRARY : [/B]TV Shows', iconImage='tvshows.png')109 self._add_dir({'mode': 'build_kodi_library_recently_added', 'db_type': 'movies', 'foldername': 'Recently Added Movies Kodi Library', 'list_name': 'Recently Added Movies Kodi Library'}, '[B]KODI LIBRARY : [/B]Recently Added Movies', iconImage='movies.png')110 self._add_dir({'mode': 'build_kodi_library_recently_added', 'db_type': 'episodes', 'foldername': 'Recently Added Movies Kodi Library', 'list_name': 'Recently Added Episodes Kodi Library'}, '[B]KODI LIBRARY : [/B]Recently Added Episodes', iconImage='tvshows.png')111 self._end_directory()112 def in_progress(self):113 self._add_dir({'mode': 'build_movie_list', 'action': 'in_progress_movies', 'foldername': 'Movies In Progress', 'list_name': 'Movies In Progress'}, '[B]IN PROGRESS : [/B]Movies', iconImage='movies.png')114 self._add_dir({'mode': 'build_tvshow_list', 'action': 'in_progress_tvshows', 'foldername': 'TV Shows In Progress', 'list_name': 'TV Shows In Progress'}, '[B]IN PROGRESS : [/B]TV Shows', iconImage='tvshows.png')115 self._add_dir({'mode': 'build_in_progress_episode', 'foldername': 'Episodes In Progress', 'list_name': 'Episodes In Progress'}, '[B]IN PROGRESS : [/B]Episodes', iconImage='tvshows.png')116 self._end_directory()117 def watched(self):118 self._add_dir({'mode': 'build_movie_list', 'action': 'watched_movies', 'foldername': 'David Watched Movies', 'list_name': 'Movies Watched'}, '[B]WATCHED : [/B]Movies', iconImage='movies.png')119 self._add_dir({'mode': 'build_tvshow_list', 'action': 'watched_tvshows', 'foldername': 'David Watched Shows', 'list_name': 'TV Shows Watched'}, '[B]WATCHED : [/B]TV Shows', iconImage='tvshows.png')120 self._end_directory()121 def my_trakt_content(self):122 self._add_dir({'mode': 'navigator.trakt_collection', 'foldername': 'My Trakt Collections', 'list_name': 'Trakt My Collections'}, '[B]TRAKT: [/B]Collections', iconImage='trakt.png')123 self._add_dir({'mode': 'navigator.trakt_watchlist', 'foldername': 'My Trakt Watchlists', 'list_name': 'Trakt My Watchlists'}, '[B]TRAKT: [/B]Watchlists', iconImage='trakt.png')124 self._add_dir({'mode': 'trakt.get_trakt_my_lists', 'foldername': 'My Trakt Lists', 'list_name': 'Trakt My Lists'}, '[B]TRAKT: [/B]Lists', iconImage='trakt.png')125 self._add_dir({'mode': 'trakt.get_trakt_liked_lists', 'foldername': 'My Trakt Liked Lists', 'list_name': 'Trakt My Liked Lists'}, '[B]TRAKT: [/B]Liked Lists', iconImage='trakt.png')126 self._add_dir({'mode': 'navigator.trakt_recommendations', 'foldername': 'My Trakt Recommended Lists', 'list_name': 'Trakt My Recommended Lists'}, '[B]TRAKT: [/B]Recommended Lists', iconImage='trakt.png')127 self._add_dir({'mode': 'trakt.search_trakt_lists', 'foldername': 'Search Trakt Lists', 'list_name': 'Trakt Search Lists'}, '[B]TRAKT: [/B]Search User Lists', iconImage='search.png')128 self._add_dir({'mode': 'trakt.get_trakt_my_calendar', 'foldername': 'TV Show Calendar', 'list_name': 'TV Show Calendar'}, '[B]TRAKT: [/B]TV Show Calendar', iconImage='trakt.png')129 self._add_dir({'mode': 'navigator.trakt_widgets', 'foldername': 'Trakt Widgets', 'list_name': 'Trakt Widgets'}, '[B]TRAKT: [/B]Widgets', iconImage='trakt.png')130 self._end_directory()131 def trakt_collection(self):132 self._add_dir({'mode': 'build_movie_list', 'action': 'trakt_collection', 'foldername': 'My Trakt Movie Collection', 'list_name': 'Movies Trakt Collection'}, '[B]COLLECTION: [/B]Movies', iconImage='movies.png')133 self._add_dir({'mode': 'build_tvshow_list', 'action': 'trakt_collection', 'foldername': 'My Trakt TV Show Collection', 'list_name': 'TV Shows Trakt Collection'}, '[B]COLLECTION: [/B]TV Shows', iconImage='tvshows.png')134 self._end_directory()135 def trakt_watchlist(self):136 self._add_dir({'mode': 'build_movie_list', 'action': 'trakt_watchlist', 'foldername': 'My Trakt Movie Watchlist', 'list_name': 'Movies Trakt Watchlist'}, '[B]WATCHLIST: [/B]Movies', iconImage='movies.png')137 self._add_dir({'mode': 'build_tvshow_list', 'action': 'trakt_watchlist', 'foldername': 'My Trakt TV Show Watchlist', 'list_name': 'TV Shows Trakt Watchlist'}, '[B]WATCHLIST: [/B]TV Shows', iconImage='tvshows.png')138 self._end_directory()139 def trakt_recommendations(self):140 self._add_dir({'mode': 'build_movie_list', 'action': 'trakt_recommendations', 'foldername': 'My Trakt Movie Recommendations', 'list_name': 'Trakt My Movie Recommendations'}, '[B]RECOMMENDATIONS: [/B]Movies', iconImage='movies.png')141 self._add_dir({'mode': 'build_tvshow_list', 'action': 'trakt_recommendations', 'foldername': 'My Trakt TV Show Recommendations', 'list_name': 'Trakt My TV Show Recommendations'}, '[B]RECOMMENDATIONS: [/B]TV Shows', iconImage='tvshows.png')142 self._end_directory()143 def trakt_widgets(self):144 # use 'new_page' to pass the type of list to be processed when using 'trakt_collection_widgets'...145 self._add_dir({'mode': 'build_movie_list', 'action': 'trakt_collection_widgets', 'new_page': 'recent', 'foldername': 'Trakt Collection Recently Added Movies', 'list_name': 'Trakt Collection Recently Added Movies'}, '[B]TRAKT WIDGETS: [/B]Collection: Recently Added Movies', iconImage='trakt.png')146 self._add_dir({'mode': 'build_movie_list', 'action': 'trakt_collection_widgets', 'new_page': 'random', 'foldername': 'Trakt Collection Random Movies', 'list_name': 'Trakt Collection Random Movies'}, '[B]TRAKT WIDGETS: [/B]Collection: Random Movies', iconImage='trakt.png')147 self._add_dir({'mode': 'build_tvshow_list', 'action': 'trakt_collection_widgets', 'new_page': 'recent', 'foldername': 'Trakt Collection Recently Added TV Shows', 'list_name': 'Trakt Collection Recently Added TV Shows'}, '[B]TRAKT WIDGETS: [/B]Collection: Recently Added TV Shows', iconImage='trakt.png')148 self._add_dir({'mode': 'build_tvshow_list', 'action': 'trakt_collection_widgets', 'new_page': 'random', 'foldername': 'Trakt Collection Random TV Shows', 'list_name': 'Trakt Collection Random TV Shows'}, '[B]TRAKT WIDGETS: [/B]Collection: Random TV Shows', iconImage='trakt.png')149 self._add_dir({'mode': 'trakt.get_trakt_my_calendar', 'recently_aired': 'true', 'foldername': 'Trakt Collection Recently Aired Episodes', 'list_name': 'Trakt Collection Recently Aired Episodes'}, '[B]TRAKT WIDGETS: [/B]Collection: Recently Aired Episodes', iconImage='trakt.png')150 self._end_directory()151 def search(self):152 self._add_dir({'mode': 'build_movie_list', 'action': 'tmdb_movies_search', 'query': 'NA', 'foldername': 'Movie Search', 'list_name': 'Search Movies'}, '[B]Search : [/B]Movies', iconImage='search.png')153 self._add_dir({'mode': 'build_tvshow_list', 'action': 'tmdb_tv_search', 'query': 'NA', 'foldername': 'TV Show Search', 'list_name': 'Search TV Shows'}, '[B]Search : [/B]TV Shows', iconImage='search.png')154 self._add_dir({'mode': 'people_search.search', 'foldername': 'People Search', 'list_name': 'Search People'}, '[B]Search : [/B]People', iconImage='people-search.png')155 self._add_dir({'mode': 'search_history', 'action': 'movie', 'foldername': 'Movie Search', 'list_name': 'Search History Movies'}, '[B]History : [/B]Movie Search', iconImage='search.png')156 self._add_dir({'mode': 'search_history', 'action': 'tvshow', 'foldername': 'TV Show Search', 'list_name': 'Search History TV Shows'}, '[B]History : [/B]TV Show Search', iconImage='search.png')157 self._add_dir({'mode': 'search_history', 'action': 'people', 'foldername': 'People Search', 'list_name': 'Search History People'}, '[B]History : [/B]People Search', iconImage='people-search.png')158 self._end_directory()159 def tools(self):160 self._add_dir({'mode': 'open_settings', 'query': '0.0', 'foldername': 'General', 'list_name': 'Settings General'}, '[B]Settings : [/B]General', iconImage='tools.png')161 self._add_dir({'mode': 'open_settings', 'query': '1.0', 'foldername': 'Playback', 'list_name': 'Settings Playback'}, '[B]Settings : [/B]Playback', iconImage='tools.png')162 self._add_dir({'mode': 'open_settings', 'query': '2.0', 'foldername': 'Results', 'list_name': 'Settings Results'}, '[B]Settings : [/B]Results', iconImage='tools.png')163 self._add_dir({'mode': 'open_settings', 'query': '3.0', 'foldername': 'Next Episodes', 'list_name': 'Settings Next Episodes'}, '[B]Settings : [/B]Next Episodes', iconImage='tools.png')164 self._add_dir({'mode': 'open_settings', 'query': '4.0', 'foldername': 'Accounts', 'list_name': 'Settings Accounts'}, '[B]Settings : [/B]Accounts', iconImage='tools.png')165 self._add_dir({'mode': 'open_settings', 'query': '5.0', 'foldername': 'Trakt', 'list_name': 'Trakt'}, '[B]Settings : [/B]Trakt', iconImage='tools.png')166 self._add_dir({'mode': 'open_settings', 'query': '6.0', 'foldername': 'Internal Scrapers', 'list_name': 'Settings Internal Scrapers'}, '[B]Settings : [/B]Internal Scrapers', iconImage='tools.png')167 self._add_dir({'mode': 'open_settings', 'query': '7.0', 'foldername': 'External Scrapers', 'list_name': 'Settings External Scrapers'}, '[B]Settings : [/B]External Scrapers', iconImage='tools.png')168 self._add_dir({'mode': 'open_settings', 'query': '8.0', 'foldername': 'Subscriptions', 'list_name': 'Settings Subscriptions'}, '[B]Settings : [/B]Subscriptions', iconImage='tools.png')169 self._add_dir({'mode': 'open_settings', 'query': '9.0', 'foldername': 'Downloads', 'list_name': 'Settings Downloads'}, '[B]Settings : [/B]Downloads', iconImage='tools.png')170 display_time = '' if settings.subscription_update() == False else '[COLOR=grey]| Next Update: %s[/COLOR]' % str(__addon__.getSetting('service_time'))171 self._add_dir({'mode': 'navigator.changelogs', 'foldername': 'Changelogs & Log Viewer', 'list_name': 'Tools Changelogs & Log Viewer'}, '[B]David : [/B]Changelogs & Kodi Log Viewer', iconImage='tools.png')172 self._add_dir({'mode': 'navigator.tips', 'foldername': 'Tips for David Use', 'list_name': 'Tips for David Use'}, '[B]David : [/B]Tips for David Use', iconImage='tools.png')173 self._add_dir({'mode': 'navigator.set_view_modes', 'foldername': 'Set Views', 'list_name': 'Tools Set Views'}, '[B]David : [/B]Set Views', iconImage='tools.png')174 self._add_dir({'mode': 'navigator.backup_restore', 'foldername': 'Backup/Restore David User Data', 'list_name': 'Tools Backup/Restore David User Data'}, '[B]David : [/B]Backup/Restore David User Data', iconImage='tools.png')175 self._add_dir({'mode': 'navigator.clear_info', 'foldername': 'Clear Databases and Clean Settings Files', 'list_name': 'Tools Clear Databases and Clean Settings Files'}, '[B]David : [/B]Clear Databases and Clean Settings Files', iconImage='tools.png')176 self._add_dir({'mode': 'navigator.external_scrapers', 'foldername': 'External Scrapers Manager', 'list_name': 'Tools External Scrapers Manager'}, '[B]David : [/B]External Scrapers Manager', iconImage='tools.png')177 self._add_dir({'mode': 'navigator.shortcut_folders', 'foldername': 'Shortcut Folders Manager', 'list_name': 'Tools Shortcut Folders Manager'}, '[B]David : [/B]Shortcut Folders Manager', iconImage='tools.png')178 self._add_dir({'mode': 'navigator.next_episodes', 'foldername': 'Next Episode Manager', 'list_name': 'Tools Next Episode Manager'}, '[B]David : [/B]Next Episode Manager', iconImage='tools.png')179 self._add_dir({'mode': 'update_subscriptions', 'foldername': 'Update Subscriptions', 'list_name': 'Tools Update Subscriptions'}, '[B]David : [/B]Update Subscriptions %s' % display_time, iconImage='tools.png')180 if settings.watched_indicators() == 1: self._add_dir({'mode': 'trakt_sync_watched_to_david', 'refresh': True, 'foldername': 'ReSync David Watched to Trakt Watched', 'list_name': '[B]David : [/B]ReSync David Watched to Trakt Watched'}, '[B]TOOLS : [/B]ReSync David Watched to Trakt Watched', iconImage='tools.png')181 enable_fu = True182 if not __addon__.getSetting('furk_api_key'):183 if not __addon__.getSetting('furk_login') or not __addon__.getSetting('furk_password'):184 enable_fu = False185 enable_en = False if '' in (__addon__.getSetting('easynews_user'), __addon__.getSetting('easynews_password')) else True186 enable_pm = False if __addon__.getSetting('pm.token') == '' else True187 if enable_fu: self._add_dir({'mode': 'navigator.furk', 'foldername': 'Furk', 'list_name': 'Furk'}, '[B]Premium Services: [/B]Furk', iconImage='tools.png')188 if enable_en: self._add_dir({'mode': 'navigator.easynews', 'foldername': 'Easynews', 'list_name': 'Easynews'}, '[B]Premium Services : [/B]Easynews', iconImage='tools.png')189 self._add_dir({'mode': 'external_settings', 'ext_addon': 'script.david.metadata', 'foldername': 'David Meta Settings', 'list_name': 'Settings David Meta Settings'}, '[B]David : [/B]Configure Meta Settings', iconImage='tools.png')190 self._add_dir({'mode': 'external_settings', 'ext_addon': 'script.module.openscrapers', 'foldername': 'OpenScrapers Settings', 'list_name': 'Settings OpenScrapers Settings'}, '[B]OpenScraper Settings : [/B]Configure OpenScrapers Settings', iconImage='tools.png')191 self._add_dir({'mode': 'resolveurl_settings', 'foldername': 'ResolveURL Settings', 'list_name': 'Settings ResolveURL Settings'}, '[B]ResolveURL : [/B]Configure ResolveURL Settings', iconImage='tools.png')192 self._add_dir({'mode': 'navigator.premiumize', 'foldername': 'Premiumize', 'list_name': 'Premiumize'}, '[B]Premiumize : [/B](Re)Authorize David With Premiumize', iconImage='tools.png')193 self._add_dir({'mode': 'navigator.alldebrid', 'foldername': 'All Debrid', 'list_name': 'All Debrid'}, '[B]All Debrid : [/B](Re)Authorize David With All Debrid', iconImage='tools.png')194 self._add_dir({'mode': 'navigator.real_debrid', 'foldername': 'Real Debrid', 'list_name': 'Real Debrid'}, '[B]Real-Debrid : [/B](Re)Authorize David With Real-Debrid', iconImage='tools.png')195# self._add_dir({'mode': 'navigator.debrid_authorize', 'foldername': '(Re)Authorize Debrid Services', 'list_name': 'Authorize Debrid Services'}, '[B]Premium Services : [/B](Re)Authorize Debrid Services', iconImage='tools.png')196 self._add_dir({'mode': 'trakt_authenticate', 'foldername': '(Re)Authenticate Trakt', 'list_name': 'Tools (Re)Authenticate Trakt'}, '[B]Trakt : [/B](Re)Authorize David With Trakt', iconImage='trakt.png')197 self._end_directory()198 def backup_restore(self):199 self._add_dir({'mode': 'backup_settings', 'foldername': 'Backup David User Data', 'list_name': 'Tools Backup David User Data'}, '[B]Tools : [/B]Backup David User Data', iconImage='tools.png')200 self._add_dir({'mode': 'restore_settings', 'foldername': 'Restore David User Data', 'list_name': 'Tools Restore David User Data'}, '[B]Tools : [/B]Restore David User Data', iconImage='tools.png')201 self._end_directory()202 def clear_info(self):203 clear_all_amble = '[B][COLOR=grey] (Excludes Favourites, Subscriptions & Search History)[/COLOR][/B]'204 self._add_dir({'mode': 'clean_settings', 'foldername': 'Clean Settings Files', 'list_name': 'Clean Settings Files'}, '[B]Clean : [/B]Clean Settings Files', iconImage='tools.png')205 self._add_dir({'mode': 'clear_all_cache', 'foldername': 'Clear All Cache', 'list_name': 'Tools Clear All Cache'}, '[B]Clear All Cache[/B] [I]%s[/I]' % clear_all_amble, iconImage='tools.png')206 self._add_dir({'mode': 'clear_favourites', 'foldername': 'Clear David Favourites', 'list_name': 'Tools Clear David Favourites'}, '[B]Cache : [/B]Clear David Favourites', iconImage='tools.png')207 self._add_dir({'mode': 'clear_subscriptions', 'foldername': 'Clear David Subscriptions', 'list_name': 'Tools Clear David Subscriptions'}, '[B]Cache : [/B]Clear David Subscriptions', iconImage='tools.png')208 self._add_dir({'mode': 'clear_search_history', 'foldername': 'Clear Search History', 'list_name': 'Tools Clear Search History'}, '[B]Cache : [/B]Clear Search History', iconImage='tools.png')209 self._add_dir({'mode': 'clear_cache', 'cache': 'meta', 'foldername': 'Clear Meta Cache', 'list_name': 'Tools Clear Meta Cache'}, '[B]Cache : [/B]Clear Meta Cache', iconImage='tools.png')210 self._add_dir({'mode': 'clear_cache', 'cache': 'list', 'foldername': 'Clear List Cache', 'list_name': 'Tools Clear List Cache'}, '[B]Cache : [/B]Clear List Cache', iconImage='tools.png')211 self._add_dir({'mode': 'clear_cache', 'cache': 'trakt', 'foldername': 'Clear Trakt Cache', 'list_name': 'Tools Clear Trakt Cache'}, '[B]Cache : [/B]Clear Trakt Cache', iconImage='tools.png')212 self._add_dir({'mode': 'clear_cache', 'cache': 'pages', 'foldername': 'Clear Browsed Pages Cache', 'list_name': 'Tools Clear Browsed Pages Cache'}, '[B]Cache : [/B]Clear Browsed Pages Cache', iconImage='tools.png')213 self._add_dir({'mode': 'clear_cache', 'cache': 'internal_scrapers', 'foldername': 'Clear Internal Scrapers Cache', 'list_name': 'Tools Clear Internal Scrapers Cache'}, '[B]Cache : [/B]Clear Internal Scrapers Cache', iconImage='tools.png')214 self._add_dir({'mode': 'clear_cache', 'cache': 'external_scrapers', 'foldername': 'Clear External Scrapers Cache', 'list_name': 'Tools Clear External Scrapers Cache'}, '[B]Cache : [/B]Clear External Scrapers Cache', iconImage='tools.png')215 self._add_dir({'mode': 'clear_cache', 'cache': 'rd_cloud', 'foldername': 'Clear Real Debrid Cache', 'list_name': 'Tools Clear Real Debrid Cache'}, '[B]Cache : [/B]Clear Real Debrid Cache', iconImage='tools.png')216 self._add_dir({'mode': 'clear_cache', 'cache': 'pm_cloud', 'foldername': 'Clear Premiumize Cache', 'list_name': 'Tools Clear Premiumize Cache'}, '[B]Cache : [/B]Clear Premiumize Cache', iconImage='tools.png')217 self._add_dir({'mode': 'clear_cache', 'cache': 'ad_cloud', 'foldername': 'Clear Cache', 'list_name': 'Tools Clear All Debrid Cache'}, '[B]Cache : [/B]Cache All Debrid Cache', iconImage='tools.png')218 self._end_directory()219 def next_episodes(self):220 self._add_dir({'mode': 'build_next_episode_manager', 'action': 'manage_in_progress', 'foldername': 'Manage In Progress Shows', 'exclude_external': 'true'}, '[B]Next Episode : [/B]Manage In Progress Shows', iconImage='tools.png')221 if settings.watched_indicators() == 0: self._add_dir({'mode': 'build_next_episode_manager', 'action': 'manage_unwatched', 'foldername': 'Manage Unwatched Shows', 'exclude_external': 'true'}, '[B]Next Episode : [/B]Manage Unwatched Shows', iconImage='tools.png')222 self._add_dir({'mode': 'next_episode_options_choice', 'setting': 'Sort Type', 'foldername': 'Manage Sort Type', 'exclude_external': 'true'}, '[B]Next Episode : [/B]Manage Sort Type', iconImage='tools.png')223 self._add_dir({'mode': 'next_episode_options_choice', 'setting': 'Sort Order', 'foldername': 'Manage Sort Order', 'exclude_external': 'true'}, '[B]Next Episode : [/B]Manage Sort Order', iconImage='tools.png')224 self._add_dir({'mode': 'next_episode_options_choice', 'setting': 'Include Unaired', 'foldername': 'Manage Unaired Episodes', 'exclude_external': 'true'}, '[B]Next Episode : [/B]Manage Unaired Episodes', iconImage='tools.png')225 self._add_dir({'mode': 'next_episode_options_choice', 'setting': 'Include Trakt or David Unwatched', 'foldername': 'Include Include Unwatched TV Shows', 'exclude_external': 'true'}, '[B]Next Episode : [/B]Include Unwatched TV Shows', iconImage='tools.png')226 self._add_dir({'mode': 'next_episode_options_choice', 'setting': 'Cache To Disk', 'foldername': 'Manage Cache To Disk', 'exclude_external': 'true'}, '[B]Next Episode : [/B]Manage Cache To Disk', iconImage='tools.png')227 self._add_dir({'mode': 'next_episode_options_choice', 'setting': 'Include Airdate in Title', 'foldername': 'Include Airdate in title', 'exclude_external': 'true'}, '[B]Next Episode : [/B]Include Airdate in title', iconImage='tools.png')228 self._add_dir({'mode': 'next_episode_options_choice', 'setting': 'Airdate Format', 'foldername': 'Manage Airdate Format', 'exclude_external': 'true'}, '[B]Next Episode : [/B]Manage Airdate Format', iconImage='tools.png')229 self._add_dir({'mode': 'next_episode_color_choice', 'setting': 'Airdate', 'foldername': 'Manage Airdate Color Highlight', 'exclude_external': 'true'}, '[B]Next Episode : [/B]Manage Airdate Color Highlight', iconImage='tools.png')230 self._add_dir({'mode': 'next_episode_color_choice', 'setting': 'Unaired', 'foldername': 'Manage Unaired Color Highlight', 'exclude_external': 'true'}, '[B]Next Episode : [/B]Manage Unaired Color Highlight', iconImage='tools.png')231 self._add_dir({'mode': 'next_episode_color_choice', 'setting': 'Unwatched', 'foldername': 'Manage Unwatched Color Highlight', 'exclude_external': 'true'}, '[B]Next Episode : [/B]Manage Unwatched Color Highlight', iconImage='tools.png')232 self._end_directory()233 def debrid_authorize(self):234 self._add_dir({'mode': 'real_debrid.authenticate', 'foldername': '(Re)Authorize Real-Debrid', 'list_name': 'Authorize Real-Debrid'}, '[B]Real Debrid : [/B](Re)Authorize Real-Debrid', iconImage='tools.png')235 self._add_dir({'mode': 'alldebrid.authenticate', 'foldername': '(Re)Authorize All Debrid', 'list_name': 'Authorize All Debrid'}, '[B]All Debrid : [/B](Re)Authorize All Debrid', iconImage='tools.png')236 self._add_dir({'mode': 'premiumize.authenticate', 'foldername': '(Re)Authorize Premiumize', 'list_name': 'Authorize Premiumize'}, '[B]Premiumize : [/B](Re)Authorize Premiumize', iconImage='tools.png')237 self._end_directory()238 def external_scrapers(self):239 icon = xbmcaddon.Addon(id='script.module.openscrapers').getAddonInfo('icon')240 fail_color = 'crimson'241 all_color = 'mediumvioletred'242 debrid_color = __addon__.getSetting('prem.identify')243 torrent_color = __addon__.getSetting('torrent.identify')244 self._add_dir({'mode': 'external_scrapers_disable', 'foldername': 'Disable Failing External Scrapers', 'list_name': 'Tools Disable Failing External Scrapers'}, '[COLOR %s][B]FAILURES : [/B][/COLOR][I]Disable Failing External Scrapers[/I]' % fail_color, iconImage=icon)245 self._add_dir({'mode': 'external_scrapers_reset_stats', 'foldername': 'Reset Failing External Scraper Stats', 'list_name': 'Tools Reset Failing External Scraper Stats'}, '[COLOR %s][B]FAILURES : [/B][/COLOR][I]Reset Failing External Scraper Stats[/I]' % fail_color, iconImage=icon)246 self._add_dir({'mode': 'external_scrapers_toggle_all', 'folder': 'all_eng', 'setting': 'true', 'foldername': 'Enable All Scrapers', 'list_name': 'Tools Enable All Scrapers'}, '[COLOR %s][B]ALL SCRAPERS : [/B][/COLOR][I]Enable All Scrapers[/I]' % all_color, iconImage=icon)247 self._add_dir({'mode': 'external_scrapers_toggle_all', 'folder': 'all_eng', 'setting': 'false', 'foldername': 'Disable All Scrapers', 'list_name': 'Tools Disable All Scrapers'}, '[COLOR %s][B]ALL SCRAPERS : [/B][/COLOR][I]Disable All Scrapers[/I]' % all_color, iconImage=icon)248 self._add_dir({'mode': 'external_scrapers_enable_disable_specific_all', 'folder': 'all_eng', 'foldername': 'Enable/Disable Specific Scrapers', 'list_name': 'Tools Enable/Disable Specific Scrapers'}, '[COLOR %s][B]ALL SCRAPERS : [/B][/COLOR][I]Enable/Disable Specific Scrapers[/I]' % all_color, iconImage=icon)249 self._add_dir({'mode': 'external_scrapers_toggle_all', 'folder': 'en_DebridOnly', 'setting': 'true', 'foldername': 'Enable All Debrid Scrapers', 'list_name': 'Tools Enable All Debrid Scrapers'}, '[COLOR %s][B]DEBRID SCRAPERS : [/B][/COLOR][I]Enable All Debrid Scrapers[/I]' % debrid_color, iconImage=icon)250 self._add_dir({'mode': 'external_scrapers_toggle_all', 'folder': 'en_DebridOnly', 'setting': 'false', 'foldername': 'Disable All Debrid Scrapers', 'list_name': 'Tools Disable All Debrid Scrapers'}, '[COLOR %s][B]DEBRID SCRAPERS : [/B][/COLOR][I]Disable All Debrid Scrapers[/I]' % debrid_color, iconImage=icon)251 self._add_dir({'mode': 'external_scrapers_enable_disable_specific_all', 'folder': 'en_DebridOnly', 'foldername': 'Enable/Disable Specific Debrid Scrapers', 'list_name': 'Tools Enable/Disable Specific Debrid Scrapers'}, '[COLOR %s][B]DEBRID SCRAPERS : [/B][/COLOR][I]Enable/Disable Specific Debrid Scrapers[/I]' % debrid_color, iconImage=icon)252 self._add_dir({'mode': 'external_scrapers_toggle_all', 'folder': 'en_Torrent', 'setting': 'true', 'foldername': 'Enable All Torrent Scrapers', 'list_name': 'Tools Enable All Torrent Scrapers'}, '[COLOR %s][B]TORRENT SCRAPERS : [/B][/COLOR][I]Enable All Torrent Scrapers[/I]' % torrent_color, iconImage=icon)253 self._add_dir({'mode': 'external_scrapers_toggle_all', 'folder': 'en_Torrent', 'setting': 'false', 'foldername': 'Disable All Torrent Scrapers', 'list_name': 'Tools Disable All Torrent Scrapers'}, '[COLOR %s][B]TORRENT SCRAPERS : [/B][/COLOR][I]Disable All Torrent Scrapers[/I]' % torrent_color, iconImage=icon)254 self._add_dir({'mode': 'external_scrapers_enable_disable_specific_all', 'folder': 'en_Torrent', 'foldername': 'Enable/Disable Specific Torrent Scrapers', 'list_name': 'Tools Enable/Disable Specific Torrent Scrapers'}, '[COLOR %s][B]TORRENT SCRAPERS : [/B][/COLOR][I]Enable/Disable Specific Torrent Scrapers[/I]' % torrent_color, iconImage=icon)255 self._end_directory()256 def set_view_modes(self):257 self._add_dir({'mode': 'navigator.view_chooser', 'view_setting_id': 'view.main', 'title': 'Set Main List View', 'view_type': 'addons', 'exclude_external': 'true'},'[B]Set View : [/B]Main List', iconImage='tools.png')258 self._add_dir({'mode': 'navigator.view_chooser', 'view_setting_id': 'view.movies', 'title': 'Set Movies View', 'view_type': 'movies', 'exclude_external': 'true'},'[B]Set View : [/B]Movies', iconImage='tools.png')259 self._add_dir({'mode': 'navigator.view_chooser', 'view_setting_id': 'view.tvshows', 'title': 'Set TV Show View', 'view_type': 'tvshows', 'exclude_external': 'true'},'[B]Set View : [/B]TV Shows', iconImage='tools.png')260 self._add_dir({'mode': 'navigator.view_chooser', 'view_setting_id': 'view.seasons', 'title': 'Set Seasons View', 'view_type': 'seasons', 'exclude_external': 'true'},'[B]Set View : [/B]Seasons', iconImage='tools.png')261 self._add_dir({'mode': 'navigator.view_chooser', 'view_setting_id': 'view.episodes', 'title': 'Set Episodes View', 'view_type': 'episodes', 'exclude_external': 'true'},'[B]Set View : [/B]Episodes', iconImage='tools.png')262 self._add_dir({'mode': 'navigator.view_chooser', 'view_setting_id': 'view.episode_lists', 'title': 'Set Episode Lists View', 'view_type': 'episodes', 'exclude_external': 'true'},'[B]Set View : [/B]Episode Lists View', iconImage='tools.png')263 self._add_dir({'mode': 'navigator.view_chooser', 'view_setting_id': 'view.trakt_list', 'title': 'Set Trakt Lists View', 'view_type': 'movies', 'exclude_external': 'true'},'[B]Set View : [/B]Trakt Lists', iconImage='tools.png')264 self._add_dir({'mode': 'navigator.view_chooser', 'view_setting_id': 'view.search_results', 'title': 'Set Search Results View', 'view_type': 'files', 'exclude_external': 'true'},'[B]Set View : [/B]Search Results', iconImage='tools.png')265 self._add_dir({'mode': 'navigator.view_chooser', 'view_setting_id': 'view.premium', 'title': 'Set Premium Files View', 'view_type': 'files', 'exclude_external': 'true'},'[B]Set View : [/B]Premium Files', iconImage='tools.png')266 self._end_directory()267 def changelogs(self):268 david_version = __addon__.getAddonInfo('version')269 scrapers_version = xbmcaddon.Addon(id='script.module.openscrapers').getAddonInfo('version')270 meta_version = xbmcaddon.Addon(id='script.david.metadata').getAddonInfo('version')271 main_text_file, main_heading = xbmc.translatePath(os.path.join(addon_dir, "resources", "text", "changelog.txt")), 'David Changelog [I](v.%s)[/I]' % david_version272 meta_text_file, meta_heading = xbmc.translatePath(os.path.join(xbmc.translatePath(xbmcaddon.Addon(id='script.david.metadata').getAddonInfo('path')), "changelog.txt")), 'David Meta Changelog [I](v.%s)[/I]' % meta_version273 scrapers_text_file, scrapers_heading = xbmc.translatePath(os.path.join(xbmc.translatePath(xbmcaddon.Addon(id='script.module.openscrapers').getAddonInfo('path')), "changelog.txt")), 'OpenScrapers Changelog [I](v.%s)[/I]' % scrapers_version274 kodi_log_location = os.path.join(xbmc.translatePath('special://logpath/'), 'kodi.log')275 self._add_dir({'mode': 'show_text', 'text_file': main_text_file, 'heading': main_heading, 'foldername': main_heading, 'list_name': 'David Changelog'}, '[B]Changelog : [/B] %s' % main_heading.replace(' Changelog', ''), iconImage='tools.png')276 self._add_dir({'mode': 'show_text', 'text_file': meta_text_file, 'heading': meta_heading, 'foldername': meta_heading, 'list_name': 'David Meta Changelog'}, '[B]Changelog : [/B] %s' % meta_heading.replace(' Changelog', ''), iconImage='tools.png')277 self._add_dir({'mode': 'show_text', 'text_file': scrapers_text_file, 'heading': scrapers_heading, 'foldername': scrapers_heading, 'list_name': 'Open Scrapers Changelog'}, '[B]Changelog : [/B] %s' % scrapers_heading.replace(' Changelog', ''), iconImage='tools.png')278 self._add_dir({'mode': 'show_text', 'text_file': kodi_log_location, 'heading': 'Kodi Log Viewer', 'usemono': 'True', 'foldername': 'Kodi Log Viewer', 'list_name': 'Kodi Log Viewer'}, '[B]Log : [/B]Kodi Log Viewer', iconImage='tools.png')279 self._end_directory()280 def certifications(self):281 params = dict(parse_qsl(sys.argv[2].replace('?','')))282 if params.get('menu_type') == 'movie': from modules.nav_utils import movie_certifications as certifications283 else: from modules.nav_utils import tvshow_certifications as certifications284 mode = 'build_movie_list' if params.get('menu_type') == 'movie' else 'build_tvshow_list'285 action = 'tmdb_movies_certifications' if params.get('menu_type') == 'movie' else 'trakt_tv_certifications'286 list_name_insert = self.make_list_name(params.get('menu_type'))287 for cert in certifications:288 self._add_dir({'mode': mode, 'action': action, 'certification': cert, 'foldername': cert.upper(), 'list_name': '%ss %s Certification' % (list_name_insert, cert.upper())}, cert.upper(), iconImage='certificates.png')289 self._end_directory()290 def languages(self):291 from modules.nav_utils import languages292 params = dict(parse_qsl(sys.argv[2].replace('?','')))293 mode = 'build_movie_list' if params.get('menu_type') == 'movie' else 'build_tvshow_list'294 action = 'tmdb_movies_languages' if params.get('menu_type') == 'movie' else 'tmdb_tv_languages'295 list_name_insert = self.make_list_name(params.get('menu_type'))296 for lang in languages:297 self._add_dir({'mode': mode, 'action': action, 'language': lang[1], 'foldername': lang, 'list_name': '%ss %s Language' % (list_name_insert, lang[0])}, lang[0], iconImage='languages.png')298 self._end_directory()299 def years(self):300 from modules.nav_utils import years301 params = dict(parse_qsl(sys.argv[2].replace('?','')))302 mode = 'build_movie_list' if params.get('menu_type') == 'movie' else 'build_tvshow_list'303 action = 'tmdb_movies_year' if params.get('menu_type') == 'movie' else 'tmdb_tv_year'304 list_name_insert = self.make_list_name(params.get('menu_type'))305 for i in years():306 self._add_dir({'mode': mode, 'action': action, 'year': str(i), 'foldername': '%s - %s' % (str(i), params.get('menu_type')), 'list_name': '%ss %s Premiered' % (list_name_insert, str(i))}, str(i), iconImage='calendar.png')307 self._end_directory()308 def genres(self):309 params = dict(parse_qsl(sys.argv[2].replace('?','')))310 mode = 'build_movie_list' if params.get('menu_type') == 'movie' else 'build_tvshow_list'311 action = 'tmdb_movies_genres' if params.get('menu_type') == 'movie' else 'tmdb_tv_genres'312 list_name_insert = self.make_list_name(params.get('menu_type'))313 if params.get('menu_type') == 'movie': from modules.nav_utils import movie_genres as genre_list314 else: from modules.nav_utils import tvshow_genres as genre_list315 self._add_dir({'mode': mode, 'action': action, 'genre_list': json.dumps(genre_list), 'exclude_external': 'true', 'foldername': 'Multiselect'}, '[B]Multiselect...[/B]', iconImage='genres.png')316 for genre, value in sorted(genre_list.items()):317 self._add_dir({'mode': mode, 'action': action, 'genre_id': value[0], 'foldername': genre, 'list_name': '%ss %s Genre' % (list_name_insert, genre)}, genre, iconImage=value[1])318 self._end_directory()319 def networks(self):320 from modules.nav_utils import networks321 for item in sorted(networks, key=lambda k: k['name']):322 self._add_dir({'mode': 'build_tvshow_list', 'action': 'tmdb_tv_networks', 'network_id': item['id'], 'foldername': item['name'], 'list_name': 'TV Shows %s Network' % item['name']}, item['name'], iconImage=item['logo'])323 self._end_directory()324 def trakt_mosts(self):325 params = dict(parse_qsl(sys.argv[2].replace('?','')))326 final_mode = 'build_movie_list' if params.get('menu_type') == 'movie' else 'build_tvshow_list'327 action = 'trakt_movies_mosts' if params.get('menu_type') == 'movie' else 'trakt_tv_mosts'328 list_name_insert = self.make_list_name(params.get('menu_type'))329 trakt_mosts = {'Played': ['played', 'trakt.png'],330 'Collected': ['collected', 'trakt.png'],331 'Watched': ['watched', 'trakt.png']}332 for most, value in trakt_mosts.items():333 self._add_dir({'mode': 'navigator.trakt_mosts_duration', 'action': action, 'period': value[0], 'menu_type': params.get('menu_type'), 'final_mode': final_mode, 'iconImage': value[1], 'foldername': 'Most %s' % most, 'list_name': '%ss Most %s' % (list_name_insert, most)}, '[B]MOST: [/B]%s' % most, iconImage=value[1])334 self._end_directory()335 def trakt_mosts_duration(self):336 params = dict(parse_qsl(sys.argv[2].replace('?','')))337 list_name_insert = self.make_list_name(params.get('menu_type'))338 durations = [('This Week', 'weekly'), ('This Month', 'monthly'), ('This Year', 'yearly'), ('All Time', 'all')]339 for duration, urlitem in durations:340 self._add_dir({'mode': params['final_mode'], 'action': params['action'], 'period': params['period'], 'duration': urlitem, 'foldername': duration, 'list_name': '%ss Most %s %s' % (list_name_insert, params.get('period').capitalize(), duration)}, '[B]MOST %s:[/B] %s' % (params.get('period').upper(), duration), iconImage=params['iconImage'])341 self._end_directory()342 def folder_navigator(self):343 def make_directory(isFolder=True):344 url = os.path.join(folder_path, item)345 listitem = xbmcgui.ListItem(item)346 listitem.setArt({'fanart': self.fanart})347 return xbmcplugin.addDirectoryItem(handle=__handle__, url=url, listitem=listitem, isFolder=isFolder)348 params = dict(parse_qsl(sys.argv[2].replace('?','')))349 folder_path = params['folder_path']350 try:351 dirs, files = xbmcvfs.listdir(folder_path)352 for item in dirs: make_directory()353 for item in files: make_directory(False)354 except: pass355 xbmcplugin.addSortMethod(__handle__, xbmcplugin.SORT_METHOD_FILE)356 self._end_directory()357 358 def sources_folders(self):359 for source in ('folder1', 'folder2', 'folder3', 'folder4', 'folder5'):360 for db_type in ('movie', 'tvshow'):361 folder_path = settings.source_folders_directory(db_type, source)362 if not folder_path: continue363 name = '[B]%s (%sS): %s[/B]\n [I]%s[/I]' % (source.upper(), db_type.upper(), __addon__.getSetting('%s.display_name' % source).upper(), folder_path)364 self._add_dir({'mode': 'navigator.folder_navigator', 'folder_path': folder_path, 'foldername': name, 'list_name': name}, name, iconImage='trakt.png')365 self._end_directory()366 def tips(self):367 tips_location = xbmc.translatePath(os.path.join(addon_dir, "resources", "text", "tips"))368 files = sorted(xbmcvfs.listdir(tips_location)[1])369 important = ['HELP!!!', 'NEW!!!', 'SPOTLIGHT!!!']370 for tip in files:371 tip_name = tip.replace('.txt', '')[4:]372 if any(i in tip_name for i in important):373 for idx, string in enumerate(important):374 if string in tip_name:375 break376 color = 'orange' if idx == 0 else 'crimson' if idx == 1 else 'purple'377 tip_name = (tip_name % color).replace(important[idx], important[idx] + '[/COLOR]')378 self._add_dir({'mode': 'show_text', 'text_file': xbmc.translatePath(os.path.join(tips_location, tip)), 'exclude_external': 'true', 'heading': 'David Tips', 'foldername': '[B]David Tips %s[/B]' % tip_name, 'list_name': 'David Tips [B]%s[/B]' % tip_name}, '[B]TIPS : [/B] %s' % tip_name, iconImage='tools.png')379 self._end_directory()380 def because_you_watched(self):381 from modules.indicators_bookmarks import get_watched_info_movie, get_watched_info_tv382 def _convert_david_watched_episodes_info():383 final_list = []384 used_names = []385 _watched, _trakt = get_watched_info_tv()386 if not _trakt:387 for item in _watched:388 name = item[3]389 if not name in used_names:390 if item[3] == name:391 tv_show = [i for i in _watched if i[3] == name]392 season = max(tv_show)[1]393 episode = max(tv_show)[2]394 final_item = (tv_show[0][0], 'foo', [(season, episode),], tv_show[0][3], tv_show[0][4])395 final_list.append(final_item)396 used_names.append(name)397 _watched = final_list398 return _watched, _trakt399 params = dict(parse_qsl(sys.argv[2].replace('?','')))400 db_type = params['menu_type']401 func = get_watched_info_movie if db_type == 'movie' else _convert_david_watched_episodes_info402 key_index = 2 if db_type == 'movie' else 4403 name_index = 1 if db_type == 'movie' else 3404 tmdb_index = 0405 mode = 'build_movie_list' if db_type == 'movie' else 'build_tvshow_list'406 action = 'tmdb_movies_recommendations' if db_type == 'movie' else 'tmdb_tv_recommendations'407 recently_watched = func()[0]408 recently_watched = sorted(recently_watched, key=lambda k: k[key_index], reverse=True)409 for item in recently_watched:410 if db_type == 'movie': name = '[I]Because You Watched...[/I] [B]%s[/B]' % item[name_index]411 else:412 season, episode = item[2][-1]413 name = '[I]Because You Watched...[/I] [B]%s - %sx%s[/B]' % (item[name_index], season, episode)414 tmdb_id = item[tmdb_index]415 self._add_dir({'mode': mode, 'action': action, 'sim_recom_name': name, 'sim_recom_tmdb': tmdb_id, 'foldername': name, 'list_name': name, 'exclude_external': 'true'}, name, iconImage='userlists.png')416 self._end_directory()417 def view_chooser(self):418 params = dict(parse_qsl(sys.argv[2].replace('?','')))419 self._add_dir({'mode': 'navigator.set_views', 'view_setting_id': params.get('view_setting_id'), 'title': params.get('title'), 'view_type': params.get('view_type'), 'exclude_external': 'true'}, 'Set view and then click here', iconImage='tools.png')420 xbmcplugin.setContent(__handle__, params.get('view_type'))421 xbmcplugin.endOfDirectory(__handle__)422 self._setView(params.get('view_setting_id'), params.get('view_type'))423 def set_views(self):424 from modules.nav_utils import notification425 VIEWS_DB = os.path.join(profile_dir, "views.db")426 settings.check_database(VIEWS_DB)427 params = dict(parse_qsl(sys.argv[2].replace('?','')))428 view_type = params.get('view_setting_id')429 view_id = str(xbmcgui.Window(xbmcgui.getCurrentWindowId()).getFocusId())430 dbcon = database.connect(VIEWS_DB)431 dbcon.execute("DELETE FROM views WHERE view_type = '%s'" % (str(view_type)))432 dbcon.execute("INSERT INTO views VALUES (?, ?)", (str(view_type), str(view_id)))433 dbcon.commit()434 notification("%s set to %s" % (params.get('title')[3:], xbmc.getInfoLabel('Container.Viewmode').upper()), time=2000)435 def make_list_name(self, menu_type):436 return menu_type.replace('tvshow', 'TV Show').replace('movie', 'Movie')437 438 def shortcut_folders(self):439 def _make_new_item():440 display_name = '[I]Make New Shortcut Folder...[/I]'441 url_params = {'mode': 'navigator.adjust_shortcut_folder_lists', 'method': 'add_shortcut_folder'}442 url = self._build_url(url_params)443 listitem = xbmcgui.ListItem(display_name)444 listitem.setArt({'icon': icon, 'poster': icon, 'thumb': icon, 'fanart': self.fanart, 'banner': icon})445 xbmcplugin.addDirectoryItem(handle=__handle__, url=url, listitem=listitem, isFolder=True)446 dbcon = database.connect(NAVIGATOR_DB)447 dbcur = dbcon.cursor()448 dbcur.execute("SELECT list_name, list_contents FROM navigator WHERE list_type = ?", ('shortcut_folder',))449 folders = dbcur.fetchall()450 try: folders = sorted([(str(i[0]), i[1]) for i in folders], key=lambda s: s[0].lower())451 except: folders = []452 icon = os.path.join(self.icon_directory, 'tools.png')453 _make_new_item()454 for i in folders:455 try:456 cm = []457 name = i[0]458 display_name = '[B]SHORTCUT FOLDER : [/B] %s ' % i[0]459 contents = json.loads(i[1])460 url_params = {"iconImage": "tools.png", 461 "mode": "navigator.build_shortcut_folder_lists",462 "action": name,463 "name": name, 464 "foldername": name,465 "shortcut_folder": 'True',466 "external_list_item": 'True',467 "shortcut_folder": 'True',468 "contents": contents}469 remove_params = {'mode': 'navigator.adjust_shortcut_folder_lists', 'method': 'delete_shortcut_folder', 'list_name': name}470 remove_all_params = {'mode': 'navigator.adjust_shortcut_folder_lists', 'method': 'remove_all_shortcut_folders'}471 url = self._build_url(url_params)472 listitem = xbmcgui.ListItem(display_name)473 listitem.setArt({'icon': icon, 'poster': icon, 'thumb': icon, 'fanart': self.fanart, 'banner': icon})474 cm.append(("[B]Delete Shortcut Folder[/B]",'XBMC.RunPlugin(%s)'% self._build_url(remove_params)))475 cm.append(("[B]Delete All Shortcut Folders[/B]",'XBMC.RunPlugin(%s)'% self._build_url(remove_all_params)))476 listitem.addContextMenuItems(cm)477 xbmcplugin.addDirectoryItem(handle=__handle__, url=url, listitem=listitem, isFolder=True)478 except: pass479 self._end_directory()480 def adjust_main_lists(self, params=None):481 from modules.nav_utils import notification482 def db_execute():483 dbcon = database.connect(NAVIGATOR_DB)484 dbcon.execute("DELETE FROM navigator where list_name=? and list_type=?", (list_name, 'edited'))485 dbcon.execute("INSERT INTO navigator VALUES (?, ?, ?)", (list_name, 'edited', json.dumps(li)))486 dbcon.commit()487 window.setProperty('david_%s_edited' % list_name, json.dumps(li))488 def menu_select(heading, position_list=False):489 for item in choice_items:490 line = 'Place [B]%s[/B] below [B]%s[/B]' % (menu_name, item['name']) if position_list else ''491 icon = item.get('iconImage') if item.get('network_id', '') != '' else os.path.join(self.icon_directory, item.get('iconImage'))492 listitem = xbmcgui.ListItem(item['name'], line)493 listitem.setArt({'icon': icon})494 choice_list.append(listitem)495 if position_list:496 listitemTop = xbmcgui.ListItem('Top Position', 'Place [B]%s[/B] at Top of List' % menu_name)497 listitemTop.setArt({'icon': os.path.join(self.icon_directory, 'library_update.png')})498 choice_list.insert(0, listitemTop)499 return dialog.select(heading, choice_list, useDetails=True)500 def select_from_main_menus(current_list=[], item_list=[]):501 include_list = DefaultMenus().DefaultMenuItems()502 menus = DefaultMenus().RootList()503 menus.insert(0, {'name': 'Root', 'iconImage': 'icon.png', 'foldername': 'Root', 'mode': 'navigator.main', 'action': 'RootList'})504 include_list = [i for i in include_list if i != current_list]505 menus = [i for i in menus if i.get('action', None) in include_list and not i.get('name') == item_list]506 return menus507 def get_external_name():508 dialog = xbmcgui.Dialog()509 name_append_list = [('RootList', ''), ('MovieList', 'Movies '), ('TVShowList', 'TV Shows ')]510 orig_name = params.get('list_name', None)511 try: name = '%s%s' % ([i[1] for i in name_append_list if i[0] == orig_name][0], menu_item.get('name'))512 except: name = orig_name513 name = dialog.input('Choose Display Name', type=xbmcgui.INPUT_ALPHANUM, defaultt=name)514 return name515 def db_execute_shortcut_folder(action='add'):516 dbcon = database.connect(NAVIGATOR_DB)517 dbcon.execute("DELETE FROM navigator where list_name=? and list_type=?", (menu_name, 'shortcut_folder'))518 if action == 'add': dbcon.execute("INSERT INTO navigator VALUES (?, ?, ?)", (menu_name, 'shortcut_folder', json.dumps(li)))519 dbcon.commit()520 window.setProperty('david_%s_shortcut_folder' % menu_name, json.dumps(li))521 def db_execute_add_to_shortcut_folder():522 dbcon = database.connect(NAVIGATOR_DB)523 dbcur.execute("SELECT list_contents FROM navigator WHERE list_name = ?", (shortcut_folder_name,))524 dbcon.execute("DELETE FROM navigator where list_name=? and list_type=?", (menu_name, 'shortcut_folder'))525 if action == 'add': dbcon.execute("INSERT INTO navigator VALUES (?, ?, ?)", (menu_name, 'shortcut_folder', json.dumps(li)))526 dbcon.commit()527 window.setProperty('david_%s_shortcut_folder' % list_name, json.dumps(li))528 def select_shortcut_folders(make_new=False):529 dbcon = database.connect(NAVIGATOR_DB)530 dbcur = dbcon.cursor()531 dbcur.execute("SELECT list_name, list_contents FROM navigator WHERE list_type = ?", ('shortcut_folder',))532 folders = dbcur.fetchall()533 try: folders = sorted([(str(i[0]), i[1]) for i in folders], key=lambda s: s[0].lower())534 except: folders = []535 selection = 0536 if len(folders) > 0:537 folder_choice_list = []538 folder_names = ['[B]%s[/B]' % i[0] for i in folders]539 for item in folder_names:540 icon = os.path.join(self.icon_directory, 'tools.png')541 listitem = xbmcgui.ListItem(item, 'Existing Shortcut Folder')542 listitem.setArt({'icon': icon})543 folder_choice_list.append(listitem)544 if make_new:545 make_new_item = xbmcgui.ListItem('[B]MAKE NEW FOLDER[/B]', 'Make New Shortcut Folder')546 make_new_item.setArt({'icon': os.path.join(self.icon_directory, 'library_update.png')})547 folder_choice_list.insert(0, make_new_item)548 selection = dialog.select('DAVID - Shortcut Folder Choice', folder_choice_list, useDetails=True)549 return folders, selection550 dialog = xbmcgui.Dialog()551 if not params: params = dict(parse_qsl(sys.argv[2].replace('?','')))552 menu_name = params.get('menu_name', '')553 list_name = params.get('list_name', '')554 li = None555 method = params.get('method')556 choice_list = []557 if not method in ('display_edit_menu', 'add_external', 'add_trakt_external', 'add_sim_recom_external', 'restore'):558 try:559 current_position = int(params.get('position', '0'))560 default_list, edited_list = self._db_lists(list_name)561 def_file = default_list if not edited_list else edited_list562 li, def_li = def_file, default_list563 choice_items = [i for i in def_li if i not in li]564 except: pass565 try:566 if method == 'display_edit_menu':567 from ast import literal_eval568 from modules.utils import selection_dialog569 default_menu = params.get('default_menu')570 edited_list = None if params.get('edited_list') == 'None' else params.get('edited_list')571 list_name = params.get('list_name') if 'list_name' in params else self.list_name572 menu_name = params.get('menu_name')573 position = params.get('position')574 external_list_item = literal_eval(params.get('external_list_item', 'False'))575 list_is_full = literal_eval(params.get('list_is_full', 'False'))576 list_slug = params.get('list_slug', '')577 menu_item = json.loads(params.get('menu_item'))578 shortcut_folder = literal_eval(menu_item.get('shortcut_folder', 'False'))579 menu_item['list_name'] = list_name580 list_heading = 'Root' if list_name == 'RootList' else 'Movies' if list_name == 'MovieList' else 'TV Shows'581 string = "Edit [B]'%s'[/B] Menu..." % list_heading582 listing = []583 if len(default_menu) != 1:584 listing += [("Move [B]'%s'[/B] to a different position in the list" % menu_name, 'move')]585 listing += [("Remove [B]'%s'[/B] from the list" % menu_name, 'remove')]586 if not shortcut_folder:587 listing += [("Add [B]'%s'[/B] to a different Menu list" % menu_name, 'add_external')]588 listing += [("Add [B]'%s'[/B] to a [B]Shortcut Folder[/B]" % menu_name, 'shortcut_folder_add')]589 if list_name in ('RootList', 'MovieList', 'TVShowList'): listing += [("Add a Trakt list to [B]'%s'[/B] Menu" % list_heading, 'add_trakt')]590 if not list_is_full: listing += [("Re-add a removed item from [B]'%s'[/B] Menu" % list_heading, 'add_original')]591 listing += [("Restore [B]'%s'[/B] Menu to default" % list_heading, 'restore')]592 listing += [("Check if [B]'%s'[/B] Menu has New Menu items" % list_heading, 'check_update')]593 if not list_slug and not external_list_item: listing += [("Reload [B]'%s'[/B]" % menu_name, 'reload')]594 if list_name in ('RootList', 'MovieList', 'TVShowList'): listing += [("Add [B]Shortcut Folder[/B]", 'shortcut_folder_new')]595 choice = selection_dialog([i[0] for i in listing], [i[1] for i in listing], string)596 if choice in (None, 'save_and_exit'): return597 elif choice == 'move': params = {'method': 'move', 'list_name': list_name, 'menu_name': menu_name, 'position': position}598 elif choice == 'remove': params = {'method': 'remove', 'list_name': list_name, 'menu_name': menu_name, 'position': position}599 elif choice == 'add_original': params = {'method': 'add_original', 'list_name': list_name, 'position': position}600 elif choice == 'restore': params = {'method': 'restore', 'list_name': list_name, 'position': position}601 elif choice == 'add_external': params = {'method': 'add_external', 'list_name': list_name, 'menu_item': json.dumps(menu_item)}602 elif choice == 'shortcut_folder_add': params = {'method': 'shortcut_folder_add', 'list_name': list_name, 'menu_item': json.dumps(menu_item)}603 elif choice == 'add_trakt': params = {'method': 'add_trakt', 'list_name': list_name, 'position': position}604 elif choice == 'reload': params = {'method': 'reload_menu_item', 'list_name': list_name, 'menu_name': menu_name, 'position': position}605 elif choice == 'shortcut_folder_new': params = {'method': 'shortcut_folder_new', 'list_name': list_name, 'menu_name': menu_name, 'position': position}606 elif choice == 'check_update': params = {'method': 'check_update_list', 'list_name': list_name, 'menu_name': menu_name, 'position': position}607 return self.adjust_main_lists(params)608 elif method == 'move':609 choice_items = [i for i in li if i['name'] != menu_name]610 new_position = menu_select('Choose New Position of Menu Item (Insert Below Chosen Item)...', position_list=True)611 if new_position < 0 or new_position == current_position: return612 li.insert(new_position, li.pop(current_position))613 db_execute()614 elif method == 'remove':615 li = [x for x in li if x['name'] != menu_name]616 db_execute()617 elif method == 'add_original':618 selection = menu_select("Choose item to add to menu")619 if selection < 0: return620 selection = choice_items[selection]621 choice_list = []622 choice_items = li623 item_position = menu_select('Choose Insert Position of Menu Item (Insert Below Chosen Item)...', position_list=True)624 if item_position < 0: return625 li.insert((item_position), selection)626 db_execute()627 elif method == 'shortcut_folder_add':628 menu_item = json.loads(params['menu_item'])629 if not menu_item: return630 name = get_external_name()631 if not name: return632 menu_item['name'] = name633 current_shortcut_folders, folder_selection = select_shortcut_folders()634 if folder_selection < 0: return635 folder_selection = current_shortcut_folders[folder_selection]636 shortcut_folder_name = folder_selection[0]637 shortcut_folder_contents = json.loads(folder_selection[1])638 choice_items = shortcut_folder_contents639 if len(choice_items) > 0: item_position = menu_select('Choose Insert Position of Menu Item (Insert Below Chosen Item)...', position_list=True)640 else: item_position = 0641 if item_position < 0: return642 menu_item['external_list_item'] = 'True'643 shortcut_folder_contents.insert((item_position), menu_item)644 menu_name = shortcut_folder_name645 li = shortcut_folder_contents646 db_execute_shortcut_folder()647 elif method == 'add_external':648 menu_item = json.loads(params['menu_item'])649 if not menu_item: return650 name = get_external_name()651 if not name: return652 menu_item['name'] = name653 choice_items = select_from_main_menus(params.get('list_name'), name)654 selection = menu_select("Choose Menu to add %s Into.." % params.get('list_name'))655 if selection < 0: return656 add_to_menu_choice = choice_items[selection]657 list_name = add_to_menu_choice['action']658 default_list, edited_list = self._db_lists(list_name)659 def_file = default_list if not edited_list else edited_list660 li = def_file661 if menu_item in li: return662 choice_list = []663 choice_items = li664 item_position = menu_select('Choose Insert Position of Menu Item (Insert Below Chosen Item)...', position_list=True)665 if item_position < 0: return666 menu_item['external_list_item'] = 'True'667 li.insert((item_position), menu_item)668 db_execute()669 elif method == 'add_trakt':670 from apis.trakt_api import get_trakt_list_selection671 trakt_selection = json.loads(params['trakt_selection']) if 'trakt_selection' in params else get_trakt_list_selection(list_choice='nav_edit')672 if not trakt_selection: return673 name = dialog.input('Choose Display Name', type=xbmcgui.INPUT_ALPHANUM, defaultt=trakt_selection['name'])674 if not name: return675 choice_list = []676 choice_items = li677 item_position = menu_select('Choose Insert Position of Menu Item (Insert Below Chosen Item)...', position_list=True)678 if item_position < 0: return679 li.insert(item_position, {"iconImage": "trakt.png", "mode": "trakt.build_trakt_list", "name": name, "foldername": name, "user": trakt_selection['user'], "slug": trakt_selection['slug'], 'external_list_item': 'True'})680 db_execute()681 elif method == 'add_trakt_external':682 name = dialog.input('Choose Display Name', type=xbmcgui.INPUT_ALPHANUM, defaultt=params['name'])683 if not name: return684 if not li:685 choice_items = select_from_main_menus()686 selection = menu_select("Choose Menu to add %s Into.." % name)687 if selection < 0: return688 add_to_menu_choice = choice_items[selection]689 list_name = add_to_menu_choice['action']690 default_list, edited_list = self._db_lists(list_name)691 li = default_list if not edited_list else edited_list692 if name in [i['name'] for i in li]: return693 choice_list = []694 choice_items = li695 item_position = 0 if len(li) == 0 else menu_select('Choose Insert Position of Menu Item (Insert Below Chosen Item)...', position_list=True)696 if item_position < 0: return697 li.insert(item_position, {"iconImage": "trakt.png", "mode": "trakt.build_trakt_list", "name": name, "foldername": name, "user": params['user'], "slug": params['slug'], 'external_list_item': 'True'})698 db_execute()699 elif method == 'add_sim_recom_external':700 name = dialog.input('Choose Display Name', type=xbmcgui.INPUT_ALPHANUM, defaultt=params['sim_recom_name'])701 if not name: return702 if not li:703 choice_items = select_from_main_menus()704 selection = menu_select("Choose Menu to add %s Into.." % name)705 if selection < 0: return706 add_to_menu_choice = choice_items[selection]707 list_name = add_to_menu_choice['action']708 default_list, edited_list = self._db_lists(list_name)709 li = default_list if not edited_list else edited_list710 if name in [i['name'] for i in li]: return711 choice_list = []712 choice_items = li713 item_position = 0 if len(li) == 0 else menu_select('Choose Insert Position of Menu Item (Insert Below Chosen Item)...', position_list=True)714 if item_position < 0: return715 li.insert(item_position, {"iconImage": "library_update.png", "mode": params['end_mode'], 'action': params['end_action'], "name": name, "sim_recom_name": name, "foldername": name, "sim_recom_tmdb": params['sim_recom_tmdb'], 'external_list_item': 'True'})716 db_execute()717 elif method == 'browse':718 heading = "Choose Removed Item to Browse Into.."719 selection = menu_select(heading)720 if selection < 0: return721 mode = choice_items[selection]['mode'] if 'mode' in choice_items[selection] else ''722 action = choice_items[selection]['action'] if 'action' in choice_items[selection] else ''723 url_mode = choice_items[selection]['url_mode'] if 'url_mode' in choice_items[selection] else ''724 menu_type = choice_items[selection]['menu_type'] if 'menu_type' in choice_items[selection] else ''725 query = choice_items[selection]['query'] if 'query' in choice_items[selection] else ''726 db_type = choice_items[selection]['db_type'] if 'db_type' in choice_items[selection] else ''727 xbmc.executebuiltin("XBMC.Container.Update(%s)" % self._build_url({'mode': mode, 'action': action, 'url_mode': url_mode,728 'menu_type': menu_type, 'query': query, 'db_type': db_type}))729 elif method == 'reload_menu_item':730 default = eval('DefaultMenus().%s()' % list_name)731 default_item = [i for i in default if i['name'] == menu_name][0]732 li = [default_item if x['name'] == menu_name else x for x in def_file]733 list_type = 'edited' if self._db_lists(list_name)[1] else 'default'734 dbcon = database.connect(NAVIGATOR_DB)735 dbcon.execute("DELETE FROM navigator where list_name=? and list_type=?", (list_name, list_type))736 dbcon.execute("INSERT INTO navigator VALUES (?, ?, ?)", (list_name, list_type, json.dumps(li)))737 dbcon.commit()738 window.setProperty('david_%s_%s' % (list_name, list_type), json.dumps(li))739 elif method == 'shortcut_folder_new':740 make_new_folder = True741 current_shortcut_folders, folder_selection = select_shortcut_folders(make_new=True)742 if folder_selection < 0: return743 if folder_selection > 0:744 make_new_folder = False745 folder_selection = current_shortcut_folders[folder_selection-1] # -1 because we added the 'Make New' listitem746 name = folder_selection[0]747 contents = folder_selection[1]748 if make_new_folder:749 name = dialog.input('Choose Folder Name', type=xbmcgui.INPUT_ALPHANUM)750 if not name: return751 contents = []752 if name in [i['name'] for i in li]: return753 menu_item = {"iconImage": "tools.png", 754 "mode": "navigator.build_shortcut_folder_lists",755 "action": name,756 "name": name, 757 "foldername": name,758 "shortcut_folder": 'True',759 "external_list_item": 'True',760 "contents": contents}761 choice_list = []762 choice_items = li763 menu_name = name764 item_position = 0 if len(li) == 0 else menu_select('Choose Insert Position of [B]%s[/B] Folder (Insert Below Chosen Item)...' % name.upper(), position_list=True)765 if item_position < 0: return766 li.insert(item_position, menu_item)767 db_execute()768 li = []769 db_execute_shortcut_folder()770 elif method == 'check_update_list':771 dbcon = database.connect(NAVIGATOR_DB)772 dbcur = dbcon.cursor()773 new_contents = eval('DefaultMenus().%s()' % list_name)774 if default_list != new_contents:775 new_entry = [i for i in new_contents if i not in default_list][0]776 if not dialog.yesno("David", "New item [B]%s[/B] Exists." % new_entry.get('name'), "Would you like to add this to the Menu?", '', 'Yes', 'No') == 0: return777 choice_items = def_file778 item_position = menu_select('Choose Insert Position of Menu Item (Insert Below Chosen Item)...', position_list=True)779 if item_position < 0: return780 if edited_list:781 edited_list.insert(item_position, new_entry)782 dbcon.execute("DELETE FROM navigator where list_name=? and list_type=?", (list_name, 'edited'))783 dbcon.execute("INSERT INTO navigator VALUES (?, ?, ?)", (list_name, 'edited', json.dumps(edited_list)))784 window.setProperty('david_%s_edited' % list_name, json.dumps(edited_list))785 default_list.insert(item_position, new_entry)786 dbcon.execute("DELETE FROM navigator where list_name=? and list_type=?", (list_name, 'default'))787 dbcon.execute("INSERT INTO navigator VALUES (?, ?, ?)", (list_name, 'default', json.dumps(default_list)))788 window.setProperty('david_%s_default' % list_name, json.dumps(default_list))789 dbcon.commit()790 dbcon.close()791 else:792 return dialog.ok('David', 'No New Items for [B]%s[/B].' % list_name.upper())793 elif method == 'restore':794 confirm = dialog.yesno('Are you sure?', 'Continuing will load the default Menu.')795 if not confirm: return796 dbcon = database.connect(NAVIGATOR_DB)797 for item in ['edited', 'default']: dbcon.execute("DELETE FROM navigator where list_name=? and list_type=?", (list_name, item))798 dbcon.commit()799 dbcon.execute("VACUUM")800 dbcon.execute("INSERT INTO navigator VALUES (?, ?, ?)", (list_name, 'default', json.dumps(eval('DefaultMenus().%s()' % list_name))))801 dbcon.commit()802 for item in ('edited', 'default'): window.clearProperty('david_%s_%s' % (list_name, item))803 if not method in ('browse',):804 notification("Process Successful", time=1500)805 if not method in ('browse', 'add_sim_recom_external'):806 xbmc.sleep(200)807 xbmc.executebuiltin('Container.Refresh')808 except:809 from modules.nav_utils import notification810 return notification('Error Performing Task')811 def build_main_lists(self):812 def _build(item_position, item):813 try:814 cm = []815 name = item.get('name', '')816 icon = item.get('iconImage') if item.get('network_id', '') != '' else os.path.join(self.icon_directory, item.get('iconImage'))817 url = self._build_url(item)818 cm.append(("[B]Edit Menu[/B]",'XBMC.RunPlugin(%s)' % self._build_url(819 {'mode': 'navigator.adjust_main_lists', 'method': 'display_edit_menu', 'default_menu': self.default_menu, 'menu_item': json.dumps(item),820 'edited_list': self.edited_list, 'list_name': self.list_name, 'menu_name': name,821 'position': item_position, 'list_is_full': list_is_full, 'list_slug': item.get('slug', ''),822 'external_list_item': item.get('external_list_item', 'False')})))823 if not list_is_full:824 cm.append(("[B]Browse Removed item[/B]",'XBMC.RunPlugin(%s)' % \825 self._build_url({'mode': 'navigator.adjust_main_lists', 'method': 'browse', 'list_name': self.list_name, 'position': item_position})))826 listitem = xbmcgui.ListItem(name)827 listitem.setArt({'icon': icon, 'poster': icon, 'thumb': icon, 'fanart': self.fanart, 'banner': icon})828 listitem.addContextMenuItems(cm)829 if use_threading: item_list.append({'list_item': (url, listitem, True), 'item_position': item_position})830 else: xbmcplugin.addDirectoryItem(__handle__, url, listitem, isFolder=True)831 except: return832 self.default_list, self.edited_list = self._db_lists()833 self.default_menu = self.default_list if not self.edited_list else self.edited_list834 current_items_from_default = [i for i in self.default_menu if not i.get('external_list_item', 'False') == 'True']835 list_is_full = True if len(current_items_from_default) >= len(self.default_list) else False836 cache_to_disc = False if self.list_name == 'RootList' else True837 use_threading = settings.thread_main_menus()838 if use_threading:839 from threading import Thread840 item_list = []841 threads = []842 for item_position, item in enumerate(self.default_menu): threads.append(Thread(target=_build, args=(item_position, item)))843 [i.start() for i in threads]844 [i.join() for i in threads]845 item_list.sort(key=lambda k: k['item_position'])846 xbmcplugin.addDirectoryItems(__handle__, [i['list_item'] for i in item_list])847 else:848 for item_position, item in enumerate(self.default_menu): _build(item_position, item)849 self._end_directory(cache_to_disc=cache_to_disc)850 def adjust_shortcut_folder_lists(self, params=None):851 from modules.nav_utils import notification852 def db_execute_shortcut_folder(action='add'):853 dbcon = database.connect(NAVIGATOR_DB)854 dbcon.execute("DELETE FROM navigator where list_name=? and list_type=?", (menu_name, 'shortcut_folder'))855 if action == 'add': dbcon.execute("INSERT INTO navigator VALUES (?, ?, ?)", (menu_name, 'shortcut_folder', json.dumps(li)))856 dbcon.commit()857 window.setProperty('david_%s_shortcut_folder' % menu_name, json.dumps(li))858 def menu_select(heading, position_list=False):859 for item in choice_items:860 line = 'Place [B]%s[/B] below [B]%s[/B]' % (name, item['name']) if position_list else ''861 icon = item.get('iconImage') if item.get('network_id', '') != '' else os.path.join(self.icon_directory, item.get('iconImage'))862 listitem = xbmcgui.ListItem(item['name'], line)863 listitem.setArt({'icon': icon})864 choice_list.append(listitem)865 if position_list:866 listitemTop = xbmcgui.ListItem('Top Position', 'Place [B]%s[/B] at Top of List' % name)867 listitemTop.setArt({'icon': os.path.join(self.icon_directory, 'library_update.png')})868 choice_list.insert(0, listitemTop)869 return dialog.select(heading, choice_list, useDetails=True)870 def select_shortcut_folders(select=True):871 dbcon = database.connect(NAVIGATOR_DB)872 dbcur = dbcon.cursor()873 dbcur.execute("SELECT list_name, list_contents FROM navigator WHERE list_type = ?", ('shortcut_folder',))874 folders = dbcur.fetchall()875 try: folders = sorted([(str(i[0]), i[1]) for i in folders], key=lambda s: s[0].lower())876 except: folders = []877 if not select: return folders878 selection = 0879 if len(folders) > 0:880 folder_choice_list = []881 folder_names = ['[B]%s[/B]' % i[0] for i in folders]882 for item in folder_names:883 icon = os.path.join(self.icon_directory, 'tools.png')884 listitem = xbmcgui.ListItem(item, 'Existing Shortcut Folder')885 listitem.setArt({'icon': icon})886 folder_choice_list.append(listitem)887 selection = dialog.select('DAVID - Shortcut Folder Choice', folder_choice_list, useDetails=True)888 return folders, selection889 dialog = xbmcgui.Dialog()890 if not params: params = dict(parse_qsl(sys.argv[2].replace('?','')))891 menu_name = params.get('menu_name')892 list_name = params.get('list_name')893 li = None894 method = params.get('method')895 choice_list = []896 current_position = int(params.get('position', '0'))897 try:898 if method == 'display_edit_menu':899 from ast import literal_eval900 from modules.utils import selection_dialog901 position = params.get('position')902 menu_item = json.loads(params.get('menu_item'))903 contents = json.loads(params.get('contents'))904 external_list_item = literal_eval(params.get('external_list_item', 'False'))905 list_slug = params.get('list_slug', '')906 list_heading = 'Root' if list_name == 'RootList' else 'Movies' if list_name == 'MovieList' else 'TV Shows'907 string = "Edit [B]'%s'[/B] Folder..." % list_name908 listing = []909 if len(contents) != 1: listing += [("Move", 'move')]910 listing += [("Remove", 'remove')]911 listing += [("Add a Trakt list", 'add_trakt')]912 listing += [("Clear All", 'clear_all')]913 choice = selection_dialog([i[0] for i in listing], [i[1] for i in listing], string)914 if choice in (None, 'save_and_exit'): return915 elif choice == 'move': params = {'method': 'move', 'list_name': list_name, 'menu_name': menu_name, 'position': position, 'menu_item': json.dumps(menu_item), 'contents': json.dumps(contents)}916 elif choice == 'remove': params = {'method': 'remove', 'list_name': list_name, 'menu_name': menu_name, 'position': position, 'menu_item': json.dumps(menu_item), 'contents': json.dumps(contents)}917 elif choice == 'add_trakt': params = {'method': 'add_trakt', 'list_name': list_name, 'position': position, 'menu_item': json.dumps(menu_item), 'contents': json.dumps(contents)}918 elif choice == 'clear_all': params = {'method': 'clear_all', 'list_name': list_name, 'menu_name': menu_name, 'position': position, 'menu_item': json.dumps(menu_item), 'contents': json.dumps(contents)}919 return self.adjust_shortcut_folder_lists(params)920 elif method == 'move':921 menu_name = params.get('list_name')922 name = params.get('menu_name')923 li = json.loads(params.get('contents'))924 choice_items = [i for i in li if i['name'] != name]925 new_position = menu_select('Choose New Position of Menu Item (Insert Below Chosen Item)...', position_list=True)926 if new_position < 0 or new_position == current_position: return927 li.insert(new_position, li.pop(current_position))928 db_execute_shortcut_folder()929 elif method == 'remove':930 menu_name = params.get('list_name')931 name = params.get('menu_name')932 li = json.loads(params.get('contents'))933 li = [x for x in li if x['name'] != name]934 db_execute_shortcut_folder()935 elif method == 'add_external':936 menu_item = json.loads(params['menu_item'])937 if not menu_item: return938 name = dialog.input('Choose Display Name', type=xbmcgui.INPUT_ALPHANUM, defaultt=params['name'])939 if not name: return940 menu_item['name'] = name941 current_shortcut_folders, folder_selection = select_shortcut_folders()942 if folder_selection < 0: return943 folder_selection = current_shortcut_folders[folder_selection]944 shortcut_folder_name = folder_selection[0]945 shortcut_folder_contents = json.loads(folder_selection[1])946 choice_items = shortcut_folder_contents947 if len(choice_items) > 0: item_position = menu_select('Choose Insert Position of Menu Item (Insert Below Chosen Item)...', position_list=True)948 else: item_position = 0949 if item_position < 0: return950 menu_name = shortcut_folder_name951 li = shortcut_folder_contents952 li.insert(item_position, menu_item)953 db_execute_shortcut_folder()954 elif method == 'add_trakt':955 from apis.trakt_api import get_trakt_list_selection956 trakt_selection = json.loads(params['trakt_selection']) if 'trakt_selection' in params else get_trakt_list_selection(list_choice='nav_edit')957 if not trakt_selection: return958 name = dialog.input('Choose Display Name', type=xbmcgui.INPUT_ALPHANUM, defaultt=trakt_selection['name'])959 if not name: return960 menu_name = params.get('list_name')961 li = json.loads(params.get('contents'))962 choice_items = li963 item_position = menu_select('Choose Insert Position of Menu Item (Insert Below Chosen Item)...', position_list=True)964 if item_position < 0: return965 li.insert(item_position, {"iconImage": "trakt.png", "mode": "trakt.build_trakt_list", "name": name, "foldername": name, "user": trakt_selection['user'], "slug": trakt_selection['slug'], 'external_list_item': 'True'})966 db_execute_shortcut_folder()967 elif method == 'add_trakt_external':968 name = dialog.input('Choose Display Name', type=xbmcgui.INPUT_ALPHANUM, defaultt=params['name'])969 if not name: return970 current_shortcut_folders, folder_selection = select_shortcut_folders()971 if folder_selection < 0: return972 folder_selection = current_shortcut_folders[folder_selection]973 shortcut_folder_name = folder_selection[0]974 shortcut_folder_contents = json.loads(folder_selection[1])975 choice_items = shortcut_folder_contents976 if len(choice_items) > 0: item_position = menu_select('Choose Insert Position of Menu Item (Insert Below Chosen Item)...', position_list=True)977 else: item_position = 0978 if item_position < 0: return979 menu_name = shortcut_folder_name980 li = shortcut_folder_contents981 li.insert(item_position, {"iconImage": "trakt.png", "mode": "trakt.build_trakt_list", "name": name, "foldername": name, "user": params['user'], "slug": params['slug'], 'external_list_item': 'True'})982 db_execute_shortcut_folder()983 elif method == 'clear_all':984 confirm = dialog.yesno('Are you sure?', 'Continuing will clear this Shortcut Folder.')985 if not confirm: return986 menu_name = params.get('list_name')987 li = []988 db_execute_shortcut_folder()989 elif method == 'add_shortcut_folder':990 name = dialog.input('Choose Folder Name', type=xbmcgui.INPUT_ALPHANUM)991 if not name: return992 dbcon = database.connect(NAVIGATOR_DB)993 dbcur = dbcon.cursor()994 dbcon.execute("INSERT INTO navigator VALUES (?, ?, ?)", (name, 'shortcut_folder', json.dumps([])))995 dbcon.commit()996 elif method == 'delete_shortcut_folder':997 list_name = params['list_name']998 if not dialog.yesno("David", "Are you sure?", "Continuing will delete your [B]%s[/B] folder" % list_name) != 0: return999 dbcon = database.connect(NAVIGATOR_DB)1000 dbcur = dbcon.cursor()1001 dbcur.execute("DELETE FROM navigator WHERE list_name = ?", (list_name,))1002 dbcon.commit()1003 dialog.ok('DAVID Shortcut Folders', 'You Must Also Remove Instances of this Shortcut Folder from any Lists Individually.')1004 elif method == 'remove_all_shortcut_folders':1005 if not dialog.yesno("David", "Are you sure?", "Continuing will delete all your Source Folders") == 0: return1006 dbcon = database.connect(NAVIGATOR_DB)1007 dbcur = dbcon.cursor()1008 dbcon.execute("DELETE FROM navigator WHERE list_type=?", ('shortcut_folder',))1009 dbcon.commit()1010 dialog.ok('DAVID Shortcut Folders', 'You Must Also Remove Instances of Shortcut Folders from any Lists Individually.')1011 notification("Process Successful", time=1500)1012 xbmc.sleep(200)1013 if not method in ('add_external', 'add_trakt_external'):1014 xbmc.sleep(200)1015 xbmc.executebuiltin('Container.Refresh')1016 except:1017 from modules.nav_utils import notification1018 return notification('Error Performing Task')1019 1020 def build_shortcut_folder_lists(self):1021 def _build_default():1022 icon = os.path.join(self.icon_directory, 'tools.png')1023 url_params = {'mode': 'navigator.adjust_shortcut_folder_lists', 'method': 'add_trakt', 'contents': [], 'menu_item': '',1024 'list_name': list_name, 'menu_name': '',1025 'position': '', 'list_slug': '',1026 'external_list_item': 'False'}1027 url = self._build_url(url_params)1028 listitem = xbmcgui.ListItem("[B][I]Add a Trakt List...[/I][/B]")1029 listitem.setArt({'icon': icon, 'poster': icon, 'thumb': icon, 'fanart': self.fanart, 'banner': icon})1030 xbmcplugin.addDirectoryItem(handle=__handle__, url=url, listitem=listitem, isFolder=True)1031 def _build(item_position, item):1032 try:1033 cm = []1034 name = item.get('name', '')1035 icon = item.get('iconImage') if item.get('network_id', '') != '' else os.path.join(self.icon_directory, item.get('iconImage'))1036 url = self._build_url(item)1037 cm.append(("[B]Edit Menu[/B]",'XBMC.RunPlugin(%s)' % self._build_url(1038 {'mode': 'navigator.adjust_shortcut_folder_lists', 'method': 'display_edit_menu', 'contents': json.dumps(contents), 'menu_item': json.dumps(item),1039 'list_name': list_name, 'menu_name': name,1040 'position': item_position, 'list_slug': item.get('slug', ''),1041 'external_list_item': item.get('external_list_item', 'False')})))1042 listitem = xbmcgui.ListItem(name)1043 listitem.setArt({'icon': icon, 'poster': icon, 'thumb': icon, 'fanart': self.fanart, 'banner': icon})1044 listitem.addContextMenuItems(cm)1045 if use_threading: item_list.append({'list_item': (url, listitem, True), 'item_position': item_position})1046 else: xbmcplugin.addDirectoryItem(__handle__, url, listitem, isFolder=True)1047 except: return1048 params = dict(parse_qsl(sys.argv[2].replace('?','')))1049 contents = self._db_lists_shortcut_folder()1050 list_name = params['name']1051 if not contents:1052 _build_default()1053 return self._end_directory()1054 use_threading = settings.thread_main_menus()1055 if use_threading:1056 from threading import Thread1057 item_list = []1058 threads = []1059 for item_position, item in enumerate(contents): threads.append(Thread(target=_build, args=(item_position, item)))1060 [i.start() for i in threads]1061 [i.join() for i in threads]1062 item_list.sort(key=lambda k: k['item_position'])1063 xbmcplugin.addDirectoryItems(__handle__, [i['list_item'] for i in item_list])1064 else:1065 for item_position, item in enumerate(contents): _build(item_position, item)1066 self._end_directory()1067 def _build_url(self, query):1068 return __url__ + '?' + urlencode(to_utf8(query))1069 def _setView(self, view=None, content='addons'):1070 if not 'david' in xbmc.getInfoLabel('Container.PluginName'): return1071 view_type = self.view if not view else view1072 try:1073 t = 01074 while not xbmc.getInfoLabel('Container.Content') == content:1075 if xbmc.abortRequested == True: break1076 if not 'david' in xbmc.getInfoLabel('Container.PluginName'): break1077 t += 0.011078 if t >= 60.0: break1079 time.sleep(0.01)1080 VIEWS_DB = os.path.join(profile_dir, "views.db")1081 settings.check_database(VIEWS_DB)1082 dbcon = database.connect(VIEWS_DB)1083 dbcur = dbcon.cursor()1084 dbcur.execute("SELECT view_id FROM views WHERE view_type = ?", (str(view_type),))1085 view_id = dbcur.fetchone()[0]1086 return xbmc.executebuiltin("Container.SetViewMode(%s)" % str(view_id))1087 except: return1088 def _changelog_info(self):1089 if __addon__.getSetting('disable_changelog_popup') == 'true': return1090 addon_version = __addon__.getAddonInfo('version')1091 setting_version = __addon__.getSetting('version_number')1092 if addon_version == setting_version: return1093 __addon__.setSetting('version_number', addon_version)1094 from modules.nav_utils import show_text1095 changelog_file, changelog_heading = xbmc.translatePath(os.path.join(addon_dir, "resources", "text", "changelog.txt")), '[B]David Changelog[/B] [I](v.%s)[/I]' % addon_version1096 window.setProperty('DAVID_changelog_shown', 'true')1097 show_text(changelog_heading, changelog_file)1098 def _db_lists(self, list_name=None):1099 list_name = self.list_name if not list_name else list_name1100 try:1101 default_contents = json.loads(window.getProperty('david_%s_default' % list_name))1102 try: edited_contents = json.loads(window.getProperty('david_%s_edited' % list_name))1103 except: edited_contents = None1104 return default_contents, edited_contents1105 except: pass1106 try:1107 dbcon = database.connect(NAVIGATOR_DB)1108 dbcur = dbcon.cursor()1109 dbcur.execute("SELECT list_contents FROM navigator WHERE list_name = ? AND list_type = ?", (str(list_name), 'default'))1110 default_contents = json.loads(dbcur.fetchone()[0])1111 dbcur.execute("SELECT list_contents FROM navigator WHERE list_name = ? AND list_type = ?", (str(list_name), 'edited'))1112 try: edited_contents = json.loads(dbcur.fetchone()[0])1113 except: edited_contents = None1114 window.setProperty('david_%s_default' % list_name, json.dumps(default_contents))1115 window.setProperty('david_%s_edited' % list_name, json.dumps(edited_contents))1116 return default_contents, edited_contents1117 except:1118 self._build_database()1119 return self._db_lists()1120 1121 def _db_lists_shortcut_folder(self, list_name=None):1122 list_name = self.list_name if not list_name else list_name1123 try:1124 contents = json.loads(window.getProperty('david_%s_shortcut_folder' % list_name))1125 return contents1126 except: pass1127 try:1128 dbcon = database.connect(NAVIGATOR_DB)1129 dbcur = dbcon.cursor()1130 dbcur.execute("SELECT list_contents FROM navigator WHERE list_name = ? AND list_type = ?", (str(list_name), 'shortcut_folder'))1131 contents = json.loads(dbcur.fetchone()[0])1132 window.setProperty('david_%s_shortcut_folder' % list_name, json.dumps(contents))1133 return contents1134 except:1135 return []1136 def _rebuild_single_database(self, dbcon, list_name):1137 dbcon.execute("DELETE FROM navigator WHERE list_type=? and list_name=?", ('default', list_name))1138 dbcon.execute("INSERT INTO navigator VALUES (?, ?, ?)", (list_name, 'default', json.dumps(eval('DefaultMenus().%s()' % list_name))))1139 dbcon.commit()1140 def _build_database(self):1141 settings.initialize_databases()1142 default_menus = DefaultMenus().DefaultMenuItems()1143 dbcon = database.connect(NAVIGATOR_DB)1144 for content in default_menus:1145 dbcon.execute("INSERT INTO navigator VALUES (?, ?, ?)", (content, 'default', json.dumps(eval('DefaultMenus().%s()' % content))))1146 dbcon.commit()1147 def _add_dir(self, url_params, list_name, iconImage='DefaultFolder.png', isFolder=True):1148 cm = []1149 icon = iconImage if 'network_id' in url_params else os.path.join(self.icon_directory, iconImage)1150 url_params['iconImage'] = icon1151 url = self._build_url(url_params)1152 listitem = xbmcgui.ListItem(list_name)1153 listitem.setArt({'icon': icon, 'poster': icon, 'thumb': icon, 'fanart': self.fanart, 'banner': icon})1154 if not 'exclude_external' in url_params:1155 list_name = url_params['list_name'] if 'list_name' in url_params else self.list_name1156 menu_params = {'mode': 'navigator.adjust_main_lists', 'method': 'add_external',1157 'list_name': list_name, 'menu_item': json.dumps(url_params)}1158 folder_params = {'mode': 'navigator.adjust_shortcut_folder_lists', 'method': 'add_external',1159 'name': list_name, 'menu_item': json.dumps(url_params)}1160 cm.append(("[B]Add to a Menu[/B]",'XBMC.RunPlugin(%s)'% self._build_url(menu_params)))1161 cm.append(("[B]Add to a Shortcut Folder[/B]",'XBMC.RunPlugin(%s)' % self._build_url(folder_params)))...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful