From 584ffaadf8f94ffb8b576cc3a7abebdabdfaac37 Mon Sep 17 00:00:00 2001 From: "cool.gitter.choco" Date: Mon, 27 Jan 2025 09:38:54 -0600 Subject: [PATCH] ditched email and pass for deezer --- .gitignore | 6 +++++ routes/__pycache__/__init__.cpython-312.pyc | Bin 139 -> 140 bytes .../__pycache__/credentials.cpython-312.pyc | Bin 3626 -> 3627 bytes routes/__pycache__/search.cpython-312.pyc | Bin 1653 -> 1654 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 145 -> 146 bytes .../__pycache__/credentials.cpython-312.pyc | Bin 6068 -> 6605 bytes .../utils/__pycache__/search.cpython-312.pyc | Bin 608 -> 609 bytes routes/utils/album.py | 4 --- routes/utils/credentials.py | 24 +++++++++++++----- routes/utils/playlist.py | 4 --- routes/utils/track.py | 4 --- static/js/app.js | 8 ++---- 12 files changed, 26 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 7759a30..34dcf0e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,9 @@ routes/__pycache__/ routes/utils/__pycache__/ test.sh __pycache__/ +routes/__pycache__/__init__.cpython-312.pyc +routes/__pycache__/credentials.cpython-312.pyc +routes/__pycache__/search.cpython-312.pyc +routes/utils/__pycache__/__init__.cpython-312.pyc +routes/utils/__pycache__/credentials.cpython-312.pyc +routes/utils/__pycache__/search.cpython-312.pyc diff --git a/routes/__pycache__/__init__.cpython-312.pyc b/routes/__pycache__/__init__.cpython-312.pyc index 96949c9aacc1016b5ba0addc9bbf8133e952c421..f34fe3a036c13a5176f842e1688438a1a1ed3a12 100644 GIT binary patch delta 27 hcmeBX>|x|S&CAQh00e4Fr%&WIX4IZ&FFrBU3;}KRX&CAQh00cdCQzmj7Gipt=7oQkz3IJFc2Cx7C diff --git a/routes/__pycache__/credentials.cpython-312.pyc b/routes/__pycache__/credentials.cpython-312.pyc index 865eabf75d45b9f34b9cc6fe678c088003d864fd..e02d8a1e973e0608a3a8593c4bbaedd937df33f3 100644 GIT binary patch delta 31 lcmZ1_vs#AxG%qg~0}!Y!oxYL#GZUlU7CIE*_2Xp`c delta 31 lcmeyy^OcADG%qg~0}%WwnYNKzk%duXvM!7GW>*$NCIFJ*2o?YU diff --git a/routes/utils/__pycache__/__init__.cpython-312.pyc b/routes/utils/__pycache__/__init__.cpython-312.pyc index ac1ba2807a1339cb8e7c304f714fee9d1c599a1f..920f24ad75c75110de240971ee79de7eda5bb5a4 100644 GIT binary patch delta 27 hcmbQpIEj(_G%qg~0}!Y!oj#Gez4*jX8vs@g28;jz delta 27 hcmbQlIFXV2G%qg~0}w2&n=+Bxn9*ROz4*j%YXDl`2H^kz diff --git a/routes/utils/__pycache__/credentials.cpython-312.pyc b/routes/utils/__pycache__/credentials.cpython-312.pyc index 07431f421c7d17e14ec2850a6d3c6ded75acccff..fdcb97f6fd156948cb84cfd4e27111603c5ed2ab 100644 GIT binary patch delta 1442 zcmZWoO>7%Q6rS**JDwJ6dmk z?5@=kE*9dDYLEyGh(8GhB^L+>q@JKbLaHj+^`XW>P$49)5gd?mV#bcE2xc{J-@f;~ zZ{F&C^KJCui1k5Nmj#gZ+m|1tu6n<={>gNYMwjw8l;}o2na|~uOVPqgUQ3r0^+05Q zVhj_8J6pXIDNts}W_5s=<$eHEJ7N)+GL#veLB>hxWXbUOS9{N`9q_TC1Kor= z69;cfq`;^fb;BAg!1v6j$^;$k03_;0QuXwJO~?XGXg5HpyE<$-D3PcRsV$p$pqnyX z9n{nJivU@XZQs6UXonzyAy=!!tT{R`-HhBFL=2R9&DF_d-1vgkJ)`r;v+vzwIwVM< zPp1TeqSOa8Yp3WOP@NEHw$3+l=#c!E6A$wdLE2!hfpr+^PV64M#Sg*Ypo|h)LS9M~ zsVYdxY3W3^ASV+! zIiJfGWugr&kVa%lL|TRv07h zvt$>RA%58uxOHR%lJEBG4UcsDwT8*M6?tR|GyE8F@8Rrmuh+p6(-h3h_|H1ptBRH#?2)Govk}ed|xl~&P?eUZ8tMdPp6JgX| zQla)ybB>x&%flbJM}!D<2dFuZo9=#_8YO4|toY5F3KGek9NjDB9i z*F6Km6mi$dE_~Bc0^aky%{}p-*_LqB`)b5&+vy@(**v;~nC>`83xK@dT`C^?BBUOdzX2*ral);P<2^X)(1{QvNO^SWy(=XvFJ zI{+JB-^>l2_doG`L7}ePus*8gF6o2%1$}ThXH<2wT+&x37rJvFdHn*Ek+z2(3#Xp5|_+UvTV?2fiS)7tkQ4Jok`K0sA>;U1C>anA!(zf za;0IfmJDNDC%6_nLZ1f$wC*}(lZl5_qCZ`o&`#UjDLUv5igq5FbZ>R^GLmQ0aM4HZ z_Jr)2$-a|gA7bhI^*7O;Y43+nVOpF%e%~`6;&-nz)C(+$fMOrtk8{C z^U^`E*zHvXsgLD4LkD~#!muzqbCCY_E!((>t_O6v_40ORII{{Xn})M^3o}>2KHk^= zhBNI=H6^Q-gSEv^pQ;HMpzqZj3ND1G;_rYc=G%qg~0}!MYPus}t$0)9+pOK%Ns$Y?xoS&DUoS|P_kYAEnl{&eQ@dE%| Cg%BM8 diff --git a/routes/utils/album.py b/routes/utils/album.py index 2ae913a..0565ff4 100644 --- a/routes/utils/album.py +++ b/routes/utils/album.py @@ -18,8 +18,6 @@ def download_album(service, url, main, fallback=None): # Initialize DeeLogin with Deezer credentials dl = DeeLogin( arl=deezer_creds.get('arl', ''), - email=deezer_creds.get('email', ''), - password=deezer_creds.get('password', '') ) # Download using download_albumspo dl.download_albumspo( @@ -77,8 +75,6 @@ def download_album(service, url, main, fallback=None): creds = json.load(f) dl = DeeLogin( arl=creds.get('arl', ''), - email=creds.get('email', ''), - password=creds.get('password', '') ) dl.download_albumdee( link_album=url, diff --git a/routes/utils/credentials.py b/routes/utils/credentials.py index c2567ac..0b16281 100644 --- a/routes/utils/credentials.py +++ b/routes/utils/credentials.py @@ -62,7 +62,7 @@ def create_credential(service, name, data): data (dict): Dictionary containing the credential data Raises: - ValueError: If service is invalid or data is missing required fields + ValueError: If service is invalid, data has invalid fields, or missing required fields FileExistsError: If the credential directory already exists """ if service not in ['spotify', 'deezer']: @@ -70,11 +70,18 @@ def create_credential(service, name, data): # Validate data structure required_fields = [] + allowed_fields = [] if service == 'spotify': required_fields = ['username', 'credentials'] + allowed_fields = required_fields + ['type'] data['type'] = 'AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS' else: - required_fields = ['arl', 'email', 'password'] + required_fields = ['arl'] + allowed_fields = required_fields.copy() + # Check for extra fields + extra_fields = set(data.keys()) - set(allowed_fields) + if extra_fields: + raise ValueError(f"Deezer credentials can only contain 'arl'. Extra fields found: {', '.join(extra_fields)}") for field in required_fields: if field not in data: @@ -122,7 +129,6 @@ def edit_credential(service, name, new_data): FileNotFoundError: If the credential does not exist ValueError: If new_data contains invalid fields or missing required fields after update """ - # Validate service if service not in ['spotify', 'deezer']: raise ValueError("Service must be 'spotify' or 'deezer'") @@ -140,7 +146,7 @@ def edit_credential(service, name, new_data): if service == 'spotify': allowed_fields = ['username', 'credentials'] else: - allowed_fields = ['arl', 'email', 'password'] + allowed_fields = ['arl'] for key in new_data.keys(): if key not in allowed_fields: @@ -149,13 +155,19 @@ def edit_credential(service, name, new_data): # Update data data.update(new_data) + # For Deezer: Strip all fields except 'arl' + if service == 'deezer': + if 'arl' not in data: + raise ValueError("Missing 'arl' field for Deezer credential") + data = {'arl': data['arl']} + # Ensure required fields are present required_fields = [] if service == 'spotify': required_fields = ['username', 'credentials', 'type'] - data['type'] = 'AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS' # Ensure type is correct + data['type'] = 'AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS' else: - required_fields = ['arl', 'email', 'password'] + required_fields = ['arl'] for field in required_fields: if field not in data: diff --git a/routes/utils/playlist.py b/routes/utils/playlist.py index 72321b1..9f208ef 100644 --- a/routes/utils/playlist.py +++ b/routes/utils/playlist.py @@ -18,8 +18,6 @@ def download_playlist(service, url, main, fallback=None): # Initialize DeeLogin with Deezer credentials dl = DeeLogin( arl=deezer_creds.get('arl', ''), - email=deezer_creds.get('email', ''), - password=deezer_creds.get('password', '') ) # Download using download_playlistspo dl.download_playlistspo( @@ -79,8 +77,6 @@ def download_playlist(service, url, main, fallback=None): creds = json.load(f) dl = DeeLogin( arl=creds.get('arl', ''), - email=creds.get('email', ''), - password=creds.get('password', '') ) dl.download_playlistdee( link_playlist=url, diff --git a/routes/utils/track.py b/routes/utils/track.py index f5398fb..1426d5d 100644 --- a/routes/utils/track.py +++ b/routes/utils/track.py @@ -16,8 +16,6 @@ def download_track(service, url, main, fallback=None): deezer_creds = json.load(f) dl = DeeLogin( arl=deezer_creds.get('arl', ''), - email=deezer_creds.get('email', ''), - password=deezer_creds.get('password', '') ) dl.download_trackspo( link_track=url, @@ -65,8 +63,6 @@ def download_track(service, url, main, fallback=None): creds = json.load(f) dl = DeeLogin( arl=creds.get('arl', ''), - email=creds.get('email', ''), - password=creds.get('password', '') ) dl.download_trackdee( link_track=url, diff --git a/static/js/app.js b/static/js/app.js index a2306ab..12c3543 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -11,14 +11,10 @@ const serviceConfig = { }, deezer: { fields: [ - { id: 'arl', label: 'ARL', type: 'text' }, - { id: 'email', label: 'Email', type: 'email' }, - { id: 'password', label: 'Password', type: 'password' } + { id: 'arl', label: 'ARL', type: 'text' } ], validator: (data) => ({ - arl: data.arl, - email: data.email, - password: data.password + arl: data.arl }) } };