mirror of
https://github.com/koel/koel.git
synced 2026-04-25 16:56:02 +03:00
[GH-ISSUE #589] Distributing locally cached Last.fm scrobbled song info/data. #418
Labels
No labels
Authentication
Dependencies
Documentation
Feature Request
Flac
Help Wanted
Installation/Setup
Integration
Mobile
PR Welcome
Pending Release
Performance
Playlist
S3
Search
Sync
[Pri] Low
[Pri] Normal
[Status] Keep Open
[Status] Needs Author Reply
[Status] Needs Review
[Status] Stale
[Status] Will Implement
[Type] Blessed
[Type] Bug
[Type] Duplicate
[Type] Enhancement
[Type] Help Request
[Type] Question
[Type] Task
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/koel-koel#418
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nikohd12 on GitHub (May 4, 2017).
Original GitHub issue: https://github.com/koel/koel/issues/589
Hello,
First of all, thank you @phanan for developing Koel, we're using it as our internal streaming server in our small office.
We have strict blocking configured in our firewall, so we are blocking all websites except for the one's whitelisted. Ofc, one of those websites that are included is last.fm and akamaized.
When they view the artist/album tab in the Info bar, it's white blank, but if they got lucky and it's being delivered via local server = "koel-radio/img/artist/.png", the images appear but appears as blank when served with https://lastfmimg2.akamaized.net/i/u/300x300/xxxxxxxxxxxxx.png (because of firewall blocking). Koel is caching it successfully in storage/img/artists (almost all artists images are there).
How can I enforce koel to deliver cached content rather than the one's from last.fm.
I was able to catch one error, but tried refreshing the page and catching it again, but was not able to.
Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH
http://koel-radio/api/492b98cb0ab5b132eefbf699dc728822/play?jwt-token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIsImlzcyI6Imh0dHA6XC9cL2Rhbi1yYWRpb1wvYXBpXC9tZSIsImlhdCI6MTQ5Mzc5MTUxOSwiZXhwIjoxNDk0Mzk2MzE5LCJuYmYiOjE0OTM3OTE1MTksImp0aSI6ImU3ZjQ5OTQ5ZWIyMWE4YTYyYWY3NGJjOGE5NjMyMWU0In0.CFpEG6LwE1KtTttKsjM4mFVj7YvWBEWpHMOHYeKBXxI@phanan commented on GitHub (May 4, 2017):
I'm not very sure what you mean by "local_doman:xxxx" (and the whole
description tbh), but the error isn't related to the cache but from song
streaming instead.
On Thu, May 4, 2017 at 12:22 PM, nikojaro notifications@github.com wrote:
@nikohd12 commented on GitHub (May 4, 2017):
@phanan I see. There was no playback error reported anyway.
Back to the topic, what I meant was the images are served randomly, either via localhost or via last.fm's cdn.
When I first implemented Last.FM API, all images are served locally with an address of /koel/storage/imgs/artist/jcole.png rather than the one being served right now which is https://lastfmimg2.akamaized.net/i/u/300x300/jcole.png.
I tried searching for functions that relate with caching and Last.fm, but I just saw this from resources/assets/js/components/main-wrapper/extra/artist-info.vue
<img v-if="artist.info.image" :src="artist.info.image"@phanan commented on GitHub (May 4, 2017):
If the album/artist image doesn't exist and is found via Last.fm API, Koel
will copy it to use locally.
On Thu, May 4, 2017 at 3:05 PM, nikojaro notifications@github.com wrote:
@nikohd12 commented on GitHub (May 4, 2017):
@phanan right, I do see that Koel stores it when I add new artists. But it's being served via Last.fm's CDN rather than using the local file.
@nikohd12 commented on GitHub (May 4, 2017):
Okay, I think I figured it out how to reproduce it. I created a new instance of koel, with a new database.
You can get the images served locally if you are accessing it the first time. Meaning, the trigger was right,
However, once the image was already there in the /img/artists folder, and koel found that it exists, it will proceed with last.fm's cdn.
So, I tried it with all the artists, access it the first time = it will be served locally. Select the next song, it will be served via last.fm's cdn.
Screenshot:
First time playing the artist.
Next time playing the artist.
@phanan commented on GitHub (May 5, 2017):
Even after refreshing Koel?
On Fri, May 5, 2017 at 5:46 AM, nikojaro notifications@github.com wrote:
@nikohd12 commented on GitHub (May 5, 2017):
@phanan by refreshing, do you mean restarting nginx? or by doing koel:init?
I tried doing both, still no success.
@phanan commented on GitHub (May 5, 2017):
I mean refreshing the browser.
On Fri, May 5, 2017 at 8:56 AM, nikojaro notifications@github.com wrote:
@nikohd12 commented on GitHub (May 5, 2017):
@phanan yep tried doing Ctrl + F5, and the normal refresh. No success.
There's also no album picture in the info page.
But there are pictures when you visit the Album Page and the Artists Page on their respective tabs using the same resource.
@phanan commented on GitHub (May 5, 2017):
Oh then it's another story. The image in the info panel is part of the data
returned by Last.fm, and is always from Last.fm's CDN. You'll need to white
list the URL patterns.
On Fri, May 5, 2017 at 8:59 AM, nikojaro notifications@github.com wrote:
@nikohd12 commented on GitHub (May 5, 2017):
@phanan But when you play a song from an artist the first time, it returns the data coming from the localhost. How can I enforce it to use the link being distributed the first time? Should I create a cron job to delete the images in img/artist to be able to enforce it (would create lots of io).
I guess the last option would be whitelisting it, although I have to convince our IT Security if he would allow it.
@phanan commented on GitHub (May 5, 2017):
If you have Last.fm enabled, data from Last.fm will take priority over the
local data. The flow is:
On Fri, May 5, 2017 at 9:06 AM, nikojaro notifications@github.com wrote:
@nikohd12 commented on GitHub (May 5, 2017):
@phanan Can I enable Last.fm to scrobble and disable the API once I'm done scrobbling.
So that it would use the local data.
Thanks a lot btw.
@phanan commented on GitHub (May 5, 2017):
No I don't think that's possible, or even makes sense. The most sensible
"fix" would be to configure your firewall and allow trusted sources. Your
issue has very little to do with Koel TBH.
On Fri, May 5, 2017 at 9:16 AM, nikojaro notifications@github.com wrote:
@nikohd12 commented on GitHub (May 5, 2017):
@phanan Thanks. Appreciate it.