Reply to Re: download counter?

Your name:

Reply:


Posted by devospice on 02/19/07 17:14

> > It is. The PHP feed works fine. (http://www.thefump.com/cast.php)
> > But pointing the link tag to a PHP file instead of an audio file
> > generates a "this feed is not valid" error in iTunes.
>
> > ->Later.....Spice
>
> As I said - if the header is correct, it should be OK.
>
> I looked at your link, but I didn't see any php files being pointed to -
> just the mp3 files themselves.

Sorry. Here's the code for the feed. It pulls the most recent 5
entries from the database (ignoring future ones that haven't gone live
yet) and formats it. It's based on the code I use to update my Manic
Mondays podcast (http://www.suddendeath.org/cast/feed.xml) which I've
never had a problem with. But those always point directly to the MP3
file.

->Later.....Spice

<?php

// NOTE: All links point to the site folder, which must be changed
upon launch.

include("functions.php");

// Get the 5 most recent fumps.
$today = date("Y-m-d");
$fumpSQL = "SELECT * FROM fumps WHERE date<=CURDATE() ORDER BY date
DESC LIMIT 5";
$allFumps = getDataFromTable($fumpSQL);

// Calculate the last build date.
$lastFump = $allFumps[0];
$lastDate = $lastFump["date"]; // YYYY-MM-DD
$timestamp = strtotime($lastDate);
$latestBuildDate = date("D, d M Y", $timestamp);

echo "<?xml version=\"1.0\"?>\r\n";
echo "<rss xmlns:itunes=\"http://www.itunes.com/DTDs/Podcast-1.0.dtd\"
version=\"2.0\">\r\n";
echo "<channel>\r\n";
echo "<title>The FuMP</title>\r\n";
echo "<link>http://www.thefump.com</link>\r\n";
echo "<description>The Funny Music Project!</description>\r\n";
echo "<lastBuildDate>".$latestBuildDate." 01:00:00 -0500</
lastBuildDate>\r\n";
echo "<language>en-us</language>\r\n";
echo "<copyright>Copyright ".date("Y"). " FIDIM Interactive, LLC</
copyright>\r\n";
echo "<generator>dirCastv0.4</generator>\r\n";
echo "<webMaster>support@fidim.com</webMaster>\r\n";
echo "<ttl>60</ttl>\r\n\r\n";

echo "<!--iTunes specific tags-->\r\n";
echo "<itunes:category text=\"Comedy\" />\r\n";
echo "<itunes:category text=\"Movies &amp; Television\">\r\n"; //
NEED TO CONFIRM CATEGORY!
echo "<itunes:category text=\"Music\" />\r\n";
echo "</itunes:category>\r\n\r\n";

echo "<itunes:keywords>Sudden Death, Worm Quartet, Luke Ski, Tom
Smith, Rob Balder, Raymond and Scum, fump, comedy, Dr. Demento,
dementia, funny music, funny songs, funny, weird, music</
itunes:keywords>\r\n";
echo "<itunes:subtitle>Funny music from some of todays hottest
dementia acts!</itunes:subtitle>\r\n";
echo "<itunes:summary>The FuMP is a twice-weekly podcast featuring
new, rare, and unreleased songs by some of the biggest names in funny
music. These artists are regularly featured on The Dr. Demento Show
and routinely perform at science fiction conventions and other places
around the country.</itunes:summary>\r\n";
echo "<itunes:image href=\"http://www.thefump.com/logo.jpg\" />\r
\n"; // NEED TO CREATE A LOGO GRAPHIC
echo "<itunes:author>FIDIM Interactive, LLC</itunes:author>\r\n";
echo "<itunes:owner>\r\n";
echo "<itunes:name>Tom Rockwell</itunes:name>\r\n";
echo "<itunes:email>support@fidim.com</itunes:email>\r\n";
echo "</itunes:owner>\r\n\r\n";

foreach ($allFumps as $fump) {

$artist = getData("name", "artists", $fump["artist"]);
$timestamp = strtotime($fump["date"]);
$buildDate = date("D, d M Y", $timestamp);
$link = sprintf("http://www.thefump.com/fumps/%s", $fump["mp3_128"]);
$size = filesize("fumps/".$fump["mp3_128"]);
if ($fump["explicit"] == "1") {
$explicit = "yes";
} else {
$explicit = "no";
}

echo "<item>\r\n";
echo "<!--iTunes specific tags-->\r\n";
echo "<itunes:author>".$artist."</itunes:author>\r\n";
echo "<itunes:duration>".$fump["length"]."</itunes:duration>\r\n";
echo "<itunes:explicit>".$explicit."</itunes:explicit>\r\n\r\n"; //
NEEDS TO BE YES OR NO

echo "<title>".$fump["title"]."</title>\r\n";
echo "<link>".$link."</link>\r\n";
echo "<description>".$fump["description"]."</description>\r\n";
echo "<pubDate>".$buildDate." 01:00:00 -0500</pubDate>\r\n";
echo "<enclosure url=\"".$link."\" length=\"".$size."\" type=\"audio/
mpeg\"/>\r\n";
echo "</item>\r\n";

}

echo "</channel>\r\n";
echo "</rss>\r\n";

?>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация