GithubHelp home page GithubHelp logo

ben-xo / dir2cast Goto Github PK

View Code? Open in Web Editor NEW
140.0 6.0 18.0 1.04 MB

Turn a directory of MP3s into a podcast - automatically.

Home Page: http://www.ben-xo.com/dir2cast

License: BSD 3-Clause "New" or "Revised" License

PHP 99.89% Shell 0.11%
php podcast podcasts podcasting podcast-generator mp3 mp3-files automatic folder rss

dir2cast's People

Contributors

ben-xo avatar denilsonsa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dir2cast's Issues

Remove .mp3 / .m4a Extension On RSS Feed Title

hey i have some .m4a files on my webserver and all is working fine but is it possible to remove the media extensions on the Podcast Showtitles? i have no id3tags on my files. dir2cast use the title of the filesnames. like "DJ - Party.m4a the Show is called "DJ - Party.m4a"

is it possible?

Duration Tag is Missing from the RSS

RSS is generated properly and I have been already submit it to iTunes. However, I noticed that the <duration> tag is missing from the RSS. I confirmed that the getID3 folder is in the same folder as the dir2cast.php. Could you help me resolve this issue? All of my files are mp3.

Images in item section with full system path

I have problems with images in item section of podcast:
Images are written with full filesystem path, instead of url:

<item> 
xxxxxx 
<itunes:image href="/var/www/users/show/www/show1/show_1.jpg"/> 
xxxxxx 
xxxxxx 
<pubDate>Tue, 06 Mar 2018 12:22:22 +0000</pubDate> 
xxxxx 
<image>/var/www/users/show/www/show1/show_1.jpg</image> 
</item>

Thanks, have a good day!

Still shows 10 items after increasing item count

@ben-xo I uncommented ITEM_COUNT in the ini file and made it 9999. But the php file still shows 10 items only. I tried reducing the default Expiry time etc. but still 10 items. Am I forgetting to change something or is this a bug? I tried both the stable version and with the id3 cache testing version.

Podcast feed giving error in Pocket Casts

The Pocket Casts app is the best free app for both iOS and Android. It even shows all the 1000s of episodes in the feed unlike Apple Podcasts which shows only 300. When I add my https://gorich.org/dir2cast.php feed to Pocket Casts it first some error that feed is not proper and then now it is constantly showing the error: Check your internet connection and try again, even though it is downloading episodes from other podcasts fine with the internet connection. Please @ben-xo fix the podcast feed with Pocket Casts otherwise I can't share my dir2cast feed with anyone as mostly everyone listens on their phones nowadays. Thanks. I have just donated $50.

Support season tag

It would be nice to have support for the season tag. iTunes supports <itunes:season> as an optional episode tag and there is the TPOS (part_of_a_set) ID3 tag which could be used.

Could you please add support for mp4 video files too?

I want to generate a video podcast feed for a particular folder as video podcasts are also becoming quite popular as they can download the full video episode at original audio quality and watch then watch it on youtube. You could put the name of the video file as the name of the episode and the same as the description I guess. Or any other way possible.

I can pay for your time to adding mp4 video episode support. Please let me know. Thanks.

Episode image in root folder

Hi, I'm trying to setup a podcast in a subfolder.

My problem is, that dir2cast extracts the .jpg covers from the .mp3 files in folder with dir2cast.php and not in the folder with the mp3 files. But in the rss feed the cover image urls point to the correct folder.

Do I need to configure something additionally?

current structure:

/var/www/dir2cast.php
/var/www/dir2cast.ini
/var/www/episode_001.jpg # extracted by dir2cast.php
/var/www/podcast/dir2cast.ini
/var/www/podcast/episode_001.mp3

wanted structure

/var/www/dir2cast.php
/var/www/dir2cast.ini
/var/www/podcast/dir2cast.ini
/var/www/podcast/episode_001.mp3
/var/www/podcast/episode_001.jpg # extracted by dir2cast.php

Bug: Some characters break the feed

