hendrik on 16 Nov, 2016 08:24 AM
First of all, AudioMetaData is the class that
writes directly to an audio file. It does not update any values in
iTunes. If you want to write to a file and update
stuff in iTunes, simply use an AudioSong object
returned to you by the ITunesMusicLibrary. It manages
lots of stuff under the hood. AudioMetaData implements
the AudioSong interface, so whatever you get from the
library has the same API.
The problem with the POPM frame is, that it's tied
to an email address. Unless you use the same address as the
software of your choice, it may get ignored.
Why aren't you simply using
setRating()? It's mapped to POPM.
If you post a little code sample, I'd be happy to take a look
and make suggestions!
I'm using AudioMetaData.getRating() to read the rating from the file then AudioSong.setRating() to save it to iTunes. If the rating is blank in iTunes it works the first time but when I change the rating in another program and run then script to update it in iTunes AudioMetaData.getRating() appears to be the same value as what's in iTunes and not the POM value.
hendrik on 17 Nov, 2016 08:52 AM
If the rating is blank in iTunes it works the first time but
when I change the rating in another program and run then script to
update it in iTunes AudioMetaData.getRating() appears to be the
same value as what's in iTunes and not the POM value.
When using an iTunes-based collection, beaTunes works in a mode
that is optimized to work with just iTunes. This means that any
modifications by third party programs may not be noticed either by
iTunes or beaTunes.
So when you modify the rating with some third party software,
iTunes won't display this change until you actually play the file.
This makes sense, cause otherwise iTunes would need to constantly
monitor and re-read all files.
beaTunes (when in iTunes-library mode!) only picks up changes
caused by iTunes, which are exported by iTunes in its
Library.xml file. This is done this way, because it is
far more efficient than to scan though all files all the time.
What happens when you change the rating in your third party
software, then play that song in iTunes, and then synchronize
beaTunes? Do iTunes and beaTunes show the new rating?
That aside, to force reading the third party rating in beaTunes,
first get the AudioMetaData object, read the current
rating/popm that's in the file. Then write some random value using
the AudioSong object you received from the beaTunes
library. Then write the value you got from
AudioMetaData using the AudioSong's
Reasoning: beaTunes does not propagate any values to iTunes when
they haven't changed. First changing to some random value forces a
If this does not work for whatever reason, please post code
hendrik on 17 Nov, 2016 08:40 PM
So reading from the file using AudioMetaData.getRating() doesn't
actually re-read the file's metatdata it's reads from
No. Using AudioMetaData you're always reading from
the audio file, not from the iTunes Library.xml
As a matter of fact, there is no documented API in beaTunes that
lets you read the iTunes Library.xml file
directly. You are either reading from the internal
beaTunes database (which is based on the iTunes
Library.xml file through synchronization) or you
are reading from the file itself (via an AudioMetaData
Ok .. so this whole issue of mine with a CloudStation folder (similar to
Dropbox) containing all my tracks interferes with file write permissions
from time to time .. i.e won't let tags be written while it's syncing
the file and after it's synced it .. seems to keep a lock on the file
which is screwing with my testing. Realising this has also solved my
issues reported in this discussion:
So after pausing the syncing app. I can confirm
AudioMetaData.getRating() is reading the POPULARIMETER from the file. So
I can save my ratings made in Traktor or Rekordbox etc. back to iTunes
Is the a priority of which rating tag AudioMetaData.getRating()
retrieves? I can see POPULARIMETER and FMPS_RATING in the file (see
Perhaps a method that can grab any tag such as
AudioMetaData.getId3Tag(TAG_NAME) would be handy??
hendrik on 18 Nov, 2016 07:48 AM
FMPS_RATING is only read as fallback, if there is
no regular POPM frame.
AudioMetaData is a more or less smart wrapper
around JAudioTagger, which is
used under the hood. If your goal is to get fine-grained control
over ID3 tags or the like, you might want to use the JAudioTagger