nukeop / nuclear

Streaming music player that finds free music for you
https://nuclearplayer.com
GNU Affero General Public License v3.0
12.16k stars 1.06k forks source link

Refreshing the local library makes the songs in it play from online sources instead of locally #1141

Closed Kritsos closed 6 months ago

Kritsos commented 2 years ago

Platform: Windows 10 Version: 20H2 OS Build: 19042.1466

Nuclear version: 0.6.17

Description of the issue: Refreshing the local library without adding or deleting any song on your local folders makes the local songs be played from an online source instead of your local folders.

Showcase of the bug

https://user-images.githubusercontent.com/72339454/149622949-0dd3bdd4-9057-4181-85ee-88f4c1b81a05.mp4

apisandipas commented 2 years ago

I'm taking a look at this at the moment, Will report back with my findings.

apisandipas commented 2 years ago

I can confirm this behavior is occuring on Linux (Manjaro) as well, just as described. I am unfortunately having some issues getting the project to build locally. Is the master branch stable?

I can provide more detail if needed, but out of the gate the tests fail and seem to indicate there is a typing issue in the AZLyrics plugin. The search method returns a string rather than a Promise, etc.

Can someone confirm their master branch is building?

nukeop commented 2 years ago

The latest commits from master build fine on CI: https://github.com/nukeop/nuclear/runs/4991742404 Try these instructions: https://nukeop.gitbook.io/nuclear/developer-resources/development-process

And make sure the npm/node versions match.

apisandipas commented 2 years ago

I was able to get things running locally and after some poking and prodding have found that local library queue items lose the values of their "local" and "streams" properties.

Looking in the app/actions/queue.ts file, inside the addToQueue function, we now fail the if (!item.local && isAbleToAdd) check and thereafter attempt to get a stream provider, seems to fallback to Youtube.

I'm sure I could find a solution to this in time, but wanted to seek some guidance to the best approach. Something tells me their should be a "Local" Stream Provider-type plugin to maintain the same interface between tracks of different types and avoid these edge cases but the way local tracks are modeled now, that would take a bit more understanding on my part.

@nukeop any guidance you could provide here would be very valuable.

nukeop commented 2 years ago

There's a sort of a circuit breaker that checks if the local flag is set and if so it selects the local stream instead of the currently selected stream provider. The intention is to always prioritize local tracks instead of streaming. If we make sure that the flag is preserved when saving playlists, then it should prefer local files.

The only thing that worries me is that you could delete the local track after it's added to a playlist. In this case, it should revert to streaming. Both of these cases would need to be tested.

Most of the tests in the app package test individual views or containers by simulating clicks and typing, then expect a certain redux state or other state changes to happen. It should be possible to test this the same way.

nukeop commented 6 months ago

Fixed at some point.