Backing up and restoring playlists in doubleTwist Music Player
Starting with version 2.5.2, doubleTwist Music Player will automatically back up playlists to the device as .m3u playlist files. This means that playlists created on the device will now survive library resets so if you are having problems with corrupt metadata or missing playlists from a sync in the library database, you can reset the database and the playlists will be restored after the reset.
The Android Media Scan (AMS) service automatically indexes music files and .m3u playlists found on the device. The AMS service will skip and not index any directories that has a .nomedia file/folder. When a library reset is performed, our app will import information from the AMS database to help rebuild the library database.
Because of the changes imposed by Google in Android 4.4 (KitKat), playlist files are now stored in the Android directory on the SD card. The Android directory has a .nomedia file so this means that the AMS service will not scan or index the playlist files stored inside.
The "Storage:" switch in doubleTwist Settings tells the app where to scan for playlist files during a reset:
- When it's set to "Internal:", our app will scan for playlists stored in Music folder on the root level of internal storage. After the scan, we will then import any playlists found in the AMS database. Because the SD card's Android directory is not indexed by the AMS service, none of the playlists in our app directory on the SD card will be imported.
- When it's set to "Memory card:", our app will scan for playlists stored in the SD's app directory. After the scan, we will then import any playlists found in the AMS database. Because the Music directory in internal storage is scanned and index by the AMS service, all of the playlists in the Music folder on the root level of internal storage will be imported and added to the library database.
- Because of changes made by Google to remove full access for the SD card in Android 4.4, the next time that you sync after performing a library reset, you may see a conflict dialog if you are using the SD card as the storage location for your music. Select the "Playlist from iTunes will replace the existing playlist" option to continue. The sync will proceed normally. You will then see import errors and also notifications that previously transferred files are being transferred again to your device. No previously synced files are being transferred. This is only "housekeeping" information as connections in the sync database are regenerated. These conflicts and notification will only appear once and will not appear again in subsequent syncs.
- The AMS service does not recognize or use "special" characters like ":" so if you use these characters in a playlist name, unexpected behavior may result. It's a best practice to use only standard alphanumeric characters for the playlist name.
- Because the AMS database is maintained by the Android operating system and not by doubleTwist, sometimes it can retain information on deleted playlist. This problem manifests itself when a playlist is deleted and a library reset is performed. Our app will scan the Music folder for .m3u playlist files to rebuild the library database. Since there is no .m3u playlist file in the Music folder, our app does not restore the playlist. But the next step is to import information about playlists from the AMS database and the AMS database may still contain an entry for this deleted playlist so this playlist is restored. Once the playlist information has been restored, our app will create a .m3u playlist file in the Music folder as part of the backup process. To break this cycle, do not reset the doubleTwist library database or, after deleting a playlist, please reboot your device to trigger a new AMS scan, which should remove any "phantom" playlist entries.
- When you remove all items from a playlist, the playlist will be blank and the .m3u playlist will be wiped of song entries but the .m3u file will not be removed. If a library reset is performed, the playlist will not be imported as it's empty. But the .m3u file will remain in the directory. This may cause unexpected behavior during future syncs so this is not recommended. It's better to delete the playlist using the "Delete" option from the overflow (three-dot) menu as this option will remove the playlist from the library database and also delete the .m3u playlist file.