I put Radio24syv sender uafhængige nyheder hver time, døgnet rundt - når klokken bliver hel. into description.txt and this broke the feed. Removing æ, ø and å from the description made it working again.

If I leave it in, I don't see a description, image or files. It's just the headline that's left.

This seems to be a bug. Using CentOS 7 server.

Support for .m4b files

Hello,

Thank you for this very useful piece of software! I am wondering if it would be possible to add support for the .m4b format?

I own several audiobook files in .m4b format, and using dir2cast to bring them into my phone's podcast client would make for an ideal listening experience!

Error message

Is there the possibility to just return a 404 error, when the directory (or media item) can't be found? I think it would be nice to not return the directory path to the user and instead return a proper HTTP error code.

Tuning the script for huge collections of media on the server

As suggested by you @ben-xo, opening a new issue. Maybe the script generating a full static cached file once a day automatically instead of the server doing all the heavy lifting on the fly for every access to the file. I know we can just copy the generated code manually into a static feed file everytime we upload new files but will be great if the script is automated to do that or something.

default item title to mp3 filename if no id3 tag

Love this script, works great. However, I tried it on some mp3 files that apparently don't have any id3 tag info to use as the title, so I see (untitled) in the <title> tag. At least I assume that's why it's happening. Any way you could fall back to using the filename of the mp3 file instead? At least there would be something to display then in my podcast player. Thanks!!

Duplicated item attributes

In my rss feed, all the attributes in the itunes namespace are duplicated for all item elements.

Maybe it has something to do with the podcast episodes being in a subfolder.

Example:

<item>
  <itunes:author>Author</itunes:author>
  <itunes:duration>0:30:00</itunes:duration>
  <itunes:summary>The summary</itunes:summary>
  <itunes:subtitle>Author</itunes:subtitle>
  <itunes:image href="https://example.com/podcast/Episode_1.jpg"/>
  <itunes:author>Author</itunes:author><!--here starts the duplicated element-->
  <itunes:duration>0:30:00</itunes:duration>
  <itunes:summary>The summary</itunes:summary>
  <itunes:subtitle>Author</itunes:subtitle>
  <itunes:image href="https://example.com/podcast/Episode_1.jpg"/>
  <title>Episode 1</title>
  <link>https://example.com/podcast/Episode_1.mp3</link>
  <pubDate>Sat, 20 Aug 2022 12:00:00 +0000</pubDate>
  <description><![CDATA[]]></description>
  <image>https://example.com/podcast/Episode_1.jpg</image>
  <enclosure url="https://example.com/podcast/Episode_1.mp3" length="10000" type="audio/mpeg"/>
</item>

Error: fopen(/var/www/CriticalRole/temp/bb4784c507a72f843b617cb5601ec6d6__var_www_CriticalRole.xml): failed to open stream: No such file or directory (on line 948 of /var/www/CriticalRole/dir2cast.php)

Hi there. I know there hasn't been any activity here in ages, but I figured it's worth a shot. I've got a directory of MP3s on an ubuntu 12.04 server with the LAMP stack, PHP 5.3, but I'm getting this error when trying to set up. I left the ini totally blank, but for whatever reason, this is happening. Any idea why?

file ordering in xml file

There doesn't seem to be any ordering in the generated dir2cast XML file. When generating a podcast or audiobook rss, it would be nice to have them in title/track order or something like that. Instead, the XML file lists the mp3s in no particular order.

Add Goolgle Podcast Support

Hey can u please add Google Podcast RSS Support?

Like

<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"> <channel> <title>Test Podcast</title> <googleplay:owner>[email protected]</googleplay:owner> <googleplay:author>PodcastAuthor/googleplay:author> <description>Description</description> <googleplay:image href="https://www.example.com/podcasts/dafnas-zebras/img/dafna-zebra-pod-logo.jpg"/>

ITUNES_CATEGORIES not supporting multiple categories

Hello,

