From 353586cfa56b2c672fd5ab9eaa3a9c06bbdc3cbd Mon Sep 17 00:00:00 2001 From: lamusmaser Date: Tue, 6 Feb 2024 14:50:26 -0700 Subject: [PATCH 1/7] Add exception details to `test_ta_connection`. --- Contents/Code/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index e195729..ed4f823 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -171,8 +171,8 @@ def test_ta_connection(): else: ta_version = [0,3,6] Log.Info("TubeArchivist did not respond with a version. Assuming v{} for interpretation.".format('.'.join(str(x) for x in ta_version))) - except: - Log.Error("Unable to set the `ta_version`. Check the connection via `ta_ping`.") + except Exception as e: + Log.Error("Unable to set the `ta_version`. Check the connection via `ta_ping`. Exception details: %s" % (e)) Log.Debug("Response: %s" % (response)) if ta_ping == 'pong': return True, ta_version From 32c44d6de7954388e5e985624b2059d8996fc20c Mon Sep 17 00:00:00 2001 From: lamusmaser Date: Tue, 6 Feb 2024 14:54:51 -0700 Subject: [PATCH 2/7] Exception moved to Debug. --- Contents/Code/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index ed4f823..8bd58be 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -172,8 +172,8 @@ def test_ta_connection(): ta_version = [0,3,6] Log.Info("TubeArchivist did not respond with a version. Assuming v{} for interpretation.".format('.'.join(str(x) for x in ta_version))) except Exception as e: - Log.Error("Unable to set the `ta_version`. Check the connection via `ta_ping`. Exception details: %s" % (e)) - Log.Debug("Response: %s" % (response)) + Log.Error("Unable to set the `ta_version`. Check the connection via `ta_ping`. ") + Log.Debug("Response: %s\nException details: %s" % (response, e)) if ta_ping == 'pong': return True, ta_version except Exception as e: From e2a6f53972af502ec13993c654d92cb4c04432f6 Mon Sep 17 00:00:00 2001 From: lamusmaser Date: Tue, 6 Feb 2024 15:57:05 -0700 Subject: [PATCH 3/7] Add exception debug to Scanner. --- Scanners/Series/TubeArchivist Series Scanner.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Scanners/Series/TubeArchivist Series Scanner.py b/Scanners/Series/TubeArchivist Series Scanner.py index da3a3e6..5de0cae 100644 --- a/Scanners/Series/TubeArchivist Series Scanner.py +++ b/Scanners/Series/TubeArchivist Series Scanner.py @@ -222,9 +222,9 @@ def test_ta_connection(): else: ta_version = [0,3,6] Log.info("TubeArchivist did not respond with a version. Assuming v{} for interpretation.".format('.'.join(str(x) for x in ta_version))) - except: - Log.error("Unable to set the `ta_version`. Check the connection via `ta_ping`.") - Log.debug("Response: %s" % (response)) + except Exception as e: + Log.error("Unable to set the `ta_version`. Check the connection via `ta_ping`. ") + Log.debug("Response: %s\nException details: %s" % (response, e)) if ta_ping == 'pong': return True, ta_version except Exception as e: From 3f7d410f51d20a382d05dc2dcd7b481d9bb07f74 Mon Sep 17 00:00:00 2001 From: lamusmaser Date: Tue, 6 Feb 2024 16:12:15 -0700 Subject: [PATCH 4/7] Add check for blank version. --- Contents/Code/__init__.py | 3 +++ Scanners/Series/TubeArchivist Series Scanner.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index 8bd58be..a38dac9 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -462,6 +462,9 @@ def Update(metadata, media, lang, force): filepath = os.path.dirname(episode_part.file) filename_noext, filename_ext = os.path.splitext(filename) episode_id = "" + if TA_CONFIG['version'] == [] or TA_CONFIG['version'] == [0,0,0]: + Log.Error("TubeArchivist instance version is unknown or unset. Please review the logs further and ensure that there is connectivity between Plex and TubeArchivist.") + break if TA_CONFIG['version'] > [0,3,6] and TA_CONFIG['online']: episode_id = filename_noext elif TA_CONFIG['online']: # Assume that if it is online and less that v0.4.0, it is compatible with the legacy file name schema diff --git a/Scanners/Series/TubeArchivist Series Scanner.py b/Scanners/Series/TubeArchivist Series Scanner.py index 5de0cae..7a71e47 100644 --- a/Scanners/Series/TubeArchivist Series Scanner.py +++ b/Scanners/Series/TubeArchivist Series Scanner.py @@ -345,6 +345,9 @@ def Scan(path, files, mediaList, subdirs): if match: Log.info("File matches expected filename layout.") if TA_CONFIG['online']: + if TA_CONFIG['version'] == []: + Log.error("TubeArchivist instance version is unknown or unset. Please review the logs further and ensure that there is connectivity between Plex and TubeArchivist.") + break if TA_CONFIG['version'] < [0,3,7]: Log.info("Processing filename with legacy filename format.") originalAirDate = file[0:7] From f65d42b4879ec6c5d8a2e1a678ced8cd04533e0b Mon Sep 17 00:00:00 2001 From: lamusmaser Date: Tue, 6 Feb 2024 16:46:20 -0700 Subject: [PATCH 5/7] Fix printing message for URL in `read_url`. --- Contents/Code/__init__.py | 2 +- Scanners/Series/TubeArchivist Series Scanner.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index a38dac9..4782c41 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -93,7 +93,7 @@ def read_url(url, data=None): url_content = urlopen(url, context=SSL_CONTEXT, data=data).read() return url_content except Exception as e: - Log.Error("Error reading or accessing url '%s', Exception: '%s'" % (url, e)) + Log.Error("Error reading or accessing url '%s', Exception: '%s'" % (url.get_full_url if type(url) is Request else url , e)) raise e diff --git a/Scanners/Series/TubeArchivist Series Scanner.py b/Scanners/Series/TubeArchivist Series Scanner.py index 7a71e47..1f430ed 100644 --- a/Scanners/Series/TubeArchivist Series Scanner.py +++ b/Scanners/Series/TubeArchivist Series Scanner.py @@ -95,7 +95,7 @@ def read_url(url, data=None): url_content = urlopen(url,context=SSL_CONTEXT, data=data).read() return url_content except Exception as e: - Log.error("Error reading or accessing url '%s', Exception: '%s'" % (url, e)) + Log.error("Error reading or accessing url '%s', Exception: '%s'" % (url.get_full_url if type(url) is Request else url , e)) raise e From 3789ea0cccac4dbc2c5ee99bf851209437eac9f7 Mon Sep 17 00:00:00 2001 From: lamusmaser Date: Tue, 6 Feb 2024 16:46:47 -0700 Subject: [PATCH 6/7] Fix additional space. --- Contents/Code/__init__.py | 2 +- Scanners/Series/TubeArchivist Series Scanner.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index 4782c41..e1952ef 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -93,7 +93,7 @@ def read_url(url, data=None): url_content = urlopen(url, context=SSL_CONTEXT, data=data).read() return url_content except Exception as e: - Log.Error("Error reading or accessing url '%s', Exception: '%s'" % (url.get_full_url if type(url) is Request else url , e)) + Log.Error("Error reading or accessing url '%s', Exception: '%s'" % (url.get_full_url if type(url) is Request else url, e)) raise e diff --git a/Scanners/Series/TubeArchivist Series Scanner.py b/Scanners/Series/TubeArchivist Series Scanner.py index 1f430ed..cbc5ddf 100644 --- a/Scanners/Series/TubeArchivist Series Scanner.py +++ b/Scanners/Series/TubeArchivist Series Scanner.py @@ -95,7 +95,7 @@ def read_url(url, data=None): url_content = urlopen(url,context=SSL_CONTEXT, data=data).read() return url_content except Exception as e: - Log.error("Error reading or accessing url '%s', Exception: '%s'" % (url.get_full_url if type(url) is Request else url , e)) + Log.error("Error reading or accessing url '%s', Exception: '%s'" % (url.get_full_url if type(url) is Request else url, e)) raise e From f9249f5df63d7fdb190caf17727aa3f05880308a Mon Sep 17 00:00:00 2001 From: lamusmaser Date: Tue, 6 Feb 2024 17:24:59 -0700 Subject: [PATCH 7/7] Add additional exception handler to `test_ta_connection`. --- Contents/Code/__init__.py | 2 +- Scanners/Series/TubeArchivist Series Scanner.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index e1952ef..3306d80 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -165,7 +165,7 @@ def test_ta_connection(): ta_version = [int(x) for x in response['version'][1:].split(".")] else: ta_version = [int(x) for x in response['version'].split(".")] - except AttributeError: + except (AttributeError, TypeError): ta_version = response['version'] Log.Info("TubeArchivist is running version v{}".format('.'.join(str(x) for x in ta_version))) else: diff --git a/Scanners/Series/TubeArchivist Series Scanner.py b/Scanners/Series/TubeArchivist Series Scanner.py index cbc5ddf..12ada92 100644 --- a/Scanners/Series/TubeArchivist Series Scanner.py +++ b/Scanners/Series/TubeArchivist Series Scanner.py @@ -216,7 +216,7 @@ def test_ta_connection(): ta_version = [int(x) for x in response['version'][1:].split(".")] else: ta_version = [int(x) for x in response['version'].split(".")] - except AttributeError: + except (AttributeError, TypeError): ta_version = response['version'] Log.info("TubeArchivist is running version v{}".format('.'.join(str(x) for x in ta_version))) else: