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

Create a personal podcast via Folder Actions Apps
This hint allows you to create your own personal podcast channel for iTunes using Folder Actions and either web sharing or a file sharing service like Dropbox. Here is how you can do it.
  1. Create a folder inside the Sites folder in your home directory (if you want to use web sharing), or withing your Dropbox/Public (for Dropbox users) folder, and call it myPodcast or something similar.
  2. Create a text file inside the Folder containing the following code, and call it myPodcast.rss:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
    <channel>
    <description>My personal podcast</description>
    <link>http://www.nolink.com</link>
      <title>My Podcasts/title>
    <pubDate> Wed, 21 Apr 2010 10:35:02 +0200 </pubDate>
    
    </channel></rss>
  3. Open AppleScript Editor, paste the following code, and save the script under Library » Scripts » Folder Action Scripts:
    on adding folder items to this_folder after receiving added_items
      set the_folder to POSIX path of this_folder
    
      -- Adapt the set base_url part to match the url of either your web sharing
      -- address and the folder or your public dropbox folder and the subfolder.
      -- You can get the url by using the "get public link" function on the dropbox home page.
      set base_url to "http://dl.dropbox.com/u/XXXXXXX/myPodcast/" as string
      
      repeat with i from 1 to the count of added_items
        
        set this_item to (item i of added_items) as alias
        tell application "Finder"
          set theName to the name of this_item as string
        end tell
        
        set theUrl to do shell script "python -c 'import sys, urllib; print urllib.quote(sys.argv[1])' " & quoted form of (theName)
        
        tell application "Finder"
          do shell script "cd " & (the quoted form of the_folder as string) & ";export LANG=EN_US;echo \"$(head -n 6 podcast.rss)\" >> newPodcast.rss;echo \"<pubDate> $(date +\"%a, %d %b %Y %H:%M:%S %z\") </pubDate>\" >> newPodcast.rss;tail -n $(($(wc -l < podcast.rss) - 7 )) podcast.rss | head -n $(($(wc -l < podcast.rss) - 8)) >> newPodcast.rss;echo \"<item><title>" & (theName as string) & "</title><enclosure type=\\\"audio/mpeg\\\" length=\\\"$(ls -al $" & (quoted form of theName as string) & "| awk '{print $5}')\\\" url=\\\"" & base_url & theUrl & "\\\"/></item>\" >> newPodcast.rss;tail -n 2 podcast.rss >> newPodcast.rss;rm podcast.rss;mv newPodcast.rss podcast.rss;"
        end tell
        
      end repeat
      
    end adding folder items to
  4. Control-click on the folder you created, and choose Configure Folder Actions from the pop-up menu. In the next dialog, choose the above script as Folder Action.
  5. Open iTunes and add a new Podcast. Insert the above base_url and add myPodcast.rss
Now just drop any music file into the myPodcast Folder. In case of Dropbox, wait until everything is synchronized. When you update your Podcasts in iTunes, it should download the file like in every other podcast.

From now on, you can use your personal podcast to keep track of where you are in longer audio files, like radio recordings. It also works with iTunes-compatible video files.

