I recorded a video of the iTunes DSM in action. I'm planning on posting it to YouTube to show how to use the program. In my testing, the program seems to be solid and ready for use.
I did use iTunes DSM on my own personal library finally and am pleased with the result. It's also convenient in that you can use the program on the other computers in the house and fix the orphaned files in the iTunes databases!
When I post the YouTube video I'll post it on here as well. I am still trying to figure out if I can host the program here on blogspot. I haven't really seen a way to do it yet.
Brian
Monday, September 28, 2009
Sunday, September 27, 2009
iTunes functionality in place.....for Windows
Using the previously mentioned components that I added, iTunes Duplicate Song Manager, can now locate orphaned files (those that have exclamation marks next to the song in iTunes) and remove those tracks. You can see the option added just above the clean music folder button.The user can also just run the program and just clean the orphaned files, without having to scan for duplicates, so that's nice. The program also makes sure that the host operating system is Windows based, if not, the orphan file option is greyed out.
Finally, I've added a couple more links under the help menu.
I'm still wanting to add the orphaned files remove option to Mac but not really sure how to go about AppleScripts, so I'm sure that will be later. The program itself was having trouble running in Mac under java and I wasn't sure why at first. The SwingWorker package wasn't being found, turns out that Mac Leopard was using JRE 1.5 instead of the required 1.6, so if anyone else has problems using SwingWorker in OS X look for the Java Preferences application in Finder and edit the options in there.
In other news, my research paper is 4000 words, so that's nice too. Hope everyone had a good weekend.
Brian
Friday, September 25, 2009
iTunes functionality on the way
I know I haven't posted the project yet for download, and that's because I've been messing around with JACOB, Jacobgen, and the iTunes' COM. JACOB provides a way for the java virtual machine to interact with COM objects. This isn't really a java thing and so adding this functionality via JACBO brings java up to the likes of other development environments. You can find the JACOB project here...
http://sourceforge.net/projects/jacob-project/
it works for both windows 32 and 64 bit environments which is cool. Also on the sourceforge project page is jacobgen, which automatically creates .java files for the COM objects. So everything that the iTunes com offers, jacobgen will create java files with the corresponding methods to interact with it. Very Cool!!! I had some trouble getting it to work for a long time. There is an example batch file included in jacobgen that I had to edit.
Here is the batch file code I used to run jacobgen...
To use the batch file. Open a command prompt and change directories until you get to the jacobgen directory. Place the batch file in the root jacobgen directory. Copy and paste the last line minus the letters REM into the command line and press enter. Jacobgen will place the created java files in the destdir. The main difference between my batch file and the example one is I use the java command.
Of course in the end, I didn't use the generated code. There is no documentation created with it obviously, and all kinds of errors were thrown in Netbeans. Instead, I downloaded this package http://dot-totally.co.uk/software/itunescon/ and in conjunction with JACOB, I can now control iTunes. I already have my program identifying the audio file in the iTunes library that correspond to the duplicate files found when searching for files with iteration counts appended to the end, so in conjunction with deleting the actual files, I should now be able to remove them from the iTunes library.
My next idea is since I share music throughout my home network, deleting files from the folder from one computer's library will not be reflected in other iTunes libraries until a user tries to play a song that is removed and therefore orphaned. In essence I'm going to try to add an option that will locate orphaned files, even if they are not apparent to the user.
http://sourceforge.net/projects/jacob-project/
it works for both windows 32 and 64 bit environments which is cool. Also on the sourceforge project page is jacobgen, which automatically creates .java files for the COM objects. So everything that the iTunes com offers, jacobgen will create java files with the corresponding methods to interact with it. Very Cool!!! I had some trouble getting it to work for a long time. There is an example batch file included in jacobgen that I had to edit.
Here is the batch file code I used to run jacobgen...
@echo off
cls
REM run this from the root directory of the Jacobgen project
REM it will spit out the interface classes for a dll you pass in as a parameter
REM sample command line while sitting in the JACOBGEN project directory
REM
REM The following command built a sample in the jacob directory I have
REM installed near my jacobgen project directory.
REM $ docs/run_jacobgen.bat -destdir:"..\jacob\samples" -listfile:"jacobgenlog.txt" -package:com.jacobgen.microsoft.msword "C:\Program Files\Microsoft Office\OFFICE11\MSWORD.OLB"
REM
REM
set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_16
set JRE=%JAVA_HOME%\bin
set JACOBGEN_HOME=.
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\dt.jar;%JACOBGEN_HOME%\jacobgen.jar;%JACOBGEN_HOME%\lib\viztool.jar
REM put the dll in the path where we can find it
set PATH=%PATH%;%JACOBGEN_HOME%\AMD64\
@echo on
echo %1
echo %2
echo %3
echo %4
echo %5
rem %JRE% -Xint com.jacob.jacobgen.Jacobgen %1 %2 %3 %4 %5
java -Xint com.jacob.jacobgen.Jacobgen %1 %2 %3 %4 %5
pause
REM run.bat -destdir:"c:\jacob\itunes" -listfile:"jacobgenlog.txt" -package:com.apple.itunes "C:\Program Files (x86)\itunes\itunes.exe"
To use the batch file. Open a command prompt and change directories until you get to the jacobgen directory. Place the batch file in the root jacobgen directory. Copy and paste the last line minus the letters REM into the command line and press enter. Jacobgen will place the created java files in the destdir. The main difference between my batch file and the example one is I use the java command.
Of course in the end, I didn't use the generated code. There is no documentation created with it obviously, and all kinds of errors were thrown in Netbeans. Instead, I downloaded this package http://dot-totally.co.uk/software/itunescon/ and in conjunction with JACOB, I can now control iTunes. I already have my program identifying the audio file in the iTunes library that correspond to the duplicate files found when searching for files with iteration counts appended to the end, so in conjunction with deleting the actual files, I should now be able to remove them from the iTunes library.
My next idea is since I share music throughout my home network, deleting files from the folder from one computer's library will not be reflected in other iTunes libraries until a user tries to play a song that is removed and therefore orphaned. In essence I'm going to try to add an option that will locate orphaned files, even if they are not apparent to the user.
Tuesday, September 22, 2009
iTunes 9 and an Algorithm Update
I've been using iTunes 9 since it came out and recently I've been trying to get it to create duplicates like the previous versions did. It seems at least that iTunes is much smarter about songs that are already in your library and basically seem to stop duplicates from happening; however, I did find that songs you place in the "Automatically add to iTunes" folder will create duplicates if the song is already present. I'm not sure if that is by design or not, but in the end iTunes seems to be better at preventing duplicates from occurring.
What about duplicates that were already present?
iTunes doesn't do anything for those, it still treats previous duplicates as seperate songs and so are added to the library. So for me, the 220 or so actual duplicate songs that were already in my library are still there.
I also made an obvious change to the search algorithm. The algorithm used to scan every file in all the folders of a parent directory adding each one to an ArrayList, then duplicates would be found by comparing each file to every single file in the list. This was a long process and required a lot of computer resources. Instead, the algorithm still scans each directory under a parent directory, but gets the list of files only in one folder compares those files for duplicates, and then moves on to the next folder and checks that one folder for duplicates. This has the advantage of finding duplicates as the folders are searched rather than reading every directory first and then comparing every single file to each other. This works because as iTunes keeps folders organized, there is no way that duplicate song will end up anywhere but in the same folder as the original.
I'm still planning on releasing the program here real soon. I have decided that it will be free. I have placed a button for donations on the program and on this blog, if you are feeling generous, I could use a cup of coffee every now and then! I will also post a video on youtube on how to use the program. I'm hoping to do this this week.
Brian
What about duplicates that were already present?
iTunes doesn't do anything for those, it still treats previous duplicates as seperate songs and so are added to the library. So for me, the 220 or so actual duplicate songs that were already in my library are still there.
I also made an obvious change to the search algorithm. The algorithm used to scan every file in all the folders of a parent directory adding each one to an ArrayList, then duplicates would be found by comparing each file to every single file in the list. This was a long process and required a lot of computer resources. Instead, the algorithm still scans each directory under a parent directory, but gets the list of files only in one folder compares those files for duplicates, and then moves on to the next folder and checks that one folder for duplicates. This has the advantage of finding duplicates as the folders are searched rather than reading every directory first and then comparing every single file to each other. This works because as iTunes keeps folders organized, there is no way that duplicate song will end up anywhere but in the same folder as the original.
I'm still planning on releasing the program here real soon. I have decided that it will be free. I have placed a button for donations on the program and on this blog, if you are feeling generous, I could use a cup of coffee every now and then! I will also post a video on youtube on how to use the program. I'm hoping to do this this week.
Brian
Sunday, September 20, 2009
Bug fixing

