Sometimes I do generate audio files and sometimes I tend to share them with others. To get away from push-notification, I started employing RSS files (that is, I create a podcast).

Basics

The basic idea of a podcast is nothing else than an XML file containing a list of references to file URLs. To add some convenience, several further attributes are typically embedded.

My initial situation is that i put files on a web server into a directory and that's it. All it needs now is some clever script to create some XML file from it. And since I do love using the file system to store data (who doesn't?), I use it to store all information for additional attributes in hidden files. And -- once more my laziness beatrs its own record -- instead of a manual listing their names and meanings, those files ar just drive-by created.

Usage example

We'll start with a minimal example. I do have a directory with my mp3 file I want to publish:

[ad001@glas ~/svn/develope/perl/dir2podcast/demo]$ ls -lah
total 8
drwxr-xr-x  2 ad001  ad001   512B Oct 27 19:24 .
drwxr-xr-x  3 ad001  ad001   512B Oct 27 19:24 ..
-rw-r--r--  1 ad001  ad001     0B Oct 27 19:24 mysupertrouperaudiofile.mp3
Now, after running my script for the first time, a bunch of files is added:
[ad001@glas ~/svn/develope/perl/dir2podcast/demo]$ ls -lah
total 8
drwxr-xr-x  2 ad001  ad001   512B Oct 27 19:30 .
-rw-r--r--  1 ad001  ad001     0B Oct 27 19:30 .-author
-rw-r--r--  1 ad001  ad001     0B Oct 27 19:30 .-copyright
-rw-r--r--  1 ad001  ad001     0B Oct 27 19:30 .-description
-rw-r--r--  1 ad001  ad001     0B Oct 27 19:30 .-imageUrl
-rw-r--r--  1 ad001  ad001     0B Oct 27 19:30 .-language
-rw-r--r--  1 ad001  ad001     0B Oct 27 19:30 .-link
-rw-r--r--  1 ad001  ad001     0B Oct 27 19:30 .-title
drwxr-xr-x  3 ad001  ad001   512B Oct 27 19:24 ..
-rw-r--r--  1 ad001  ad001     0B Oct 27 19:30 .mysupertrouperaudiofile.mp3.author
-rw-r--r--  1 ad001  ad001     0B Oct 27 19:30 .mysupertrouperaudiofile.mp3.description
-rw-r--r--  1 ad001  ad001     0B Oct 27 19:30 .mysupertrouperaudiofile.mp3.pubDate
-rw-r--r--  1 ad001  ad001     0B Oct 27 19:30 .mysupertrouperaudiofile.mp3.title
-rw-r--r--  1 ad001  ad001     0B Oct 27 19:24 mysupertrouperaudiofile.mp3
... as you may notice, it's one file per podcast attribute. The contents which shall be written to the attribute is just to be put in the relative file: For the global podcast attributes, the files are prefixed with .-; for attributes specific to a file, the prefix is .filename. As available, defaults are used -- e.g. for title for files defaults to file name, pubDate globally is set to date of script execution, for each file to the file date (but can be overridden from the respective file).

Download, License

The dir2podcast script is licensed under BSD license and can be found at down/dir2rss.pl. Lay back, have fun, enjoy -- and run responsibly. Yet again, not a masterpiece of responsible programming. It had to be written from scratch in roughly 4 hours.

Stichworte:


Impressum