Jump to content
Poweramp
Sign in to follow this  
flyingdutchman

Using Poweramp Media Database instead of Android

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

There is 1-to-many relation between given track and genres, genres/files will do the joins as you found out.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...