I've been updating the program more this weekend. There were a few sizable bugs I found. One of the major ones occurred when the user didn't select every song to be cleaned, rather a few of the songs. Instead of deleting the selected songs, the program would delete the number of selected songs starting from the top of the list. For example, if I picked three songs sprinkled throughout the list, the program would delete three songs starting from the top. In the end it was a minor fix and that portion is working correctly.
I've come across the Swing Worker class in Java. Swing Worker provides a way to utilize threads in the background so that the main gui thread is not bogged down with operations not directly related to the gui. In essence, the program appears to run much faster and smoother. Also a part of the Swing Worker class, the user can now cancel functions and more easily restart searches.
I have also tweaked the algorithm that finds duplicate songs. I still have artist, title, and album matching turned off as it greatly increases the computations. The program does still search filenames that end in iterations though.
Warning messages now appear if selections haven't been made and there are a couple title menu options as well namely, exit and about.
I have named this version currently version .1. I'm not really sure to version conventions, though I know v1, v2, etc are full released versions and everything in between usually refer to minor releases or bug fixes. Basically, I picked an arbitrary number and went from there.
I included a few screenshots, notice the cancel button and the title menus.
What's Next?
I'm looking into logging, to keep a record of what happens. Also a major convience to the program would be to not only remove the file itself but also remove the song from the itunes library, but that's a ways off, as communicating through com's in windows isn't really java's thing. As of now, to the have the library updated, the user has to delete the songs from the library(not from the hard drive) and then reimport the songs, so that iTunes knows exactly what is in the folders. That's all to come and until then...toodles.
Brian
Wednesday, September 16, 2009
GUI Update Again

Had some time to work on the iTunes duplicate song manager program today "betwixt" the paper and other homework. It is now much easier to actually see that the program is doing something while its processing in the background. The screenshot above shows the added progress bar and the current file or directory the program is scanning. Still not quite ready for an alpha release or anything but it's getting there.
Brian
Tuesday, September 15, 2009
GUI update




I've been working frantically on the program the last two days because I have to start writing the paper here soon and I felt I needed a working program in order to start on the paper. Enjoy!
It's important to note that while I have the functionality built into it, I have it disabled at the time, but the program identifies duplicates by filename only. If you want to be sure that a song's and duplicate's title, artist, album, etc are the same, for now it must be checked by hand. Also the eagle-eyed of you may notice some missing icons on the file dialog box, this appears to be a bug with Java and Windows 7 as it occurs in netbeans and other java projects I've worked on.
I'm planning on releasing this for free. I might add a paypal donation thingy, but I'm not really worried about it at the time. Look for more updates later.
Brian
Subscribe to:
Posts (Atom)