Apologies if this isn't the correct forum for this, but I am unsure how to contact the developer for support. I am a user of this script (www.eventalleyshow.com/podcast/dir2cast/dir2cast.php) but am having issue with the ITUNES_CATEGORIES section. If I use multiple categories, or even one category with multiple words (eg Management & Marketing), the PHP reports a "0" in it's place. I've even used the example provided in the package and can report the same issue.

Any help on this would be greatly appreciated. This script has been a great help. Feel free to email me directly at [email protected] if you would prefer.

Regards,

Suggestion: correct headers

Due to the correct UTF-8 headers of generated podcast file
I suggest a change
at line around 681 to 687
(sorry for mistake in my previous post
#12)

	public function http_headers()
	{
		header('Content-type: application/rss+xml; charset=UTF-8');
		header('Last-modified: ' . $this->getLastBuildDate());
	}

to

	public function http_headers()
	{
		header('Content-type: text/xml; charset=UTF-8');
		header('Last-modified: ' . $this->getLastBuildDate());
	}

all the best

New install doesn't update if dir2cast is added after the media files

Hi, I can't get dir2cast to update the feed when a new file is added to its directory. Deleting a file from the directory also doesn't cause any changes.

If I delete the contents of /temp then it refreshes appropriately but I'd prefer not to have to do this every time, if possible.

Details: I'm running dir2cast on a Raspberry Pi 4 in the /www folder of a SWAG docker container. Otherwise my .ini file is stock.

Include all mp3's

Love this little program!

So far I'm just trying it out. And I'm wondering about "Number of items to show in the feed" with defaults to 10. I would want it to include all the MP3's in the folder. Is that possible in some way? Otherwise see this as a feature request.

Mattias in Sweden

Is it possible to have subfolders in mp3 folder?

Hi.
Some of my podcasts are daily and ongoing for a few years now, which makes a lot of files. Right now I have them sorted by the year in subfolders. Is there a way that the script would still work?

Thank you very much.

Get an image from id3 tag [feature request]

Hi.
Is there any possibilty to implement this feature: get image from id3 tag if there is one.

Possible implementation:
If there is an image in mp3 tag, save it in the same folder as mp3 file with name: mp3_filename.jpg
and if there is an image with name: "mp3_filename.jpg" insert it in podcast item, otherwise take image,jpg (default podcast image).

I don't have the knowledge to do it so any help would be much appreciated!

Not Items found in... (question)

Hi,,

thanks for developing dir2cast. Very useful for me.

Now I've got a question. I've installed dir2cast to another server.
Same configuration, but I get "No Items found in /path/path".

The path exists, the files exist, they're publicly accessible and it works with the exact same configuration. What could cause this?

dc7ia

it doesn't generate the XML file

Thanks for fixing the other issue, however, I have tried the file in a different config and still, it is not generating the XML path for iTunes submission.

i did the following in .ini file:


; If you want the script to write the RSS to a file instead of to stdout
; you can set OUTPUT_FILE. This is useful if your RSS takes a long time 
; to generate and you would not ever want a podcast client to trigger a 
; cache refresh. You probably would want to setup dir2cast.php so only
; You run it after adding new files to the directory.
;OUTPUT_FILE = podcast.xml

Testing failures

When I run through the test process, I get several "Failed asserting that two strings are equal." errors. They're all issues where I customized dir2cast.ini as directed.

I get two errors that seem more significant:

SettingsHandlerTest::test_cli_media_dir_but_no_permissions_404
Failed asserting that exception of type "ExitException" is thrown.

SettingsHandlerTest::test_GET_media_dir_but_no_permissions_404
Failed asserting that 404 matches expected false.

/config/www/test/SettingsHandlerTest.php:340

I think I've addressed any permissions issues by mapping a working temp folder based on the directions in the docker-compose.yml file, but these issues persist. What should I do?

Tags from JSON (or other source?)

Is it possible to specify a JSON file or other file which contains tags for a specific media file?

More specifically, I want to be able to override some tags, including <pubDate> and <author>. Would it be possible that if a .json file with the same filename exists, it could be checked for valid tags, and if they are present then use those instead?

Adding support for RFC 5005 Feed Paging and Archiving

I just heard about this RFC. I'm going to work on adding support for RFC 5005 to dir2cast. My feed is at 1.2MB containing around 350 shows over 10 years. I hate orphaning the old shows so this sounds like a good solution. I wonder how many clients support this RFC...

No itunes:explicit tag

Hi.
Itunes does not validate rss feeds without itunes:explicit tag.
I added it to dir2cast.php and attached it below. I set default value to 'no'. You can add EXPLICIT to .ini file.

dir2cast.zip

ID3 tags fail on large files

For mp3 files over ~250 MB, I am unable to read the ID3 tags. The feed still loads, but for those items, the description is blank and the title is set to "(untitled)."

5 errors in feed including item should contain a guid element

Dear @ben-xo, If I try to validate my feed at https://validator.w3.org/feed/ it shows the following 5 errors:

(1) If I add an itunes category like Society & Culture > History for example, the feed returns a 0 for the itunes category, maybe due to the "&" symbol. If I replace "and" instead of this "&" then the above validator shows invalid category. So it needs the exact & instead of and I think. Also sometimes even the subcategory has "&" like: Society & Culture > Places & Travel. So please fix this both category and sub-category.

(2) w3.org gives the following error for all items:

This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

item should contain a guid element

From the RSS 2.0 Specification:

It's recommended that you provide the guid, and if possible make it a permalink. This enables aggregators to not repeat items, even if there have been editing changes.

A frequently asked question about < guid >s is how do they compare to < link >s. Aren't they the same thing? Yes, in some content systems, and no in others. In some systems, is a permalink to a weblog item. However, in other systems, each is a synopsis of a longer article, points to the article, and is the permalink to the weblog entry.

Additional useful information can be found here:

RSS Duplicate Detection

Solution

Add a different, unique, and unchanging guid to each item. See http://scripting.com/rss.xml for an example.

(3) If I set the itunes:explicit to "no" in the ini which is needed to stop the missing explicit error, then it does not add the explicit code in the feed at all and thus it shows the below missing itunes:explicit error. I think it should still add the itunes:explicit code with "no".

Missing recommended iTunes channel element: itunes:explicit

(4) Fourth error is: "Email address is missing real name" for this line:

<webMaster>[email protected]</webMaster>

Explanation

According to the RSS Advisory Board's Best Practices Profile, the recommended format for e-mail addresses in RSS elements is [email protected] (Real Name), as in the following example:

<managingEditor>[email protected] (Frank Luksa)</managingEditor>

Solution

Add a real name, or prefered pseudonym, after the email address, surrounded by parenthesis.

(5) Another small bug I found is if I add a pipe separator | in the podcast title in the ini, it returns a 0 for the podcast title in the feed. I have used - instead so not a big issue, just letting you know.

Suggestion: correct UTF-8 headers

Dear Ben, thanks for your work!
Due to the correct UTF-8 headers of generated podcast file
I suggest a change
at line around 681 to 687

public function http_headers()
	{
		header('Content-type: application/rss+xml');
		header('Last-modified: ' . $this->getLastBuildDate());
	}

to

	public function http_headers()
	{
		header('Content-type: application/rss+xml; charset=UTF-8');
		header('Last-modified: ' . $this->getLastBuildDate());
	}

all the best

Using MP3_URL but still pass subfolder path

I had the issue where the default dir2cast.ini was not working for file links and the path showed up as 'file:///path/dir2cast/cast1.mp3' I resolved this problem by setting MP3_URL to 'domain.com/dir2cast'. The file links then became to 'domain.com/dir2cast/cast1.mp3'

Unfortunately, to get this to work for subdirectories, a unique dir2cast.ini file is required in each subdirectory, with the MP3_URL set to 'domain.com/dir2cast/cast1' . This is a problem, as I need all of the subdirectories to automatically work without creating a specific ini file for each one.

It would be great if the global dir2cast.ini file used the MP3_URL as a base, but automatically appended the subdirectory name to the file URLs when a subdirectory is linked. So in other words, an DOMAIN_URL that is global instead of a MP3_URL that is specific to each subdirectory.

Example of how it currently works:
Enter URL of 'http://domain.com/dir2cast/dir2cast.php?dir=cast1' with the MP3_URL is set to 'domain.com/dir2cast'. The resulting file links are 'domain.com/dir2cast/cast1.mp3' instead of 'domain.com/dir2cast/cast1/cast1.mp3'

Would it be possible to append the directory name from the URL to the end of the global MP3_URL specified in the global dir2cast.ini file in the main dir2cast directory? This would eliminate the need to create a specific ini file for each subdirectory.

Invalid Char value 31

When i run the PHP I get the following error:

This page contains the following errors:
error on line 3310 at column 52: PCDATA invalid Char value 31
Below is a rendering of the page up to the first error.

I've done some googling and found the following from here:

I find that most characters whose char value is less than 32(decimal) is a Control Character and should not be put in the atom.xml, see this and this. The most useful info from here is:

When you put utf-8 encoded strings in a XML document you should remember that not all utf-8 valid > chars are accepted in a XML document http://www.w3.org/TR/REC-xml/#charsets
So you should strip away the unwanted chars, else you’ll have an XML fatal parsing error

I have looked but i guess i don't have the skill to find the invalid character in the file.

Upgrade version of getID3

Hi -

I wanted to add support for M4A files (which is supported in more recent versions of getID3). I was able to add support for the latest version of the library by changing the following code:

                        if(!isset($this->getid3))
                        {
                                $this->getid3 = new getID3();
                                $this->getid3->option_tag_lyrics3 = false;
                                $this->getid3->option_tag_apetag = false;
                                $this->getid3->encoding = 'UTF-8';
                        }

                        try
                        {
                                $info = $this->getid3->analyze($item->getFilename());
                                getid3_lib::CopyTagsToComments($info);
                        }
                        catch(getid3_exception $e)
                        {
                                // MP3 couldn't be analyzed.
                                return;
                        }

Use MP3s under public_html in root?

I have about 1TB of MP3s. Due to leechers, I don't want them accessible via the web, so I serve downloads of files via a PHP proxy file.

I want to offer a podcast and I am pretty sure dir2cast can help in my scenario, but I just cannot get it to work.

Server layout:
Where my website is /home/company/public_html/
Where dir2cast sits /home/company/public_html/podcast/
Where my mp3 files are /home/company/mp3s/

My settings in dir2cast.ini are:

MP3_DIR = /home/company/mp3s/
;MP3_BASE
;MP3_URL

The files are found and recursively so throughout the directories I have (brilliant) but links to the files in the XML come out as:
file:///home/company/mp3s/show1.mp3

Any help would be blinding!

Cheers

Support for non ASCII characters

I created an episode with a German umlaut (äöüÄÖÜß). First I had to replace it in the filename, but that's okay.
But then I saw, that also the name of the episode displayed ü instead of ü. Do I need to encode this differently in the episode tags (although I'm not sure how to) or is this a problem with dir2cast?

No files are created in the temp caching folder

Hi,

I'm currently running the project using the (default) docker configuration. When I don't change anything and run sudo docker-compose up everything runs as expected. However, when I make changes to my dir2cast.ini file and rerun the container, the changes are not reflected (specifically increase the value of ITEM_COUNT from 10 to 99). Also adding the FORCE_PASSWORD and trying to force a cache refresh doesn't work. When I open the /tmp folder, it is also empty, giving me the idea that something is going wrong there. Is there a way to run a debugger to see where it breaks? Thanks in advance!

Enclosure Url Problem

Urls are populated incorrectly. Example:

<enclosure url="file:///home3/userID/public_html/

Can you please help? Since url does not start with http, podcast is unable to play the mp3 files.

GooglePlay RSS feed requirements

Dear Ben,
depending on new GooglePlay requirements,
the rss header must contain also GooglePlay xmlns attributes:

xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"
all:
<rss version="2.0" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
Is it possible to add this in next revision?
More info:
https://developers.google.com/search/docs/data-types/podcast
Thanks
Robert

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.