Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > AppleScript/Automator/Folder Actions???

AppleScript/Automator/Folder Actions???
Thread Tools
vwgtiturbo
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Mar 27, 2007, 11:42 PM
 
Okay, I tried to post this long thing earlier today, and for some reason, it didn't post, so I will try to be complete, although I will abbreviate it a bit, as it took me a long time to write originally...

I am new to the Mac, only having owned my Macbook for about two weeks. So, naturally, I am not familiar with Applescript/Automator/Folder Actions, or the capabilities of them. Honestly, I don't even know if they are the same or they overlap in some way... I have a workflow issue, and I am not really looking for a how to per se (as it would probably be over my head anyway) but really am just looking for a confirmation, as far as if I can do this with these tools or am I completely off my rocker...

Okay, I have an Olympus DVR that I use for school lectures (when I insert the DVR into a USB port, it mounts in OS X as 'Olympus DVR'... this is important later). It records in WMA format, with filenames resembling WS_300xx.WMA. Now, what I normally do is copy these files from 'Folder A' on the DVR to 'Folder B' on my Mac. Then, I rename the files from 'WS_300xx.WMA' to 'xxx.wma' (with the xxx being a padded number such as 001,002, etc. depending on what files are already in the directory; also, I make the extension lower-case, as I am really anal-retentive like that). Next, I open EasyWMA and drag the new xxx.wma files into the EasyWMA window to be converted to MP3s. I don't have to change any settings every time I do this... I just set the defaults to do what I need as far as this. After the conversion, EasyWMA adds the MP3s to my iTunes library. Lastly, I open Fission and edit any worthless space before the lecture starts, and finally, change the MP3 tags (they are empty when EasyWMA creates the MP3). Now, in an unrelated note, after this process, I have smart playlists in iTunes that catalog my lectures based on the tags, and sync them to my iPod the next time I connect it.

So, ultimately, what I need to verify the possibility of is this:

1. When the Volume 'Olympus DVR' is mounted, I would like to copy *.WMA from 'Folder A' on the DVR to 'Folder B' on the Mac, and from 'Folder C' on the DVR to 'Folder D' on the Mac (there are multiple folders set up on the DVR, one for each course I am taking).

2. After the files are copied, I would like to delete the *.WMA files on the DVR. Then, I would like to change the file names in the Mac's destination directory from WS_300xx.WMA to xxx.wma (depending on the files that are already in the directory).

3. Next, I need to open the new xxx.wma files in EasyWMA to convert them to MP3 (normally, a simple drag and drop affair).

That is pretty much it. I know that I can't really automate the editing of the audio files (the garbage space at the beginning is never quiet), and I probably can't automate the tags, but what what do you think of the copying, deleting, renaming, and converting of the raw files? Ultimately, I would like to be able to plug in the DVR and walk away for the 5-10 minutes it takes to copy, delete, and convert the audio files (not to mention, eliminate some clicks and such...).

Any assistance/insight or constructive "You must be crazy" comments would be greatly appreciated!

Ron
     
brokenjago
Mac Elite
Join Date: Sep 2005
Location: Los Angeles, California
Status: Offline
Reply With Quote
Mar 28, 2007, 12:41 AM
 
Automator is simply a GUI front end to Applescript.
Linkinus is king.
     
zro
Mac Elite
Join Date: Nov 2003
Location: The back of the room
Status: Offline
Reply With Quote
Mar 28, 2007, 02:24 AM
 
Aside from the encoding, I see no reason the rest of it can't be done. In fact, I wouldn't be so sure it hasn't.

A folder action attached to the /Volumes folder can do the copying. There was a recent hint on Mac OS X Hints concerning USB thumb drives and the backing up thereof.

macosxhints.com - Automated backup of flash drives

Be sure to read through the comments as the original hint wasn't quite "there" at the time.

I wouldn't count on EasyWMA being AppleScriptable. It might be healthier to look for a QuickTime plug-in that reads WMA, or better yet look for an existing script that does what you'd like to do.
     
larkost
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status: Offline
Reply With Quote
Mar 29, 2007, 05:40 PM
 
Originally Posted by brokenjago View Post
Automator is simply a GUI front end to Applescript.
No, it does not use AppleScript (Apple Events) to communicate with applications at all. The development work to provide AppleScript hooks and Automator Actions are completely separate. In fact they even are architectured differently (Automator is completely linear).

I was very disappointed when I learned that, as I hoped that it would push Apple to include more AppleScript hooks in their applications. But there are some signs of a possible AppleEvents renaissance at Apple, with more languages being added to those that can natively (without add-ins) support AppleEvents (Python and Ruby being the big ones), and Apple working to make AppleScript Studio a more native environment (Core Data Bindings!!, for JavaScript even!!!).
     
Diggory Laycock
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Apr 1, 2007, 12:19 PM
 
I don't know why, but I decided to write this for you. Sometimes I like mucking around with AppleScript.

I cut out EasyWMA and just used ffmpeg (which is what EasyWMA does under the hood anyway.)

The Script Application can be downloaded at the following url: http://monkeyfood.com/software/MountOlympusBundle.zip

You'll probably want to use 'Do Something When' Azarhi Software to run the script when the Olympus is mounted.

A couple of notes about the script -
1 - It contains an executable of ffmpeg inside it so you can't just copy and paste the code from below (although I'll put it there anyway for Google.)
2 - I'm assuming that these folders on the Olympus are at the root of the device (i.e. not in subfolders)
3 - You'll need a local folder (i.e. on your mac) that the script uses to copy the files to. This folder is called the 'Destination folder' - the first time the script runs it will ask you where this folder is. The script will only copy across files from folders on the Olympus if there is an equivalently named folder in the destination folder.
4 - I'd test it out first without any valuable files on the Olympus - it shouldn't mangle anything, but it's better to be safe than sorry.
5 - The script uses Growl http://www.growl.info to notify you of progress and errors. You'll need Growl otherwise the script will complain. It's possible to comment out the Growl calls if you don't want to use Growl.

Let me know how it goes.

Digs.

code:

-- DSW Script for KeyDrive

-- This script will be executed when the Olumpus Recorder is mounted
-- as long as there is a rule set in the DSW prefpane
-- (http://www.azarhi.com/Projects/DSW/index.php)
-- to run this script when then appropriate volume is mounted.

--This script is saved as an Application bundle, it has a copy of ffmpeg in the resources directory.



-- Script-wide properties
property defaultNotification : "Transcode Olympus Audio Files"
property olympusVolumeName : "Keydrive"
property olympusRecordingFolderAlias : ""
property macMP3Folder : ""
property DeleteMeLabel : 3

-- Routines
to growlRegister()
tell application "GrowlHelperApp"
set myAllNotesList to {defaultNotification}
register as application defaultNotification all notifications myAllNotesList default notifications {defaultNotification} icon of application "Finder.app"
end tell
end growlRegister


to growlNotify(noteText, stickyState)
tell application "GrowlHelperApp"
notify with name defaultNotification title defaultNotification description noteText application name defaultNotification sticky stickyState
end tell
end growlNotify


to getFilenameWithoutExtension(fileAlias)
try
set fileName to name of (info for fileAlias)
set fileExt to name extension of (info for fileAlias)
set nameLength to (length of fileName) - (length of fileExt) - 1
set nameWithoutExt to (characters 1 thru nameLength of fileName) as string
return nameWithoutExt
on error
-- error probably caused by the fact that the file didn't have an extension anyway
-- so just return the filename unmodified
return name of (info for fileAlias)
end try
end getFilenameWithoutExtension


to amIRunningInScriptEditor()
try
set executingApp to me
set this_app to (path to me) as string
if name of executingApp is "Script Editor" then
-- my growlNotify("we are running in Script Editor.", no)
return true
end if
on error err
-- my growlNotify("error getting name of executing app: ", yes)
end try
-- my growlNotify("we are running outside of Script Editor.", no)
return false
end amIRunningInScriptEditor


to transcodeWMAToMP3(wmaAlias, destinationFolder)
tell application "Finder"
try
if my amIRunningInScriptEditor() then
-- we are debugging in Script Editor
set the ffmpegExecutable to item "ffmpeg" of folder "Diggory" of folder "Users" of startup disk as alias
else
-- The script is being run from the droplet
set this_app to (path to me) as string
set the resources_folder to this_app & "Contents:Resources:" as alias
set the ffmpegExecutable to item "ffmpeg" of the resources_folder as alias
end if
set pathToFFMPEG to (quoted form of POSIX path of ffmpegExecutable)
-- my growlNotify("path to ffmpeg: " & (pathToFFMPEG), no)
on error err
my growlNotify("Error getting path to ffmpeg: " & err, yes)
end try

try
set pathToWMAFile to quoted form of POSIX path of wmaAlias
set audioFileBasename to my getFilenameWithoutExtension(wmaAlias)
-- set pathToFFMPEG to (quoted form of POSIX path of ffmpegExecutable)
set transcodeShellCommand to (pathToFFMPEG & " -i " & pathToWMAFile & " -ab 64 " & quoted form of (POSIX path of destinationFolder & audioFileBasename & ".mp3"))
-- my growlNotify(transcodeShellCommand, yes)
do shell script transcodeShellCommand
my growlNotify("Transcoded file: " & (audioFileBasename), no)
return true
on error err
my growlNotify("transcode error: " & err, yes)
end try
end tell
end transcodeWMAToMP3



to findHighestNumberInFolder(scanFolder)
tell application "Finder"
my growlNotify("Searching for highest number in this folder..... ", no)
set highestNumber to 0
repeat with i from 1 to (count of items in folder scanFolder)
set thisFile to item i of scanFolder
set thisFileName to name of thisFile
set shortName to my getFilenameWithoutExtension(thisFile as alias)
try
set nameNumber to (shortName as number)
-- log (nameNumber)
if (nameNumber > highestNumber) then
set highestNumber to nameNumber as number
-- log ("new Highest")
end if
end try
end repeat

return highestNumber
end tell
end findHighestNumberInFolder





-- This part of the script is the main routine: itruns when the drive is mounted:
on run

my growlRegister()
my growlNotify("Olympus DVR mounted....", no)

tell application "Finder"

-- Find the Olympus DVR volume
try
set olympusVolume to disk named olympusVolumeName
on error
-- It's not there! Find the correct volume
set removeableDisks to every disk whose ejectable is true
set diskNames to {}
repeat with i from 1 to number of items in removeableDisks
set diskName to (name of (item i of removeableDisks))
copy diskName to end of diskNames
end repeat

choose from list diskNames with title "Choose The Olympus" with prompt "Ejectable Discs" without multiple selections allowed
if the result is equal to false then
return
else
set olympusVolumeName to (item 1 of result)
set olympusVolume to disk named olympusVolumeName
end if
end try

-- try and locate the folder where recordings should be copied to on the Mac
try
set destinationFolder to folder macMP3Folder
on error errorText number errNum
-- my growlNotify("Error finding destination folder" & errorText, no)
my growlNotify("Please locate folder where recordings are to be copied to on the Mac...", no)
set macMP3Folder to choose folder with prompt "Please locate the destination folder on the Mac"
end try


-- Iterate through the folders of the Olympus
repeat with i from 1 to number of folders in olympusVolume
set currentOlympusFolder to folder i of olympusVolume
log (name of currentOlympusFolder as string)

if exists (folder named (name of currentOlympusFolder) of macMP3Folder) then
log ("Yes, there is a folder like that locally")
set currentDestinsationFolder to (folder named (name of currentOlympusFolder) of macMP3Folder)

-- Find highest number:
set nextNumber to my findHighestNumberInFolder(currentDestinsationFolde r as alias)
set nextNumber to nextNumber + 1


set allFolderFiles to every file of currentOlympusFolder

-- iterate through all files in this folder
set numItemsInFolder to number of items in currentOlympusFolder
repeat with i from 1 to number of items in currentOlympusFolder
set thisWMAFile to item i of currentOlympusFolder
if name extension of thisWMAFile is "wma" then
my growlNotify("Found WMA File..." & (displayed name of thisWMAFile), no)

try
-- Copy the WMA file to the local disk
set copiedFile to (move thisWMAFile to currentDestinsationFolder) as alias
if name of thisWMAFile is not "testingFile.wma" then
-- If we actually delete the file then it screws our iterator
-- Instead we mark them for deletion later.
set label index of thisWMAFile to DeleteMeLabel
end if

-- rename file
if (nextNumber < 10) then set newFileName to ("00" & nextNumber as string) & ".wma"
if ((nextNumber > 9) and (nextNumber < 100)) then set newFileName to ("0" & nextNumber as string) & ".wma"
if (nextNumber > 99) then set newFileName to (nextNumber as string) & ".wma"
set name of copiedFile to newFileName
set nextNumber to nextNumber + 1


my transcodeWMAToMP3(copiedFile as alias, currentDestinsationFolder as alias)
on error err
my growlNotify("Error copying file (" & (displayed name of thisWMAFile) & ") - " & err, no)
end try
end if

if (i is equal to numItemsInFolder) then
-- We've completed this folder - delete the files which are labelled for deletion
set allFilesToDelete to (every file in currentOlympusFolder whose label index is DeleteMeLabel)
delete allFilesToDelete
end if
end repeat

else
my growlNotify("There is no local folder named: " & name of currentOlympusFolder, no)
end if
end repeat





end tell

end run
     
itai195
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status: Offline
Reply With Quote
Apr 2, 2007, 12:42 PM
 
Yes you certainly can do all the file copying, deleting, opening, and renaming pretty easily with Automator. Check out the actions Ask for Finder Items, Get Specified Finder Items, Copy Finder Items, Rename Finder Items, Open Finder Items, etc. You can even automate importing the files into iTunes and setting the metadata tags in bulk. PM me if you need any help setting this up, but play around with Automator a bit first and I think you'll find that it does much of what you're looking for.
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Apr 2, 2007, 11:19 PM
 
Digs:
Alright, you must be masochistic or something... hahaha Anyways, I tried this out (I had to get Growl first, as I hadn't installed that as of yet), and here's what happens:
1) The files are in subdirectories, so the app complained a bit, but...
2) Just to try and see how it worked, I moved one of the files manually to the root, and the result is here: http://rondeagle.com/mac.stuff/olympusapp.jpg

Really though, don't spend much time on this. As soon as I read your post, I felt bad, not only because I don't have the time at the moment to learn this, but because I am sure you have better things to do In any case, thank you very much for taking the time!
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Apr 2, 2007, 11:24 PM
 
Originally Posted by itai195 View Post
Yes you certainly can do all the file copying, deleting, opening, and renaming pretty easily with Automator. Check out the actions Ask for Finder Items, Get Specified Finder Items, Copy Finder Items, Rename Finder Items, Open Finder Items, etc. You can even automate importing the files into iTunes and setting the metadata tags in bulk. PM me if you need any help setting this up, but play around with Automator a bit first and I think you'll find that it does much of what you're looking for.
I will start mucking with this... I am interested, but with work/school/house/family, you just never know when I will get around to it. I will drop you a line if I can, sometime this week after I mess with this a bit (and hopefully not nuke my new MacBook in the process). Thanks!
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
Diggory Laycock
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Apr 3, 2007, 06:43 AM
 
Originally Posted by vwgtiturbo View Post
Digs:
1) The files are in subdirectories, so the app complained a bit, but...
2) Just to try and see how it worked, I moved one of the files manually to the root, and the result is here: http://rondeagle.com/mac.stuff/olympusapp.jpg
OK, those errors are just telling you that there aren't any of those folders in the destination folder on the Mac.

I assume that the folders DSS_FLDA etc.. are the ones that contain the recordings you want to transcode.

All you have to do is create an empty folder (in the destination folder) for each of those folders, with the same name:

e.g.: if the filesystem of the olympus looks like this: (the board has stripped my indentation below - but I hope you see what I mean...)


/OLYMPUSDVR
DSS_FLDA/
WS300_01.WMA
WS300_02.WMA
WS300_03.WMA
DSS_FLDB/
WS300_01.WMA
WS300_02.WMA
WS300_03.WMA


then you need your destination folder to look like this:

/users/vwgtiturbo/Documents/incomingRecordings (or wherever your destination folder is)
DSS_FLDA/
DSS_FLDB/


If there is is no corresponding folder then the script skips that folder.

If you want the script not to show that warning about 'no local folder' then simply comment out that line in the script (open the script bundle in script editor and search for "local folder named" )

Digs
( Last edited by Diggory Laycock; Apr 3, 2007 at 06:54 AM. )
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Apr 3, 2007, 02:19 PM
 
Wow, this is SO awesome. I have been tinkering with Automator for a bit, and am REALLY impressed with it. I am only having one issue (so far)... Instead of having me select the files, I have it set to find files in 'DSS_FLDA' with which the extension is 'WMA'. So, it finds the one WMA in that folder successfully, and copies it to my Mac. My problem is that it then doesn't stop in the DSSxxxA directory... it keeps copying things to the destination directory from OTHER directories (i.e. after some snooping, I found it copying things from the other directories on the DVR, and from my trash...) which just won't work, as I use a different subfolder for each class (and for now, have a separate workflow for each class until I can get the kinks ironed out and am confident that I am not going to zap anything important). I am not sure why it is behaving this way, but then again, I did just start learning this, so who knows... Here is my .app: http://rondeagle.com/mac.stuff/test.app.zip

Okay, for some reason, my link above isn't working...

Nevermind... for some reason, my browser/webhost wasn't liking the .app file (and when I deleted it from my host, it said that 17 files were being deleted???; the app along with file names that I have never seen... are .app actually archives of some sort?). Making the .app into a .zip works fine.
( Last edited by vwgtiturbo; Apr 3, 2007 at 02:32 PM. )
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Apr 3, 2007, 02:57 PM
 
Okay, it seems to be going recursively through my directories (although it is STARTING in the directory I specified in the script). So, if I want it to find WMA files in FLDA, it will start in FLDA, copy those WMA files first, then go to FLDB, copy those, FLDC, copy those, sort forth and so on... It does, however, move the file over correctly, rename them based on the numbers already in the destination, and opens EasyWMA to convert them (which also adds them to the iTunes library). If I can get it to only search the directory I specify, and then find a way to add the tags via script, I will be pretty much set, using Do Something When to run the workflow when I attach the DVR (with the exception of the editing, which I have to do by hand, although that really isn't too bad).
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Apr 3, 2007, 07:32 PM
 
Well, I recreated the structure of the DVR on my desktop, and the .app did NOT recursively go through the directories (DSS_FLDA, DSS_FLDB, etc.). It went through DSS_FLDA, as it was supposed to, then continued on with the other actions in the workflow.
So, I set the script to once again work off of the DVR, and it started recursing again. I don't know... is there something different about running this using a removable drive versus a regular point on the file system?
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
itai195
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status: Offline
Reply With Quote
Apr 3, 2007, 09:11 PM
 
I haven't been able to recreate the problem you're seeing, however you may try another approach by replacing Find Finder Items with a Get Specified Finder Items containing the DSS_FLDA folder followed by Get Folder Contents. Also, the Get Specified Finder Items action that you've currently got after Find Finder Items isn't needed because Find Finder Items already returns the items that it finds. If that works, then later on, to get all the folders, you can put the parent folder in Get Specified Finder Items and check the 'Repeat for each subfolder' checkbox in Get Folder Contents.

Also a general tip, if you haven't discovered the View Results action you should take a look at it, it's a great help when building and debugging a workflow.
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Apr 3, 2007, 11:51 PM
 
Okay... I am trying to use View Results... It took me a bit, as I was thinking that I was going to see some kind of pop up dialogue telling me what was going on, but I didn't realize that I have to run the script from within Automator to see the results. Anyways, how can I stop a script that I am running within Automator (or do I have to force quit Automator itself?). The process I am testing is long, and if I can see that it is going to fail, I would rather not wait through the entire process.
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Apr 4, 2007, 12:00 AM
 
Alrighty... Thanks for the 'View Results' tip. It led me to this:
http://rondeagle.com/mac.stuff/dvrresults.jpg

So, the script is doing what it is fed, but somehow it is getting the wrong results from the get go. The attached screen shot shows how it is set up in this regard, so I am not sure where the mixup is happening...
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
itai195
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status: Offline
Reply With Quote
Apr 4, 2007, 12:57 AM
 
I'm not sure since I can't recreate it, but the issue is most likely with Find Finder Items. Try replacing it with the other two actions I mentioned, and if you need to filter things out so you only get WMA files, add a Filter Finder Items action after them.
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Apr 4, 2007, 11:55 AM
 
Thank you very much for the help. This is moving right along now!
Okay, using your advice, everything is golden, as far as copying only the files I need over to the Mac. However, I can't figure out how to set the tags in iTunes. Basically, I have the files renamed sequentially (ie. 001.WMA), renamed to lowercase (ie. 001.wma), and renamed to add the modified date to the beginning (ie. 04-04-2007_001.wma). My problem is getting the output of EasyWMA (the newly created MP3s with the same name as the WMAs) to feed into the 'Set Info of iTunes Songs' action.
I've tried various actions for filtering and such and am not having any luck. I must be missing something...
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Apr 4, 2007, 01:20 PM
 
Okay, I now have it figured out to where it will find songs that exist in iTunes and change their info via Automator. However, I still can't get it to work with my newly created MP3s. When the MP3s are created, the have the name xxx_date.mp3 and all of the MP3 tags are blank (so in iTunes, the artist, album, genre, etc. are blank). I have a 'Find Songs' action, with 'Whose: Artist is equal to " " (I have tried this with and without quotes to try to find songs with blank artist names) and also have it set to try and find songs with blank albums names and genres.

It is getting so close, I can almost taste it...

After this is done, I will just pair it up with Do Something When, so I can literally just plug in the DVR and walk away for a bit, with all of the copying, naming, converting, and tagging done automagically (of course, much testing will need to be done before I get to that point... knowing my luck, I would walk away just to come back to a smoldering pile of goo on my desk).
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Apr 4, 2007, 01:30 PM
 
Here is what I have so far:
http://rondeagle.com/mac.stuff/test.app2.zip

It doesn't work, but should give an idea as to where I am on this...
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Apr 4, 2007, 06:56 PM
 
Now I almost have this licked... I ended up having to create an iTunes smart playlist 'Empty Tags' (because the MP3s that EasyWMA spits out have empty ID3 tags) and this playlist tracks songs with empty album, artist, and genre tags. In addition, I added the 'Get Specified iTunes Items' action and pointed it to the 'Empty Tags' playlist, which is then piped through to the 'Set info of iTunes Songs'.
There is still one problem... When I use the 'Open Finder Item' action on two files, at least for EasyWMA, one file gets converted while the other in is a qeue. When the conversion is finished on the first file, the second file then starts converting, but at this point, it counts as being 'opened', as if the 'Open Finder Items' action has been completed. Of course, it hasn't, and the second track isn't listed in the Empty Tags playlist (because it hasn't been converted/imported into iTunes yet).
Now, just for testing, I applied a 'Pause' action and set it for a time in which the conversions would have been done, and the Automator works great. However, I can't really use a set Pause time in reality, as some tracks take longer than others. I COULD set a time that I know is the MAXIMUM time required to convert a track, but if the track is cut short (class dismissed early or something) then I will be waiting around for a while. In any case, I may just do that so I can get this puppy working, because as of now, notwithstanding this minor quibble, everything works as it should. Maybe I will add something to delete the original WMAs from the DVR after they are copied and converted...
( Last edited by vwgtiturbo; Apr 4, 2007 at 07:05 PM. )
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Apr 4, 2007, 07:48 PM
 
Well, using DSW, it works. Another issue (kind of along the same lines as the Pause, is that I have this set up to run twice in the same script (one for each class/directory). If I don't have the first class one day, I still have to sit and wait through the pause during it's portion of the script. Darn...
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Apr 4, 2007, 11:30 PM
 
Due to the 'Pause' issue, I decided to split this up into two .apps, then run both of them when the DVR is mounted. This cuts down on the wait time a little bit. I wish there was a way to bypass the whole 'Pause' bit all together, as I usually wait longer than necessary (but need to make sure that the wait is long enough to accommodate my longest lecture). One thing I did learn though... The Automator action used to change the track tags in iTunes doesn't like non-standard genre. I tried to set mine to 'School', which of course, isn't one of the default options. When I did this, it wouldn't change any of the tags, and then for some reason (maybe due to a transparent error message or something) it wouldn't delete the original WMA files from the DVR. No biggie... I just leave the genre blank, and fill in the album (Spring 2007) and artist (Calculus 1A), and it is enough to satisfy my smart playlist.
That damn pause...

In any case, thank you very much for all of the help. For anyone else that might stumble on this, the latest version of this can be found here: http://rondeagle.com/mac.stuff/Olymp...ctions.app.zip
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
vwgtiturbo  (op)
Forum Regular
Join Date: Feb 2007
Status: Offline
Reply With Quote
Apr 6, 2007, 11:13 AM
 
Let me rephrase one section of the above post:

It isn't that the script doesn't like non-standard genres (when setting the tags of my newly imported tracks)... It doesn't like setting the genre AT ALL. It doesn't matter if you want a default or custom genre... If I set it to try to write a genre tag, it will only write the Album (not Artist). It is really odd, but ultimately, not a big deal.

Overall, this works okay. I made the script delete the original WMAs from the DVR when everything completes (which works great because if any part of the actions fails, then the delete at the end doesn't take place, so if something goes awry, I still have my original lecture file).

I still can't stand the pause though... especially if there is no lecture from one class (and DSW is set to run both upon mounting the DVR). I sort of counteracted this by running both scripts at the same time, that way, on days when I have Calc, but no History, it isn't too big of a deal to wait for the History script, because I am already waiting for the Calc lecture to download.

Anyways, thanks for all of your help!
Black 13" Widescreen MacBook
2.0Ghz C2D, 2GB RAM, 320GB HDD
Mac OS X v10.6 Snow Leopard
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:58 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,