jmshrv / finamp

A Jellyfin music client for mobile
Mozilla Public License 2.0
2k stars 130 forks source link

Tracks with no album [singles] are not downloaded #863

Open Hate9 opened 2 months ago

Hate9 commented 2 months ago

If I have a track with an artist but no album, and I download the library it's in, all the tracks in albums download, but none of the tracks without albums do.

This is on beta 9.9.

Also, there is no way to list non-album tracks for an artist without adding everything of theirs to the queue or searching in the "tracks" tab, but idk if that should go in this issue.

Chaphasilor commented 2 months ago

Hmm, this was added back in 0.9.7, so I'm not sure why it isn't working for you.

Could you share more info about your setup? How and where does Jellyfin show the track? How does it look in Finamp?

If you could provide some logs after deleting and re-downloading your library, that might also help!

Hate9 commented 2 months ago

Sure! Jellyfin also does not show the track under the artist unless it's in an album, and also adds non-album tracks to the queue when adding all songs by an artist. Both Jellyfin and Finamp (online) list the track in "all tracks". Offline, Finamp shows all album-tracks by all artists in their artist pages and the global tracks listing, but not non-album tracks. I can create a queue with albumless tracks in online mode and continue to play it in offline mode, but if I restart the app, the albumless tracks "cannot be restored" and are removed from the queue.

My library is kinda large, but I'll make a new library with just one artist's stuff, download it, and upload the logs.

Chaphasilor commented 2 months ago

Great, thanks for the info. I'm also interested in your file structure to make sure there's nothing unexpectes going on :)

Hate9 commented 2 months ago

image

I have a top-level directory which contains loose tracks, playlists, artist folders, and album folders. Artist folders contain a list of albums and/or a collection of loose tracks (or very occasionally multiple subfolders of albums).

Chaphasilor commented 2 months ago

Are "Big Blue Wave" and "Complicated" downloaded? I use this exact directory structure for testing, and just confirmed the tracks download fine on 0.9.9.

Also, what happens if you manually download one of these tracks using the long-press menu? Does it show up in offline mode?

Hate9 commented 2 months ago

Yeah, weirdly enough, the loose tracks in the top-level folder download fine. Odd...

Hate9 commented 2 months ago

Manually downloading a track still works, so it appears it can download and will show up, it just doesn't without explicitly selecting that track.

Chaphasilor commented 2 months ago

Yeah, if the top-level tracks work then it seems like the request we make to the server to get the tracks not belonging to any album only catch the top-level tracks, but not the other ones. I'll see if I can modify it to include those as well. We just need to make sure tracks aren't downloaded multiple times :)

Chaphasilor commented 2 months ago

I'm guessing in the case of the other tracks, the parent item is not the library itself (like it is for the top-most tracks), but the artist. So applying the same fix we did for the top-level orphans should also work if applied to each artist.

@Komodo5197 do you think this section could easily be copied to the artist fetching as well?

https://github.com/jmshrv/finamp/blob/redesign/lib%2Fservices%2Fdownloads_service_backend.dart#L1311-L1321

I haven't tested my theory yet, but I'm reasonably sure it would work, that's why I'm asking :)

Komodo5197 commented 2 months ago

I don't believe trying to grab loose artist tracks is a good idea, because I don't believe artist-related requests can be limited to a specific library. If you can find a way to limit that, I guess it would work, although it would dramatically increase the amount of requests needed to perform a library sync update for a very small improvement.

Chaphasilor commented 2 months ago

Ah that's a good point, I always forget that Jellyfin has no library filter 🙃

As for the requests, I belive it would require #artists more requests, correct?

I have some time to spare now, will play around with it!

Komodo5197 commented 2 months ago

Yeah, it would add #artists requests, which could easily be 100+. Currently, a full library sync with no changes is 2 requests.

Chaphasilor commented 2 months ago

Okay, so there is a way to get those tracks, by using Recursive=false and also using the ParentId instead of ArtistIds (normally ArtistIds has to be used to properly fetch albums).
We could make this an optional setting for compatibility, emphasizing that normally all tracks should be part of an album.
@Hate9 or do you think it would be easier to just add pseudo-albums for all of your singles?

Edit: I'm guessing the two requests are checking for new albums and new artists?

Hate9 commented 2 months ago

We can definitely make it an optional setting, and I'll probably just make pseudo-albums in the mean-time, but Jellyfin already breaks in lots of ways if your library isn't setup very specifically, and we don't want to exaccerbate that further here, so it should definitely be fixed, even if only optionally.