![]() |
Movie Properties Info Delete Script?
I have a bunch of MIDI files that I am using in iTunes. Unfortunately, all the song titles are either "untitled" or reference numbers. All of the file names are the correct title. I have noticed that if I delete the Quicktime movie properties, that the filename will drop in by default and will display properly in iTunes. So, here is what I need.
I need a batch script that will allow me to strip the information in the Quicktime Movie Properties. I could probably do this later with Automator, but would like to do it now if possible. Thanks all! |
Have you tried doing an Applescript? The Finder is scriptable, so you might be able to have the script editor record the script while you do a file. Then you apply the script to a folder, using "enable folder actions" so that you can drop the rest of the files into the folder and run the script on them automaitically.
Applescript can be a little intimidating to start, but it is good to learn for future use. I'm not great at it, but this seems like a nice project that wouldn't be too difficult. |
Yeah, I wish I knew how to AppleScript, but right now I have to get my head around ActionScript, and programming is very difficult for me.
|
If you want to send me a file, I'll give it a try. Make it a small one, I don't want to post my real email on the web, so I'm using my throwaway account:
cwtdirect@hotmail.com Only send one, I'll just duplicate it to try the script. ;) |
Done... it's a teeny MIDI file. Thanks!
|
Got it, but now I'm stuck! How do you delete the Quicktime movie properties? I can't script it unless I know how to do it!
|
Oops! Needed to delete them in Quicktime Pro. Now I know what needs to be done. I just need to figure out how to script it. Funny, Script Editor records a script and then won't run what it recorded!
|
I think stuff like that is what frustrated me about ScriptEditor. Hence I went on to other things. I am hoping Automator will change my life.
|
I've managed to get it to delete the properties. Now I'm trying to get it to save the file. You'd think that would be the easy part!
|
A guy at Apple discussions showed me one at the Apple site. I ran it and it worked, but it would not save the file. The change did not "take". Here is the code if it helps at all...
Code:
-- the list of creator types which will be processed |
Seems kind of complicated. I'm trying to set up a folder action where the script will have Quicktime Pro open the file, remove the movie properties and then save the file. This is what I have so far:
set annot1 to "Full Name" set annot2 to "Copyright" tell application "Finder" to display dialog "'" & aItem & "'" buttons {"Yes", "No"} default button 2 with icon 1 tell application "QuickTime Player" to open aItem tell application "Finder" to display dialog aItem & " has been opened. " buttons {"Yes", "No"} default button 2 with icon 1 tell application "QuickTime Player" delete annotation annot1 delete annotation annot2 end tell tell application "Finder" to display dialog aItem & " has been cleared. " buttons {"Yes", "No"} default button 2 with icon 1 --tell application "QuickTime Player" -- set nme to name of annotation "Music Track" --end tell --tell application "Finder" to display dialog nme buttons {"Yes", "No"} default button 2 with icon 1 set plce to folder2 & aItem tell application "QuickTime Player" save aItem in folder2 as movie end tell tell application "Finder" to display dialog aItem & " has been saved. " buttons {"Yes", "No"} default button 2 with icon 1 I've got the display dialogs in there to help me debug. I get to save, which I've tried in lots of ways, and it fails. Still working on it though! |
Doh! You aren't going to believe this. I just upgraded to the latest iTunes (4.7.1) and added your file in. The song name came up as: Player Piano Roll # 52923A
Apparently, Apple was one step ahead of us. A script is no longer required! |
Although cwtnospam has discovered that the problem appears to have been resolved by upgrading iTunes, I have on occasion run into similar problems with MP3, AAC etc i.e where the track name has a different name to that of the file name. (In fact if you look closely at any tracks you've put on your system with the "Get CD Track Names" option, you will see file names do differ from track names as a result of the process.)
So I did the following AS to sort out name conflicts. To use, select the track in iTunes, and run the script. The track name will be edited to be the file name minus the extension. Don't know if it works for MIDI files, but I don't see why it shouldn't. Code:
tell application "iTunes" |
Bramley,
Cwtnospam was a bit confused about the new version of iTunes, it will not convert or display the MIDI files correctly. But your script, on the other hand, did the trick! Many thanks for it and a big thank you to cwtnospam who tried to make the QT script work. Thanks again! |
You're welcome. I'm still trying to get Quicktime to do it by deleting the movie properties. For some reason, I can't get it to open a file from a script!
For example: tell application "QuickTime Player" activate open "Macintosh HD:Users:shared:anymoviename.mov" will fail! I'm glad you don't need it, bu now I don't want to let it win. :o |
A little late, but I got it to work! Just in case you're interested, the script is below. It works using a folder action and requires two folders. One to drop the files into and another folder at the same level and named the same, but with the number 2 at the end. After running the script, just add files from folder2 into iTunes.
on adding folder items to this_folder after receiving added_items try tell application "Finder" set the folder_name to the name of this_folder set l to the length of folder_name set cpya to folder of this_folder set cpy to ((cpya as string) & folder_name) as string set ai to length of cpy set annot1 to "Full Name" set annot2 to "Copyright" end tell repeat with aItem in added_items set lai to aItem as string set la to length of lai set adj to ai + 2 set fl to characters adj through la of lai as string set fnm to cpy & "2:" & fl as string tell application "QuickTime Player" open aItem delete annotation annot1 in movie 1 delete annotation annot2 in movie 1 save movie 1 in fnm close movie 1 saving no end tell end repeat end try end adding folder items to |
I had never done a folder action before, so this took some figuring out. Once I got it going, it sorta worked, then crashed QT.
|
Did it convert some files and then crash? I only tested it on a few duplicates of that one file.
|
Yeah, it converted a couple then crashed. I think I might know why. Some of the files have two data entries and the ones that crash have one. There is Filename and Copyright. I tried deleting just Filename and it displayed the way I wanted to. So if the script were changed to just delete the Filename data attribute, I think that would work.
This has been good for me, if nothing but to know how to set up a folder action. Quite interesting. |
Try this:
Put two dashes in front of the second delete command. That turns it into a comment, so it doesn't get executed. (Then save the script) delete annotation annot1 in movie 1 --delete annotation annot2 in movie 1 |
I did that and it stopped crashing. I also commented out --set annot2 to "Copyright"
I drag 100 files in, it does about 3-4 files then stops. |
That's strange. I've just duplicated it on mine. For some reason, Quicktime quits. I'll see what I can do.
|
It's definitely Quicktime unexpectedly quitting. I have been able to get it to do all of the 9 copies I made of the file, but with no significant changes to my code. Then I try it a second time and it crashes on the third file!
|
Here's the latest. Quicktime is crashing on opening the file. The error log says:
Command: QuickTime Player Path: /Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player Version: 6.5.2 (6.5.2) PID: 2713 Thread: 0 Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x0000002c What's really strange about this is that is appears to be random, so I doubt it's the Applescript code. Anybody have any ideas? The code: on adding folder items to this_folder after receiving added_items try tell application "Finder" set the folder_name to the name of this_folder set l to the length of folder_name set cpya to folder of this_folder set cpy to ((cpya as string) & folder_name) as string display dialog cpy set ai to length of cpy set annot1 to "Full Name" set annot2 to "Copyright" end tell repeat with aItem in added_items set lai to aItem as string set la to length of lai set adj to ai + 2 set fl to characters adj through la of lai as string set fnm to cpy & "2:" & fl as string tell application "Finder" to open aItem tell application "QuickTime Player" delete annotations in movie 1 save movie 1 in fnm close movie 1 saving no quit "QuickTime Player" end tell end repeat end try end adding folder items to |
Again, worked a couple of times then, this time, got an unexpected error -600
Is it possible to make a droplet and save to another folder? I can hard-code in the location. |
Quote:
set fnm to cpy & "2:" & fl as string and save movie 1 in fnm are for. It's to change the path from "~:folder:filename" to "!:folder2:filename" Anyway, the problem is that Quicktime is crashing on opening the file, not saving it. It's weird because this test script to open and close each file, works: on adding folder items to this_folder after receiving added_items try tell application "Finder" repeat with aItem in added_items open aItem tell application "QuickTime Player" close movie 1 saving no end tell end repeat end tell end try end adding folder items to |
I think I've found the problem, although I don't yet have a solution. It seems that files with spaces in their names often affect not their own processing, but the next file to be opened and then saved. I think it's a bug in Applescript, because it doesn't always happen, especially if there is a delay such as that caused by a dialog or the command: delay 1
on adding folder items to this_folder after receiving added_items tell application "Finder" repeat with aItem in added_items set nxtone to aItem as string set lnxt to the length of nxtone set flname to name of aItem as string set lfln to length of flname set ll to lfln as text --activate --display dialog "#" & flname & "#" delay 1 open aItem set adj to lnxt - lfln - 1 set cpy to characters 1 through adj of nxtone as string set fnm to cpy & "2:" & flname as string tell application "QuickTime Player" delete annotations in movie 1 save movie 1 in fnm close movie 1 saving no end tell end repeat end tell end adding folder items to |
| All times are GMT -5. The time now is 10:21 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.