From 2d20dc42829133f372f09cda91542c59cd68cf7d Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 21 Dec 2021 21:22:16 -0500 Subject: [PATCH] Remove unused and commented out code --- default.py | 3 --- resources/lib/datamanager.py | 7 ----- resources/lib/dir_functions.py | 8 ------ resources/lib/functions.py | 3 --- resources/lib/play_utils.py | 2 -- resources/lib/server_detect.py | 2 -- resources/lib/skin_cloner.py | 1 - resources/lib/websocket_client.py | 1 - scripts/check_strings.ps1 | 15 ----------- scripts/copy_embycon.bat | 15 ----------- scripts/process_addon.py | 45 ------------------------------- tox.ini | 1 - 12 files changed, 103 deletions(-) delete mode 100644 scripts/check_strings.ps1 delete mode 100644 scripts/copy_embycon.bat delete mode 100644 scripts/process_addon.py diff --git a/default.py b/default.py index 10757b9..8396435 100644 --- a/default.py +++ b/default.py @@ -16,6 +16,3 @@ if log_timing_data: log.debug("About to enter mainEntryPoint()") main_entry_point() - -# clear done and exit. -# sys.modules.clear() diff --git a/resources/lib/datamanager.py b/resources/lib/datamanager.py index eeff03d..bf79fbc 100644 --- a/resources/lib/datamanager.py +++ b/resources/lib/datamanager.py @@ -43,7 +43,6 @@ class DataManager: addon_dir = xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('profile')) def __init__(self, *args): - # log.debug("DataManager __init__") pass @timer @@ -66,10 +65,6 @@ class DataManager: url_hash = m.hexdigest() cache_file = os.path.join(self.addon_dir, "cache_" + url_hash + ".pickle") - # changed_url = url + "&MinDateLastSavedForUser=" + urllib.unquote("2019-09-16T13:45:30") - # results = self.GetContent(changed_url) - # log.debug("DataManager Changes Since Date : {0}", results) - item_list = None total_records = 0 baseline_name = None @@ -135,7 +130,6 @@ class DataManager: cache_item.total_records = total_records cache_thread.cached_item = cache_item - # copy.deepcopy(item_list) if not use_cache: cache_thread = None @@ -171,7 +165,6 @@ class CacheManagerThread(threading.Thread): def run(self): log.debug("CacheManagerThread : Started") - # log.debug("CacheManagerThread : Cache Item : {0}", self.cached_item.__dict__) home_window = HomeWindow() is_fresh = False diff --git a/resources/lib/dir_functions.py b/resources/lib/dir_functions.py index 7b3e077..0a69195 100644 --- a/resources/lib/dir_functions.py +++ b/resources/lib/dir_functions.py @@ -106,13 +106,6 @@ def get_content(url, params): url = url + "&StartIndex=" + str(start_index) + "&Limit=" + str(page_limit) log.debug("ADDING NEXT URL: {0}".format(url_next)) - # use the data manager to get the data - # result = dataManager.GetContent(url) - - # total_records = 0 - # if result is not None and isinstance(result, dict): - # total_records = result.get("TotalRecordCount", 0) - use_cache = params.get("use_cache", "true") == "true" dir_items, detected_type, total_records = process_directory(url, progress, params, use_cache) @@ -381,7 +374,6 @@ def process_directory(url, progress, params, use_cache_data=False): series_url = ('{server}/Shows/' + first_season_item.series_id + '/Episodes' '?userId={userid}' + - # '&seasonId=' + season_id + '&IsVirtualUnAired=false' + '&IsMissing=false' + '&Fields=SpecialEpisodeNumbers,{field_filters}' + diff --git a/resources/lib/functions.py b/resources/lib/functions.py index cdbc43b..f0b26bd 100644 --- a/resources/lib/functions.py +++ b/resources/lib/functions.py @@ -125,11 +125,9 @@ def main_entry_point(): elif mode == "WIDGET_CONTENT_CAST": get_widget_content_cast(int(sys.argv[1]), params) elif mode == "SHOW_CONTENT": - # plugin://plugin.video.jellycon?mode=SHOW_CONTENT&item_type=Movie|Series check_server() show_content(params) elif mode == "SEARCH": - # plugin://plugin.video.jellycon?mode=SEARCH xbmcplugin.setContent(int(sys.argv[1]), 'files') show_search() elif mode == "NEW_SEARCH": @@ -614,7 +612,6 @@ def show_menu(params): dialog.ok("Error", "Error getting safe delete confirmation") elif selected_action == "show_extras": - # "http://localhost:8096/Users/3138bed521e5465b9be26d2c63be94af/Items/78/SpecialFeatures" u = "{server}/Users/{userid}/Items/" + item_id + "/SpecialFeatures" action_url = ("plugin://plugin.video.jellycon/?url=" + quote(u) + "&mode=GET_CONTENT&media_type=Videos") built_in_command = 'ActivateWindow(Videos, ' + action_url + ', return)' diff --git a/resources/lib/play_utils.py b/resources/lib/play_utils.py index 27ae5f6..b2c3557 100644 --- a/resources/lib/play_utils.py +++ b/resources/lib/play_utils.py @@ -155,7 +155,6 @@ def add_to_playlist(play_info): icon="special://home/addons/plugin.video.jellycon/icon.png") return - # play_session_id = id_generator() play_session_id = playback_info.get("PlaySessionId") # select the media source to use @@ -951,7 +950,6 @@ def prompt_for_stop_actions(item_id, data): settings = xbmcaddon.Addon() current_position = data.get("current_position", 0) duration = data.get("duration", 0) - # media_source_id = data.get("source_id") next_episode = data.get("next_episode") item_type = data.get("item_type") can_delete = data.get("can_delete", False) diff --git a/resources/lib/server_detect.py b/resources/lib/server_detect.py index f2fd1c6..19c63dd 100644 --- a/resources/lib/server_detect.py +++ b/resources/lib/server_detect.py @@ -128,7 +128,6 @@ def get_server_details(): message = b"who is JellyfinServer?" multi_group = ("", 7359) - # multi_group = ("127.0.0.1", 7359) sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.settimeout(4.0) @@ -144,7 +143,6 @@ def get_server_details(): xbmc.sleep(1000) server_count = 0 - # while True: try: sock.sendto(message, multi_group) while True: diff --git a/resources/lib/skin_cloner.py b/resources/lib/skin_cloner.py index 1fbdbf1..8f0d890 100644 --- a/resources/lib/skin_cloner.py +++ b/resources/lib/skin_cloner.py @@ -130,7 +130,6 @@ def clone_skin(): def update_kodi_settings(): log.debug("Settings Kodi Settings") - # set_value("screensaver.mode", "script.screensaver.logoff") set_value("videoplayer.seekdelay", 0) set_value("filelists.showparentdiritems", False) set_value("filelists.showaddsourcebuttons", False) diff --git a/resources/lib/websocket_client.py b/resources/lib/websocket_client.py index 7d5cc56..b7db55d 100644 --- a/resources/lib/websocket_client.py +++ b/resources/lib/websocket_client.py @@ -239,7 +239,6 @@ class WebSocketClient(threading.Thread): def run(self): - # websocket.enableTrace(True) download_utils = downloadutils.DownloadUtils() token = None diff --git a/scripts/check_strings.ps1 b/scripts/check_strings.ps1 deleted file mode 100644 index 98ddfde..0000000 --- a/scripts/check_strings.ps1 +++ /dev/null @@ -1,15 +0,0 @@ - -$string_ids = @() - -Select-String -path resources\language\resource.language.en_gb\strings.po -pattern "msgctxt " | select Line | ForEach { - $id = [regex]::match($_.Line.ToString(), '\"#([0-9]+)\"').Groups[1].Value - if($string_ids -contains $id) - { - Write-Host "ERROR: String ID Already Exists : " $id - } - else - { - $string_ids += $id - Get-ChildItem *.py,settings.xml,resources\language\resource.language.en_gb\strings.po -recurse | Select-String -pattern $id | group Pattern | where {$_.Count -eq 1} | select Name, Count - } -} diff --git a/scripts/copy_embycon.bat b/scripts/copy_embycon.bat deleted file mode 100644 index 50ce9c3..0000000 --- a/scripts/copy_embycon.bat +++ /dev/null @@ -1,15 +0,0 @@ - -del /F /Q /S %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.jellycon -rmdir /Q /S %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.jellycon - -xcopy /Y addon.xml %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.jellycon\ -xcopy /Y default.py %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.jellycon\ -xcopy /Y fanart.jpg %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.jellycon\ -xcopy /Y icon.png %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.jellycon\ -xcopy /Y kodi.png %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.jellycon\ -xcopy /Y service.py %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.jellycon\ - -xcopy /E /Y resources %HOMEPATH%\AppData\Roaming\Kodi\addons\plugin.video.jellycon\resources\ - -cd "%programfiles%\Kodi" -kodi.exe diff --git a/scripts/process_addon.py b/scripts/process_addon.py deleted file mode 100644 index 7d01b85..0000000 --- a/scripts/process_addon.py +++ /dev/null @@ -1,45 +0,0 @@ -import xml.etree.ElementTree as ET -import subprocess -from shutil import copy2, copytree, rmtree -import os -import sys - -package_path = "package" - -def ignore_files(path, item_list): - return [".idea", ".git", ".gitignore", "scripts", package_path] - -zip_path = "c:\\Program Files\\7-Zip\\7z.exe" -addon_path = sys.argv[1] - -tree = ET.parse(addon_path + "\\addon.xml") -root = tree.getroot() - - -id = root.attrib["id"] -version = root.attrib["version"] - -print (package_path + " - " + version) - -try: - rmtree(package_path + "\\" + id) -except FileNotFoundError as err: - pass - -copytree(addon_path, package_path + "\\" + id, ignore=ignore_files) - -zip_name = id + "-" + version + ".zip" - -os.chdir(package_path) -cmd_7zip = [zip_path, "a", zip_name, id] -sp = subprocess.Popen(cmd_7zip, stderr=subprocess.STDOUT, stdout=subprocess.PIPE) -sp.wait() -os.chdir("..") - -copy2(package_path + "\\" + id + "\\addon.xml", package_path + "\\addon.xml") - -try: - rmtree(package_path + "\\" + id) -except FileNotFoundError as err: - pass - diff --git a/tox.ini b/tox.ini index 6858ea0..7b75ae0 100644 --- a/tox.ini +++ b/tox.ini @@ -6,4 +6,3 @@ extend-ignore = I202 per-file-ignores = */__init__.py: F401 - scripts/process_addon.py: F821