PHP Classes

PHP RSS Feed Gallery Generator for Audio: Generate a RSS feed and gallery for audio files

Recommend this page to a friend!
  Info   View files Example   View files View files (13)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2023-10-19 (4 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 26 All time: 11,071 This week: 231Up
Version License PHP version Categories
rss-gallery-generato 1.0The PHP License5HTML, XML, PHP 5, Content management
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
PHP Programming Innovation award nominee
October 2023
Number 6
A podcast can be implemented as a PHP application that can generate an RSS feed that lists the podcast episode audio files.

It should also provide a page to present the podcast episodes so that users can see the list and play each episode if they want to listen to the audio.

This package can present a podcast on the website page, including the podcast episode list, the podcast RSS feed, and a gallery of images for the podcast episodes in a way that can be nice for the podcast audience.

Manuel Lemos
Picture of Victor Andeloci
Name: Victor Andeloci <contact>
Classes: 6 packages by
Country: Brazil Brazil
Age: 25
All time rank: 4394355 in Brazil Brazil
Week rank: 95 Up7 in Brazil Brazil Up
Innovation award
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

Cover Image

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

  1. Download the last release .zip and extract it in your server
  2. 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

  3. 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

  1. Access your_site.xyz/feed/ first, so it will generate the .xml rss feed

  Files folder image Files  
File Role Description
Files folder imagecss (2 files)
Files folder imagefeed (3 files)
Files folder imageimg (1 file)
Files folder imagejs (1 file)
Files folder imageparts (1 file)
Files folder imagewebfonts (3 files)
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  css  
File Role Description
  Accessible without login Plain text file all.min.css Data Auxiliary data
  Accessible without login Plain text file master.css Data Auxiliary data

  Files folder image Files  /  feed  
File Role Description
  Accessible without login Plain text file index.php Example Example script
  Plain text file Rss.php Class Class source
  Plain text file Writer.php Class Class source

  Files folder image Files  /  img  
File Role Description
  Accessible without login Image file play_cover.png Icon Icon image

  Files folder image Files  /  js  
File Role Description
  Accessible without login Plain text file player.js Data Auxiliary data

  Files folder image Files  /  parts  
File Role Description
  Accessible without login Plain text file player.html Data Player template file

  Files folder image Files  /  webfonts  
File Role Description
  Accessible without login Plain text file fa-brands-400.svg Data Auxiliary data
  Accessible without login Plain text file fa-regular-400.svg Data Auxiliary data
  Accessible without login Plain text file fa-solid-900.svg Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:26
This week:0
All time:11,071
This week:231Up