• Announcements

    • andrewilley

      Poweramp v3 Project Update   04/24/2017

      As you may be aware, the Poweramp developer has been working hard on an updated material design user interface for Poweramp v3 which required a full ground-up rebuild of the code. It is hoped this will be ready for final beta-testing by the end of the May/early June. See forum thread for more details and to discuss.    
TheoKlink

Updating Poweramp Rating, Last Played, Times Played. Help Needed

4 posts in this topic

Any app developers out there who can help.?

In my app New Playlist Manager (http://www.playlistmanager.webspace.virginmedia.com/npm/)

, I am trying to provide a means to update specific Poweramp tags such as Rating, Times Played and Last Time Played. This will help those who migrate phones/devices and want to retain their Poweramp tags. For this to work, I have an export routine from Poweramp (old Phone/device) and also an import into Poweramp (new phone/device). Export works fine, Import I need some help as I am not sure how I can update each record. The code to parse the export file is complete apart from the code to update. 

 

Part 1 Export Poweramp details to text file works fine

 

public void export_pamp_details(Cursor crsor) throws IOException {
  int int_name = crsor.getColumnIndex(pamptrack_name);
  int int_rating = crsor.getColumnIndex(pamprating);
  int int_times_played = crsor.getColumnIndex(pamptimes_played);
  int int_last_played = crsor.getColumnIndex(pamplast_played);

  if (plist.check_folder(myfolder)) {
  try {
          myFile.createNewFile();
        } catch (Exception e) {
          Log.i(TAG, e.getMessage());
        }

FileOutputStream fOut = new FileOutputStream(myFile);
OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
String line = "";

for (crsor.moveToFirst(); !crsor.isAfterLast(); crsor.moveToNext()) {
 line = "\""+crsor.getString(int_name)+"\"" + ","+"\""+crsor.getString(int_rating)+"\"" + ","+"\""+crsor.getString(int_times_played)+"\"" +  ","+"\""+crsor.getString(int_last_played)+"\""+"\n";
 myOutWriter.append(line);
 }

 try {
 crsor.close();
 myOutWriter.close();
 fOut.close();
 } catch (Exception e) {

  }
 }
}

 

Result:

"01. Cruel World.mp3","0","5","1421584583"
"02. Ultraviolence.mp3","0","2","1421588250"
"04. Brooklyn Baby.mp3","0","0","0"
"05. West Coast.mp3","0","0","0"
"06. Sad Girl.mp3","0","0","0"
 

 

 

Part 2 Import into Poweramp

 

public void import_poweramp_details(Context context) throws IOException {

// load text file
// for each line, find the track in the pamp database
// if cursor is returned then update that record

BufferedReader reader = new BufferedReader(new FileReader((String.valueOf(myFile))));
try {
 String line;
while ((line = reader.readLine()) != null) {
  String[] RowData = line.split(",");
  String name = RowData[0];
  String rating = RowData[1];
  String times_played = RowData[2];
  String last_played = RowData[3];
  String where = pamptrack_name +" =?";
  String criteria[] = {name };

  Cursor pampcursor = getthispampTrackcursor(context, where, criteria );
  if(pampcursor.moveToFirst() && pampcursor != null){
>>>>> here I have the correct track record, 

>>>>> I have all the necessary details

>>>>> How to update record??
 }
Log.i(TAG,name +rating+times_played+last_played);
}
}
catch (IOException ex) {
// handle exception
}
}
}

 

Now I know from previous posts that the api does not provide an interface to update.

A) Is this assumption still correct? 

B) is there away to achieve this update?

C) perhaps Poweramp developers can help?

Share this post


Link to post
Share on other sites

Figured it OUT !!

Thenext release of New Playlist Manager will allow you to EXPORT and IMPORT your RATINGS, Times Played and Last Played. Watch this space.

Share this post


Link to post
Share on other sites

Version 62 has been released and has now functionality to export and import your ratings.

Share this post


Link to post
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