feat: Allow authentication via SUBSONIC_SALT and SUBSONIC_TOKEN
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
14
main.py
14
main.py
@@ -13,10 +13,18 @@ def main():
|
||||
"""Get playlists from a Navidrome server using the Subsonic API."""
|
||||
navidrome_url = os.environ.get('NAVIDROME_URL')
|
||||
username = os.environ.get('NAVIDROME_USER')
|
||||
password = os.environ.get('NAVIDROME_PASSWORD')
|
||||
|
||||
if not all([navidrome_url, username, password]):
|
||||
logging.error("NAVIDROME_URL, NAVIDROME_USER, and NAVIDROME_PASSWORD environment variables must be set.")
|
||||
if not all([navidrome_url, username]):
|
||||
logging.error("NAVIDROME_URL and NAVIDROME_USER environment variables must be set.")
|
||||
return
|
||||
|
||||
salt = os.environ.get('SUBSONIC_SALT')
|
||||
token = os.environ.get('SUBSONIC_TOKEN')
|
||||
|
||||
if not all([salt, token]):
|
||||
password = os.environ.get('NAVIDROME_PASSWORD')
|
||||
if not password:
|
||||
logging.error("Either (SUBSONIC_SALT and SUBSONIC_TOKEN) or NAVIDROME_PASSWORD must be set.")
|
||||
return
|
||||
|
||||
# Subsonic API requires a salt and a token (md5(password + salt))
|
||||
|
||||
Reference in New Issue
Block a user