Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No album names present for specific users. #234

Closed
exislow opened this issue Feb 11, 2024 · 14 comments
Closed

No album names present for specific users. #234

exislow opened this issue Feb 11, 2024 · 14 comments

Comments

@exislow
Copy link
Contributor

exislow commented Feb 11, 2024

I have experienced a very rare occasion, where one user from GB is not getting Album.name nor Track.album.name.

We did some analysis here: exislow/tidal-dl-ng#35

Have you seen something like this? This is actually not possible and I cannot re-produce it. In my case, I can build a workaround but this would be suuuper hacky and actually not necessary, since TIDAL must provide album names.

@tehkillerbee
Copy link
Collaborator

tehkillerbee commented Feb 11, 2024

@exislow I have never seen this myself during normal playback.

However, when trying to browse the two albums using tidal web, they are simply listed as "The content is no longer available". So perhaps such albums are not handled correctly/skipped.

  • 152668960
  • 175693674

@exislow
Copy link
Contributor Author

exislow commented Feb 12, 2024

I cannot confirm this. Those tracks / albums are fully available to me. I can listen to them using the web browser player or the TIDAL app. Have you clicked on the correct links? From which country do you try to access these songs?

The user also states, that this happens with every track he tries to access with tidal-dl-ng.

@tehkillerbee
Copy link
Collaborator

You are right, I mistakenly used the wrong ID when I checked this earlier.

Have you tried reproducing this issue using a minimum tidalapi script eg. https://github.com/tamland/python-tidal/blob/master/examples/simple.py? Does it occur there as well?

@Dialgatrainer02
Copy link

I can no longer assist with the issue as my dad has removed me from the family subscription and I have no means of paying. My app still works but I haven't tested the web player or the API yet

@exislow
Copy link
Contributor Author

exislow commented Feb 13, 2024

@tehkillerbee I never experienced this problem, and since @Dialgatrainer02 cannot assist anymore with this I would like to close this issue.

@exislow exislow closed this as completed Feb 13, 2024
@exislow
Copy link
Contributor Author

exislow commented Feb 21, 2024

@tehkillerbee I think I could finally re-produce this error. Take a look at the following:

import tidalapi
from tidalapi import Quality
from pathlib import Path

session_file1 = Path("token.json")
session = tidalapi.Session()

session.login_session_file(session_file1)

session.audio_quality = Quality.hi_res_lossless.value
album = session.album("117485440")
tracks = album.tracks()

print(vars(album))

track = session.track("117485441")

print(vars(track.album))

This is the output:

{'session': <tidalapi.session.Session object at 0x102d40c50>, 'requests': <tidalapi.request.Requests object at 0x10519c5d0>, 'artist': <tidalapi.artist.Artist object at 0x10519e950>, 'id': 117485440, 'name': 'Wer hätte das gedacht? (Special Edition)', 'cover': '6fce8655-5745-4ed7-9261-6acc4ff968e6', 'video_cover': None, 'duration': 5845, 'available': True, 'num_tracks': 27, 'num_videos': 0, 'num_volumes': 1, 'copyright': 'ASD', 'version': None, 'explicit': False, 'universal_product_number': '4056813148596', 'popularity': 11, 'type': 'ALBUM', 'artists': [<tidalapi.artist.Artist object at 0x10268f550>], 'release_date': datetime.datetime(2003, 3, 28, 0, 0), 'tidal_release_date': datetime.datetime(2019, 9, 9, 0, 0, tzinfo=tzutc()), 'user_date_added': None}
{'session': <tidalapi.session.Session object at 0x102d40c50>, 'requests': <tidalapi.request.Requests object at 0x10519c5d0>, 'artist': <tidalapi.artist.Artist object at 0x1051bced0>, 'id': 117485440, 'name': 'Wer hätte das gedacht? (Special Edition)', 'cover': '6fce8655-5745-4ed7-9261-6acc4ff968e6', 'video_cover': None, 'duration': None, 'available': None, 'num_tracks': None, 'num_videos': None, 'num_volumes': None, 'copyright': None, 'version': None, 'explicit': None, 'universal_product_number': None, 'popularity': None, 'type': None, 'artists': [<tidalapi.artist.Artist object at 0x1051bced0>], 'release_date': None, 'tidal_release_date': None, 'user_date_added': None}

