User Tools

Site Tools


podcast_generator

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
podcast_generator [2020/01/03 16:14]
neil created
podcast_generator [2020/01/03 16:46] (current)
neil
Line 44: Line 44:
 */ */
 if(empty($_REQUEST['​dirname'​])) if(empty($_REQUEST['​dirname'​]))
-   dir("​Missing mp3 directory"​);​+   die("​Missing mp3 directory"​);​
  
 $dir_name = basename($_REQUEST['​dirname'​]);​ $dir_name = basename($_REQUEST['​dirname'​]);​
 +
 +if(preg_match('/​[^a-z_\-0-9]/​i',​ $dir_name))
 +   ​die("​Invalid directory"​);​
  
 if(!empty($dir_name) and is_dir($mp3_dir.$dir_name)) { if(!empty($dir_name) and is_dir($mp3_dir.$dir_name)) {
Line 57: Line 60:
    ​die("​Missing info.json"​);​    ​die("​Missing info.json"​);​
  
-   ​header("​Content-Type:​ application/​rss+xml;​ charset=ISO-8859-1");+   ​header("​Content-Type:​ application/​rss+xml;​ charset=utf-8");
  
    $json = json_decode(file_get_contents($meta_file),​ true);    $json = json_decode(file_get_contents($meta_file),​ true);
Line 148: Line 151:
 </​code>​ </​code>​
  
 +The lengths/​duration above are just set to 32 minutes (this will be auto-updated by your client when you start to play the file). ​ You can set these automatically if you have access to the mp3info program (''​apt install mp3info''​) then replace the duration (''​00:​32:​16''​ with ''​$duration''​) and add this code around line 61, just after the $size variable is set:
 +<code php>
 +$duration = gmdate("​H:​i:​s",​ `mp3info -p "​%S"​ "​$file"​`);​
 +</​code>​
  
podcast_generator.1578068070.txt.gz ยท Last modified: 2020/01/03 16:14 by neil