Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Trim podcasts intros with AppleScript Apps
Many podcasts feature a lengthy intro that you have to hear every time you listen to a podcast. If you, like me, listen to fresh news podcasts every morning, you have to skip introductions manually just to get to the news section. Wouldn't it be nice if podcasts were trimmed automagically? Here's the AppleScript for that.

The script is based on Doug Adams' Reset Tracks Start script (GNU GPL). My version of his script goes through every track in a playlist and sets track start time to 90 seconds (you can adjust this number to suit your needs). "News" is the name of my playlist; change accordingly.

property my_title : "Trim all tracks in a playlist"
tell application "iTunes"
	set thePlaylist to playlist "News"
	with timeout of 300 seconds
		repeat with i from 1 to (index of last track of thePlaylist)
			my reset_this(track i of thePlaylist)
		end repeat
	end timeout
end tell

to reset_this(t)
	tell application "iTunes"
		try
			set start of t to 90.0
		on error m
			log m
		end try
	end tell
end reset_this

I use crontab to run this script every morning, but you can use iCal:

  1. Create a recurring event (every morning at 7 am, for example)
  2. Choose Alarm and select Run Script, locate the script file you've just created
Now, every morning at 7 am the script will quetly run and "trim" all the tracks in News playlist to make your mornings a little bit more efficient.

NB: "trimming" does NOT actually trim your tracks, it merely adjusts the starting point; this is totally reversible and instantaneous. If you want to undo this, just change 90.0 to 0.0 and re-run the script.

[kirkmc adds: This is sweet. The only problem is that different podcasts have different length intros. So what I'm going to do is make a number of scripts with different offset times and run them on selected podcasts, adding the podcasts as I want to a playlist on which the script acts. I asked Doug Adams how to change this script so it acts on a selection rather than a playlist. He said to use the following:
property my_title : "Trim all tracks in a playlist"
tell application "iTunes"
	set theSelection to selection
	with timeout of 300 seconds
		repeat with aTrack in theSelection
			my reset_this(aTrack)
		end repeat
	end timeout
end tell

to reset_this(t)
	tell application "iTunes"
		try
			set start of t to 90.0
		on error m
			log m
		end try
	end tell
end reset_this

You'll notice that only o couple if lines in the first part of the script are changed.]
    •    
  • Currently 3.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (8 votes cast)
 
[2,646 views]  

Trim podcasts intros with AppleScript | 3 comments | Create New Account
Click here to return to the 'Trim podcasts intros with AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Trim podcasts intros with AppleScript
Authored by: interlard on Jul 12, '12 11:53:21AM

I hadn't even thought of trimming those annoying intros until now. I record a radio show using Audio Hijack and use an AppleScript to set some metadata and flags. I've just added a "set start" to my script.

FYI, I don't know if these are set for Podcasts automatically, but I also set my radio show tracks to remember how far I've already listened through them and to never come up when I'm playing on shuffle:

set bookmarkable of t to true
set shufflable of t to false



[ Reply to This | # ]
Trim podcasts intros with AppleScript
Authored by: DougAdams on Jul 12, '12 01:57:22PM

I really can't stand some of the overly formal cinematic-sized intros on some podcasts. Better that podcast producers just get on with it. What'd they teach you in podcast school anyway?

Nice work on the script ;)

---
dougscripts.com



[ Reply to This | # ]
Folder Actions
Authored by: mhorn on Aug 04, '12 12:35:57PM
You can skip the cron job part and have the script applied automatically with a folder action. For example, modify the script to look like this:


property my_title : "Trim all tracks in a playlist"
on adding folder items to this_folder after receiving added_items
	delay 2 --Here to allow iTunes time to settle
	tell application "iTunes"
		set thePlaylist to playlist "ABC News"
		with timeout of 300 seconds
			repeat with i from 1 to (index of last track of thePlaylist)
				my reset_this(track i of thePlaylist)
			end repeat
		end timeout
	end tell
end adding folder items to

to reset_this(t)
	tell application "iTunes"
		try
			set start of t to 50.0
		on error m
			log m
		end try
	end tell
end reset_this
Then put this script in /Library/Scripts/Folder Action Scripts. Now attach it to the podcast folder in your iTunes library. Viola, your scripts are updated automatically every time a new one is downloaded.

[ Reply to This | # ]