Yetangitu / Spodcast

Spodcast is a caching Spotify podcast to RSS proxy. Using Spodcast you can follow Spotify-hosted netcasts/podcasts using any player which supports RSS, thus enabling the use of older hardware which is not compatible with the Spotify (web) app.
GNU General Public License v3.0
359 stars 14 forks source link

PHP URL Problems #6

Closed heywoodlh closed 2 years ago

heywoodlh commented 2 years ago

So I'm running Spodcast on my own server at home -- it is not accessible to the world.

I use FreshRSS for aggregating feeds. For some reason (I'm sure a misconfiguration on my end) the URLs for the media are all messed up when I try the default configuration and subscribing via FreshRSS.

This is what one of the media URLs looks like when I subscribe via FreshRSS (which is a web app running at http://freshrss.local): http://freshrss.local/i/spodcast.local/The_Joe_Rogan_Experience/The_Joe_Rogan_Experience_-_1782_-_Daniel_Holzman.ogg

What it actually should be is this (notice that the freshrss.local piece is missing): http://spodcast.local/The_Joe_Rogan_Experience/The_Joe_Rogan_Experience_-_1782_-_Daniel_Holzman.ogg

So for some reason it is prepending the URL of my FreshRSS web app to the media URL when I attempt to subscribe to the RSS feed.

I was able to workaround this by modifying The_Joe_Rogan_Experience's .index.php file and hardcoding the URL I use into the generated media URL:

$hardcoded_url = "http://spodcast.local{$_SERVER['REQUEST_URI']}";
...
...
echo "            <media:content url=\"".$hardcoded_url.$info->filename."\" medium=\"".$info->medium."\" duration=\"".$info->duration."\" type=\"".$info->mimetype."\" />\n";
...
...

I'm not proficient with PHP at all so is there a better way to solve this problem?

Yetangitu commented 2 years ago

(seems to be some problems with the new release, one moment...)

Yetangitu commented 2 years ago

OK, try again with the latest release, v0.3.7, available through pip install -U spodcast or from the repo.

Yetangitu commented 2 years ago

By the way, you'll want to either re-subscribe to your feeds in Spodcast or manually correct the feed .index.php to each show directory. Here's the required change:

--- a/spodcast/feedgenerator.py
+++ b/spodcast/feedgenerator.py
@@ -6,7 +6,7 @@ def RSS_FEED_CODE():
     return r'''<?php
 const SHOW_INDEX = "''' + RSS_FEED_SHOW_INDEX + r'''";
 const INFO = "''' + RSS_FEED_INFO_EXTENSION + r'''";
-$PROTOCOL + ($HTTPS) ? "https://" : "http://";
+$PROTOCOL = ($HTTPS) ? "https://" : "http://";
 header("Content-type: text/xml");
 $feed_name = "Spodcast autofeed";
 $feed_description = "Spodcast autofeed";

So, change that + after $PROTOCOL into an =. The problem was caused by a sticking Shift key on my (ancient) Model-M keyboard (Shift-= produces +), and this being PHP it happily accepted the nonsensical line as valid.

I tested with FreshRSS, it Works For Me™ using the default install of FreshRSS. If you still have problems they are caused by something else...

Yetangitu commented 2 years ago

Have you tried the latest release? Did it work?

heywoodlh commented 2 years ago

Yes, it worked perfectly! Sorry I forgot to follow up.

Yetangitu commented 2 years ago

OK, thanks for letting me know, this issue can remain closed.