The song is from the exact same album. If I get the album object and dump it, everything is fine. If I create the track object instead first and try to dump track.album I get a lot of None values instead. Why? Can you re-produce it?

EDIT: My fault. It should be track = session.track("117485441", with_album=True)

I usually create Track objects this way: Track(session, id_media) As far as I see, there is no possibility to load the album information as if I would use session.track(id_media, with_album=True). Is this correct? Can we implement a function which actually encapsulate this?

if item.album and with_album:
alb = self.album(item.album.id)
if alb:
item.album = alb

Also if I do something like this the album is unpopulated and needs to be populated manually:

album = session.album("117485440")
tracks = album.tracks()
tracks[0].album.available # None

There are cases, where I get the track from an album and need to access the album information, but at this stage album itself is not available to me in the scope of my script / routine, but track.album should be.

@exislow exislow reopened this Feb 21, 2024
@exislow exislow closed this as completed Feb 21, 2024
@exislow exislow reopened this Feb 21, 2024
@tehkillerbee
Copy link
Collaborator

@exislow The album should already be parsed for a Track (Media) object, if this field is available in the json object.

Media.parse(self, json_obj)

if json_obj["album"]:

I assume this works correctly, if you pick a different track that has this field populated? Have you observed the contents of the json response in these two cases?

Also if I do something like this the album is unpopulated and needs to be populated manually:

This sounds like a bug. The album ID never propagates to the newly created Track object so I guess the assumption is the individual track has this information.

return cast(List["Track"], tracks)

It could be interesting to see the json response when getting the track using the endpoint. I suspect that only one of them contains the album id.
"tracks/%s" vs. "albums/%s/tracks"

@exislow
Copy link
Contributor Author

exislow commented Feb 22, 2024

First of all: Have you tried to re-produce it with the script I have provided above? I am curious if you have the same results or maybe this is something depending on the users region?

This sounds like a bug. The album ID never propagates to the newly created Track object so I guess the assumption is the individual track has this information.

I am a little bit confused: The album ID gets propagated to the album object according to my output above. What do you exactly mean?

Out of json_obj (

Media.parse(self, json_obj)
)

{
   "id":117485441,
   "title":"Intro",
   "duration":90,
   "replayGain":-9.55,
   "peak":0.97998,
   "allowStreaming":true,
   "streamReady":true,
   "adSupportedStreamReady":true,
   "djReady":true,
   "stemReady":false,
   "streamStartDate":"2019-09-09T00:00:00.000+0000",
   "premiumStreamingOnly":false,
   "trackNumber":1,
   "volumeNumber":1,
   "version":"None",
   "popularity":4,
   "copyright":"ASD",
   "url":"http://www.tidal.com/track/117485441",
   "isrc":"DELZ31500001",
   "editable":false,
   "explicit":false,
   "audioQuality":"LOSSLESS",
   "audioModes":[
      "STEREO"
   ],
   "mediaMetadata":{
      "tags":[
         "LOSSLESS"
      ]
   },
   "artist":{
      "id":3510038,
      "name":"Asd",
      "type":"MAIN",
      "picture":"b145f5e1-bd84-4aa2-aad4-13ed205ac872"
   },
   "artists":[
      {
         "id":3510038,
         "name":"Asd",
         "type":"MAIN",
         "picture":"b145f5e1-bd84-4aa2-aad4-13ed205ac872"
      }
   ],
   "album":{
      "id":117485440,
      "title":"Wer hätte das gedacht? (Special Edition)",
      "cover":"6fce8655-5745-4ed7-9261-6acc4ff968e6",
      "vibrantColor":"#a9c3d7",
      "videoCover":"None"
   },
   "mixes":{
      "TRACK_MIX":"00164a565b48f835e59b20eed02904"
   }
}

This is the output of album (

if json_obj["album"]:
):

