Jump to content

iTunes interfacing: Identifying duplicate tracks


Recommended Posts

Here's what I've written (after already getting some good help and a lot of work)

It's meant to search for duplicate songs in iTunes. I've put in comments everywhere to explain

#include <array.au3>
$iTunesApp = ObjCreate("iTunes.Application")
Dim $aSelTracksName[1]
Dim $aSelTracksArtist[1]
For $track in $iTunesApp.SelectedTracks
    _ArrayAdd($aSelTracksName,$track.Name);Adds name to array
    $aSelTracksName[0] = Ubound($aSelTracksName);Measures number of songs added so far including itself
    _ArrayAdd($aSelTracksArtist,$track.Artist);Adds artist to array
Next
_ArrayDisplay($aSelTracksName,"Selected Tracks Names")

$n = $aSelTracksName[0] - 1;n = number of parts to array - the counting part
Do
    SplashTextOn("Duplicates",$n)
    $a = $aSelTracksName[$n];Last songs name
    $b = $aSelTracksName[$n - 1];songs name above last song
    $c = $aSelTracksArtist[$n];Last songs artist
    $d = $aSelTracksArtist[$n - 1];songs artist above last song
    If $a = $b Then;if the names are the same
        If $c = $d Then;if the artists are the same
            For $track in $iTunesApp.SelectedTracks;go through tracks
                If $track.Name = $a Then;if name is the one identified
                    If $track.Artist = $c Then ;if artist is the one identified
                        $track.Comment = "[D]";then set the comment to [D] which can later be searched for
                    EndIf
                EndIf
            Next
        EndIf
    EndIf
    $n = $n - 1;change n so that next time the pair checked "moves up one"
    SplashOff()
Until $n = 0;stop when it's gone thorugh all tracks



;It's meant to set the comment of songs that are duplicates to [D]
;Need to add that afterwards it automatically does a search on the [D]'s in iTunes and therefore shows all duplicates
;Would be nice if songs were automatically put into alphabetical order
;Perpaps an Array with, say, 4000 parts is too big for AutoIt? Or at least makes the script slower?
;Are sleeps needed?

You can see above some comments and questions.

It sorta works but only "marks" some of the tracks or goes berzerk and starts marking everything.

Please can you maybe test it, and/or look through it and let me know how I can fix/improve it. Editing and posting it for me would be just awesome...

Thanks in advance

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...