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

Feature: Local music library #1479

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from

Conversation

bleonard252
Copy link

@bleonard252 bleonard252 commented May 5, 2024

This PR introduces a new setting that allows you to set zero or more "local libraries" from a directory. These do not get modified in any way, not even created if they don't exist (they're just not loaded, in that case). Closes #595 (which seems to already be supported, actually).

This is only used right now in the "Local tracks" feature. Playback, queuing, removing libraries, and album art seem to work automatically, but MPRIS metadata does not, and it uses fallback data if you attempt to look at the track, album, or artist pages for any local track, but this seems to be an issue with the existing Downloads folder too.

The PR also changes some dependencies, which I had to do to get it to build and run on my machine. Feel free to revert it, or have me revert it, if you feel it necessary.

Screenshots

Screenshot of Spotube on the Settings page, focusing on the new item under Downloads labeled Local libraries
Screenshot of Spotube on the Local libraries settings sub-page, listing two entries

@KRTirtho
Copy link
Owner

KRTirtho commented May 6, 2024

Wow, that's really great work. Thanks for the contribution.

But I'd like to suggest some changes.

Instead of having the Local Library section in Settings, we can just show the Local Folders as grid of cards/list in the "Library" > "Local Tracks" Tab. The tracks for each folder will be accessible only on that Folder's specific page.
We can have the "add local library" button there as well to add the folders users want to.

This will also need the "Local Tracks" tab to be renamed as just "Local" meaning local library.

@bleonard252
Copy link
Author

I'm not completely sure what a grid view would look like for a local tracks list. If you are thinking about album/artist grouping, that's a taller task, and I think it would be better to integrate it into the local fields anyway, which is definitely outside the scope of this PR. (I'm thinking about setting up local track integration via Spotify ID in a future PR.)

I think I might try integrating the settings into the "local tracks" list, by grouping by source and putting the "add to library" button there, as you suggested.

@bleonard252
Copy link
Author

One interesting side effect of this new listing mechanism is that, now, if you click play on a track (with a clear queue, not sure if that matters), it plays all the tracks from that library source only.

A screenshot of Spotube showing some tracks grouped by library source.

@KRTirtho
Copy link
Owner

KRTirtho commented May 9, 2024

Great work. This is close to what I meant and imagined.
But, instead of showing all the tracks of all the libraries together,
we can show just the Library names in the "Local Tracks" tab. It can be a ListView or a GridView of them. Kinda similar to Playlist. But, we'll utilize the FileSystem to manage/store it.
We can move the playbuttons, sort button etc. playback related actions to specific Library view page. The Library view page will List all the Tracks contained by it

One interesting side effect of this new listing mechanism is that, now, if you click play on a track (with a clear queue, not sure if that matters), it plays all the tracks from that library source only.

Do you mean it doesn't play any other online tracks if we add them to the Queue later?

@KRTirtho KRTirtho changed the base branch from master to dev May 9, 2024 11:05
@KRTirtho
Copy link
Owner

KRTirtho commented May 9, 2024

We actually only merge PRs in to the dev branch. But, you were targetting master branch. So some conflicts arose after changing the target branch

Do debugging/testing/build etc then submit to us with PR against the development branch (dev) & we'll review your code

@bleonard252
Copy link
Author

bleonard252 commented May 9, 2024

Do you mean it doesn't play any other online tracks if we add them to the Queue later?

It does. It doesn't add the other listed sources to the queue, though. I guess if I rework it into multiple pages, this becomes intended behavior :)

We actually only merge PRs in to the dev branch

Oops I must have missed that. That makes sense. I'll rebase and solve the conflict, and then start trying to rework it into multiple pages, like you asked. I still don't think a grid view makes sense, since I'd have to figure out what image shows up on it, so it'll still be a list, but I'll revert it back to a simple ListView and just list the libraries there. (This will look silly to anyone with just Downloads set, by the way.)

This folder just doesn't get downloaded to.
I think I'm going to rework it so that it can be multiple folders,
but I'm going to commit my progress so far anyway.

Signed-off-by: Blake Leonard <me@blakes.dev>
I'm not sure if this breaks CI or something, but I couldn't build
it locally to test my changes, so I made these changes and it
builds again.

Signed-off-by: Blake Leonard <me@blakes.dev>
If you used a previous commit from this branch, this is a breaking
change, because it changes the type of a configuration field. but
since this is still in development, it should be fine.

Signed-off-by: Blake Leonard <me@blakes.dev>
This also refactors the list to use slivers instead. That's the
easiest way to have multiple scrolling lists here...

The console keeps getting spammed with some intermediate layout
error but I can't hold it long enough to figure out what's causing
it.

Signed-off-by: Blake Leonard <me@blakes.dev>
Signed-off-by: Blake Leonard <me@blakes.dev>
Signed-off-by: Blake Leonard <me@blakes.dev>
Not sure if this would be the recommended way to do it...

Signed-off-by: Blake Leonard <me@blakes.dev>
Signed-off-by: Blake Leonard <me@blakes.dev>
Signed-off-by: Blake Leonard <me@blakes.dev>
Signed-off-by: Blake Leonard <me@blakes.dev>
Signed-off-by: Blake Leonard <me@blakes.dev>
@bleonard252
Copy link
Author

The force-push was from rebasing the branch upon dev. Here's what it looks like now:
image
image

@KRTirtho
Copy link
Owner

This is close to perfect. Later, I guess we can use the Album art of the first 4 songs of the library as the image for the GridView's items.

For now I think is acceptable. I can always redo the UI for better UX later.

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

Successfully merging this pull request may close these issues.

Support for local library
2 participants