Documentation ¶
Index ¶
- type AtomLink
- type Author
- type Enclosure
- type EnclosureType
- type ICategory
- type IImage
- type ISummary
- type Image
- type Item
- type Podcast
- func (p *Podcast) AddAtomLink(href string)
- func (p *Podcast) AddAuthor(name, email string)
- func (p *Podcast) AddCategory(category string, subCategories []string)
- func (p *Podcast) AddImage(url string)
- func (p *Podcast) AddItem(i Item) (int, error)
- func (p *Podcast) AddLastBuildDate(datetime *time.Time)
- func (p *Podcast) AddPubDate(datetime *time.Time)
- func (p *Podcast) AddSubTitle(subTitle string)
- func (p *Podcast) AddSummary(summary string)
- func (p *Podcast) Bytes() []byte
- func (p *Podcast) Encode(w io.Writer) error
- func (p *Podcast) String() string
- type TextInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AtomLink ¶
type AtomLink struct { XMLName xml.Name `xml:"atom:link"` HREF string `xml:"href,attr"` Rel string `xml:"rel,attr"` Type string `xml:"type,attr"` }
AtomLink represents the Atom reference link.
type Author ¶
type Author struct { XMLName xml.Name `xml:"owner"` Name string `xml:"name"` Email string `xml:"email"` }
Author represents a named author and email.
For iTunes compliance, both Name and Email are required.
type Enclosure ¶
type Enclosure struct { XMLName xml.Name `xml:"enclosure"` // URL is the downloadable url for the content. (Required) URL string `xml:"url,attr"` // Length is the size in Bytes of the download. (Required) Length int64 `xml:"-"` // LengthFormatted is the size in Bytes of the download. (Required) // // This field gets overwritten with the API when setting Length. LengthFormatted string `xml:"length,attr"` // Type is MIME type encoding of the download. (Required) Type EnclosureType `xml:"-"` // TypeFormatted is MIME type encoding of the download. (Required) // // This field gets overwritten with the API when setting Type. TypeFormatted string `xml:"type,attr"` }
Enclosure represents a download enclosure.
type EnclosureType ¶
type EnclosureType int
EnclosureType specifies the type of the enclosure.
const ( M4A EnclosureType = iota M4V MP4 MP3 MOV PDF EPUB )
EnclosureType specifies the type of the enclosure.
func (EnclosureType) String ¶
func (et EnclosureType) String() string
String returns the MIME type encoding of the specified EnclosureType.
type ICategory ¶
type ICategory struct { XMLName xml.Name `xml:"category"` Text string `xml:"text,attr"` ICategories []*ICategory }
ICategory is a 2-tier classification system for iTunes.
type IImage ¶
IImage represents an iTunes image.
Podcast feeds contain artwork that is a minimum size of 1400 x 1400 pixels and a maximum size of 3000 x 3000 pixels, 72 dpi, in JPEG or PNG format with appropriate file extensions (.jpg, .png), and in the RGB colorspace. To optimize images for mobile devices, Apple recommends compressing your image files.
type ISummary ¶
ISummary is a 4000 character rich-text field for the itunes:summary tag.
This is rendered as CDATA which allows for HTML tags such as <a href="">.
type Image ¶
type Image struct { XMLName xml.Name `xml:"image"` URL string `xml:"url"` Title string `xml:"title"` Link string `xml:"link"` Description string `xml:"description,omitempty"` Width int `xml:"width,omitempty"` Height int `xml:"height,omitempty"` }
Image represents an image.
Podcast feeds contain artwork that is a minimum size of 1400 x 1400 pixels and a maximum size of 3000 x 3000 pixels, 72 dpi, in JPEG or PNG format with appropriate file extensions (.jpg, .png), and in the RGB colorspace. To optimize images for mobile devices, Apple recommends compressing your image files.
type Item ¶
type Item struct { XMLName xml.Name `xml:"item"` GUID string `xml:"guid"` Title string `xml:"title"` Link string `xml:"link"` Description string `xml:"description"` Author *Author `xml:"-"` AuthorFormatted string `xml:"author,omitempty"` Category string `xml:"category,omitempty"` Comments string `xml:"comments,omitempty"` Source string `xml:"source,omitempty"` PubDate *time.Time `xml:"-"` PubDateFormatted string `xml:"pubDate,omitempty"` Enclosure *Enclosure // https://help.apple.com/itc/podcasts_connect/#/itcb54353390 IAuthor string `xml:"iauthor,omitempty"` ISubtitle string `xml:"subtitle,omitempty"` ISummary *ISummary IImage *IImage IDuration string `xml:"duration,omitempty"` IExplicit string `xml:"explicit,omitempty"` IIsClosedCaptioned string `xml:"isClosedCaptioned,omitempty"` IOrder string `xml:"order,omitempty"` }
Item represents a single entry in a podcast.
Article minimal requirements are: - Title - Description - Link
Audio minimal requirements are: - Title - Description - Enclosure (HREF, Type and Length all required)
Recommendations: - Setting the minimal fields sets most of other fields, including iTunes. - Use the Published time.Time setting instead of PubDate. - Always set an Enclosure.Length, to be nice to your downloaders. - Use Enclosure.Type instead of setting TypeFormatted for valid extensions.
func (*Item) AddDuration ¶
AddDuration adds the duration to the iTunes duration field.
func (*Item) AddEnclosure ¶
func (i *Item) AddEnclosure( url string, enclosureType EnclosureType, lengthInBytes int64)
AddEnclosure adds the downloadable asset to the podcast Item.
func (*Item) AddImage ¶
AddImage adds the image as an iTunes-only IImage. RSS 2.0 does not have the specification of Images at the Item level.
Podcast feeds contain artwork that is a minimum size of 1400 x 1400 pixels and a maximum size of 3000 x 3000 pixels, 72 dpi, in JPEG or PNG format with appropriate file extensions (.jpg, .png), and in the RGB colorspace. To optimize images for mobile devices, Apple recommends compressing your image files.
func (*Item) AddPubDate ¶
AddPubDate adds the datetime as a parsed PubDate.
UTC time is used by default.
func (*Item) AddSummary ¶
AddSummary adds the iTunes summary.
Limit: 4000 characters
Note that this field is a CDATA encoded field which allows for rich text such as html links: <a href="http://www.apple.com">Apple</a>.
type Podcast ¶
type Podcast struct { XMLName xml.Name `xml:"channel"` Title string `xml:"title"` Link string `xml:"link"` Description string `xml:"description"` Category string `xml:"category,omitempty"` Cloud string `xml:"cloud,omitempty"` Copyright string `xml:"copyright,omitempty"` Docs string `xml:"docs,omitempty"` Generator string `xml:"generator,omitempty"` Language string `xml:"language,omitempty"` LastBuildDate string `xml:"lastBuildDate,omitempty"` ManagingEditor string `xml:"managingEditor,omitempty"` PubDate string `xml:"pubDate,omitempty"` Rating string `xml:"rating,omitempty"` SkipHours string `xml:"skipHours,omitempty"` SkipDays string `xml:"skipDays,omitempty"` TTL int `xml:"ttl,omitempty"` WebMaster string `xml:"webMaster,omitempty"` Image *Image TextInput *TextInput AtomLink *AtomLink // https://help.apple.com/itc/podcasts_connect/#/itcb54353390 IAuthor string `xml:"author,omitempty"` ISubtitle string `xml:"subtitle,omitempty"` ISummary *ISummary IBlock string `xml:"block,omitempty"` IImage *IImage IDuration string `xml:"duration,omitempty"` IExplicit string `xml:"explicit,omitempty"` IComplete string `xml:"complete,omitempty"` INewFeedURL string `xml:"new-feed-url,omitempty"` IOwner *Author // Author is formatted for itunes as-is ICategories []*ICategory Items []*Item // contains filtered or unexported fields }
Podcast represents a podcast.
func New ¶
New instantiates a Podcast with required parameters.
Nil-able fields are optional but recommended as they are formatted to the expected proper formats.
func (*Podcast) AddAtomLink ¶
AddAtomLink adds a FQDN reference to an atom feed.
func (*Podcast) AddCategory ¶
AddCategory adds the category to the Podcast.
ICategory can be listed multiple times.
Calling this method multiple times will APPEND the category to the existing list, if any, including ICategory.
Note that Apple iTunes has a specific list of categories that only can be used and will invalidate the feed if deviated from the list. That list is as follows.
Arts * Design * Fashion & Beauty * Food * Literature * Performing Arts * Visual Arts Business * Business News * Careers * Investing * Management & Marketing * Shopping Comedy Education * Education Technology * Higher Education * K-12 * Language Courses * Training Games & Hobbies * Automotive * Aviation * Hobbies * Other Games * Video Games Government & Organizations * Local * National * Non-Profit * Regional Health * Alternative Health * Fitness & Nutrition * Self-Help * Sexuality Kids & Family Music News & Politics Religion & Spirituality * Buddhism * Christianity * Hinduism * Islam * Judaism * Other * Spirituality Science & Medicine * Medicine * Natural Sciences * Social Sciences Society & Culture * History * Personal Journals * Philosophy * Places & Travel Sports & Recreation * Amateur * College & High School * Outdoor * Professional Technology * Gadgets * Podcasting * Software How-To * Tech News TV & Film
func (*Podcast) AddImage ¶
AddImage adds the specified Image to the Podcast.
Podcast feeds contain artwork that is a minimum size of 1400 x 1400 pixels and a maximum size of 3000 x 3000 pixels, 72 dpi, in JPEG or PNG format with appropriate file extensions (.jpg, .png), and in the RGB colorspace. To optimize images for mobile devices, Apple recommends compressing your image files.
func (*Podcast) AddItem ¶
AddItem adds the podcast episode. It returns a count of Items added or any errors in validation that may have occurred.
This method takes the "itunes overrides" approach to populating itunes tags according to the overrides rules in the specification. This not only complies completely with iTunes parsing rules; but, it also displays what is possible to be set on an individual episode level - if you wish to have more fine grain control over your content.
This method imposes strict validation of the Item being added to confirm to Podcast and iTunes specifications.
Article minimal requirements are:
* Title * Description * Link
Audio, Video and Downloads minimal requirements are:
* Title * Description * Enclosure (HREF, Type and Length all required)
The following fields are always overwritten (don't set them):
* GUID * PubDateFormatted * AuthorFormatted * Enclosure.TypeFormatted * Enclosure.LengthFormatted
Recommendations:
- Just set the minimal fields: the rest get set for you.
- Always set an Enclosure.Length, to be nice to your downloaders.
- Follow Apple's best practices to enrich your podcasts: https://help.apple.com/itc/podcasts_connect/#/itc2b3780e76
- For specifications of itunes tags, see: https://help.apple.com/itc/podcasts_connect/#/itcb54353390
func (*Podcast) AddLastBuildDate ¶
AddLastBuildDate adds the datetime as a parsed PubDate.
UTC time is used by default.
func (*Podcast) AddPubDate ¶
AddPubDate adds the datetime as a parsed PubDate.
UTC time is used by default.
func (*Podcast) AddSubTitle ¶
AddSubTitle adds the iTunes subtitle that is displayed with the title in iTunes.
Note that this field should be just a few words long according to Apple. This method will truncate the string to 64 chars if too long with "..."
func (*Podcast) AddSummary ¶
AddSummary adds the iTunes summary.
Limit: 4000 characters
Note that this field is a CDATA encoded field which allows for rich text such as html links: <a href="http://www.apple.com">Apple</a>.