Skip to content

Commit

Permalink
Merge pull request #50 from tubearchivist/test
Browse files Browse the repository at this point in the history
v0.1.4
  • Loading branch information
lamusmaser authored Feb 7, 2024
2 parents 86aade0 + 26ece13 commit bad2249
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
13 changes: 8 additions & 5 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -165,15 +165,15 @@ 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:
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:
Expand Down Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions Scanners/Series/TubeArchivist Series Scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -216,15 +216,15 @@ 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:
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:
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit bad2249

Please sign in to comment.