How can I figure it out if iTunes: keep iTunes Folder Organized installed programmatically in Windows

How can I work if iTunes: Preferences: Optional: keep iTunes Folder Organized programmatically installed on Windows, my Java application that interacts with iTunes should know this.

Unfortunately, neither the iTunes xml file nor the iTunes API seem to provide this information, I assume these are preferences stored somewhere else, but how can I find out if this is enabled or not, I also you need to know this for copy files to iTunes Media folder when adding to the library

Update: Nothing in the registry, but Ive found the settings file

C: \ Users \ username \ AppData \ Roaming \ Apple Computer \ iTunes

however it seems to be encrypted / encoded, I don't know how to read the values

Update 2:

The saved copy of the file changed the value of "Copy files" to the iTunes Media Folder folder when adding to the library and comparison and selected the change

<key>Documents:132</key> <data> AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAEAAACwf6jgsOrUhX8BAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= </data> 

but as you can see, it’s hard to notice the difference, and Id would be worried if I crack this valkue, it might break between versions of iTunes, is there any way to decode this file?

Update 3

I found that the Apache Community Configuration supports the Places format in the Xml format http://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration/plist/XMLPropertyListConfiguration.html , but not unfortunately used here is the binary format.

I wrote this code listing all the keys, and then tried to decode the location property, as I know that it contains only one path to the base64 encoding file.

 public File getITunesXMLFile() { String homedir = System.getProperty("user.home"); File prefsFile = new File(homedir,"AppData/Roaming/Apple Computer/iTunes/iTunesPrefs.xml"); try { XMLPropertyListConfiguration xpc = new XMLPropertyListConfiguration(prefsFile); xpc.load(); Iterator<String> keys = xpc.getKeys(); while(keys.hasNext()) { String nextKey = keys.next(); System.out.println(nextKey+":"+xpc.getProperty(nextKey).getClass()); } ArrayList location = (ArrayList)xpc.getProperty("User Preferences.iTunes Library XML Location:1"); System.out.println("Location:"+location.get(0).getClass()); System.out.println("Location:"+location.get(1).getClass()); System.out.println("Location1:"+ new BASE64Decoder().decodeBuffer(location.get(0).toString())); System.out.println("Location2:"+ new BASE64Decoder().decodeBuffer(location.get(1).toString())); } catch(Exception ex) { MainWindow.logger.log(Level.SEVERE,"Unable to open iTunes Prefs file:"+prefsFile.getName(),ex); } File xmlFile = new File(homedir + "/Music/iTunes/iTunes Music Library.xml"); if (!xmlFile.exists()) { return null; } return xmlFile; } 

but, unfortunately, it does not work, because the data is returned as an ArrayList of a class like [B, which does not make any sense to me, this is not a valid name for the class.

Exit

 EQ Preferences.EQPresets:129:class java.util.ArrayList User Preferences.Documents:132:class java.util.ArrayList User Preferences.Gracenote User ID:1:class java.util.ArrayList User Preferences.Music Store:1:class java.util.ArrayList User Preferences.Pairing Preferences:301:class java.util.ArrayList User Preferences.Preferences:130:class java.util.ArrayList User Preferences.Radio Tuner Categories:131:class java.util.ArrayList User Preferences.Touch Remote Preferences:400:class java.util.ArrayList User Preferences.iTunes Library XML Location:1:class java.util.ArrayList User Preferences.iTunes..exe:AAC Encoder:class java.util.ArrayList User Preferences.iTunes..exe:iTunes Classic Visualiser:class java.util.ArrayList User Preferences.license-agreements.EA0962:class java.util.ArrayList User Preferences.storefront:class java.util.ArrayList Location:class [B Location:class [B Location1:[ B@58a7a Location2:[ B@2893bb6f +++++++++++++++++++++++++++++++++++++++++++++++ 

and also found this problem https://issues.apache.org/jira/browse/CONFIGURATION-262

Update 4

Found library that already supports binary .google.com / p / plist looks reliable

Update 5

I managed to use this library to decode the location of the Xml file as follows (Base64 class from Apache Commons Codec 1.8)

 public File getITunesXMLFile() { System.getProperties().list(System.out); String homedir = System.getProperty("user.home"); File prefsFile = new File(homedir,"AppData/Roaming/Apple Computer/iTunes/iTunesPrefs.xml"); File xmlFile; try { NSDictionary rootDict = (NSDictionary) PropertyListParser.parse(prefsFile); NSDictionary userPrefs = (NSDictionary) rootDict.objectForKey("User Preferences"); if(userPrefs!=null) { NSData iTunesLocation = (NSData) userPrefs.objectForKey("iTunes Library XML Location:1"); if(iTunesLocation!=null) { String base64 = iTunesLocation.getBase64EncodedData(); String filepath = new String(Base64.decodeBase64(base64),"UTF-16LE"); xmlFile = new File(filepath); System.out.println(filepath+":File Exists:"+xmlFile.exists()); if (xmlFile.exists()) { return xmlFile; } } } } catch(Exception ex) { ex.printStackTrace(); //Use default then xmlFile = new File(homedir + "/Music/iTunes/iTunes Music Library.xml"); if (xmlFile.exists()) { return xmlFile; } } return null; } 

Update 6

I tried to do this for the data that I was really interested in, I can extract data from base64encoded from the Documents: 132 file, but unfortunately I'm trying to decode this base64encoding, I really can’t get anything, maybe I just have to look for differences in the base 64-encoded data when flags are on / off.

  public boolean isiTunesCopyFolderToMediaFolder() { String homedir = System.getProperty("user.home"); File prefsFile = new File(homedir,"AppData/Roaming/Apple Computer/iTunes/iTunesPrefs.xml"); try { NSDictionary rootDict = (NSDictionary) PropertyListParser.parse(prefsFile); NSDictionary userPrefs = (NSDictionary) rootDict.objectForKey("User Preferences"); if(userPrefs!=null) { NSData options = (NSData) userPrefs.objectForKey("Documents:132"); if(options!=null) { String base64 = options.getBase64EncodedData(); System.out.println("optionBase54Data:"+base64); String optionData = new String(Base64.decodeBase64(base64)); System.out.println("optionData:"+optionData); return true; } } } catch(Exception ex) { ex.printStackTrace(); } return false; } 

prints mostly spaces (AAAA)

optionBase54Data: AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAV09SQjQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAADUXX4fAc2UWH8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA =

plus built-in output

WORB4

and

] ~ X

An example iTunes settings file can be found here.

http://www.jthink.net/jaikoz/scratch/iTunesPrefs.xml

+7
java com itunes
source share
1 answer

I copied iTunesPrefs.xml with the on and off setting, and then compared the differences.

With its check (true)

Base64 encoding: AAIAAAAAAAEAAAAGAQAA ///// wEAAHoAAP //// 8EAEYAbABhAHQAAAAAAAAA

Hex value: 02 01 06 01 01 7a 04 46 6c 61 74

Not verified with it (false)

Base64 encoding: AAIAAAAAAAEAAAAGAQAA ///// wEAAHsAAP //// 8EAEYAbABhAHQAAAAAAAAA

Hex value: 02 01 06 01 01 7b 04 46 6c 61 74

This is contained in the Settings section: 130, how these values ​​are stored, I don’t know, maybe you can find something. Consider using the command line to look for differences in the file, diff for linux or fc for windows.

I know this is not an answer, but it does not match the comments.

0
source share

All Articles