{
   "session":<tidalapi.session.Session object at 0x1051a4e90>,
   "requests":<tidalapi.request.Requests object at 0x1062f1990>,
   "artist":<tidalapi.artist.Artist object at 0x106355890>,
   "id":117485440,
   "name":"Wer hätte das gedacht? (Special Edition)",
   "cover":"6fce8655-5745-4ed7-9261-6acc4ff968e6",
   "video_cover":"None",
   "duration":"None",
   "available":"None",
   "num_tracks":"None",
   "num_videos":"None",
   "num_volumes":"None",
   "copyright":"None",
   "version":"None",
   "explicit":"None",
   "universal_product_number":"None",
   "popularity":"None",
   "type":"None",
   "artists":[
      <tidalapi.artist.Artist object at 0x106355890>
   ],
   "release_date":"None",
   "tidal_release_date":"None",
   "user_date_added":"None"
}
#1
Valid (RFC 8259)
Fixer/Validator Output
    Info: Replaced incorrect quotes.
    Info: Converted true to lowercase.
    Info: Converted false to lowercase.
    Info: Inserted missing quotes. 
Formatted JSON Data
{
   "id":117485441,
   "title":"Intro",
   "duration":90,
   "replayGain":-9.55,
   "peak":0.97998,
   "allowStreaming":true,
   "streamReady":true,
   "adSupportedStreamReady":true,
   "djReady":true,
   "stemReady":false,
   "streamStartDate":"2019-09-09T00:00:00.000+0000",
   "premiumStreamingOnly":false,
   "trackNumber":1,
   "volumeNumber":1,
   "version":"None",
   "popularity":4,
   "copyright":"ASD",
   "url":"http://www.tidal.com/track/117485441",
   "isrc":"DELZ31500001",
   "editable":false,
   "explicit":false,
   "audioQuality":"LOSSLESS",
   "audioModes":[
      "STEREO"
   ],
   "mediaMetadata":{
      "tags":[
         "LOSSLESS"
      ]
   },
   "artist":{
      "id":3510038,
      "name":"Asd",
      "type":"MAIN",
      "picture":"b145f5e1-bd84-4aa2-aad4-13ed205ac872"
   },
   "artists":[
      {
         "id":3510038,
         "name":"Asd",
         "type":"MAIN",
         "picture":"b145f5e1-bd84-4aa2-aad4-13ed205ac872"
      }
   ],
   "album":{
      "id":117485440,
      "title":"Wer hätte das gedacht? (Special Edition)",
      "cover":"6fce8655-5745-4ed7-9261-6acc4ff968e6",
      "vibrantColor":"#a9c3d7",
      "videoCover":"None"
   },
   "mixes":{
      "TRACK_MIX":"00164a565b48f835e59b20eed02904"
   }
}

Does this looks correct?

It could be interesting to see the json response when getting the track using the endpoint. I suspect that only one of them contains the album id.

"tracks/%s" (self.requests.map_request("tracks/%s" % '117485441'))

{
   "id":117485441,
   "title":"Intro",
   "duration":90,
   "replayGain":-9.55,
   "peak":0.97998,
   "allowStreaming":true,
   "streamReady":true,
   "adSupportedStreamReady":true,
   "djReady":true,
   "stemReady":false,
   "streamStartDate":"2019-09-09T00:00:00.000+0000",
   "premiumStreamingOnly":false,
   "trackNumber":1,
   "volumeNumber":1,
   "version":"None",
   "popularity":4,
   "copyright":"ASD",
   "url":"http://www.tidal.com/track/117485441",
   "isrc":"DELZ31500001",
   "editable":false,
   "explicit":false,
   "audioQuality":"LOSSLESS",
   "audioModes":[
      "STEREO"
   ],
   "mediaMetadata":{
      "tags":[
         "LOSSLESS"
      ]
   },
   "artist":{
      "id":3510038,
      "name":"Asd",
      "type":"MAIN",
      "picture":"b145f5e1-bd84-4aa2-aad4-13ed205ac872"
   },
   "artists":[
      {
         "id":3510038,
         "name":"Asd",
         "type":"MAIN",
         "picture":"b145f5e1-bd84-4aa2-aad4-13ed205ac872"
      }
   ],
   "album":{
      "id":117485440,
      "title":"Wer hätte das gedacht? (Special Edition)",
      "cover":"6fce8655-5745-4ed7-9261-6acc4ff968e6",
      "vibrantColor":"#a9c3d7",
      "videoCover":"None"
   },
   "mixes":{
      "TRACK_MIX":"00164a565b48f835e59b20eed02904"
   }
}

"albums/%s/tracks" (self.requests.map_request("albums/%s/tracks" % self.id)['items'][0])

