dougscripts.com

February 5 2014 - 10:30 am

NEW: Export Files From Playlists

Export Files From Playlists—playlists, plural—will export copies of the files of the tracks in a selection of playlists to a single user-selected folder.

More information and download is here.

February 4 2014 - 7:44 am

UPDATED: This Tag That Tag v3.4

This Tag That Tag v3.4 will assist with swapping, copying, and appending data between two user-chosen tags in selected tracks or tracks in the selected playlist:

Swap - swap data between tags, ex: ARTIST<->COMPOSER
Copy - copy data from one to another tag, ex: ARTIST->COMPOSER ARTIST
Append - append data from one tag to the end of another, ex: ARTIST->COMPOSER - ARTIST
Prepend - prepend data from one tag to the beginning of another, ex: ARTIST->ARTIST - COMPOSER

The latter three actions also provide an option to delete the info from the first tag after the copy.

This latest version adds "Category", "Description" and "Episode ID" text tags as options and a few minor tweaks and adjustments.

More info and download is here.

February 2 2014 - 8:17 am

Disc 1 of 1

A Corespondent laments:

My personal preference when dealing with the disc count field (1 of 2, etc) is to leave it blank for single CD albums instead of tagging them as "1 of 1." There is something about 1 of 1 that just bugs me so I try to clear those out. Can you think of anything you have that can search in those fields? Sorting the library by disc number [is an unsatisfactory solution] because every disc 1—regardless if there is a second disc—gets sorted.

Yeah. It would be easy to do a Multi-Item edit on these guys if you could only corral 'em all together somehow. But: sorting by Disc # sorts by Disc Number alone and ignores the Disc Count so the "1 of 1" tracks are not necessarily sorted together; rather, they're sorted by Album (all the Disc 1 albums A-Z, followed by all the Disc 2 albums A-Z, and so on). Smart Playlists are of little use to gather up these tracks since Disc Count is not a smart criterion.

So here's a script that will look at each track in a selection or all the tracks in the selected playlist; if the track's Disc Count is 1 the script will set it to 0, effectively blanking it:

tell application id "com.apple.iTunes"

set thePlaylist to (get view of front window)

set sel to selection

if sel is {} then

# all tracks in playlist

repeat with i from 1 to (get index of last track of thePlaylist)

my processTheTrack(track i of thePlaylist)

end repeat

else

# selected tracks

repeat with i from 1 to (length of sel)

my processTheTrack(item i of sel)

end repeat

end if

end tell

to processTheTrack(t)

tell application id "com.apple.iTunes"

try

if disc count of t is 1 then set disc count of t to 0

end try

end tell

end processTheTrack

You can save that in AppleScript Editor named whatever you like and using "Script" as the file format to your ~/Library/iTunes/Scripts/ folder whereupon it will appear in the iTunes Scripts menu.

The script iterates through each track individually, so if you run it against your entire Music library playlist you'll have time to file nails, tidy bookshelves, re-string guitar, or perform some other menial task.

UPDATE: To eliminate the disc number as well (although I prefer to keep it) change the handler to this:

to processTheTrack(t)

tell application id "com.apple.iTunes"

try

if disc count of t is 1 then

set disc number of t to 0

set disc count of t to 0

end if

end try

end tell

end processTheTrack

January 22 2014 - 7:15 pm

Apple Releases iTunes v11.1.4

Apple has released iTunes 11.1.4 which lets you see your Wish List in the library, improved languages support and unspecific "stability improvements".

December 28 2013 - 3:04 pm

UPDATED: Track Down Purchases v2.3

Track Down Purchases v2.3 will examine each track in the entire iTunes library—or a selection of tracks—for items purchased from the iTunes Store (audio, video, and audiobooks) and then sort them by either the purchaser's name or account ID into discrete playlists, eg: "Purchased by Tom Ryan" or "Purchased by tomryan@email.com".

Purchaser information is gleaned by examining the track's local file (purchase info for iTunes Match tracks in the cloud is inaccessible and cloud tracks will be ignored), which, depending on file location and access speed, may take as long a second per track. Just sayin'.

This lateset version fixes a problem for some OS X 10.9 users whereby the script would hang once engaged.

More information and download is here.

December 20 2013 - 10:47 am

UPDATED: File Renamer v2.4

File Renamer will rename the files of the selected tracks (or the files of the tracks in the selected playlist) with a filename pattern that is formulated using the tracks' tag data. Optionally, export a copy of the files to a chosen location and rename the files in that location.

This latest version supports literal bracket characters (ie: [ and ]) and provides a [play order] pattern "field" which will match the index of each selected track in its sorted order.

More information and download is here.

December 14 2013 - 1:36 pm

UPDATED: PDF Adder v4.2

PDF Adder is a collection of two scripts (it used to be three) that assist with adding PDF files to iTunes as "digital booklet" PDF tracks. Each provides a method for easily supplying Author (artist), Album, Category (genre), Year, Rating and Description tag data which is then applied to the newly-added PDF track entry:

  • Add as PDF to iTunes is a PDF Service workflow that, when installed, will be available in the PDF pop-up menu of the Print Dialog. It allows you to save the current document as a PDF file (from any application that uses the Print Dialog) and add it to iTunes.
  • PDF Adder is an applet/droplet that will let you choose or drag-and-drop an existing PDF file and add it to iTunes. It can be installed in iTunes' Scripts folder for easy access from iTunes Script menu.

Each script displays a panel like this so you can provide tag data for the PDF:

Anything you can print, you can export as a PDF...and any PDF can be added to iTunes.

These latest versions are updated for compatibility with OS X 10.9. I also got rid of PDF Dropper and just made PDF Adder launch via double-click (or Script menu launch) or by drag-and-drop. Finally, Add as PDF to iTunes will use applicable tag data for the PDF metadata tags Title, Author, Keywords (Category/Genre tag) and Subject (Description tag).

I almost included an option to add PDFs to iBooks (see below, "iBooks is Not Scriptable. Much.") but iBooks ignores PDF metadata except for Author and of course prevents "tag" editing in the app itself. You can drag PDFs from iTunes to iBooks and the name and artist/author tags will be copied to Title and Author correctly, but that's insufficient for me. I prefer the bevy of tags available for PDF tracks in iTunes.

Deal-breaker for some: under Mavericks, with iBooks installed, PDFs added to iTunes are put in the Music library. Under earlier OS's, iTunes puts them in Books or Audiobooks.

More information and download here.

December 13 2013 - 1:10 pm

Search iTunes Store via Google

Kirk had a tip about using Google to search the iTunes Store in his Macworld column today. Here's a script for that:

try

set searchText to text returned of (display dialog "Search the iTunes Music Store for:" default answer "")

tell application "Finder" to open location "http://www.google.com/search?q=site:itunes.apple.com " & searchText

end try

Launch and enter some search text and click the "OK" button. A new window with Google results will be displayed by your default browser.

December 11 2013 - 11:24 am

iBooks is Not Scriptable. Much.

iBooks is built without AppleScript support so I'm still using iTunes to manage my PDFs. But if you need to programmatically add a file—like a PDF—to iBooks you can use this trick, where filePath is an alias:

using terms from application "iTunes"

tell application "iBooks" to open filePath

end using terms from

Unfortunately, you can't edit the tags in iBooks. Nor does iBooks seem to use any existing PDF metadata except "Author". Strangely, in fact, it uses the PDF's file name (without extension) for "Title" instead of checking the PDF's metadata for "Title". And while I'm making wishes, "Keyword" metadata could be parsed for a Category and perhaps a way could be found to use the PDF "Subject" metadata as a description tag somewhere.

iBooks, which seems to me to be a pretty basic database manager, stores much more metadata for other types of books (have a look at ~/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books and the Books.plist there) so it doesn't seem like it would be much of a bother to accommodate PDFs a little better.

November 29 2013 - 12:12 pm

UPDATED: Copy Tracks to Multiple Playlists v2.2

Copy Tracks to Multiple Playlists v2.2 will copy the selected iTunes tracks to one or more chosen playlists.

This latest version makes some tweaks for compatibility with OS X 10.9.

More info and download 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.