dirCaster v0.1 is a php script that allows one to very easily start Podcasting mp3 files from their web host. This allows original content creators to easily provide a feed for iPodder, jPodder, etc.
Drop the dircaster.php script into a directory and it will generate an RSS feed suitable for iPodder, etc based off the MP3 files in that directory. To ‘cast a new file, simply upload it to the directory containing the script.
Check out Brad’s remix feed to see an example of dirCaster in operation.
More information here.
The link for downloading the script doesn’t work (looks like an issue with the relative link).
I recommend appending “.nyud.net:8090″ to the domain for podcasted files, in order to take advantage of NYU’s Coral caching service (it’s like freecache, except for it actually works) and thus save dramatically on bandwidth. For example, an enclosure from my podcast looks like this:
http://dentonharekrishna.org.nyud.net:8090/prabhupada-casts/advancement_of_maya.mp3
Yup, you’re correct. The command line rewriter was killing the URL. It’s fixed now. Duh me.
I didn’t know about the nyud.net service, is there somewhere with more informtion? The site itself appears to be pretty slow and doesn’t seem to say much.
The site for Coral is at http://www.scs.cs.nyu.edu/coral/
You’re right that they don’t offer a great deal of info. Maybe it’s one of those things where I’m trying to think too hard, when actually it’s just really really easy. However, I’m with you on this one: I’d like to know more.
I browsed through the mailing list archives and joined their discussion list (dead silence so far).
Basically, it seems to work a lot like archive.org’s Freecache, but Freecache seems to be down a lot, which is really a showstopper.
I’ve been monitoring my bandwidth consumption, and it *is* going up, but not dramatically. I suspect that often-requested items remain in their cache, and less-often-requested items get bumped out and then have to be served up and cached again.
They *say* that anyone with a cable modem and a server should be able to host a site with tons of big files… which tempts me to get some old box together with hundreds of gigs of storage, but I’m still not confident that it would work as it should.
Interesting. A neat way to do it would be to have multiple URLs for a given mp3. iPodder keeps track of which filenames it has already downloaded so it would only pull the file from the second link if the first had failed, etc. It’d make for a sloppy feed but if iPodder was the only daemon involved I don’t think anybody would notice.
I’m not sure how much bandwidth is really an issue anyway. It’s not completely free, but it is really cheap these days. If you’re doing enough traffic to need it, you can probably find a way to afford it.
Hey, nice job on the script. But you (guess this actually goes to Brad) need to change the parameters on your own feed. When I use iPodderX to subscribe to it, the title comes up generic - “dirCasted Podcast” - and if you double click on the title, it tries to find myWeblog.com instead of your site. Edit your php and you’ve got it.
I’m not a programmer so other than that I can’t offer any useful feedback. Except…
Can you do one for the video bloggers out there (looks for .mov files) and one for the bittorrent posters (looks for the .torrent files)? Don’t need the ID3 tags.
Or one that checks for any of a range of media file formats? Take a look at MT-Enclosures, a plugin that Brandon Fuller made. Of course yours is more generally useful, doesn’t require MT.
It Lives!!!
So I finally got my answering machine/voice modem working last night.
Yay!! Now I just need to remember to not let MS download that new modem driver onto my machine. (Guess that will be stuck in my updates forever.)
For the podcasters out there…
Thanks for putting together dircaster. Unfortunately, I am having trouble getting it to work. I am able topull in the header information, but I cannot get the ITEMS to pull in. You can see the feed here…
http://webword.com/podcasts/dircaster.php
I’ve tried many different MP3’s. I’ve tried using one MP3, and a whole list of MP3’s in the directory. The dircaster.php script and MP3’s are in a directory on webword.com called podcasts. (You can see that in URL above.) I’ve also tried opendir versus getdir in the script and that didn’t help. (I’m not a developer; just playing.) Please ask me some questions about what I am doing. I really want to get this working.
By the way, the reason I am doing this at all is because there isn’t a module for an RSS 2.0 feed using PostNuke, which is the CMS I use for my usability blog. Grrr.
Thanks for you help!
For detailed information on Coral, you might want to check out one of the papers describing the system:
http://www.scs.cs.nyu.edu/coral/docs/coral-nsdi04.pdf
I’m still having issues. I know that at least one other person is having the issue that I am having. If anyone reading this has an answer, please provide it here or throw me an email. If (when?) I get an answer, I’ll post here and a few other places. Thanks!
Another person was having the same problem as me. He did some investigation and found out that his file name (e.g., file.wav.mp3) was not well formed. He removed the .wav from the file name and it worked great. Similarly, I was using .MP3 but when I changed my file name to .mp3 (lower case) everything worked great. Lesson: Watch those file names!
Hey. Very sorry I haven’t been active with this, I’ve been busy with travel. Thanks everyone for the feedback, I’m glad so many people have found dircaster useful.
I’m planning to release dircaster 0.2 in a week or so, it will correct the issues with odd files names and URLs missing the root domain. Stay tuned.
Could dircaster 0.2 call ID3 v2 tags Inlcuding comments) rather than v1 - or have an option switch?
Great script!
Here’s a suggested snippet of code to add to 0.2; allow a foo.tag file to override the id3 tags found in foo.mp3, so you can more easily set up mp3s without having to edit the id3 tags directly, and can go beyond the 30 character limit. Just add this code to the start of getid3:
…
function getid3 ($file)
{ // read the ID3 tag from an MP3 file
// start of new code
// .tag file info will override tags in MP3 file
$tagfile = substr($file, 0, strlen($file)-3) . “tag”;
if (file_exists($tagfile))
{ //after verifying the file exists,
$fp = fopen($tagfile, “r”);
$this->title = rtrim(fgets($fp, 30));
$this->artist = rtrim(fgets($fp, 30));
$this->album = rtrim(fgets($fp, 30));
$this->year = rtrim(fgets($fp, 4));
$this->comment = rtrim(fgets($fp, 30));
$this->genre = rtrim(fgets($fp, 1));
fclose($fp);
return true;
}
// end of new code
if (file_exists($file))
…
A tag file is just a text file with the 6 lines of info above:
Hour Hour
Firesign Theatre
June 21 KPFK broadcast
1970
comment
?
Also, I can’t find a table of the “genre” codes, but I read on one web page that the currently defined genre codes are 0..114, so this line:
$this->genre = stripJunk(trim(fread($fp, 1)));
…would throw out any genre codes below 32 (space). stripJunk shouldn’t be called for the genre code byte (though it isn’t used anywhere - yet).
Whoops, obviously to get around the 30 character limit, the fgets() calls should have something like 255 as the lengths, not 30/30/30/4/30…
I just can’t stop fiddling with it; I added a seventh “description” field from the .tag file that gets tacked onto the generated description of title - album - artist so you can be a little more verbose/descriptive, and if all of these are null strings, the description is the filename:
change:
echo (”$mp3file->title - $mp3file->album - $mp3file->artist \n”);
to:“); \n”);
echo (”
if (”$mp3file->title$mp3file->album$mp3file->artist” != “”)
echo (”$mp3file->title - $mp3file->album - $mp3file->artist”);
else if ($mp3file->description == “”)
$mp3file->description = $filename;
echo (”$mp3file->description
And add these lines in the obvious places to getid3():
var $description;
$this->description = rtrim(fgets($fp, 255));
again, whoops: the line:
echo (”$mp3file->description\n”);
should be:
echo (”$mp3file->description\n”);
argh! the < > tags are getting removed by the HTML display!
You can’t just copy & paste these parts…
Let’s see if this comes out right; new code only:
echo (”<description>”);
if (”$mp3file->title$mp3file->album$mp3file->artist” != “”)
echo (”$mp3file->title - $mp3file->album - $mp3file->artist”)
;
else if ($mp3file->description == “”)
$mp3file->description = $filename;
echo (”$mp3file->description</description>\n”);
Hey, you did a great job. I like this feature and im using it - but got some trouble. the xml-file does’t have the id3-tags. But im sure, my m3-files have some. any idea, why the script can’t read them?
hi again, got it, it was the id3v1 problem…
To fix the problems people have had with filenames with dots in them, or .MP3 instead of .mp3 as the suffix, change this line in getDir:
if (stristr($file, “.”) == “.mp3″) {
to this:
if (strtolower(substr($file, -4)) == “.mp3″) {
I am having a bit of trouble with the script, when I look at it via IE I see the enclosure URL as follows:
enclosure url=”http://firstpodcast128.mp3″
That isn’t right - it isn’t looking in the correct directory. Where should it be picking up the site URL from and can you think why it wouldn’t work. Could it be because I am running my webserver on port 8081 so my URL to the podcast directory is:
http://mysite.com:8081/podcast/dircaster.php
The code that generates the root of the enclosure URL is:
$rootMP3URL = “http://” . $HTTP_HOST . $REQUEST_URI; // Detect script base URL
$rootMP3URL = substr($rootMP3URL, 0, strrpos ($rootMP3URL, “/”)); // Trim off script name itself
The first line is supposed to construct the URL to the script, and the second line remove the “/dircaster.php” part at the end.
It looks like your PHP server is returning null strings for $HTTP_HOST and $REQUEST_URI or something like that. Try making a test.php that just prints out what these are.
Here’s php.net on URL construction; is your page in a frame?
http://us2.php.net/manual/en/ref.url.php
For a worst case, comment out the two $rootMP3URL calcs and just assign it:
$rootMP3URL = “http://mysite.com:8081/podcast”;
You’ll have to change your script if you move it to a new directory, though.
hi, here is nocolas first of all: very nice job!
:
but, i have a feature request
it ouhgt be pretty cool, if you might have the ability to chose the folder (URL) where the mp3 files are lokated.
So you would be able to host the script, on host “A” and all the MP3’s on host “B”.
why do i ask: my problem is, that my host (B) offers me unlimited bandwidth and a large amount of space but no PHP functionality, my other host (A) got PHP, but no space left.
so i would apprecciate any sollution
THANKS
ok, we figured out, a sollution.
but, how can i contact the author of this page… there is no email link available…
ok, remotedircaster is now released. check it out, the documentation is in english
download here:
http://pochoirs.de/reblog/Remotedircaster.rar
I have finished moving (to England of all places) and will get back on dirCaster this week.
Nice work Nicolas, I never even thought of hosting from an FTP server like that.
Planned features are:
- ignore case of filename
- works with additional periods in filename
- id3v2 tag support
- support for .tag files containing file information to go with mp3 files
Any other suggestions?
I’ve just found someone with malformed podcasting software or something; every single visit, he downloads everything, every time. I’ve added an array of IPs to ignore if you’d like to add it:
// Array of IPs to ignore
// (downloads everything each visit, or otherwise abusive)
$idiots = array(
“24.47.255.6″,
);
…
$ip = $HTTP_SERVER_VARS[’REMOTE_ADDR’];
foreach ($idiots as $idiot) {
if (strcmp($ip, $idiot) == 0) {
[ignore message, or whatever you like goes here]
return (0);
}
}
I put it after the standard headers, but before the directory search, and print a message about the IP being blocked for abuse in tags with an email address to get it unblocked.
I’ve looked and looked but can’t see a download link for this? On any of the blogs or pages regarding direcaster?
oops typo - I meant dircaster…sorry
me also stupid
where can i find the script ??
greetins
Having the same problem as tim and stupid, can’t find the download link which makes me feel like a complete idiot.
here is the link guys : http://www.shadydentist.com/wordpress/software/dircaster03.tgz
we feature the new version on our site.
and by the way, a new remote-dircaster version is out now.
with debug-mode
code optimisation and more features check it out:
www.pochors.de/reblog/rdc.rar
oh, sorry, typo (where is the “edit button”? )
http://www.pochoirs.de/reblog/rdc.rar
Any guidance on what I can do to edit this to use it for MP4 files?
hope this is a quick question - anyone know what it would take to get this script to work with quicktime movies instead of mp3?
Hi all. I’ve got a separate set of scripts that does this for ID3v2 tagged MP3s. I had trouble with tags generated by iTunes with the hacked version above. Let me know if you’re interested.
I’m also putting together a php RSS 2.0 library with podcasts in mind– I’ll post when that stuff is done.
Also, I started an IRC channel on Freenode called rss2. If you’re working on this stuff, come join!
I’d like to add the ability of having the script grab files from a different directory. Reason being I have an administration panel on the backend of my site and I want to add an upload script so I can just upload the files from the website. In order to acheive this I have to have the mp3 directory permissions set to 777. Most webhosting companies won’t let you run a script in a folder that has the permissions open to the world so I have to have the script outside the upload folder.
I’ve been messing with it for a bit now and I can get it to parse the directory but I can’t for the life of me figure out how to get the links to work out right.
Any ideas?
A Better Dircaster for the FastCast
In my quest to make podcasting as easy as possible, I’ve hacked the dircast (turns a directory of mp3s into a podcast) to support getID3() (reads the ID3 tags; artist, album, comments, from an mp3 file). I’ve also cleaned up the code a li…
Great job
I hope I can try it out soon.
<a href="http://mawagapb.joolo.com/greek-forumcom/" rel="nofollow"> greek forumcom </a>
<a href="http://menocikb.freewebhosting360.com/as-tu-vucom/" rel="nofollow"> as tu vucom </a>
<a href="http://rutityqb.freehostplace.com/team-hondacom/" rel="nofollow"> team hondacom </a>
<a href="http://rutityqb.freehostplace.com/americanexpresscom-deltabonus/" rel="nofollow"> americanexpresscom deltabonus </a>
<a href="http://nocuxicb.987mb.com/real-torcom/" rel="nofollow"> real torcom </a>
<a href="http://menocikb.freewebhosting360.com/ky-speedwaycom/" rel="nofollow"> ky speedwaycom </a>
<a href="http://nocuxicb.987mb.com/future-activecom/" rel="nofollow"> future activecom </a>
<a href="http://gezideqb.k2free.com/pepsismashcom-search/" rel="nofollow"> pepsismashcom search </a>
<a href="http://voqogicb.hostedwith.us/working-vancouver-jobs-canadacom/" rel="nofollow"> working vancouver jobs canadacom </a>
<a href="http://gezideqb.k2free.com/dmozorg-linkdomain-site-youtubecom/" rel="nofollow"> dmozorg linkdomain site youtubecom </a>
<a href="http://culeterb.jvl.com/whirlpoolcom-accessory/" rel="nofollow"> whirlpoolcom accessory </a>
<a href="http://nocuxicb.987mb.com/linkdomain-dictionaryreferencecom/" rel="nofollow"> linkdomain dictionaryreferencecom </a>
<a href="http://menocikb.freewebhosting360.com/http-owcpdolacs-inccom-portal-maindo/" rel="nofollow"> http owcpdolacs inccom portal maindo </a>
<a href="http://culeterb.jvl.com/4-dreems-ecorpcom/" rel="nofollow"> 4 dreems ecorpcom </a>
<a href="http://qofimybb.hothostcity.com/dragon-modelscom/" rel="nofollow"> dragon modelscom </a>
<a href="http://gezideqb.k2free.com/bellca-e911/" rel="nofollow"> bellca e911 </a>
<a href="http://mawagapb.joolo.com/victory-hondacom/" rel="nofollow"> victory hondacom </a>
<a href="http://nivojucb.gigazu.com/farishag-frontiernetnet/" rel="nofollow"> farishag frontiernetnet </a>
<a href="http://culeterb.jvl.com/debt-diet-oprahcom/" rel="nofollow"> debt diet oprahcom </a>
<a href="http://cuvodutb.my3gb.com/web-sourcenet-html-code-charthtm/" rel="nofollow"> web sourcenet html code charthtm </a>