{
   "id":117485441,
   "title":"Intro",
   "duration":90,
   "replayGain":-9.55,
   "peak":0.97998,
   "allowStreaming":true,
   "streamReady":true,
   "adSupportedStreamReady":true,
   "djReady":true,
   "stemReady":false,
   "streamStartDate":"2019-09-09T00:00:00.000+0000",
   "premiumStreamingOnly":false,
   "trackNumber":1,
   "volumeNumber":1,
   "version":"None",
   "popularity":4,
   "copyright":"ASD",
   "url":"http://www.tidal.com/track/117485441",
   "isrc":"DELZ31500001",
   "editable":false,
   "explicit":false,
   "audioQuality":"LOSSLESS",
   "audioModes":[
      "STEREO"
   ],
   "mediaMetadata":{
      "tags":[
         "LOSSLESS"
      ]
   },
   "artist":{
      "id":3510038,
      "name":"Asd",
      "type":"MAIN",
      "picture":"b145f5e1-bd84-4aa2-aad4-13ed205ac872"
   },
   "artists":[
      {
         "id":3510038,
         "name":"Asd",
         "type":"MAIN",
         "picture":"b145f5e1-bd84-4aa2-aad4-13ed205ac872"
      }
   ],
   "album":{
      "id":117485440,
      "title":"Wer hätte das gedacht? (Special Edition)",
      "cover":"6fce8655-5745-4ed7-9261-6acc4ff968e6",
      "vibrantColor":"#a9c3d7",
      "videoCover":"None"
   },
   "mixes":{
      "TRACK_MIX":"00164a565b48f835e59b20eed02904"
   }
}

If I understand the outputs correctly the correct album id is propagated but the album information are never fetched, are they?

I assume this works correctly, if you pick a different track that has this field populated?

For me, this is the case for all the tracks currently. As I like to access track.album I get all the None values. Do you have any track id I should try? I am really curious, if you can re-produce it.

@exislow exislow changed the title No Album Names present for specific users. No album names present for specific users. Feb 22, 2024
@tehkillerbee
Copy link
Collaborator

tehkillerbee commented Feb 22, 2024

@exislow

Have you tried to re-produce it with the script I have provided above?

Not yet but I will try when time allows.

I am a little bit confused: The album ID gets propagated to the album object according to my output above.

I am referring to the issue that you described where you stated that the album is unpopulated and needs to be populated manually

album = session.album("117485440")
tracks = album.tracks()
tracks[0].album.*

I am talking about the Track object associated with a parent Album. When looking at the code for album.tracks(), it looks like each track is always parsed from the json object so the track.album field is never set from the parent album. So my theory was that the track itself did NOT have the album field set causing this issue. Unfortunately, from your json dumps, it looks like that is not the case, as the album field clearly exists when getting the track info from either endpoint.

I will try to test when I have time and see if this issue also occurs in my end.

@exislow
Copy link
Contributor Author

exislow commented Feb 26, 2024

Thank you. Let me know, if I can help somehow.

@tehkillerbee
Copy link
Collaborator

tehkillerbee commented Feb 27, 2024

I have tested with this script, with your additions.

import tidalapi
from tidalapi import Quality
from pathlib import Path

session_file1 = Path("tidal-session-pkce.json")
session = tidalapi.Session()

session.login_session_file(session_file1)

session.audio_quality = Quality.hi_res_lossless
album = session.album("117485440")
tracks = album.tracks()

print(vars(album))

track = session.track("117485441")

print(vars(track.album))

track = session.track("117485441", with_album=True)
print(vars(track.album))

#
album = session.album("117485440")
tracks = album.tracks()
alb1 = tracks[0].album

Output:

