• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Durations of mp3 files?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Durations of mp3 files?


  • Subject: Re: Durations of mp3 files?
  • From: "Steven D. Majewski" <email@hidden>
  • Date: Thu, 7 Dec 2006 16:09:15 -0500





On Dec 7, 2006, at 3:40 PM, Steven D. Majewski wrote:

'mdls' of an mp3 will give you kMDItemDurationSeconds (among many other items).

Something like:

last word of (do shell script 'mdls ' & ( posix path of ... ) & "| grep kMDItemDurationSeconds" )

ought to work ( but I suspect there *must* be a more direct way to get the info in Applescript ).


Looks like you can use System Events QuickTime File Suite without starting up Quicktime Player:



tell application "System Events" to get {duration, time scale} of QuickTime file named ((choose file) as text)


  (first item of result) / (last item of result)


-- Steve Majewski



On Dec 7, 2006, at 3:14 PM, Mr Tea wrote:

This from Luther Fuller - dated 7/12/06 7.20 pm:

Both QuickTime Player and iTunes contain a 'duration' command.

...and I think you probably have to open the file to use it.

QuickTime Player might be the way to go. I knocked this up in a couple of
minutes and got a usable result.


tell application "QuickTime Player"
 open alias "Shed!:iTunes Music:Slam:Warparty D & House AB:Positive
Education.mp3"
 set theLength to round (duration of movie of window 1) / 600
 set trackname to name of window 1
 close window 1
end tell
set {theMinutes, theSeconds} to {theLength div 60, theLength mod 60}
set showTime to trackname & " - " & theMinutes & ":" & theSeconds

--> Positive Education - 6:32

I'm sure this could be adapted/tidied up and made into a useful droplet or
script menu item for the purposes of the OP.



_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
40virginia.edu
Archives: http://lists.apple.com/mailman//archives/applescript-users


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Durations of mp3 files?
      • From: Mr Tea <email@hidden>
References: 
 >Re: Durations of mp3 files? (From: Mr Tea <email@hidden>)
 >Re: Durations of mp3 files? (From: "Steven D. Majewski" <email@hidden>)

  • Prev by Date: Re: Durations of mp3 files?
  • Next by Date: Re: Running an applescript from a Filemaker Advanced file (Addressing Problems)
  • Previous by thread: Re: Durations of mp3 files?
  • Next by thread: Re: Durations of mp3 files?
  • Index(es):
    • Date
    • Thread