android - jaudiotagger POPULARIMETER tag -


i migrating app using org.blinkenlights.jid3 jaudiotagger. have implemented of mp3 tags struggling popm tag. trying read popm gettting frame. appears correct method code recongnises 3 methods

(long irating = popmframe.getrating(); long cnt = popmframe.getcounter(); string mail = popmframe.getemailtouser()).  

what should put in brackets framebodypopm popmframe = id3v24tag.getframe( );. using jid3 achieved result follows:

try {                  id3v2_3_0tag id3v2_3_0tag =     (org.blinkenlights.jid3.v2.id3v2_3_0tag) mediafile.getid3v2tag();                 if (null != id3v2_3_0tag) {                     (int = 0; < id3v2_3_0tag.getpopmframes().length; i++) {                         if (id3v2_3_0tag.getpopmframes()[i] != null) {                             rating = id3v2_3_0tag.getpopmframes()[i].getpopularity();                             break;                         }                     }                 }                 rating = rating / 50;             } catch (id3exception e) {                 e.printstacktrace();             } 

using jaudiotagger have far following code:

          try {         mp3file musicfile = (mp3file) audiofileio.read(sourcefile);          if (musicfile != null && musicfile.hasid3v2tag()) {             id3v24tag id3v24tag = musicfile.getid3v2tagasv24();             framebodypopm popmframe = id3v24tag.getframe(??????);             long irating = popmframe.getrating();             long cnt = popmframe.getcounter();             string mail = popmframe.getemailtouser();          }     } catch (cannotreadexception | ioexception | tagexception             | readonlyfileexception | invalidaudioframeexception e5) {         throw e5;     } 

for question marks reports string when enter string such "popm" reports required: org.jaudiotagger.tag.id3.framebody framebodypopm , found java.lang.object

anybody can show how read , write popm tag using jaudiotagger library?

update: believe value should frame identifier so

framebodypopm popmframe = (framebodypopm) id3v24tag.getframe(id3v24frames.frame_id_popularimeter); 

compiles results in error:

java.lang.classcastexception: org.jaudiotagger.tag.id3.id3v24frame cannot cast org.jaudiotagger.tag.id3.framebody.framebodypopm 

but if make popmframe id3v24frame, 3 methods no longer available think framebodypopm correct way.

resolved issue. below code works expected.

         try {         mp3file musicfile = (mp3file) audiofileio.read(sourcefile);          if (musicfile != null && musicfile.hasid3v2tag()) {             id3v23frame frame = (id3v23frame) musicfile.getid3v2tag().getframe(id3v24frames.frame_id_popularimeter);             framebodypopm body = (framebodypopm) frame.getbody();             string mail = body.getemailtouser();             long irating = body.getrating();             long cnt = body.getcounter();         }     } catch (cannotreadexception | ioexception | tagexception             | readonlyfileexception | invalidaudioframeexception e5) {         throw e5;     } 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -