Jump to content
Poweramp
flyingdutchman

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

Recommended Posts

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

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.


×
×
  • Create New...