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 (2 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 10 This week: 10All time: 11,129 This week: 8Up
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.

Picture of Victor Andeloci
Name: Victor Andeloci <contact>
Classes: 6 packages by
Country: Brazil Brazil
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:10
This week:10
All time:11,129
This week:8Up