Jump to content

Adding songs to playlist is very slow (in some circumstances)


The Timebreaker
Go to solution Solved by maxmp,

Recommended Posts

Hello everyone,

I am using playlists, that are locally saved on my phone in the folders scanned by Poweramp (*.m3u8 format). This is due to some problems where my whole library, including playlists, got destroyed a couple of years ago.

However, I am experiencing heavy slowdowns when adding songs to these playlists. When selecting "Add to playlist" from withing the song player or when surfing the library, i will get a "Working..." prompt at the bottom of my screen. Sometimes, it takes "just" a couple of seconds, but I already had some cases where i had to wait 30 seconds or more just to add one single song to a playlist.

For testing purposes, i created a new playlist from within the Poweramp app, which is using poweramps default format (whatever that may be) and I had no slowdowns there. Not even the "Working..." prompt. I just wanted to ask if that kind of difference between a playlist from disk and a playlist by Poweramp is normal or if there is a technical reason that I don't know about.

Technical stuff: Poweramp build 929 (from PlayStore), OnePlus 9 Pro on Android 12 (but I had this problem also with the previous Android 11 version)

With best regards,
TheTimebreaker / Yanick

Link to comment
Share on other sites

Are these lists especially large? The Android 12 storage access is not very fast, and PA has to re-write the entire file when you make even a simple change. Shouldn't take more than a few seconds though. Do you have Settings > Misc > File Access legacy Mode turned on or off?

Andre

Link to comment
Share on other sites

  • Solution

@The Timebreaker writing extremely large playlists (thousands of tracks), esp. on slow medium (sd-card) may be slow, but not that slow. 20k songs are written in ~1sec. Due to the way new file access is implemented on Android, we can't do direct file access though.

The problem lies not just in the saving itself, but in the Android scanner intercepting our saved file and trying to parse stuff. If you have 1000+ tracks on the phone "known" to the system scanner, it will slow down any media files ops around file based playlist on that phone and that's the slowdown you can see. Android scanner tries to find all tracks, and it does it without using db indexes or otherwise so slowly that it may take minutes. I guess Google never tested that scenario.

You can get better results by adding .nomedia empty file into the folder where you have your playlists stored. Note that other music players won't see media content in folders with .nomedia file (and any subfolders of these).

Enabling Legacy file access may help too, but Android scanner will take its time anyway, just in background. Also, moving from/to Legacy access requires Music Folders reselection, so this may break all meta information associated with the tracks (ratings, play statistics, etc.), unless data backup is used.

Also, due to this issue, I will revert playlist saving from atomic saving to less safer target file write.

 

Link to comment
Share on other sites

7 hours ago, maxmp said:

Also, due to this issue, I will revert playlist saving from atomic saving to less safer target file write.

I would hope that there is another solution to this particular user's issue, as atomic saving is much safer and seems to have stopped all of the playlist file corruption issues that were happening in the past. And if you are creating a temporary file with no know media extension (until it gets renamed) wouldn't that stop the Android media scanner from taking an interest in it in the meantime anyway?

Andre

Link to comment
Share on other sites

@andrewilley currently it creates temporary file, but unfortunately Android hooks on renaming it back to the original file name. When Android media scanner hooks and scans, it delays further processing in Poweramp (we can't skip this, or if we offload it to extra thread, that will be in the background for a long time) and on the phones with large collection of songs, known to the system media scanner, system scanner is quite slow (50-60ms per playlist entry, causing 1000 songs playlist to be saved for 50-60 seconds, this is on high end phone).

10k songs in playlist make it basically freeze forever, while Poweramp itself saves the playlist in <1sec.

Less safer approach doesn't trigger Android media scanner immediately and everything is fast. Android scanner may be triggered later though, so large playlists preferable should be in .nomedia folder.

Link to comment
Share on other sites

My own preference would always be for the safest option to avoid any potential file corruption. But then I already have a .nomedia file in the root level of my music folders hierarchy, as I never want Android's music scanner also picking through my music when I'm never going to use it as I only listen via Poweramp.

@The Timebreaker Did the .nomedia or other advice in this thread resolve the problem for you?

Andre

Link to comment
Share on other sites

Thanks you two for the replies!
The playlist is ~2800 songs long (260kB). Adding the .nomedia file to the folder helped a lot and got the saving time down to almost being innoticable again (~1 sec), according to the bit of testing I did, so that solved it for me.

Although I feel like I should add that the File Lagecy Access is not there in my options. I can search for it and it shows up there, but when i click on it, it takes me to the MISC section, where it's nowhere to be found. Maybe because Im on Android 12?

ANyway, thanks a lot for helping me here!

Link to comment
Share on other sites

The Legacy mode was removed for a while on Android 12 devices as it was not meant to work according to Google, but it does still seem to be available so Max recently restored the option into PA's menus. Make sure you are using the latest beta-build of Poweramp (currently 925).

But at least the culprit has been found in this case, it's Google's media scanner getting in the way.

Andre

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...