Metalove.Podcast (Metalove v0.5.0)

View Source

This module defines a Metalove.Podcast struct and the main functions working with it.

Summary

Types

t()

Represents a podcast.

Functions

Add a feed url to a podcast if it isn't listed yet.

Either returns a already scraped podcast for this feed url, or fetches the url and creates a new one if possible

Returns an existing podcast for that id, otherwise nil

Returns an existing podcast for that link if it exists, otherwise nil

Returns the shortened id formed from a website link

Creates a new Metalove.Podcast struct filled with the information found by scraping the url given. Also triggers a fetch of the given feed to populate the repository.

Types

t()

@type t() :: %Metalove.Podcast{
  created_at: DateTime.t(),
  feed_urls: [String.t()],
  id: String.t(),
  main_feed_url: nil | String.t(),
  updated_at: DateTime.t()
}

Represents a podcast.

  • :id: String representing the podcast, likely to be a reduced url stripping the schema and the trailing slash, e.g. "atp.fm"
  • :main_feed_url: String representing the mp3 feed if present, otherwise the first one found
  • :feed_urls: List of URL strings for all the found feeds for this podcast

Functions

add_feed_urls(podcast, list)

@spec add_feed_urls(t(), [String.t()]) :: t()

Add a feed url to a podcast if it isn't listed yet.

get_by_feed_url(feed_url, opts \\ [])

Either returns a already scraped podcast for this feed url, or fetches the url and creates a new one if possible

get_by_id(id)

Returns an existing podcast for that id, otherwise nil

get_by_link(link)

Returns an existing podcast for that link if it exists, otherwise nil

id_from_link(url)

Returns the shortened id formed from a website link

new_with_main_feed_url(main_feed_url)

@spec new_with_main_feed_url(String.t()) :: t()

Creates a new Metalove.Podcast struct filled with the information found by scraping the url given. Also triggers a fetch of the given feed to populate the repository.