flyingdutchman Posted August 7, 2018 Share Posted August 7, 2018 In my app New Playlist Manager, I am developing "Smart Playlist" functionality ahainst the Poweramp Media database instead of the Android Media database. Main reason for doing this is that Android does not offer the ratings tags whereas Poweramp does. However I run into the same frsutrating issue when trying to query for Genre. Both Poweramp and Android appear not to adhere to relational database design principles as I am unable to return "genre" within the same query. The table folder_files holds foreign keys to album, artist, composer referring to data held in other tables. Surprisingly the key to genre is missing. There are url's listed in the API documentation but I would like to return all relevant track info in one sql pass, for example: powerampuri = Uri.parse("content://com.maxmpz.audioplayer.data/files"); return resolver.query( powerampuri, new String[]{pamp.pamptrack_id, pamp.folders_path, pamp.folder_files_name}, mwhere, sselectionArgs, msort_order); but as fas as I am able to establish, genre is not included Anyone have any suggestions? Link to comment Share on other sites More sharing options...
flyingdutchman Posted August 7, 2018 Author Share Posted August 7, 2018 I believe that using the uri final Uri powerampgenreuri = Uri.parse("content://com.maxmpz.audioplayer.data/genres/files"); builds the following so it appears problem solved SELECT folder_files._id as pampid, folders.path as fpath, folder_files.name as fname, genres.genre FROM genre_entries INNER JOIN genres ON genres._id=genre_entries.genre_id INNER JOIN folder_files ON folder_files._id=genre_entries.folder_file_id INNER JOIN folders ON folders._id=folder_files.folder_id LEFT JOIN albums ON albums._id=folder_files.album_id LEFT JOIN artists ON artists._id=folder_files.artist_id WHERE (folder_files.cue_folder_id IS NULL) AND (genres.genre LIKE ?) ORDER BY genre COLLATE NOCASE ,track_tag, folder_files.title_tag COLLATE NOCASE Link to comment Share on other sites More sharing options...
maxmp Posted August 31, 2018 Share Posted August 31, 2018 There is 1-to-many relation between given track and genres, genres/files will do the joins as you found out. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.