Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2023-10-19 (2 days ago) | | Not yet rated by the users | | Total: 10 This week: 10 | | All time: 11,129 This week: 8 |
|
Description | | Author |
This package can generate an RSS feed and gallery for audio files.
It can traverse a server-side directory containing audio files and generate an RSS feed with the list of files.
The package can also generate HTML to display the list of audio files in a gallery Web page.
If the package finds images for each audio file in the scanned directory, it may display them on the gallery Web page and the RSS feed. | |
|
|
Innovation award
Nominee: 5x |
|
Example
<?php
/*
Runs from a directory containing files to provide an
RSS 2.0 feed that contains the list and modification times for all the
files.
*/
require_once('Rss.php');
$rss = new Rss();
function get_m_time_dir($path){
$directory = new RecursiveDirectoryIterator(
$path,
FilesystemIterator::KEY_AS_PATHNAME |
FilesystemIterator::CURRENT_AS_FILEINFO |
FilesystemIterator::SKIP_DOTS
);
$iterator = new RecursiveIteratorIterator(
$directory,
RecursiveIteratorIterator::SELF_FIRST
);
$resultFile = $iterator->current();
foreach($iterator as $file) {
if ($file->getMtime() > $resultFile->getMtime()) {
$resultFile = $file;
}
}
return $resultFile->getMtime();
}
$lastFile = get_m_time_dir('./content/');
header('Content-type: text/xml');
if(file_exists('rss_feed.xml') && (filemtime('rss_feed.xml') >= $lastFile)){
$xmlRss = file_get_contents('rss_feed.xml');
echo $xmlRss;
} else {
echo $rss->generateFeed();
}
|
Details
rss-gallery-generator
Generate a RSS Feed based on a directory containing audio files and automatically save the XML and display the content found in a page/gallery
Info
The RSS generator part was created based in this amazing gist
I got info from files based in getID3. It's a submodule, located in feed/getID3
Usage
-
Download the last release .zip and extract it in your server
-
Put your audio files (just mp3 for now) in feed/content/
You can put images with the same name as the .mp3 files. The script will recognize it and use as cover images for each item
-
Edit the infos of the podcast in <code>feed/Rss.php</code>:
private $feedName = 'My Audio Feed';
private $feedDesc = 'Feed for the my audio files in some server folder';
private $feedURL = 'http://www.mysite.com/audio';
private $explicit = 'NO'; //explicit content?
private $coverImg = '//localhost/kaiceph/img/play_cover.png'; //cover image src
private $copyright = 'Copyright of feed content';
private $language = 'en-us'; //pt-br, en-us
-
Access your_site.xyz/feed/ first, so it will generate the .xml rss feed
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.