Apple Intelligence is now available on iPhone, iPad, and Mac!

Trying to replace a song with a better version of all playlists. Help on deduper by turingtest2 pt. 2

I had been working with deduper (Great Script!) by turingtest2 to edit and clean up my my iTunes library a couple of years ago. I was able to get things working and had a lot of success, but then life got complicated and I had to work on other projects for the past year and a half.

I have finally found time to return to my iTunes project and I recently noticed I had the wrong version of "Show Me the Way" by Peter Frampton on a bunch of playlists and thought I would use this script to replace the wrong version with the correct one.


Unfortunately, despite re-reading my own thread found here: Looking for help on deduper by turingtest… - Apple Community, and trying to figure out things on my own, I still cannot figure out why both versions are not showing up as a duplicate.


The two songs are named:

Show Me the Way (Live 1975)

Show Me the Way


The Artist is the same on both; however, they are in different albums and they are of different lengths of time. I am enabling "Ignore Brackets," which I thought would eliminate the bracketed information when matching, and I also tried to change the album name so they were both on the same album, but still I had no match. Maybe it has to do with the length?


I believe these hurdles had be cleared with some tweaks of the script, and maybe I am forgetting where to make them. I thought I had written notes on this script but, unfortunately, I cannot find them presently. Perhaps I never wrote them, because I am pretty organized, but alas, they do not exist.


I then changed the name of the track and the album to be the same but they were still not coming back as duplicates, so I think it may have to do with the length of the track, but my reading of my previous thread indicates otherwise, so now I am really lost!


If I could get some help figuring this out it would be greatly appreciated as I have a I have a lot of playlists and sometimes I have to replace a song an 8 or more playlists, so it can become extremely tedious.

Windows

Posted on Sep 11, 2024 7:46 AM

Reply
10 replies

Sep 12, 2024 9:44 AM in response to esumsea

Hi there,


Somewhat busy at work right now but I've spotted the thread which is a start. I don't have time to review the original thread at the moment but presumably I created a custom flag to ignore brackets in song titles. In general deduper is looking for tracks that have the same name, track #, disk #, album name, and artist/album artist. I could potentially add some more flags to ignore mismatches in some of those properties, but that does increase the risk of unwanted matches. That said with the script running in two phases, one that unchecks dupes, and another that actually removes them, there is a chance to stop and review things before going too far.


As before if you could give me one or two specific examples of pairs of songs you want to consider as duplicates, with all of the aforementioned properties so I can see which ones should be ignored, then I can see how to best modify the script to achieve that.


tt2

Sep 13, 2024 8:16 AM in response to turingtest2

Hello again!


No worries on timing. I can be patient. I could quite possibly be remembering things incorrectly, but I thought we had created a solution that avoided having to have the same track, album and even time because my goal back then was to have one copy of the song, whether it came from the original album or a greatest hits, and sometimes the cut on the

greatest hits would be 3-5 seconds longer/shorter than the original. So while I did use deduper to get rid of exact duplicates, I was also using it, perhaps more so, for replacing versions/masterings of songs in playlists with a better

version. Since I have any playlists, this saved me a bunch of work, making things that perhaps would not be feasible time-wise into reality.

Again, perhaps I not remembering correctly, but I remember a step where the duplicates would be found and then being able to check and uncheck items to signal which tracks to keep in playlists and which to remove. I do a lot of complicated stuff in different programs and I almost always write notes to remember but it does not seem that I did so this time, possibly because I thought I could reference back to the treads. I do remember have 2 separate threads on deduper due to this forum's approach of archiving old threads and forcing users to create new ones.  Unfortunately, only one thread shows up in my search and even when checking my profile I can only see 3 of the 14 threads I have started, so I guess I will copy the threads from now on for reference.  I am sorry about this.

Basically what I looking to do is this:

“After using Deduper and realizing all the options within the script itself, I can't help but wonder how difficult it would be to add the option of having the script disregard Track number, Album, Time as matching characteristics. If these could be set to true or false then the potency of the script would increase dramatically and one could use it to remove all sorts of duplicates, including all the varieties I was trying to eliminate. It would also eliminate all the work of having to rename the album, disk and track numbers when you want to remove a duplicate that exists on another album.” (Looking for help on deduper by turingtest… - Apple Community)

“… I think this can be thought of as adding criteria to the duplicate search.  By doing this you can make your script find any type of duplicate.