[robg adds: I haven't tested this one. If you're not a Dropbox user and you'd like to thank Lutzifer for this hint, you can sign up using his Dropbox referral link. This will get him a bit of extra Dropbox storage space.]
    •    
  • Currently 3.30 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (10 votes cast)
 
[10,016 views]  

Create a personal podcast via Folder Actions | 8 comments | Create New Account
Click here to return to the 'Create a personal podcast via Folder Actions' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create a personal podcast via Folder Actions
Authored by: pepijndevos on Apr 23, '10 11:55:33AM

I love the idea of creating a podcast via folder actions, but I think the script can be improved.
Doesn't Applescript have a library for working with XML files?
That would maybe eliminate part of the bash mess at the end.



[ Reply to This | # ]
Create a personal podcast via Folder Actions
Authored by: Dibbler on Apr 23, '10 12:26:59PM

There's a third party scripting addition at http://www.latenightsw.com/freeware/XMLTools2/index.html.



[ Reply to This | # ]
Create a personal podcast via Folder Actions
Authored by: Lutzifer on Apr 24, '10 05:10:23AM

Improvements are welcome :-)

Bash was imho the fastest way to do it, though it looks like a real mess...



[ Reply to This | # ]
This is probably easier done in PHP
Authored by: altotus on Apr 23, '10 12:04:01PM
You don't need folder actions. A better solution is to make the RSS dynamically based on the contents of a folder that you copy your files into (mind you, it presumes that PHP is available, as it is on a stock Mac). For example, put this PHP file in your sites directory, and create a sub-directory there names "podcast" to put your audio files in:

<?php
    header("Content-type: application/rss+xml");
    print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
    <channel>
        <description>My personal podcast</description>
        <link>http://www.nolink.com</link>
        <title>My Podcasts</title>
        <pubDate><?=@date(DateTime::RFC1123)?></pubDate>
        <?php
            $podcastFiles = scandir("./podcast");
            uasort($podcastFiles, "by_date");
           
            foreach ($podcastFiles as $podcast) {
                if (substr($podcast, 0, 1) == ".") continue;
                
                $url = "http://" . $_SERVER['HTTP_HOST'] .
                       ":" . $_SERVER['SERVER_PORT'] .
                       dirname($_SERVER['REQUEST_URI']) .
                       "/podcast/$podcast";
            ?>
                <item>
                    <title><?=substr($podcast,0,-4)?></title>
                    <enclosure type="audio/mpeg" length="<?=filesize("./podcast/" . $podcast)?>" url="<?=$url?>"/>
                </item>
            <? }
            
            function by_date($a, $b) {
                filemtime("./podcast/$a") - filemtime("./podcast/$b");
            }
        ?>
    </channel>
</rss>


[ Reply to This | # ]
Create a personal podcast via Folder Actions
Authored by: flammable on Apr 24, '10 07:33:33AM

No kidding, I'm learning AppleScript now, and it's stuff like this that keeps amazing me.

This is very cool, thanks for sharing!



[ Reply to This | # ]
Create a personal podcast via Folder Actions
Authored by: magir on Apr 24, '10 10:41:39AM

I guess there's already a hint for that, but as it is related...

You're also able to add files to iTunes automatically by moving them in a folder called "Automatically Add to iTunes" (which is created automatically by iTunes within the iTunes Music folder).

I use that and change the kind of my music files to "Podcast" after that. That may not group them as this hint does but you won't need Web Sharing, Applescript and Folder actions.



[ Reply to This | # ]
Create a personal podcast via Folder Actions
Authored by: dgold105 on Dec 08, '10 08:05:19PM

I haven't been able to get this to work. I set it up as per the instructions and it wouldn't work in iTunes once subscribing. I put the feed URL into feed validatior and got the following. Can anyone tell me what I'm doing wrong so I can get it to work.

This feed does not validate.

line 1, column 0: XML parsing error: <unknown>:1:0: not well-formed (invalid token) [help]

{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
Source: http://dl.dropbox.com/u/385008/myPodcast/myPodcast.rss

{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fnil\fcharset0 Monaco;}
{\colortbl;\red255\green255\blue255;\red142\green30\blue0;}
\paperw11900\paperh16840\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\deftab720
\pard\pardeftab720\sl320\qj

\f0\fs24 \cf2 <?xml version="1.0" encoding="ISO-8859-1"?>\
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">\
<channel>\
<description>My personal podcast</description>\
<link>http://www.nolink.com</link>\
<title>My Podcasts/title>\
<pubDate> Wed, 21 Apr 2010 10:35:02 +0200 </pubDate>\
\
</channel></rss>}



[ Reply to This | # ]
Create a personal podcast via Folder Actions
Authored by: SkoshOfSean on May 13, '11 06:40:09PM

I realize this is not a very current topic, but I just stumbled across it as I was searching for the ability to autogenerate a private RSS feed based on the contents of a folder.

The hint has two errors, as best I can tell. In the first piece of code there </title> closing tag has an error. (It is missing the "<"). The hint also says to save the first piece of code as "myPodcast.rss". It needs to be saved as "podcast.rss" in order to work with the second piece of code.

Hope this helps someone as it took me a while to figure out.



[ Reply to This | # ]