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

Create an Internal ID for Podcasts #40

Open
JavaScriptDude opened this issue Jan 30, 2021 · 0 comments
Open

Create an Internal ID for Podcasts #40

JavaScriptDude opened this issue Jan 30, 2021 · 0 comments

Comments

@JavaScriptDude
Copy link

JavaScriptDude commented Jan 30, 2021

To make it easier to add other features like downloading specific podcasts, it would be a good idea to add an ID attribute for podcast records. Using a straight numeric ID would not be ideal as there may be cases where the numbers to get out of sync.

To create a safe unique identifier, you can create a short hash of the podcast audio URL as follows:

import hashlib
feed_url="https://media.transistor.fm/9c4b292f/754f684f.mp3"
feed_id=hashlib.shake_256(feed_url.encode()).hexdigest(5)

This will create a short 10 character hash that would be unique for every feed regardless of the changes to the feeds. As long as the feed does not re-use podcast URLs, there should be no collisions.

This ID should be stored in the feed.json as id and it can be used to download specific podcasts.

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

1 participant