{'session': <tidalapi.session.Session object at 0x7f4ad4276d10>, 'request': <tidalapi.request.Requests object at 0x7f4ad2421d50>, 'artist': <tidalapi.artist.Artist object at 0x7f4ad2421c90>, 'id': 117485440, 'name': 'Wer hätte das gedacht? (Special Edition)', 'cover': '6fce8655-5745-4ed7-9261-6acc4ff968e6', 'video_cover': None, 'duration': 5845, 'available': True, 'ad_supported_ready': True, 'dj_ready': True, 'allow_streaming': True, 'premium_streaming_only': False, 'num_tracks': 27, 'num_videos': 0, 'num_volumes': 1, 'copyright': 'ASD', 'version': None, 'explicit': False, 'universal_product_number': '4056813148596', 'popularity': 13, 'type': 'ALBUM', 'artists': [<tidalapi.artist.Artist object at 0x7f4ad2423670>], 'release_date': datetime.datetime(2003, 3, 28, 0, 0), 'tidal_release_date': datetime.datetime(2019, 9, 9, 0, 0, tzinfo=tzutc()), 'user_date_added': None}
{'session': <tidalapi.session.Session object at 0x7f4ad4276d10>, 'request': <tidalapi.request.Requests object at 0x7f4ad2421d50>, 'artist': <tidalapi.artist.Artist object at 0x7f4ad22a8910>, 'id': 117485440, 'name': 'Wer hätte das gedacht? (Special Edition)', 'cover': '6fce8655-5745-4ed7-9261-6acc4ff968e6', 'video_cover': None, 'duration': None, 'available': None, 'ad_supported_ready': None, 'dj_ready': None, 'allow_streaming': None, 'premium_streaming_only': None, 'num_tracks': None, 'num_videos': None, 'num_volumes': None, 'copyright': None, 'version': None, 'explicit': None, 'universal_product_number': None, 'popularity': None, 'type': None, 'artists': [<tidalapi.artist.Artist object at 0x7f4ad22a8910>], 'release_date': None, 'tidal_release_date': None, 'user_date_added': None}
{'session': <tidalapi.session.Session object at 0x7f4ad4276d10>, 'request': <tidalapi.request.Requests object at 0x7f4ad2421d50>, 'artist': <tidalapi.artist.Artist object at 0x7f4ad22a9300>, 'id': 117485440, 'name': 'Wer hätte das gedacht? (Special Edition)', 'cover': '6fce8655-5745-4ed7-9261-6acc4ff968e6', 'video_cover': None, 'duration': 5845, 'available': True, 'ad_supported_ready': True, 'dj_ready': True, 'allow_streaming': True, 'premium_streaming_only': False, 'num_tracks': 27, 'num_videos': 0, 'num_volumes': 1, 'copyright': 'ASD', 'version': None, 'explicit': False, 'universal_product_number': '4056813148596', 'popularity': 13, 'type': 'ALBUM', 'artists': [<tidalapi.artist.Artist object at 0x7f4ad22a9360>], 'release_date': datetime.datetime(2003, 3, 28, 0, 0), 'tidal_release_date': datetime.datetime(2019, 9, 9, 0, 0, tzinfo=tzutc()), 'user_date_added': None}

So the output for the track.album only has selected fields set.

The documentation for the Album class states:

If the album is created from a media object, this object will only contain the id, name, cover and video cover. TIDAL does this to reduce the network load.

So it looks like this is the expected behaviour.

@exislow
Copy link
Contributor Author

exislow commented Feb 28, 2024

That is a bummer. This means, I need to re-create each Album track with session.track("ANY ID", with_album=True) and indeed this would cost some overhead.

What do you think about this proposal:

Lets extend this method

def tracks(self, limit: Optional[int] = None, offset: int = 0) -> List["Track"]:
and also .items([...]) with a parameter like enrich and if it is set to True the method copies all album information to the newly retrieved tracks, which are lacking of album information due to TIDALs reduction of network load.

Or is there any other easy way to retrieve all album information for a Track I have retrieved from an Album, Playlist etc. object via .tracks() / .items() instead of re-creating the Track object using session.track("ANY ID", with_album=True)?

@tehkillerbee
Copy link
Collaborator

I need to re-create each Album track with session.track("ANY ID", with_album=True)

I'm not sure why you do not keep the album object for accessing the album related fields, then you do not need the extra requests. But I guess it is easier for your use case to work directly with the track objects.

which are lacking of album information due to TIDALs reduction of network load.

Yes, I think this is the way forward. Since we already have the Album information on hand, we should be able to pass on the album fields to the track when calling .items()/.tracks()

Or is there any other easy way to retrieve all album information for a Track

No, I think this is the only way until we add the functionality that you suggest.

Feel free to create a PR, otherwise I will look at it as soon as I have some time.

@tehkillerbee
Copy link
Collaborator

Closing, moved to a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants