Skip to content

Create an Internal ID for Podcasts #40

Description

@JavaScriptDude

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions