Splasm Software Discussions
http://www.splasm.com/forum/

AppleScript: iTunes selection to Audiobook Builder project
http://www.splasm.com/forum/viewtopic.php?f=14&t=659
Page 1 of 1

Author:  thorix [ Thu Dec 04, 2008 11:16 am ]
Post subject:  AppleScript: iTunes selection to Audiobook Builder project

The first step for batching is done:

annoyed by the lot of copy&paste work still to do I wrote an AppleScript to create an ABB project including cover artwork from an iTunes selection.


Blog article: AppleScript: Create Audiobook Builder project from iTunes selection

Direct download link

Installation:
Copy into ~/Library/iTunes/Scripts - create folders if necessary.

Warning:
    This script builds a project file which works for ABB 1.0.11. Since the project file format is owned by Splasm, there’s no guarantee for future versions of ABB.
    The script assumes you have sorted the selection (by album) and copies the artist, album and artwork from the first track of your selection. It will build a single file chapter for each selected track in order of your selection, not by file name or other criteria.
    Check each project before conversion begins, espc. when you wish to delete the source.


Attachments:
File comment: This is the zipped script itself.
abbp-0.9.zip [25.54 KiB]
Downloaded 1050 times
File comment: The generated project, name/artist/cover taken from the first selected track …
abbpCoverScreen-01.png
abbpCoverScreen-01.png [ 36.41 KiB | Viewed 15174 times ]
File comment: … with a chapter for each track regarding it’s artwork
abbpChapterScreen-01.png
abbpChapterScreen-01.png [ 35.8 KiB | Viewed 15172 times ]

Author:  thorix [ Sun Dec 07, 2008 3:03 am ]
Post subject:  Re: AppleScript: iTunes selection to Audiobook Builder project

A batch mode mod:

Replace the main program, the first “tell application "iTunes"” block with this (or download directly):
Code:
tell application "iTunes"
   if selection is not {} then
      set theSelection to selection
      set theAlbumTitle to the album of (item 1 of theSelection)
      set theAlbum to {}
      repeat with eachTrack in theSelection
         if theAlbumTitle is equal to the album of eachTrack then
            copy eachTrack to the end of theAlbum
         else -- new Album: create the project
            set theProject to my abbCreateProject(theAlbum)
            set theAlbumTitle to the album of eachTrack
            set theAlbum to {eachTrack}
         end if
      end repeat
      set theProject to my abbCreateProject(theAlbum) -- the last one
      -- set theProject to my abbCreateProject(theSelection)
      tell application "Finder"
         activate
         reveal (POSIX file theProject) as alias
      end tell
   else
      display dialog "Select some tracks first..." buttons {"Cancel"} default button 1 with icon 2 giving up after 15
   end if
   
end tell

This code scans a track list (sorted by ‘Album’) and creates an ABB project for each encountered album. Be careful, though, it’s not tested under every condition ;-)

Author:  Deepwinter [ Wed Aug 25, 2010 8:41 am ]
Post subject:  Re: AppleScript: iTunes selection to Audiobook Builder proje

I tried this script but got the following error message

Couldn't create/complete project
bundle "/users/garry/Music/
Audiobook Builder/The Amber
Spyglass.abbuilder" (File exists?) -
Don't use it!

Any ideas,i dont know anything about applescript so i wouldn't know where to start but would really appreciate any help

Author:  thorix [ Wed Aug 25, 2010 11:30 am ]
Post subject:  Re: AppleScript: iTunes selection to Audiobook Builder proje

Deepwinter wrote:
I tried this script but got the following error message

Couldn't create/complete project
bundle "/users/garry/Music/
Audiobook Builder/The Amber
Spyglass.abbuilder" (File exists?) -
Don't use it!

Any ideas,i dont know anything about applescript so i wouldn't know where to start but would really appreciate any help


Let’s look at the script:
Code:
set cmd1 to "mkdir " & quoted form of (projectPath)
   set cmd2 to "mkdir " & quoted form of (projectPath & "/Files")
   set cmd3 to "mkdir " & quoted form of (projectPath & "/Images")
   try
      do shell script cmd1
      do shell script cmd2
      do shell script cmd3
   on error
      display dialog "Couldn’t create/complete project bundle “" & projectPath & "” (File exists?) - Don’t use it!" buttons {"Cancel"} default button 1 with icon 2 giving up after 15
      error number -128
   end try
e


This means an error occurs with Shell’s mkdir creating a directory which already exists. I think you have a “The Amber Spyglass.abbuilder” bundle in your destination folder, so delete it first. Then the script should work.

(These days my son and I are listening to „Das Bernsteinteleskop“, which is my localized version of the Amber Spyglass 8) )

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/