Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
Fixed bug where the playlist and album fragment because i had them mixed up
  • Loading branch information
kostas214 committed Apr 6, 2023
1 parent 69f76be commit f8f92c9
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 9 deletions.
28 changes: 28 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ android {
minSdk 24
targetSdk 33
versionCode 1
versionName "1.1"
versionName "1.1.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/python/.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"access_token": "BQA3-FzI11P2iRxeFtdkzQnX45frJyIpJKnRSMVejj7LyEKF5GffE2TrUFCWy1Z2mVALXeakMrte_vtSvejiuCkt6lBMWyPdA4GaNR6s7WSOCzUNM1WE", "token_type": "Bearer", "expires_in": 3600, "expires_at": 1680794006}
Binary file not shown.
16 changes: 8 additions & 8 deletions app/src/main/python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def songSearchSpotifyPlaylist(albumLink):
offset = 0
songs = []
try:
tracks = sp.album_tracks(album_id=albumLink, offset=offset)
tracks = sp.playlist_tracks(playlist_id=albumLink, offset=offset)
except requests.exceptions.ConnectionError:
success = 1
print("Unable to connect to the internet")
Expand All @@ -38,16 +38,16 @@ def songSearchSpotifyPlaylist(albumLink):

if success == 0:
for key in tracks['items']:
songs.append(f"{key['name']} {key['artists'][0]['name']}")
songs.append(f"{key['track']['name']} {key['track']['artists'][0]['name']}")
while done:
if len(songs) == offset + 100:
try:
tracks = sp.album_tracks(album_id=playlistLink, offset=offset)
tracks = sp.playlist_tracks(playlist_id=playlistLink, offset=offset)
except requests.exceptions.ConnectionError:
success = 1
print("unable to connect to the internet")
for key in tracks['items']:
songs.append(f"{key['name']} {key['artists'][0]['name']}")
songs.append(f"{key['track']['name']} {key['track']['artists'][0]['name']}")
offset += 100
if len(songs) < offset + 100:
done = False
Expand All @@ -66,7 +66,7 @@ def songSearchSpotifyAlbum(playlistLink):
offset = 0
songs = []
try:
tracks = sp.playlist_items(playlist_id=playlistLink, offset=offset)
tracks = sp.album_tracks(album_id=playlistLink, offset=offset)
except requests.exceptions.ConnectionError:
success = 1
print("Unable to connect to the internet")
Expand All @@ -76,16 +76,16 @@ def songSearchSpotifyAlbum(playlistLink):

if success == 0:
for key in tracks['items']:
songs.append(f"{key['track']['name']} {key['track']['artists'][0]['name']}")
songs.append(f"{key['name']} {key['artists'][0]['name']}")
while done:
if len(songs) == offset + 100:
try:
tracks = sp.playlist_items(playlist_id=playlistLink, offset=offset)
tracks = sp.album_tracks(album_id=playlistLink, offset=offset)
except requests.exceptions.ConnectionError:
success = 1
print("unable to connect to the internet")
for key in tracks['items']:
songs.append(f"{key['track']['name']} {key['track']['artists'][0]['name']}")
songs.append(f"{key['name']} {key['artists'][0]['name']}")
offset += 100
if len(songs) < offset + 100:
done = False
Expand Down

0 comments on commit f8f92c9

Please sign in to comment.