flyingdutchman Posted April 26, 2013 Share Posted April 26, 2013 I am trying to update the Poweramp Playlist from an android playlist.I havethe Poweramp database structurePoweramp content:// uris to select frommanaged to complete the first step which is to add the new android playlist name into the Poweramp playlist table.the actual file name of the trackverified that the Poweramp unlock license is installed as it seems that this is what unlocks the dataprovider for PowerampI need to obtain:the track_number by querying the folder_files tableupdate: 2/8/13. removed most of this post as it was irrelevant. Question is valid though and I think I now have my answer Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/ Share on other sites More sharing options...
flyingdutchman Posted May 5, 2013 Author Share Posted May 5, 2013 It looks like I have to abandon this piece of functionality. It would have been a nice addition to my "Playlist Manager" and I am sure would have been appreciated by all Poweramp users.You can find my app on Google market. Search for Playlist Manager by THEOKLINK.If I do get some help with this, I will add the "Android to Poweramp" playlist export functionality. ps I just need to be able to READ from the folder_files table to return the _id as I need this to create a new playlist in folder_playlist_entries Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-18297 Share on other sites More sharing options...
maxmp Posted May 16, 2013 Share Posted May 16, 2013 Please check the Samples API for the URIs. The URI "root" is: PowerampAPI.ROOT_URI => content://com.maxmpz.audioplayer.dataThe following playlist related uris are implemented for "update", "delete" db actions:content://com.maxmpz.audioplayer.data/playlistscontent://com.maxmpz.audioplayer.data/playlists/ID/files "insert" db action:content://com.maxmpz.audioplayer.data/playlists You can't add playlist entries currently via API. If you need this functionality - we can add it to the next builds.Also, you can just generate and update m3u8 files in /Playlists (or actually, any other accessible by Poweramp folder) - Poweramp will show those as file based playlists. Note that only songs which are in Poweramp accessible folders will be shown in such playlists. Thanks! Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-18444 Share on other sites More sharing options...
flyingdutchman Posted May 20, 2013 Author Share Posted May 20, 2013 using the m3u suggestion works and I have implemented it in my app. Nicer though if we can create Poweramp native playlists. Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-18505 Share on other sites More sharing options...
flyingdutchman Posted June 12, 2013 Author Share Posted June 12, 2013 As no one has responded perhaps I need to simplify my question: "how do I query the Poweramp database and return the track_id" Update: Nov 13; my "Playlist Manager" app by THEOKLINK on Google Play checks if Poweramp is installed on your device. If it is, it offers you mp3 tags from Poweramp so you can create playlists outside Poweramp but still use tags such as ratings. An m3u export function also allows you to play these android playlists in Poweramp. The user manual available in the app provided detailed information on how to set this up. Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-18835 Share on other sites More sharing options...
dsaran Posted July 13, 2013 Share Posted July 13, 2013 As no one has responded perhaps I need to simplify my question: "how do I query the Poweramp database and return the track_id" try something like this: mContext.getContentResolver().query( PowerAMPiAPI.ROOT_URI.buildUpon().appendEncodedPath("files").build(), new String[] { "_id" }, null, null, null); Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-19112 Share on other sites More sharing options...
flyingdutchman Posted August 2, 2013 Author Share Posted August 2, 2013 Dsaran,your tip has helped me enormously. As I am an android newby, I now realise that the first step is to include the Poweramp library. Once I understood this, I have been able to query the tables using variations of the above uri.However, I have come unstuck again as I now understand what maxmp means by "You can't add playlist entries currently via API. If you need this functionality - we can add it to the next builds." It would be great if this functionality could be added to the next release. I am developing a Playlist Manager for Poweramp similar to the one I have for native android on Google Market (search for "Playlist Manager" by THEOKLINK)As my app exports native playlists to m3u format, I have even provided a user guide with screenshots on how to set Poweramp up to scan folders for m3u playlists. If anyone has other suggestions, please let me know.Thanks Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-19444 Share on other sites More sharing options...
flyingdutchman Posted August 20, 2013 Author Share Posted August 20, 2013 For those who are interested:Although it is not possible to update the Poweramp playlist, I did manage to interrogate the database and return valuesIn its simplest form:final String pamptrack_id = "folder_files._id";final String pamptrack_no = "folder_files.track_number";final String pamptrack_name = "folder_files.name";final String pampartist = "artists.artist";final String pampduration = "folder_files.duration";final String pampalbum = "albums.album";final String pampyear = "folder_files.year";final String pamppath = "folders.path";final String pamprating = "folder_files.rating";final String pamptimes_played = "folder_files.played_times";final String pamplast_played = "folder_files.played_at";final Uri uri = Uri.parse("content://com.maxmpz.audioplayer.data/files"); public Cursor getpampTrackTrackcursor(Context context, Cursor cursor){// gets all tracksContentResolver cr = context.getContentResolver();String[] proj ={ pamptrack_id, pamprating,pamptimes_played, pamplast_played };cursor = cr.query(uri,proj,null,null,null);return cursor;} gohttps://play.google.com/store/apps/details?id=com.flyingdutchman.playlistmanager&hl=ento see this is action Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-19722 Share on other sites More sharing options...
fullahead Posted February 2, 2014 Share Posted February 2, 2014 Please check the Samples API for the URIs. The URI "root" is: PowerampAPI.ROOT_URI => content://com.maxmpz.audioplayer.dataThe following playlist related uris are implemented for "update", "delete" db actions:content://com.maxmpz.audioplayer.data/playlistscontent://com.maxmpz.audioplayer.data/playlists/ID/files"insert" db action:content://com.maxmpz.audioplayer.data/playlistsYou can't add playlist entries currently via API. If you need this functionality - we can add it to the next builds.Also, you can just generate and update m3u8 files in /Playlists (or actually, any other accessible by Poweramp folder) - Poweramp will show those as file based playlists. Note that only songs which are in Poweramp accessible folders will be shown in such playlists.Thanks! Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-21552 Share on other sites More sharing options...
flyingdutchman Posted February 2, 2014 Author Share Posted February 2, 2014 fullahead,what is the point of your post? You have simply cut and pasted a previous response. Did you forget to ask a question? or contribute a solution?Thanks Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-21553 Share on other sites More sharing options...
maxmp Posted February 4, 2014 Share Posted February 4, 2014 The problem is that not all URIs are writeable (insertable/deletable/etc) from available API provider - Poweramp internally don't use content provider API, so only few "verbs" are implemented. We will certanly add all the missing parts in upcoming Poweramp v3.Thanks! Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-21592 Share on other sites More sharing options...
flyingdutchman Posted July 27, 2016 Author Share Posted July 27, 2016 A few years on an a little more android/java savvy and re-reading Max's responses, I have added the Poweramp Playlists to my app New Playlist Manager (NPM). Functionality at the moment : - list Poweramp Playlists in NPM (including the .m3u types) - Play a playlist directly from the NPM app - simple click and play a track - Maintain albumart and mp3 tags for track, album or selection of tracks The next release will allow you to delete Poweramp Playlists from NPM. Hopefully the next release of Poweramp will allow me to add all other functionality generally available in NPM . As Max states " We will certainly add all the missing parts in upcoming Poweramp v3 " Keeping my fingers crossed !!! Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-35224 Share on other sites More sharing options...
Reptile619 Posted July 28, 2016 Share Posted July 28, 2016 On 02/08/2013 at 4:27 PM, TheoKlink said: Dsaran, your tip has helped me enormously. As I am an android newby, I now realise that the first step is to include the Poweramp library. Once I understood this, I have been able to query the tables using variations of the above uri. However, I have come unstuck again as I now understand what maxmp means by "You can't add playlist entries currently via API. If you need this functionality - we can add it to the next builds." It would be great if this functionality could be added to the next release. I am developing a Playlist Manager for Poweramp similar to the one I have for native android on Google Market (search for "Playlist Manager" by THEOKLINK) As my app exports native playlists to m3u format, I have even provided a user guide with screenshots on how to set Poweramp up to scan folders for m3u playlists. If anyone has other suggestions, please let me know. Thanks Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-35243 Share on other sites More sharing options...
flyingdutchman Posted July 30, 2016 Author Share Posted July 30, 2016 In this thread Max states On 2/1/2014 at 5:33 AM, fullahead said: You can't add playlist entries currently via API. If you need this functionality - we can add it to the next builds. but somewhere else he states http://forum.powerampapp.com/index.php?/topic/3644-changing-playlist-content/#comment-14466 Thus to insert track into Poweramp list you need: 1. have it under Poweramp available folders (there should be entries for the track in folder_files table) 2. insert appropriate folder_files._id into playlists table." The statements seems to contradict. Perhaps Max can clarify? Anyway, at the moment I am stuck on trying to add playlist entries (so perhaps the first statement is correct) Below the stacktrace errors when trying different uri's Adding and deletion of a playlist works fine. Next step is to add to folder_playlist_entries but am unable to find the correct uri. I have tried all playlist uris as provided in the Poweramp API but have been unable to complete the updates Case1 uri= Uri uri = PowerampAPI.ROOT_URI.buildUpon() .appendEncodedPath("playlists") .build() 07-30 05:11:08.111 1814-2106/com.maxmpz.audioplayer E/SQLiteLog: (1) table folder_playlists has no column named folder_file_id 07-30 05:11:08.111 1814-2106/com.maxmpz.audioplayer E/SQLiteDatabase: Error inserting folder_file_id=88 playlist_id=3 sort=7 android.database.sqlite.SQLiteException: table folder_playlists has no column named folder_file_id (code 1): , while compiling: INSERT INTO folder_playlists(folder_file_id,playlist_id,sort) VALUES (?,?,?) Case 2 Uri uri = PowerampAPI.ROOT_URI.buildUpon() .appendEncodedPath("playlists") .appendEncodedPath("files") .build(); java.lang.IllegalArgumentException: Unknown URI content://com.maxmpz.audioplayer.data/playlists/files Case 3 Uri uri = PowerampAPI.ROOT_URI.buildUpon() .appendEncodedPath("playlists") .appendEncodedPath(Long.toString(playlist_id)) .appendEncodedPath("files") .build(); java.lang.IllegalArgumentException: Unknown URI content://com.maxmpz.audioplayer.data/playlists/3/files Can anyone help ?? Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-35277 Share on other sites More sharing options...
flyingdutchman Posted August 20, 2016 Author Share Posted August 20, 2016 I guess the only person to respond to this would be Max or Magadaner. If the current api does not have the correct uri to update folder_playlist_entries , would it be possible to release an interim api update? (given that the release date for the new version is unknown) In the meantime, I remain hopeful of a positive outcome. Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-35624 Share on other sites More sharing options...
flyingdutchman Posted October 12, 2016 Author Share Posted October 12, 2016 I guess the only person to respond to this would be Max or Magadaner. If the current api does not have the correct uri to update folder_playlist_entries , would it be possible to release an interim api update? (given that the release date for the new version is unknown) any luck with this? Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-36542 Share on other sites More sharing options...
incutonez Posted December 1, 2016 Share Posted December 1, 2016 @TheoKlink, do you think you could provide some guidance? I was able to import the library doing import com.maxmpz.Poweramp.player.PowerampAPI; but now I think I've hit the same issue that you have... I can't actually query the table, but I think that's because I'm passing the wrong column ID... not sure what the column name is. final String idKey = MediaStore.Audio.Playlists._ID; final String nameKey = MediaStore.Audio.Playlists.NAME; final String[] columns = { idKey, nameKey }; // I think I'm using the wrong column names here... what should I use? // Getting the playlists here works though, and I can display them in a ListView final Cursor playLists = resolver.query(PowerampAPI.ROOT_URI.buildUpon().appendEncodedPath("playlists").build(), columns, null, null, null); ... public Uri getPlaylistUri() { return PowerampAPI.ROOT_URI.buildUpon().appendEncodedPath("playlists").appendEncodedPath(Long.toString(getPlaylistId())).build(); } public Cursor createPlaylistCursor(String sort) { Log.d("BLAH", getPlaylistUri().toString()); // this looks like it logs the proper path "content://com.maxmpz.audioplayer.data/playlists/8" return getContentResolver().query(getPlaylistUri(), null, null, null, sort); // This crashes the app with Unknown URI content://com.maxmpz.audioplayer.data/playlists/8 } Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-37416 Share on other sites More sharing options...
flyingdutchman Posted December 1, 2016 Author Share Posted December 1, 2016 First off, Poweramp has its own database so querying the android database is pointless. You must use the column names as held in the Poweramp database. To get the database, use Android Device Monitor in Android Studio and pull it to your pc. It is data/data/com.maxmpz.audiplayer/databases/folders.db The way I went about this is use an sql tool on my pc (Razorsql) (or on android) and open the Poweramp database. You will see the structure and the column names. The next thing then is to figure out which uri to use. You can find the uris listed in the Poweramp API. Each uri gives access to certain tables and returns data from them. As these uris are a bit of black art, I tended to add an invalid column name so it would crash. The stacktrace then gives you clues as to what it is trying to do. // SELECT folder_files._id, folder_files.name AS name, // folder_files.artist_id AS artist_id,duration, rating, artists.artist, // albums.album, folders.path FROM folder_files // INNER JOIN folders ON folders._id=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) // ORDER BY folder_files.title_tag COLLATE NOCASE See the attached screenshot as an example of folder_files. To get all Poweramp playlists public Cursor getPowerampPlaylists(Context context) { final String criteria = null; ContentResolver cr = context.getContentResolver(); String[] columns = {"_id", "folder_playlists.name"}; return cr.query(Uri.parse("content://com.maxmpz.audioplayer.data/playlists"), columns, criteria, null, "name ASC"); } I hope this gets you going Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-37420 Share on other sites More sharing options...
ikndev Posted October 7, 2017 Share Posted October 7, 2017 Hi everyone, I was thinking of developing a very small app for use with Poweramp, the main feature of which would have been to add the track you are currently listening to to a playlist quickly. This seems to currently be impossible judging from this thread, however these posts seem to be rather old - Have you guys found a way or is it still a feature for developers which has yet do be added? Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-43192 Share on other sites More sharing options...
flyingdutchman Posted October 7, 2017 Author Share Posted October 7, 2017 If you want to add to a Poweramp playlist using your own code, simple answer is you can't. The api does not provide the insert. As i have stated previously, hopefully the new api has this functionality. Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-43193 Share on other sites More sharing options...
flyingdutchman Posted January 22, 2018 Author Share Posted January 22, 2018 removed as no longer relevant Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-45243 Share on other sites More sharing options...
flyingdutchman Posted February 13, 2018 Author Share Posted February 13, 2018 For the benefit of programmers interested: To delete tracks from a playlist: public void deleteTrackOnPowerampPlaylist(Context context,long playlist_id, String id ) { Uri uri = PowerampAPI.ROOT_URI.buildUpon() .appendEncodedPath("playlists") .appendEncodedPath(Long.toString( playlist_id)) .appendEncodedPath("files") .build(); ContentResolver resolver = context.getContentResolver(); String where = pampfolder_playlist_entries_id +" =?"; // id is the id of folder_playlist_entries String selectionArgs[]={id}; resolver.delete(uri, where,selectionArgs); } Move a track on the playlist by changing its sort order public void updatePositionOnPowerampPlaylist(Context context,long playlist_id, String id, int to) { Uri uri = PowerampAPI.ROOT_URI.buildUpon() .appendEncodedPath("playlists") .appendEncodedPath(Long.toString( playlist_id)) .appendEncodedPath("files") .build(); ContentResolver resolver = context.getContentResolver(); ContentValues values = new ContentValues(); values.put("sort",to); String where = pampfolder_playlist_entries_id +" =?"; String selectionArgs[]={id}; resolver.update(uri, values, where,selectionArgs); } Inserting into folder_playlist_entries is at the moment not possible. Update: after v795, ALL FUNCTIONALITY is available. I have updated my app accordingly Link to comment https://forum.powerampapp.com/topic/4679-how-to-update-the-poweramp-playlist-in-android/#findComment-45660 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.