List Podcasts Applescript


-- Copyleft 2008 by The Core Files ALL WRONGS RESERVED
-- DISCLAIMER: You are free to copy, modify, and reuse this code as you wish
-- and without attribution. For edcuational purposes only. The author assumes
-- no liability for related to this code. You really should know what something
-- like this does before you run it on your own computer!

on sort_list(the_list)

repeat with i from 1 to (the number of items in the_list)
set lowest_j to i
repeat with j from (i + 1) to (the number of items in the_list)
if (item j of the_list) is less than (item lowest_j of the_list) then
set lowest_j to j
end if
end repeat
if lowest_j is greater than i then
set old_i to item i of the_list
set item i of the_list to item lowest_j of the_list
set item lowest_j of the_list to old_i
end if
end repeat

return the_list
end sort_list

tell application "iTunes"

set podcast_names to {}

repeat with a_track in every track of playlist "Podcasts"

set the_album to album of a_track
set the_artist to artist of a_track

if the_artist is "Magnatune" then
set the_album to "Mangatune " & characters 1 thru ((length of the_album) - 19) of the_album as string
end if

if podcast_names does not contain the_album then
set end of podcast_names to the_album
end if
end repeat
end tell

set podcast_names to sort_list(podcast_names)
set podcast_list to ""
repeat with a_podcast in podcast_names
set podcast_list to (podcast_list & a_podcast as string) & "
"
end repeat

tell application "TextEdit"
activate
set new_document to make document
set the text of the new_document to podcast_list
end tell

One Response to List Podcasts Applescript

  1. Pingback: The Core Files - Pork Chops and Apple Sauce

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>