Skip to content

Commit

Permalink
Increase feedback of timezone selection process to user
Browse files Browse the repository at this point in the history
  • Loading branch information
InsertDisc authored Feb 17, 2024
1 parent cf5e8e4 commit b2364c5
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,30 +792,35 @@ def setting(value):
if is_docker == "True":
try:
timezone = os.environ.get('TZ')
print(f"Using locality {timezone} to adjust for airing dates.")
except Exception as e:
print("Could not retrieve timezone information from docker 'TZ' environment variable.")
print(f"An error occured: {e}")
print("Attempting 'Docker Host'")
try:
system_tz = tzlocal.get_localzone()
timezone = str(system_tz)
print(f"Using locality {timezone} to adjust for airing dates.")
except Exception as e:
print("Could not retrieve timezone information from 'Docker Host'.")
print(f"An error occured: {e}")
print("Falling back to Plex Meta Manager default 'America/New_York'")
print("Falling back to default")
timezone = "America/New_York"
print(f"Using locality {timezone} to adjust for airing dates.")
entry = timezone

if is_docker == "False":
try:
system_tz = tzlocal.get_localzone()
timezone = str(system_tz)
print(f'Found Timezone => "{timezone}" from host')
print(f'Found timezone information from host')
print(f"Using locality {timezone} to adjust for airing dates.")
except Exception as e:
print("Could not retrieve timezone information from host.")
print(f"An error occured: {e}")
print("Falling back to Plex Meta Manager default 'America/New_York'")
print("Falling back default")
timezone = "America/New_York"
print(f"Using locality {timezone} to adjust for airing dates.")
entry = timezone

except Exception as e:
Expand All @@ -826,27 +831,32 @@ def setting(value):
if timezone_source == 'forced':
try:
timezone = pref['settings']['timezone']['locality']
print(f'Using user defined Timezone => "{timezone}"')
print(f'Using user defined Timezone => "{timezone}" to adjust for airing dates.')
entry = timezone
except KeyError:
print(f"Timezone 'forced' locality missing or not found in settings.")
print(f'Check configuration/YAML structure')
print(f'Falling back to default...')
timezone_source = 'default'
entry = timezone
timezone_source = 'default'
if timezone_source == 'default':
timezone = 'America/New_York'
print("'default' timezone selected")
print(f"Using locality {timezone} to adjust for airing dates.")
entry = timezone
except Exception as e:
print("Encountered an error while parsing timezone settings:")
print(f"{e}")

elif use_local == False:
print("Using default Plex Meta Manager timezone for TMDB Discover builder")
entry = 'America/New_York'
timezone = 'America/New_York'
print(f"Using locality {timezone} to adjust for airing dates.")
entry = timezone


except KeyError:
entry = False
timezone = 'America/New_York'
print(f"Using default locality '{timezone}' to adjust for airing dates.")
entry = timezone


if value == 'rsback_color':
Expand Down

0 comments on commit b2364c5

Please sign in to comment.