So I’m currently recreating DougScript’s “Drop Folders to Make Playlists” script.
Adapting it so that it will also in iTunes create parent folders and move playlists and sub playlist folders to their parent folder… based on what is in the finder.
Doug’s script has an option to name playlist based on their parent folder by Prefixing the parent folder name. I’m adapting mine so if the parent folder has the suffix “PREFIX” then it will prefix that to the playlist name, and also create and move the playlists to that folder in iTunes.
I will share the full script when i’m done.
As I’ve been working on it, like you, I suffer the frustration of possibly adding another duplicate file to iTunes, I’ve figure out how to approach this. In my script I want to present an alert to the user about possibly importing a duplicate and choose to:
- not import the file
- not import and use a selected duplicate in the playlist instead
- import both the new file and also add the selected duplicates to the playlist
- also add the option to add to the Comments TAG “DUPE”
So the main thing that is needed to check for dupes is TAG info from the files.
You can’t get this from iTunes because it hasn’t import the file yet. So I discovered that
Shane’s BridgePlus has the method
Method
spotlightDataFor:
https://macosxautomation.com/applescript/apps/BridgePlus_Manual/Pages/spotlightDataFor_.html
use scripting additions
use framework "Foundation"
use script "BridgePlus"
load framework
set theResult to current application's SMSForder's spotlightDataFor:aFile
here is theResult on a m4a audio file
aRecord is:, (NSDictionary) {kMDItemMediaTypes:{"Sound"}, kMDItemAudioSampleRate:44100, kMDItemFSContentChangeDate:(NSDate) "2021-11-05 08:28:46 +0000", kMDItemAudioChannelCount:2, kMDItemTotalBitRate:511999, kMDItemAudioBitRate:511999, kMDItemFSTypeCode:0, kMDItemDisplayName:"Walk The Walk", kMDItemFSLabel:0, kMDItemFSIsExtensionHidden:NO, kMDItemAuthors:{"Gaz Coombes"}, kMDItemContentCreationDate:(NSDate) "2021-11-05 08:28:36 +0000", kMDItemContentTypeTree:{"com.apple.m4a-audio", "public.mpeg-4-audio", "public.audio", "public.audiovisual-content", "public.data", "public.item", "public.content"}, kMDItemAudioEncodingApplication:"fdkaac 0.6.3, libfdk-aac 4.0.0, CBR 512kbps", kMDItemFSFinderFlags:0, kMDItemAlternateNames:{"/Volumes/Panko/Music to Install/Soulseek Downloads/Complete Converted/m4a/2021 11 New Music/2021 1103 All/2021 1022 Rediscover/Gaz Coombes - 03 - Walk The Walk.m4a"}, kMDItemDurationSeconds:236.213333333333, kMDItemFSSize:15469911, kMDItemFSName:"Gaz Coombes - 03 - Walk The Walk.m4a", kMDItemAudioTrackNumber:3, kMDItemRecordingYear:2018, kMDItemDateAdded:(NSDate) "2021-11-05 08:28:36 +0000", kMDItemFSCreationDate:(NSDate) "2021-11-05 08:28:36 +0000", kMDItemPhysicalSize:15470592, kMDItemFSCreatorCode:0, kMDItemFSInvisible:NO, kMDItemKind:"Apple MPEG-4 audio", kMDItemFSOwnerUserID:89, kMDItemContentModificationDate:(NSDate) "2021-11-05 08:28:46 +0000", kMDItemTitle:"Walk The Walk", kMDItemAlbum:"World's Strongest Man", kMDItemContentType:"com.apple.m4a-audio", kMDItemLogicalSize:15469911, kMDItemFSOwnerGroupID:89}
The main keys main be interested in are:
(note: authors returns a list/array so you have to as for firstObject()
kMDItemTitle
kMDItemAuthors
kMDItemAlbum
kMDItemDurationSeconds
kMDItemTotalBitRate
once you have that basic info from the file.
You can then search iTunes for matching dupe files.
And go from there