I have a list of songs rated by folder they are in开发者_JAVA技巧 (e.g. 1 star songs in a folder, 2 star songs in another folder and so on). I want to rate songs in iTunes depending on which folder they are in, fast and automatically using codes from java.
I found a perl script that does similar thing: http://www.hydrogenaudio.org/forums/index.php?showtopic=38083
It would make it event simpler to use folder name instead of tags to set rating.
If you want to do similar thing in java, you'd have to use Jacob (example here) or BridJ to do access iTunes database via COM. It's painful, platform-dependant and I wouldn't recommend doing it unless you really need it.
iTunes stores its library as an XML file so I suppose you could manipulate that directly from within Java. Of course you'd have to be careful with this approach as different versions of iTunes have different XML formats, and if you invalidate the library than all the metadata iTunes is holding about the tracks in its library will be lost.
精彩评论