Shuttle2 icon indicating copy to clipboard operation
Shuttle2 copied to clipboard

Importing playlists fails on large libraries

Open daladim opened this issue 1 year ago • 9 comments

🌎 Environment

Shuttle2, built from source

💬 Description

When I import a large library (7000+ songs) into a S2 Media Provider, songs are correctly imported, but no playlist is.

🦶 Reproduction Steps

After some investigation, it turns out importSongs() successfully completes, but songRepository.getSongs() in importPlaylists() returns 0 songs.

You probably already hit this issue, because you've hard-coded a delay here. If I understand correctly, this gives time for the SQL DB to get populated (I suppose that's because songRepository.insertUpdateAndDelete(...) is some kind of async coroutine/background task/something around those lines?) As one could expect, this is not a definitive solution, because any arbitrary delay here would be defeated by any large enough library.

I am not experienced enough, but do you think of any clean solution? Could we make the SQL insertion synchronous? Otherwise, could we check (every 100ms for instance) if anything has been added to the DB, and proceed with importPlaylists() only when this is done?

Thanks for your insight :)

daladim avatar Apr 22 '23 20:04 daladim

I have the same problem with v1.0.6 installed through Google Play.

Using Android Media Store my playlists are correctly populated but using the S2 Media Provider my playlists all show up as empty (0 songs).

(in case it's relevant, my playlists are stored in m3u format using relative file paths)

futwick avatar May 11 '23 12:05 futwick

@daladim I reckon you're probably right. An arbitrary delay is a bit of a code smell and perhaps the insert is taking more than 500ms to complete. There is probably a more robust way to handle this, not sure what that looks like but I'll have a look when I get some time

timusus avatar May 16 '23 02:05 timusus

I was having a similar issue (no playlists showing up), but was able to get them to show up with a library rescan

(on a Google Pixel 6, app installed from Google Play Store, m3u playlists, but I forget if they're relative paths or not. using both Android Media Store and S2 Media Provider)

UltimateRiff avatar Dec 02 '23 19:12 UltimateRiff

@UltimateRiff are you using the latest alpha? Are you just confirming that it's fixed?

timusus avatar Dec 02 '23 20:12 timusus

based on my experience, I feel like the issue is somewhere in the initial setup part, because I had a similar issue* until I did a manual rescan

I'm on 1.0.6, installed from the Google Play Store

*playlists not showing at all, instead of showing empty playlists

UltimateRiff avatar Dec 03 '23 16:12 UltimateRiff

Closing, hoping this is fixed via #141 and released in 1.0.7

timusus avatar Jan 11 '24 09:01 timusus

In 1.0.6 my playlists appeared with 0 songs.

In 1.0.7 my playlists do not appear at all (although I can see them being processed during scans).

futwick avatar Jan 12 '24 17:01 futwick

@futwick can you show me what the contents of your m3u playlist looks like, and also screenshot the song info for a particular song? I'd like to compare the paths..

timusus avatar Jan 15 '24 08:01 timusus

I use Clementine to make playlists and Syncthing to copy music and playlists to the SD card in my phone.

The paths are relative to the location of the playlist files (e.g. Music/Playlists/Test Playlist.m3u).

I made a new playlist with a single song. The contents of this new playlist:

#EXTM3U #EXTINF:197,The Skids - Into the Valley ../S/The Skids/The Saints are Coming - The Best of The Skids/02 - Into the Valley.mp3

The song info for this track: screenshot of song info

futwick avatar Jan 15 '24 16:01 futwick