The script should ask: Do you want a duplicate to be considered a duplicate if X set of factors are satisfied: be it Title and Artist (Can track duplicates across Albums, compilations, anthologies) ; Just Title (Maybe you just want one version of a song); Title, Artist & Album (What the script currently does); Time & Title (Track Duplicates across albums, comps, anthologies even if artist name is inconsistent which can happen with different spellings or different ways to list or not list feat. artists); Title and Album (In case Artist is not consistent), Album Artist (In case the Artist is not consistent or one uses Album Artists as Artist to keep songs unified in consolidated iTunes folders under one artist rather than under VA or

Various Artists.

So, if you thought of it as stating True or False to having the following criterion be equal to be considered duplicate:  Title, Artist, Album Artist, Album, & Time.  This is similar to what you did with the disc number (smart tweak).

Artist=False              Artist must match for songs to be duplicates (Here the artist wouldn't have to match)

Album Artist=False   Album Artist must match for songs to be duplicates (Here the artist wouldn't have to match)

Album=True              Album must match for songs to be duplicates (Here the Album would have to match)

Title=True                  Title must be equal for songs to be duplicates (Here the Title would have to match)


Why Title!? Some songs are mis-named: EX: Rollings Stones' Satisfaction AKA I Can't Get No Satisfaction AKA (I Can't Get No) Satisfaction. This would catch songs that are not consistently named.

I assume the lines of the script would be similar for all of the above factors (but what do I know?) Then you could add the options for time (within how many seconds, with 0 being exactly the same), or match a specific length of title (first X characters of title, with 0 being the whole title) for the two songs to be considered duplicates. I assume the later two are more difficult but could be conceptualized as:

Time=2             Time must be within X seconds (+/-) of another song to be considered a duplicate.

Title=True         Title must be equal for songs to be considered duplicates

If true, Length=0    Title must match the first X of title, if 0 the whole title must match


There are other variables you could add, like Track, but I cannot see how that would be useful.” Feb 2, 2022 8:52 AM in response to esumsea

Sep 13, 2024 8:19 AM in response to esumsea

We also worked a solution that would ignore suffixes because sometimes you want to replace Ripple (1969 mix) with Ripple (1971 mix) in a playlist.  I think that this is accomplished by enabling and disabling “Ignore Backets” on the script.

To that end you had written on Feb 2, 2022 2:21 PM :

 “We're still only dealing with identically named songs so far but you also mentioned you might have tracks such as:

Jack-A-Roe (05/28/1979)

Jack-A-Roe (08/28/1980)


Rather than comparing a fixed number of characters perhaps compare the title with anything after " (" removed? That way alternate versions of Jack-A-Roe get whittled down to one active version. This facility could be turned on or off with another flag.”


Please let me know if you need more specifics.  I am happy to assist in anyway to get this going.  Frankly, I think most of the work was done already, and I may be forgetting how to use the script.  I did try to figure it out but was having trouble, which is why I came here.  I promise to write complete notes next time so this does not happen again.  Thank you so much for being willing to work on this!!!!!

To try to save some of your time here are the most helpful posts to read from our last thread, 2 of which are quoted above:

Jan 12, 2022 6:43 AM in response to turingtest2

Jan 28, 2022 3:32 PM in response to esumsea

Jan 28, 2022 4:13 PM in response to turingtest2

*Feb 2, 2022 8:52 AM in response to esumsea

Feb 2, 2022 2:21 PM in response to esumsea

Feb 8, 2022 9:14 AM in response to turingtest2

*Feb 8, 2022 10:08 AM in response to esumsea

Sep 23, 2024 6:16 AM in response to esumsea

Hi,


Thanks for your patience. I've had a chance to immerse myself in the code today are refresh my memory. I've also had a recent request to account for potential trailing spaces in track names. With that in mind I've implemented some code that eliminates repeated spaces and trims leading or trailing spaces when reading the album, artist, and name values that it compares with other tracks in the list. I've updated the feature for ignoring brackets to work with both regular and square brackets, and it now removes the brackets from the title rather than just truncating at that point, so "(This) Song" can match with "Song [Also]". Another new feature lets you match on the first n characters. The flags that affect these options are:


  • SameSongs - True if you want to match song & artist only
  • IgnoreBraces - True if you want to ignore brackets when comparing song names
  • MaxChars - Greater than 0 if you want to match song names on the first n characters


Hopefully these changes will help you with your task.


In your second post you wrote:

Why Title!? Some songs are mis-named: EX: Rollings Stones' Satisfaction AKA I Can't Get No Satisfaction AKA (I Can't Get No) Satisfaction. This would catch songs that are not consistently named.


Sadly there is no audio fingerprint information to draw on so we are left with making text matches with combinations of the available fields. These are going to work best when there is at least a certain degree of consistency throughout the library. With the new version "Satisfaction" should be able to match with "(I Can't Get No) Satisfaction", as long they have the same data in the artist field. If you've also variously called this band "The Rolling Stones" and "Rolling Stones" then either that needs cleaning up in your library first or I could add another option for ignoring leading articles (a/an/the) in artist names.


tt2

Oct 17, 2024 12:23 PM in response to esumsea

Just replying to keep this thread alive. Unfortunately I have not been able to try this but hope to this weekend. I am really sorry after all your effort, but unfortunately a confluence of unforeseen circumstances have successively descended upon me. :(


Actually, I tried to squeeze in some time now and I could not download the script. I tried another script and it downloaded so I think it only has to do with this particular script. Let me know when I can download it to give the script a try.

Trying to replace a song with a better version of all playlists. Help on deduper by turingtest2 pt. 2

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.