Zibbp / tidal-utils

Convert Spotify playlists to Tidal playlists and more.
GNU General Public License v3.0
24 stars 1 forks source link

Go error #1

Closed Leptopoda closed 2 years ago

Leptopoda commented 2 years ago

Hi there, just got this crash

tidal-utils  | panic: runtime error: index out of range [0] with length 0
tidal-utils  | 
tidal-utils  | goroutine 1 [running]:
tidal-utils  | main.searchSpotifyToTidal({{0xc000015050, 0x14}, {{0x0, 0x0}, 0xc0005726f0, {0x0, {0x0, 0x0}}, {0xc00022c400, 0x3a}, ...}, ...}, ...)
tidal-utils  |  /app/cmd/main.go:137 +0x793
tidal-utils  | main.spotifyToTidal(0xc0001036c0?, 0xc0001345f0)
tidal-utils  |  /app/cmd/main.go:104 +0x888
tidal-utils  | main.main()
tidal-utils  |  /app/cmd/main.go:42 +0x86
Zibbp commented 2 years ago

Hi, It appears it's crashing on attempting to search a track on Tidal. Does this error repeat starting the container again? If it does, can you enable debug in the config by setting to true and posting the logs.

Leptopoda commented 2 years ago

The logs do not contain anything new it iterates through all songs and hangs on the same song again time="2022-06-13T15:44:59Z" level=debug msg="Adding track 195798526 to playlist e30fe528-8b3a-4b60-864d-35bd5659850f"

This is the spotify song in question https://open.spotify.com/track/4hjuUelurEBKlqpJPJ77Iw?si=c644af6e9531407f And it clearly exists on tidal (I was able to import the playlist in question with some other tool once and all songs where available)

Zibbp commented 2 years ago

I added that single song to an empty playlist and it was able to be added to a Tidal playlist. Is there an error below the "adding track" log line?

Any HTTP errors should be getting caught and logged so I'm not too sure what is happening at the moment. Would you be comfortable sharing the Spotify playlist so I can do some testing?

Leptopoda commented 2 years ago

I only got the error in my initial post. If there is some private way of communication I can send you the playlist ID

Zibbp commented 2 years ago

You can send me an email with the playlist ID, my email can be found on my Github profile page.

Zibbp commented 2 years ago

I believe I found the issue. After the last track that is processed (Eleanor Rigby) and before the next track (Pocketful of Sunshine) there is an empty track object being returned from the Spotify API. This only occurs in the API as looking at the tracks through the interface there is no track between the two above.

I've never seen this before. It doesn't say it's a local track and if it got removed from Spotify it would have been removed from the playlist as well? Maybe Spotify nulls the track entry instead of removing it?

 {
                "added_at": "2022-01-17T07:42:00Z",
                "added_by": {
                    "display_name": "",
                    "external_urls": {
                        "spotify": "https://open.spotify.com/user/REDACTED"
                    },
                    "followers": {
                        "total": 0,
                        "href": ""
                    },
                    "href": "https://api.spotify.com/v1/users/REDACTED",
                    "id": "REDACTED",
                    "images": null,
                    "uri": "spotify:user:REDACTED"
                },
                "is_local": false,
                "track": {
                    "artists": null,
                    "available_markets": null,
                    "disc_number": 0,
                    "duration_ms": 0,
                    "explicit": false,
                    "external_urls": null,
                    "href": "",
                    "id": "",
                    "name": "",
                    "preview_url": "",
                    "track_number": 0,
                    "uri": "",
                    "type": "",
                    "album": {
                        "name": "",
                        "artists": null,
                        "album_group": "",
                        "album_type": "",
                        "id": "",
                        "uri": "",
                        "available_markets": null,
                        "href": "",
                        "images": null,
                        "external_urls": null,
                        "release_date": "",
                        "release_date_precision": ""
                    },
                    "external_ids": null,
                    "popularity": 0,
                    "is_playable": null,
                    "linked_from": null
                }
            },
Leptopoda commented 2 years ago

I had a Podcast episode in the playlist but I can't find it anymore. My guess is that it got deleted by Spotify but it remained in the Playlist.

I'm not 100% shure though but thats the only thing I coul'd imagine.

Zibbp commented 2 years ago

I added a check to see if the track ID is null and skip if it is. After this change I was able to process the entire playlist. f4ca6bd49315a3c46b77b9ae240a7de69cd12e14

Spotify says there are 151 songs below the Playlist name but scrolling to the bottom of the track list there are 150 tracks. I guess they are counting the null track entry as a song.

Leptopoda commented 2 years ago

I saw it thanks going to try it now