diff --git a/.gitignore b/.gitignore index 8c2b884..c7d18ea 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,26 @@ # Built Visual Studio Code Extensions *.vsix +# Python cache och loggar +__pycache__/ +*.py[cod] +*.log + +# Editorfiler +.vscode/ +.idea/ +*.swp + +# Miljöfiler +.env +.venv/ +venv/ +env/ + +# OS-specifikt +.DS_Store +Thumbs.db + +# Din lokala konfigurationsfil +config_local.py +cache.json diff --git a/config.py b/config.py index 6559200..d001f44 100644 --- a/config.py +++ b/config.py @@ -1,8 +1,8 @@ -LASTFM_USERNAME = "ditt_lastfm_namn" -LASTFM_API_KEY = "din_lastfm_api_nyckel" - -LIDARR_URL = "http://localhost:8686" -LIDARR_API_KEY = "din_lidarr_api_nyckel" +# config.py +try: + from config_local import * +except ImportError: + print("⚠️ Du måste skapa en config_local.py med dina API-nycklar.") ROOT_FOLDER = "/media/music2" QUALITY_PROFILE_ID = 1 diff --git a/lastfm_helpers.py b/lastfm_helpers.py index fbe55e3..e177ca5 100644 --- a/lastfm_helpers.py +++ b/lastfm_helpers.py @@ -4,6 +4,10 @@ from collections import defaultdict from datetime import datetime, timedelta def lf_request(method, **params): + # Fixa 'from_' → 'from' och 'to_' → 'to' (Last.fm accepterar inte Python-säkra namn) + for alt, real in (("from_", "from"), ("to_", "to")): + if alt in params: + params[real] = params.pop(alt) url = "https://ws.audioscrobbler.com/2.0/" params.update({ "method": method,