Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Episode does not exist" Displayed when clicking on otherwise completely functional episode through /admin/episodes_list.php menu #691

Open
evoTecc opened this issue Aug 26, 2022 · 9 comments
Labels

Comments

@evoTecc
Copy link

evoTecc commented Aug 26, 2022

System Information
Podcast Generator Version: 3.2.7
Webserver: nginx/1.20.1 on Ubuntu Server 20.04 x64 Digital Ocean LEMP 1 Click Install
PHP Version: PHP 7.4.30

Podcast Generator Config

<?php

$podcastgen_version = '3.2.7'; // Version

$first_installation = 1655770137;

CENSORED installationKey

$scriptlang = 'en_US';

CENSORED url

$absoluteurl = '/usr/share/nginx/html/'; // The location on the server

$theme_path = 'themes/default/';

$upload_dir = 'media/'; // 'media/' the default folder (Trailing slash required). Set chmod 755

$img_dir = 'images/'; // (Trailing slash required). Set chmod 755

$feed_dir = ''; // Where to create feed.xml (empty value = root directory). Set chmod 755

$max_recent = 'all'; // How many file to show in the home page

$recent_episode_in_feed = 'All'; // How many file to show in the XML feed (1,2,5 etc.. or 'All')

$episodeperpage = 10;

$enablestreaming = 'yes'; // Enable mp3 streaming? ('yes' or 'no')

$freebox = 'yes'; // enable freely customizable box

$enablepgnewsinadmin = 'yes';

$strictfilenamepolicy = 'no'; // strictly rename files (just characters A to Z and numbers) 

$categoriesenabled = 'yes';

$cronAutoIndex = 1; //Auto Index New Episodes via Cron

$cronAutoRegenerateRSS = 1; //Auto regenerate RSS via Cron

$indexfile = 'index.php';    // Path of the index file

$podcastPassword = '';       // Password to protect the podcast generator webpages, this will NOT protect the audio or XML files. Leave blank to disable.

$customtagsenabled = 'no';   // Advanced functionality for custom RSS tag input

$timezone = '';              // Timezone used for displaying dates and times

#####################

# XML Feed stuff

$podcast_guid = ''; // Globally unique identifier for your podcast

CENSORED podcast_title

CENSORED podcast_subtitle

CENSORED podcast_description

$podcast_cover = 'FinalThumb.jpg';

CENSORED author_name

CENSORED author_email

# The e-mail of the technical admin of the podcast

$webmaster = 'podcastadmin@example.com';

$itunes_category[0] = 'Arts'; // iTunes categories (mainCategory:subcategory)

$itunes_category[1] = '';

$itunes_category[2] = '';

$link = '?name='; // permalink URL of single episode (appears in the <link> and <guid> tags in the feed)

$feed_language = 'en';

$feed_sort = 'timestamp'; // sort method used to order episodes in the feed (by timestamp or by season/episode number)

$feed_locked = ''; // podcast:locked status ('yes', 'no', '' for off)

CENSORED copyright

$feed_encoding = 'utf-8';

CENSORED explicit_podcast

$users_json = '{\"deb\": \"\$2y\$10\$jFYTNv7GZLaa72YDt9oaDefKKJtvANK8yxvGaa2hSZ7RfMsmUAtBy\"}';

#####################

# WebSub

$websub_server = '';

#####################

# Podcast Index

$pi_api_key = "";

$pi_api_secret = "";

$pi_podcast_id = 0; // is the podcast in Podcast Index? This is its show ID there.

#####################

# WebSub

$websub_server = "https://pubsubhubbub.appspot.com/";

// END OF CONFIG

Expected behavior
"Episode does not exist" page is displayed when clicking on otherwise completely functional episode through /admin/episodes_list.php menu.

Actual behavior
Episode should behave as others when clicking on the title to open up the edit corresponding episodes_edit.php page. Some things of note: The single error episode in question functions normally through various apps and is able to be listened to. I can still edit the .xml file through command line using nano to make episode changes. When listing the /media directory with the "ls" command this episode happens to be the only surrounded in single quotes suggesting a space is present however I am able to edit the file with nano without quotes or spaces.

How to reproduce
Unknown at this time.

@evoTecc evoTecc added the Bug label Aug 26, 2022
@evoTecc
Copy link
Author

evoTecc commented Aug 26, 2022

Just discovered the apostrophe in the title may be to blame as the link to this episode on /admin/episodes_list.php cuts off after the apostrophe as if it was not escaped or something? Strange as other podcast episodes with the apostrophe in the title haven't suffered the same issue; This also appears to be the only episode where the title of the episode is the filename instead of 2022-07-19_episode_104.xml or 2022-07-19_episode_106.xml this episodes files within the media file appear to named as "2022-08-16_title_of_episode.xml"

@sseguin613
Copy link

Is there any solution to this? We have two entries we just did that we want to edit and they are also saying Episode does not Exist. No apostrophe in the title though.

@evoTecc
Copy link
Author

evoTecc commented Sep 9, 2022

I did end up fixing our first occurrence of this though it has happened again to another episode. I can't remember the exact fix at the moment as it was about a week ago but I believe what I did was rename the episode xml files with nano through ssh to get the link to actually correspond to the filename; After that we were able to have the link navigate to the episode details for editing. When I get some time to go fix that other episode I'll try and document the fix here.

@coldacid
Copy link
Member

I'm going to bring over the renaming that I did for the live items (in my work branch for that) to episodes, but existing episodes on sites will still need to be fixed up manually. Please make sure that for any episode media file x.ext there's x.xml and that the only characters in the filenames are alphanumeric characters, the dash character, and the underscore character.

@coldacid
Copy link
Member

Further on my previous comment, PG looks for the episode metadata by replacing the extension of the episode media file with ".xml" so if that file doesn't exist or is differently-cased then the admin page will think the episode doesn't exist.

coldacid pushed a commit that referenced this issue Sep 12, 2022
Fix up makeEpisodeFilename() and makeUniqueFilename() so that characters
outside the alphanumeric range that aren't the period, dash, or
underscore are replaced with an underscore.

refs #691
@coldacid coldacid removed this from To do in Code quality overhaul Sep 22, 2022
coldacid pushed a commit that referenced this issue Oct 30, 2022
Fix up makeEpisodeFilename() and makeUniqueFilename() so that characters
outside the alphanumeric range that aren't the period, dash, or
underscore are replaced with an underscore.

refs #691

(cherry picked from commit fc058e0)
@coldacid
Copy link
Member

You shouldn't change the <guid></guid> element value other than to replace certain special characters with their appropriate XML escapes (e.g. < with &lt; or & with &amp;). This is because the value of this tag uniquely represents the episode, and if changed, then clients think that it's a new episode.

@evoTecc
Copy link
Author

evoTecc commented Dec 29, 2022

You shouldn't change the <guid></guid> element value other than to replace certain special characters with their appropriate XML escapes (e.g. < with &lt; or & with &amp;). This is because the value of this tag uniquely represents the episode, and if changed, then clients think that it's a new episode.

Thanks for noting this, didn't realize <guid></guid> was used as the episodes sole unique identifier; Deleted my previous comment with instructions on how to fix this manually per episode as to not have people breaking episode identity across clients.

So to manually fix these episodes, would all one need to do is change the <guid></guid> element with the appropriate escaping characters, remove the offending non alphanumeric, dash, or underscore characters from the filename, then all should be well?

@coldacid
Copy link
Member

I wish you hadn't deleted your comment because other than the part about changing the value of the guid tag, it was all correct. Fixing the filename is necessary, as is keeping the XML sidecar filename in sync, but the only thing that should ever be done to the value of the guid element in any of those sidecar files is fixing up any unescaped characters that could cause parsing issues for the XML.

@evoTecc
Copy link
Author

evoTecc commented Dec 29, 2022

I wish you hadn't deleted your comment because other than the part about changing the value of the guid tag, it was all correct. Fixing the filename is necessary, as is keeping the XML sidecar filename in sync, but the only thing that should ever be done to the value of the guid element in any of those sidecar files is fixing up any unescaped characters that could cause parsing issues for the XML.

Thanks for you help, I did keep a copy of the prior comment just in case, prior comment with hopefully updated guid instructions (have only updated the instructions for dealing with guid):

This is mainly a note for those looking to fix this issue where it has happened in older versions of Podcast Generator (instance where I fixed this is not the latest for sure)

It looks like what breaks the episode and makes it "not exist" while still actually existing, at least in my case, is when a special character gets into the Linux file name for the episode. (See @coldacid comment above, mentions all characters should be alphanumeric characters, the dash character, and the underscore character); When running "ls" in the /PodcastGenerator/media directory it may also put apostrophes around broken episode file names while your other episodes have not apostrophes around the episode title names.
So a clean episode would look like: 2022-08-27_title_here.mp3 and 2022-08-27_title_here.xml
And a bad episode may display as: '2022-08-27_bad_episode&otherstuff.mp3' and '2022-08-27_bad_episode&otherstuff.xml'
To fix this, I had to remove the ampersand from the file names thus making:
'2022-08-27_bad_episode&otherstuff.mp3' and '2022-08-27_bad_episode&otherstuff.xml'
into
2022-08-27_bad_episodeotherstuff.mp3 and 2022-08-27_bad_episodeotherstuff.xml

Update to below (credit to @coldacid comment below):
You shouldn't change the <guid></guid> element value other than to replace certain special characters with their appropriate XML escapes (e.g. < with &lt; or & with &amp;). This is because the value of this tag uniquely represents the episode, and if changed, then clients think that it's a new episode.

And you must also edit the <guid></guid> tag contents within bad episode's .xml file to match the corresponding title changes you just made. In this case what I would do is open 2022-08-27_bad_episodeotherstuff.xml with a text editor such as nano and change:
<guid>https://your.url.com/?name=../media/2022-08-27_bad_episode&otherstuff.mp3</guid>
to
<guid>https://your.url.com/?name=../media/2022-08-27_bad_episode&amp;otherstuff.mp3</guid>

Removing all ampersands / special characters from file names and making the episodes <guid> entry the same as it previously was but with the proper escaping characters replacing the bad ones. See https://www.ibm.com/docs/en/was-liberty/base?topic=SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/rwlp_xml_escape.htm for XML escape characters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants