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

Setting custom GUID not working #41

Open
dewey opened this issue Sep 1, 2024 · 1 comment
Open

Setting custom GUID not working #41

dewey opened this issue Sep 1, 2024 · 1 comment

Comments

@dewey
Copy link

dewey commented Sep 1, 2024

Hey,

I'm trying to set the GUID to a unique ID, without having to use the url. This is valid as far as I know. The code seems to just ignore that and set the GUID to the i.Link or i.Enclosure.URL in AddItem().

	if i.Enclosure != nil {
		if len(i.GUID) == 0 {
			i.GUID = i.Enclosure.URL // yep, GUID is the Permlink URL
		}

		if i.Enclosure.Length < 0 {
			i.Enclosure.Length = 0
		}
		i.Enclosure.LengthFormatted = strconv.FormatInt(i.Enclosure.Length, 10)
		i.Enclosure.TypeFormatted = i.Enclosure.Type.String()

		// allow Link to be set for article references to Downloads,
		// otherwise set it to the enclosurer's URL.
		if len(i.Link) == 0 {
			i.Link = i.Enclosure.URL
		}
	} else {
		i.GUID = i.Link // yep, GUID is the Permlink URL
	}

I believe the code block should basically be wrapped in a if i.GUID == "" {} so that the user can decide if they want to set a custom GUID or just use the default behavior of using the url.

What do you think?

@eduncan911
Copy link
Owner

eduncan911 commented Sep 2, 2024

hello @dewey ! thank you for the repor! could you copy-n-paste the code and modify it to what you propose? :)

it's been a while since i've looked at the spec.

The episode’s globally unique identifier (GUID) If you uploaded subscriber audio in Apple Podcasts Connect and need to link it to an episode in your RSS feed, you can use the Apple Podcasts Episode ID in the GUID tag. Learn more about how to set up your show for a subscription.

It is very important that each episode have a unique GUID and that it never changes, even if an episode’s metadata, like title or enclosure URL, do change.

Globally unique identifiers (GUID) are case-sensitive strings. If a GUID is not provided, an episode’s enclosure URL will be used instead. If a GUID is not provided, make sure that an episode’s enclosure URL is unique and never changes.

Failing to comply with these guidelines may result in duplicate episodes being shown to listeners, inaccurate data in Analytics, and can cause issues with your podcasts’s listing and chart placement in Apple Podcasts.

With that spec, if you are adding an Audio file, the GUID is to specify the URL - if not set.

IIRC, most iTunes parsers don't even look at the Episode URL but the GUID to list for download.

Reading the AddItem() description reminds me of some logic I was going for there:

// The following fields are always overwritten (don't set them):
//
//   * GUID
//   * PubDateFormatted
//   * AuthorFormatted
//   * Enclosure.TypeFormatted
//   * Enclosure.LengthFormatted

But for the life of me, I can't recall exactly why I imposed that restriction.

I think it was a way to guarantee that:

  1. Every episode gets a unique GUID (if not set)
  2. There's no way for me to guarantee the GUIDs are unique across all of the items, without me retroactively parsing all items - as you add one at a time.

I'm open to ways to allow the user to add a GUID, while also guaranteeing a unique item list.

Right now, it relies on the URL as the URL is acceptable as being globally unique (according to iTunes that is). If we were to allow GUIDs, anyone can set any static GUID to all episodes - and then the feed would be invalid, without a way for me to tell the user (which is the whole point of using "the functions" to add the episode - a guaranteed valid podcast.


lastly, I do believe GUID is used for episode downloads for a lot of Podcast readers as it's in the iTunes spec. allowing you to set it out right may break certain clients.

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

No branches or pull requests

2 participants