dougscripts.com

Managing Files

November 14 2018 - 2:13 pm

Re-Ripping FYI

Those of us who may still rip/re-rip a CD or two in iTunes from time to time may see this dialog:

I heard from a user today who wanted to replace a bunch of MP3s with new Apple Lossless copies. But he was afraid that selecting to "Replace Existing" would erase the tags he had meticulously created for the original MP3s.

iTunes uses the Song Name, Artist and Album of each CD track and looks for a track in the iTunes library with tags that match. If a match is found, then you will see the dialog above. And then if you select to "Replace Existing", you are essentially replacing the file and not the track entry itself; that is, the newly ripped-CD track's file replaces the original MP3 file pointed to by the track entry and the other track entry data remains the same (except for obvious changes due to the change of file, like size and file kind and so on).

If one or more of the Song Name, Artist and Album is different then you won't be asked to replace any tracks and the CD tracks will be imported as "new" tracks, perhaps as duplicates.

Rather than allow iTunes to make these decisions, here's a trick. Before importing, copy some tag data from the original tracks in the library to the corresponding CD tracks using Copy Tag Info Tracks to Tracks.

You probably only need to copy Song Name, Artist and Album. But any additional tags wouldn't hurt either.

(Also, see this article at the German site unhyped.de which describes the technique as well.)

Then, when you import the CD, you'll probably now see the "already been imported" dialog from whence you can select "Replace Existing" to correctly replace the original files and keep the existing track entry data.

January 5 2018 - 11:01 am

Exporting Voice Memos

A Correspondent asked how to deal with Voice Memos when the Voice Memo track in iTunes is named using the text that was entered after recording it and its associated file is named using a date and time format. Specifically, he wanted to offload and archive some of the recordings but was concerned that the filenames were not sufficient to describe the contents of the file. Could the track name be transferred to the filename?

The script File Renamer is ostensibly for renaming a track's file in-place. But it can also be used to rename a copy of a file which can be saved to a user-chosen folder.

In this case, the Voice Memos have already been sync'd to iTunes from the iPhone. I've selected a single Voice Memo track in the screenshot, but batches are acceptable as well.

I originally named the Voice Memo "New Recording 3". But the filename of the selected track is something like "20180105 060425.m4a", indicating that I recorded it on January 5, 2018 a little after 6AM. File Renamer will create a copy of the file and name it "Voice Memo - New Recording 3.m4a" using the genre and name tags of the track, as well as some additional separator text. The original file remains unaffected.

BTW: I wasn't able to find a specific Voice Memos playlist in iTunes. (Was there ever one? I'm not a Voice Memos Guy.) So I created my own with a Smart Playlist matching all media where Media Kind is Voice Memo.

For more sophisticated offloading options, you may also want to try M3Unify.

August 31 2017 - 8:41 am

Dropbox Dropping Support for Older OSs Soon

I just got an email from Dropbox letting me know that as of November 3, new installations of Dropbox will be no longer be possible on macOS 10.6 (Snow Leopard), 10.7 (Lion) and 10.8 (Mountain Lion) and Windows Vista. Then, on January 17, 2018, support for these OSs will be discontinued entirely. There is more here at Dropbox's site.

I know some iTunes users like to store their libraries in Dropbox (which I don't think is a great idea, but there it is) so if you've got media files on an older machine using Dropbox you may want to move that stuff out of there.

August 10 2017 - 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 2017 - 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 2017 - 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 2017 - 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 2017 - 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 2017 - 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 2016 - 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.

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