dougscripts.com

Archive for the
‘Managing Files’ Category

August 10 '17 - 10:23 am
Refresh a Track From Its File’s Metadata

If you make changes to the file of an iTunes track in another application, iTunes doesn’t always immediately update its database with the changes until you’ve played the track or tapped its Get Info window.

This is a relatively old AppleScript command, but refresh is intended to do this. This script will compel iTunes to update the selected track entries in the database with information from the metadata of the their files:

tell application "iTunes"

set sel to selection

if sel is {} then return

repeat with aTrack in sel

if class of aTrack is file track then refresh aTrack

end repeat

end tell

August 10 '17 - 7:21 am
NEW: Show Me The Metadata

Every now and then I’ve needed to inspect the Spotlight metadata for an audio file, usually to find its UTIs or something along those lines. Many years ago I wrote about Spotlight scripting and a one-line mdls script to read this data. But as the years passed, I’d been adding features to this tool as my look-ups became more specific.

Now look what I’ve done.

Show Me The Metadata will display the audio metadata and the Spotlight metadata for either the file of a selected track in iTunes or a user-selected audio file.

The display areas are scrollable. The window and the heights of the display areas are resizable. It also includes additional features to display embedded artwork and activate the Finder’s Information Window for the file. You won’t use this a lot, but it’ll be handy when you need it.

Show Me The Metadata is for macOS 10.10 and later and is free to use with a donation nag. More information and download is on this page.

August 9 '17 - 7:03 pm
Show Information Window for a Track’s File

Occasionally it might be convenient to see the Finder’s Information WIndow for a track’s file. At any rate, it will be more convenient to do so using this script:

tell application "iTunes"

set sel to selection

if length of sel is not 1 then return

set theTrack to item 1 of sel

if class of theTrack is not file track then return

set loc to (get theTrack's location)

if loc is missing value then return

end tell

tell application "Finder"

activate

open information window of loc

end tell

Click the script icon to open this in the Script Editor.app on your machine. Save it named whatever you like as a “Script” in your ~Library/iTunes/Scripts/ folder so it will appear in iTunes’ Script menu. Select a track (that has a local file), launch the script and the Finder will respond to you.

July 1 '17 - 3:01 pm
NEW: Find Empty iTunes Media Folders


A tweet is worth…well, I guess only 140 characters. But a picture of a tweet should be worth more, right?

Anyway, this tweet from a Correspondent reminded me about something I’ve been aiming to do for a while and that’s find the folders in the iTunes Media folder that 1) are empty and that iTunes wouldn’t or couldn’t delete and 2) find the folders that are virtually empty except for any files that aren’t compatible with iTunes.

Typically, if you allow iTunes to manage the iTunes Media folder, iTunes will remove “Artist” and “Album” folders when it happens that they become empty by virtue of deleting tracks and their files in the app. But, if you manage the iTunes Media folder yourself (or some other folder/s that store your media files) and delete tracks and files, I’m not so sure iTunes will delete the empties. Or, if, like the author of the tweet, you’ve placed files alongside your media that iTunes doesn’t recognize—set lists or liner notes as text files, album art as “folder.jpg” or “cover.jpg” files, and so on—then iTunes won’t delete these folders either. My guess is that if you’ve Trashed the media files, you probably don’t need the associated bric-a-brac anymore and these folders could be disposed of.

Short of going through the entire iTunes Media folder using your fingers and eyeballs, Find Empty iTunes Media Folders will quickly traverse the iTunes Media folder looking for empty folders and folders that only contain files that iTunes doesn’t recognize.

I wish I had taken a screenshot of the folders it found before I really started testing the delete feature. I originally had about thirty folders either empty or containing potential jetsam.

Find Empty iTunes Media Folders can be downloaded and used in Demo Mode for free. In Demo Mode, several features will be disabled, which include:

  • Show Finder Information Window
  • Reveal in Finder
  • Send to Trash
  • Select all Empty/non-Empty
  • Only Scan for Empty Folders
  • Scan other user-selected folder

If you like and use the app, you can purchase a registration code for $1.99 that will remove the Demo Mode restrictions and enable the features listed above. You can get more information and download it from this page.

May 19 '17 - 12:14 pm
UPDATED: Convert and Replace v2.4

Convert and Replace v2.4 will convert the files of the selected tracks using an iTunes encoder chosen on-the-fly (each encoder’s current Preferences-set options will be in effect) and replace the original tracks throughout the playlists of your entire library with the newly converted versions. Additionally, you can opt to Trash/delete or keep the original files and tracks.

This latest version will stay running and not quit after conversion (registered version), monitors changes to the selection of tracks and removes the ability to select a playlist of tracks.

Interestingly, a Correspondent inquired if the script could be modified to accommodate two conversions. Here’s why: he wanted to convert 24 bit depth/48 kHz audio files (downloaded from Bandcamp) to Apple Lossless. But Apple Lossless conversion retains the original bit depth and sample rate, defeating the purpose (to some extent) of converting to a smaller file format. So he uses the script to convert these files to 16 bit/44.1 kHz AIFF files first and then again to convert them to ALAC.

Performing two conversions back-to-back automatically with different encoders would be a bit of a stretch for the script. So, as a compromise, I have let it stay open after conversion (at least for registered users) so that the original set of tracks remains the Source if a second conversion of them is required.

A registration code for Convert and Replace is $1.99 and it’s free to demo for ten days; it’s a free upgrade for current users. It can be downloaded from this page.

April 24 '17 - 11:51 am
UPDATED: Drop A Few My Way v4.0

It’s been five years since I last updated Drop A Few My Way which is now at version 4.0. This script is a droplet that converts audio files dropped on it using an iTunes encoder selected on-the-fly and saves the converted files to a user-selected location or adjacent to the source file. The tracks created during the process are removed from iTunes. I keep it in the Toolbar of my Finder windows for quick access when I just need to quickly convert a file or three without having to add it to iTunes and later clean out the detritus.

This latest version of Drop A Few My Way is a general update for macOS 10.10 and later and is free to use with a donation requested.

November 27 '16 - 6:51 am
NEW: Display File Path

Essentially—and some might argue for either better or worse—iTunes is a file manager.
In fact, I usually will tell people to just forget about the files. Let iTunes deal with them. Most people will never need to examine the files inside the iTunes Media folder.

OTOH, I do all kinds of twisted things to tags and metadata and I often need to know how that may have affected the location of a file. Or sometimes I’ll need to know if a file is where I think it is or is still named what I thought it was.

This information isn’t handily available (although some Smarties will copy the file path to the Comments tag so it is viewable in the Comments column in the browser window). You can reveal a track’s file using iTunes’ “Show in Finder” command or see its file path in the Info window’s File tab, but this uses up valuable finger time. And the Info window is modal; you can’t run scripts when it’s visible.

So I made this simple stay-open applet that will monitor iTunes and display the file path of the single selected track.

The window is resizeable horizontally and the text is scrollable.

The Display File Path window will float alongside iTunes and whenever a single track is selected—and its file is accessible—the file’s path will be displayed. The displayed file path can be copied as text to the clipboard and the file can be selected in the Finder. There’s also an option to show the file paths of each playing track instead of the single selected track.

Obviously, it’s only useful for occasional special jobs but I’ve been finding it handy when the need has arisen. It’s free to download and use with a donation nag and is available here.

November 14 '15 - 7:07 pm
UPDATED: Music Folder Files Not Added v5.2

I think I finally licked a text encoding problem with Music Folder Files Not Added in this latest version.

Music Folder Files Not Added will list the file paths of the files in your designated “iTunes Media” folder which are not in iTunes’ track library. Additionally, you can select a different parent folder and its contents will be compared to the iTunes library. The files listed in this screenshot are located in my “iTunes Media” folder but have no associated track entry in iTunes:

Includes options to Filter results, Add a selection of found files to iTunes (Mobile Applications can not be added this way), move them to the Trash, and Export a text file listing the file paths.

Several users had been reporting issues with text encodings (especially with Greek, German and Cyrillic text, but others also) and this version addresses this problem.

More information and download is here.

July 20 '15 - 2:22 pm
UPDATED: Music Folder Files Not Added v5.0

Music Folder Files Not Added v5.0 will list the file paths of the files in your designated “iTunes Media” folder which are not in iTunes’ track library.

The files listed in this screenshot are in my iTunes Media/Music/ folder but are not in the iTunes track library. In my case, this iTunes Media folder is used by two different iTunes installations on different partitions, so it is also possible that these files are added as track entries in the iTunes on the other partition. However, it is not uncommon to delete the tracks from iTunes without choosing to Trash the files.

Additionally, you can select a different parent folder and its contents will be compared to the iTunes library. Includes options to Filter results, Add a selection of found files to iTunes (Mobile Applications can not be added this way), move them to the Trash, and Export a text file listing the file paths.

This latest version includes PDF, Mobile Application, iTunes LP and iTunes Extra files when used with iTunes 12.2 or later; adds a Filter option to show only file paths containing entered text; has general performance tweaks.

Music Folder Files Not Added is free to try for 10 days and is $1.99 thereafter. More information and download is on this page.

July 1 '15 - 11:07 am
UPDATED: Music Folder Files Not Added v4.5

Music Folder Files Not Added will list the file paths of the files in your designated “iTunes Media” folder which are not in iTunes’ track library. Additionally, you can select a different parent folder and its contents will be compared to the iTunes library. Includes options to Add a selection of found files to iTunes, move them to the Trash, and export a text file listing the file paths.

This latest version accommodates some changes in iTunes 12.2 and provides preliminary support for OS X 10.11 (El Capitan) beta.

Music Folder Files Not Added is free to try for 10 days, $1.99 thereafter. This is a free update for registered users.

More information and download is on this page.

Site contents © 2001 - 2017 (that's right: 2001) Doug Adams and weblished by Doug Adams. Contact support AT dougscripts DOT com. About.
All rights reserved. Legal.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no direct affiliation with Apple, Inc.
One who says "it cannot be done" should not interrupt one doing it.