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

Some songs Art no showing #393

Open
Jisan09 opened this issue Mar 3, 2022 · 4 comments
Open

Some songs Art no showing #393

Jisan09 opened this issue Mar 3, 2022 · 4 comments

Comments

@Jisan09
Copy link

Jisan09 commented Mar 3, 2022

I'm trying to get thumb image of current playing song.
For some it showing & for some it returning white star image .

.get_now_playing().get_cover_image()

@hugovk
Copy link
Member

hugovk commented Mar 3, 2022

Not every track has an image. What track is it happening for?

@Jisan09
Copy link
Author

Jisan09 commented Mar 3, 2022

These bellow songs & many other songs also can't recall their name now

• Sachet Tandon - Mere Sohneya
• Javed-Mohsin - Pal
• Jasleen Royal - Kho Gaye Hum Kahan

image

But when making raw api call, it returing image.
x = requests.get(f'http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key={API_KEY}&artist=Javed-Mohsin&album=Pal&format=json')

It will good if it get fix or it return None in place of that Star Image so can use api call as try except to get the thumb.

@hugovk
Copy link
Member

hugovk commented Mar 3, 2022

.get_now_playing() calls https://www.last.fm/api/show/user.getRecentTracks

doc = self._request(self.ws_prefix + ".getRecentTracks", False, params)

https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=Jisan09&api_key=YOUR_API_KEY&format=json

Do you see image when making a raw API call to this endpoint?


You can also add this to your Python progam:

import logging
logging.basicConfig(level=logging.DEBUG)

And find your pylast/__init__.py and uncomment this:

    def _check_response_for_errors(self, response):
        """Checks the response for errors and raises one if any exists."""
        try:
            doc = _parse_response(response)
        except Exception as e:
            raise MalformedResponseError(self.network, e) from e

        e = doc.getElementsByTagName("lfm")[0]
-       # logger.debug(doc.toprettyxml())
+       logger.debug(doc.toprettyxml())

        if e.getAttribute("status") != "ok":
            e = doc.getElementsByTagName("error")[0]
            status = e.getAttribute("code")
            details = e.firstChild.data.strip()
            raise WSError(self.network, status, details)

It will then print out the data it's getting from the API.

@Jisan09
Copy link
Author

Jisan09 commented Mar 3, 2022

On making raw API call by https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=Jisan09&api_key=YOUR_API_KEY&format=json
its returning Image for all songs. Some are correct and some are white star.

But one thing i noticed the songs which returning white img doesn't have mbid & album mbid

For example this song with white thumb.
{"recenttracks":{"track":[{"artist":{"mbid":"","#text":"Jasleen Royal"},"streamable":"0","image":[{"size":"small","#text":"https:\/\/lastfm.freetls.fastly.net\/i\/u\/34s\/2a96cbd8b46e442fc41c2b86b821562f.png"},{"size":"medium","#text":"https:\/\/lastfm.freetls.fastly.net\/i\/u\/64s\/2a96cbd8b46e442fc41c2b86b821562f.png"},{"size":"large","#text":"https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/2a96cbd8b46e442fc41c2b86b821562f.png"},{"size":"extralarge","#text":"https:\/\/lastfm.freetls.fastly.net\/i\/u\/300x300\/2a96cbd8b46e442fc41c2b86b821562f.png"}],"mbid":"","album":{"mbid":"","#text":"Baar Baar Dekho (Original Motion Picture Soundtrack)"},"name":"Kho Gaye Hum Kahan","@attr":{"nowplaying":"true"},"url":"https:\/\/www.last.fm\/music\/Jasleen+Royal\/_\/Kho+Gaye+Hum+Kahan"},

And this song with correct thumb.
{"recenttracks":{"track":[{"artist":{"mbid":"21a14ee3-cede-420a-9d6d-a33517d2f952","#text":"Alec Benjamin"},"streamable":"0","image":[{"size":"small","#text":"https:\/\/lastfm.freetls.fastly.net\/i\/u\/34s\/e8e096ff83f840b67d3427275a227f4e.jpg"},{"size":"medium","#text":"https:\/\/lastfm.freetls.fastly.net\/i\/u\/64s\/e8e096ff83f840b67d3427275a227f4e.jpg"},{"size":"large","#text":"https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/e8e096ff83f840b67d3427275a227f4e.jpg"},{"size":"extralarge","#text":"https:\/\/lastfm.freetls.fastly.net\/i\/u\/300x300\/e8e096ff83f840b67d3427275a227f4e.jpg"}],"mbid":"00df4b23-feb5-4c7b-a23d-3515d1637edf","album":{"mbid":"534056a1-b641-46b5-b74e-2b41a6818d7e","#text":"Narrated For You"},"name":"Let Me Down Slowly","@attr":{"nowplaying":"true"},"url":"https:\/\/www.last.fm\/music\/Alec+Benjamin\/_\/Let+Me+Down+Slowly"},

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

2 participants