rss

package
v0.0.0-...-b325b5c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package rss ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdatePodcast

func UpdatePodcast(ctx context.Context, p *store.Podcast, flags UpdatePodcastFlags) (int, error)

UpdatePodcast fetches the feed URL for the given podcast, parses it and updates all of the episodes we have stored for the podcast. This method updates the passed-in store.Podcast with the latest details.

To keep memory usage managable, we use the xml.Decoder interface to decode the XML file in a streaming fashion.

If force is false, then we assume the podcast only has the latest handful of episodes -- anything older than the oldest episode we have already stored is ignored (if there's no existing episode then we assume this is a new podcast and load everything).

If flags contains ForceUpdate, then we ignore existing episodes and re-store all episodes in the RSS file. If it contains IconOnly, we skip updating episodes and just update the icon.

Types

type AtomLink struct {
	Href string `xml:"href,attr"`
	Rel  string `xml:"rel,attr"`
}

AtomLink ...

type Channel

type Channel struct {
	Title       string   `xml:"title"`
	Link        AtomLink `xml:"http://www.w3.org/2005/Atom link"`
	Language    string   `xml:"language"`
	Copyright   string   `xml:"copright"`
	Description string   `xml:"description"`
	Image       Image    `xml:"image"`
	Items       []Item   `xml:"item"`
}

Channel ...

type Feed

type Feed struct {
	Channel Channel `xml:"channel"`
}

Feed ...

type Image

type Image struct {
	URL   string `xml:"url"`
	Href  string `xml:"href,attr"`
	Title string `xml:"title"`
	Link  string `xml:"link"`
}

Image ...

type Item

type Item struct {
	Title              string `xml:"title"`
	Description        string `xml:"description"`
	EncodedDescription string `xml:"http://purl.org/rss/1.0/modules/content/ encoded"`
	PubDate            string `xml:"pubDate"`
	GUID               string `xml:"guid"`
	Media              Media  `xml:"enclosure"`
}

Item ...

type Media

type Media struct {
	URL    string `xml:"url,attr"`
	Length int    `xml:"length,attr"`
	Type   string `xml:"type,attr"`
}

Media ...

type UpdatePodcastFlags

type UpdatePodcastFlags int
const (
	ForceUpdate UpdatePodcastFlags = 1 << iota
	IconOnly
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL