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 > Our Archives > General Archives > Delicious Monster > AppleScripts?

 
AppleScripts?
Thread Tools
Gord Lacey
Fresh-Faced Recruit
Join Date: Jun 2008
Status: Offline
Jun 21, 2008, 04:58 PM
 
Hey guys, are there any neat AppleScripts for DL?

I'm looking for something that would help me strip the additional information Amazon adds to some of their releases (Blu-ray movies have [Blu-ray] and HD DVD has [HD DVD]). I have a couple hundred titles that are formatted this way, and it's a PITA to edit them all by hand. Anyone know of an AppleScript that could help me?

Thanks,
Gord
     
Gord Lacey  (op)
Fresh-Faced Recruit
Join Date: Jun 2008
Status: Offline
Jul 6, 2008, 11:26 AM
 
Well, after spending a couple of hours playing around with AppleScript and DL, I don't think this is even possible. It doesn't seem as though I can pull the name of the title so I can strip something from it. Anyone else have any ideas?

Gord
     
absenthanded
Fresh-Faced Recruit
Join Date: Jun 2008
Location: Raleigh, NC
Status: Offline
Jul 6, 2008, 01:05 PM
 
This script seemed to work for me. It assumes that all Blu-ray titles will end in " [Blu-ray]" and all HD DVD titles will end in " [HD DVD]" (note the leading spaces). If Amazon ever changes their titling system, this script won't work.

Anyway, dump this in "/Users/<your login>/Library/Scripts/Applications/Delicious Library 2" and give it a try.

(Don't include the "Code:" part. I don't know why, but the forum's CODE tag is inserting itself).

Code:
set oldDelims to AppleScript's text item delimiters tell first document of application "Delicious Library 2" set AppleScript's text item delimiters to "" set BluRays to (every movie where its name contains " [Blu-ray]") set BluRayLength to length of " [Blu-ray]" repeat with BluRay in BluRays set movieName to BluRay's name set nameLength to the length of the movieName set movieName to characters 1 thru -(BluRayLength + 1) of movieName as string set BluRay's name to movieName end repeat set HDDVDs to (every movie where its name contains " [HD DVD]") set HDDVDLength to length of " [HD DVD]" repeat with HDDVD in HDDVDs set movieName to HDDVD's name set nameLength to the length of the movieName set movieName to characters 1 thru -(HDDVDLength + 1) of movieName as string set HDDVD's name to movieName end repeat end tell set AppleScript's text item delimiters to oldDelims
     
Gord Lacey  (op)
Fresh-Faced Recruit
Join Date: Jun 2008
Status: Offline
Jul 8, 2008, 05:51 PM
 
Thank you SO much! This is exactly what I was looking to do. If Amazon makes a change I can just edit this script. Thanks again.

Gord
     
absenthanded
Fresh-Faced Recruit
Join Date: Jun 2008
Location: Raleigh, NC
Status: Offline
Jul 8, 2008, 09:32 PM
 
I'm still learning AppleScript, so this is mainly for my own edification.

Here's a version of the script that will be easier to change. Just put the types of discs you want cleaned up on the end of the DiscType list:

Code:
set DiscTypes to {" [HD DVD]"} & {" [Blu-ray]"} set oldDelims to AppleScript's text item delimiters set AppleScript's text item delimiters to "" tell first document of application "Delicious Library 2" repeat with DiscType in DiscTypes set Discs to (every movie where its name contains DiscType) set DiscTypeLength to length of DiscType repeat with Disc in Discs set movieName to Disc's name set nameLength to the length of the movieName set movieName to characters 1 thru -(DiscTypeLength + 1) of movieName as string set Disc's name to movieName end repeat end repeat end tell set AppleScript's text item delimiters to oldDelims
     
Gord Lacey  (op)
Fresh-Faced Recruit
Join Date: Jun 2008
Status: Offline
Jul 9, 2008, 12:13 AM
 
I assume it could be modified further to allow a user to input the text they want cleaned up, right, though only if it appears at the end of the title name?

Anyway, you saved me a ton of work edited all those titles, and I really appreciate it.

Gord
     
illitrate
Junior Member
Join Date: Nov 2006
Status: Offline
Jul 20, 2008, 04:53 AM
 
just a quick Thanks to abesenhanded from me to - that script has been a massive time saver
now i can get rid of the [UMD for PSP] as well as the (NTSC) and so on also
it's really quick too

cheers!!
-- ---
"one day we're all gonna die and then we'll see who's laughing"
     
 
   
Thread Tools
 
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 05:36 AM.
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.,