-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0.5.66 - added plex token refresh, removed debug log/local library sc…
…an/purge not wanted task references, fixed clipboard issue with log sharing, update incorrect Plex titles from more recent metadata
- Loading branch information
Showing
12 changed files
with
502 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import os | ||
import json | ||
import logging | ||
from datetime import datetime | ||
from config_manager import CONFIG_DIR | ||
|
||
TOKEN_STATUS_FILE = os.path.join(CONFIG_DIR, 'plex_token_status.json') | ||
|
||
def load_token_status(): | ||
"""Load the token status from the JSON file.""" | ||
try: | ||
if os.path.exists(TOKEN_STATUS_FILE): | ||
with open(TOKEN_STATUS_FILE, 'r') as f: | ||
return json.load(f) | ||
except Exception as e: | ||
logging.error(f"Error loading token status: {e}") | ||
return {} | ||
|
||
def save_token_status(status): | ||
"""Save the token status to the JSON file.""" | ||
try: | ||
with open(TOKEN_STATUS_FILE, 'w') as f: | ||
json.dump(status, f, indent=4, default=str) | ||
except Exception as e: | ||
logging.error(f"Error saving token status: {e}") | ||
|
||
def update_token_status(username, valid, expires_at=None, plex_username=None): | ||
"""Update the status for a specific token.""" | ||
status = load_token_status() | ||
status[username] = { | ||
'valid': valid, | ||
'last_checked': datetime.now().isoformat(), | ||
'expires_at': expires_at.isoformat() if expires_at else None, | ||
'username': plex_username | ||
} | ||
save_token_status(status) | ||
|
||
def get_token_status(): | ||
"""Get the current status of all tokens.""" | ||
return load_token_status() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.