Browse Source

Not planning on submitting a merge request. Decoupling from upstream

master
Ismael Arenzana 1 year ago
parent
commit
b4de14d039
Signed by: isma
GPG Key ID: D5586DE2A32CBC3C
  1. 2
      LICENSE
  2. 4
      Makefile
  3. 58
      README.md
  4. 12
      doc.go
  5. 2
      enclosure_test.go
  6. 22
      example_test.go
  7. 16
      examples_test.go
  8. 2
      go.mod
  9. 2
      item_test.go
  10. 13
      podcast.go
  11. 2
      podcast_test.go

2
LICENSE

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017 Eric Duncan
Copyright (c) 2017 Ismael Arenzana
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

4
Makefile

@ -1,6 +1,6 @@
SHELL = /bin/bash
GITHUB_REPO:=eduncan911/podcast
GITHUB_REPO:=arenzana/podcast
README:
godoc2ghmd -play -ex -verify_import_links=0 github.com/$(GITHUB_REPO) > README.md.tmp
@ -8,7 +8,7 @@ README:
echo "[![Build Status](https://github.com/$(GITHUB_REPO)/workflows/go-cicd/badge.svg)](https://github.com/$(GITHUB_REPO)/actions?workflow=go-cicd)" >> README.md
echo "[![Coverage Status](https://coveralls.io/repos/github/$(GITHUB_REPO)/badge.svg?branch=master)](https://coveralls.io/github/$(GITHUB_REPO)?branch=master)" >> README.md
echo "[![Go Report Card](https://goreportcard.com/badge/github.com/$(GITHUB_REPO))](https://goreportcard.com/report/github.com/$(GITHUB_REPO))" >> README.md
echo "[![MIT License](https://img.shields.io/npm/l/mediaelement.svg)](https://eduncan911.mit-license.org/)" >> README.md
echo "[![MIT License](https://img.shields.io/npm/l/mediaelement.svg)](https://arenzana.mit-license.org/)" >> README.md
echo >>README.md
cat README.md.tmp >> README.md
rm README.md.tmp

58
README.md

@ -1,21 +1,21 @@
[![GoDoc](https://godoc.org/github.com/eduncan911/podcast?status.svg)](https://godoc.org/github.com/eduncan911/podcast)
[![Build Status](https://github.com/eduncan911/podcast/workflows/go-cicd/badge.svg)](https://github.com/eduncan911/podcast/actions?workflow=go-cicd)
[![Coverage Status](https://coveralls.io/repos/github/eduncan911/podcast/badge.svg?branch=master)](https://coveralls.io/github/eduncan911/podcast?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/eduncan911/podcast)](https://goreportcard.com/report/github.com/eduncan911/podcast)
[![MIT License](https://img.shields.io/npm/l/mediaelement.svg)](https://eduncan911.mit-license.org/)
[![GoDoc](https://godoc.org/github.com/arenzana/podcast?status.svg)](https://godoc.org/github.com/arenzana/podcast)
[![Build Status](https://github.com/arenzana/podcast/workflows/go-cicd/badge.svg)](https://github.com/arenzana/podcast/actions?workflow=go-cicd)
[![Coverage Status](https://coveralls.io/repos/github/arenzana/podcast/badge.svg?branch=master)](https://coveralls.io/github/arenzana/podcast?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/arenzana/podcast)](https://goreportcard.com/report/github.com/arenzana/podcast)
[![MIT License](https://img.shields.io/npm/l/mediaelement.svg)](https://arenzana.mit-license.org/)
# podcast
Package podcast generates a fully compliant iTunes and RSS 2.0 podcast feed
for GoLang using a simple API.
Full documentation with detailed examples located at <a href="https://godoc.org/github.com/eduncan911/podcast">https://godoc.org/github.com/eduncan911/podcast</a>
Full documentation with detailed examples located at <a href="https://godoc.org/github.com/arenzana/podcast">https://godoc.org/github.com/arenzana/podcast</a>
### Usage
To use, `go get` and `import` the package like your typical GoLang library.
$ go get -u github.com/eduncan911/podcast
$ go get -u github.com/arenzana/podcast
import "github.com/eduncan911/podcast"
import "github.com/arenzana/podcast"
The API exposes a number of method receivers on structs that implements the
logic required to comply with the specifications and ensure a compliant feed.
@ -25,7 +25,7 @@ Notably, the `Podcast.AddItem` function performs most
of the heavy lifting by taking the `Item` input and performing
validation, overrides and duplicate setters through the feed.
Full detailed Examples of the API are at <a href="https://godoc.org/github.com/eduncan911/podcast">https://godoc.org/github.com/eduncan911/podcast</a>.
Full detailed Examples of the API are at <a href="https://godoc.org/github.com/arenzana/podcast">https://godoc.org/github.com/arenzana/podcast</a>.
### Go Modules
This library is supported on GoLang 1.7 and higher.
@ -57,8 +57,8 @@ of the inputs.
go get -u github.com/dvyukov/go-fuzz/go-fuzz
go get -u github.com/dvyukov/go-fuzz/go-fuzz-build
go get -u github.com/eduncan911/podcast
cd $GOPATH/src/github.com/eduncan911/podcast
go get -u github.com/arenzana/podcast
cd $GOPATH/src/github.com/arenzana/podcast
go-fuzz-build
go-fuzz -func FuzzPodcastAddItem
@ -175,15 +175,15 @@ Podcasts: <a href="https://help.apple.com/itc/podcasts_connect/#/itca5b22233">ht
// instantiate a new Podcast
p := podcast.New(
"eduncan911 Podcasts",
"http://eduncan911.com/",
"arenzana Podcasts",
"http://arenzana.org/",
"An example Podcast",
&pubDate, &updatedDate,
)
// add some channel properties
p.AddAuthor("Jane Doe", "me@janedoe.com")
p.AddAtomLink("http://eduncan911.com/feed.rss")
p.AddAtomLink("http://arenzana.org/feed.rss")
p.AddImage("http://janedoe.com/i.jpg")
p.AddSummary(`link <a href="http://example.com">example.com</a>`)
p.IExplicit = "no"
@ -232,20 +232,20 @@ Podcasts: <a href="https://help.apple.com/itc/podcasts_connect/#/itca5b22233">ht
// <?xml version="1.0" encoding="UTF-8"?>
// <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
// <channel>
// <title>eduncan911 Podcasts</title>
// <link>http://eduncan911.com/</link>
// <title>arenzana Podcasts</title>
// <link>http://arenzana.org/</link>
// <description>An example Podcast</description>
// <generator>go podcast v1.3.1 (github.com/eduncan911/podcast)</generator>
// <generator>go podcast v1.3.1 (github.com/arenzana/podcast)</generator>
// <language>en-us</language>
// <lastBuildDate>Mon, 06 Feb 2017 08:21:52 +0000</lastBuildDate>
// <managingEditor>me@janedoe.com (Jane Doe)</managingEditor>
// <pubDate>Sat, 04 Feb 2017 08:21:52 +0000</pubDate>
// <image>
// <url>http://janedoe.com/i.jpg</url>
// <title>eduncan911 Podcasts</title>
// <link>http://eduncan911.com/</link>
// <title>arenzana Podcasts</title>
// <link>http://arenzana.org/</link>
// </image>
// <atom:link href="http://eduncan911.com/feed.rss" rel="self" type="application/rss+xml"></atom:link>
// <atom:link href="http://arenzana.org/feed.rss" rel="self" type="application/rss+xml"></atom:link>
// <itunes:author>me@janedoe.com (Jane Doe)</itunes:author>
// <itunes:summary><![CDATA[link <a href="http://example.com">example.com</a>]]></itunes:summary>
// <itunes:image href="http://janedoe.com/i.jpg"></itunes:image>
@ -333,7 +333,7 @@ Podcasts: <a href="https://help.apple.com/itc/podcasts_connect/#/itca5b22233">ht
// <title>Sample Podcasts</title>
// <link>http://example.com/</link>
// <description>An example Podcast</description>
// <generator>go podcast v1.3.1 (github.com/eduncan911/podcast)</generator>
// <generator>go podcast v1.3.1 (github.com/arenzana/podcast)</generator>
// <language>en-us</language>
// <lastBuildDate>Mon, 06 Feb 2017 08:21:52 +0000</lastBuildDate>
// <managingEditor>jane.doe@example.com (Jane Doe)</managingEditor>
@ -1168,8 +1168,8 @@ Bytes returns an encoded []byte slice.
```go
p := podcast.New(
"eduncan911 Podcasts",
"http://eduncan911.com/",
"arenzana Podcasts",
"http://arenzana.org/",
"An example Podcast",
&pubDate, &updatedDate,
)
@ -1203,18 +1203,18 @@ p := podcast.New(
// <?xml version="1.0" encoding="UTF-8"?>
// <rss version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
// <channel>
// <title>eduncan911 Podcasts</title>
// <link>http://eduncan911.com/</link>
// <title>arenzana Podcasts</title>
// <link>http://arenzana.org/</link>
// <description>An example Podcast</description>
// <generator>go podcast v1.3.1 (github.com/eduncan911/podcast)</generator>
// <generator>go podcast v1.3.1 (github.com/arenzana/podcast)</generator>
// <language>en-us</language>
// <lastBuildDate>Mon, 06 Feb 2017 08:21:52 +0000</lastBuildDate>
// <managingEditor>me@janedoe.com (Jane Doe)</managingEditor>
// <pubDate>Sat, 04 Feb 2017 08:21:52 +0000</pubDate>
// <image>
// <url>http://janedoe.com/i.jpg</url>
// <title>eduncan911 Podcasts</title>
// <link>http://eduncan911.com/</link>
// <title>arenzana Podcasts</title>
// <link>http://arenzana.org/</link>
// </image>
// <itunes:author>me@janedoe.com (Jane Doe)</itunes:author>
// <itunes:summary><![CDATA[A very cool podcast with a long summary using Bytes()!
@ -1271,4 +1271,4 @@ type TextInput struct {
TextInput represents text inputs.
- - -
Generated by [godoc2ghmd](https://github.com/eduncan911/godoc2ghmd)
Generated by [godoc2ghmd](https://github.com/arenzana/godoc2ghmd)

12
doc.go

@ -1,15 +1,15 @@
// Package podcast generates a fully compliant iTunes and RSS 2.0 podcast feed
// for GoLang using a simple API.
//
// Full documentation with detailed examples located at https://godoc.org/github.com/eduncan911/podcast
// Full documentation with detailed examples located at https://godoc.org/github.com/arenzana/podcast
//
// Usage
//
// To use, `go get` and `import` the package like your typical GoLang library.
//
// $ go get -u github.com/eduncan911/podcast
// $ go get -u github.com/arenzana/podcast
//
// import "github.com/eduncan911/podcast"
// import "github.com/arenzana/podcast"
//
// The API exposes a number of method receivers on structs that implements the
// logic required to comply with the specifications and ensure a compliant feed.
@ -19,7 +19,7 @@
// of the heavy lifting by taking the `Item` input and performing
// validation, overrides and duplicate setters through the feed.
//
// Full detailed Examples of the API are at https://godoc.org/github.com/eduncan911/podcast.
// Full detailed Examples of the API are at https://godoc.org/github.com/arenzana/podcast.
//
// Go Modules
//
@ -54,8 +54,8 @@
//
// go get -u github.com/dvyukov/go-fuzz/go-fuzz
// go get -u github.com/dvyukov/go-fuzz/go-fuzz-build
// go get -u github.com/eduncan911/podcast
// cd $GOPATH/src/github.com/eduncan911/podcast
// go get -u github.com/arenzana/podcast
// cd $GOPATH/src/github.com/arenzana/podcast
// go-fuzz-build
// go-fuzz -func FuzzPodcastAddItem
//

2
enclosure_test.go

@ -3,7 +3,7 @@ package podcast_test
import (
"testing"
"github.com/eduncan911/podcast"
"github.com/arenzana/podcast"
"github.com/stretchr/testify/assert"
)

22
example_test.go

@ -7,7 +7,7 @@ import (
"os"
"strconv"
"github.com/eduncan911/podcast"
"github.com/arenzana/podcast"
)
func Example_httpHandlers() {
@ -18,15 +18,15 @@ func Example_httpHandlers() {
// instantiate a new Podcast
p := podcast.New(
"eduncan911 Podcasts",
"http://eduncan911.com/",
"arenzana Podcasts",
"https://arenzana.org/",
"An example Podcast",
&pubDate, &updatedDate,
)
// add some channel properties
p.AddAuthor("Jane Doe", "me@janedoe.com")
p.AddAtomLink("http://eduncan911.com/feed.rss")
p.AddAtomLink("http://arenzana.org/feed.rss")
p.AddImage("http://janedoe.com/i.jpg")
p.AddSummary(`link <a href="http://example.com">example.com</a>`)
p.IExplicit = "no"
@ -75,20 +75,20 @@ func Example_httpHandlers() {
// <?xml version="1.0" encoding="UTF-8"?>
// <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
// <channel>
// <title>eduncan911 Podcasts</title>
// <link>http://eduncan911.com/</link>
// <title>arenzana Podcasts</title>
// <link>http://arenzana.org/</link>
// <description>An example Podcast</description>
// <generator>go podcast v1.3.1 (github.com/eduncan911/podcast)</generator>
// <generator>go podcast v1.3.1 (github.com/arenzana/podcast)</generator>
// <language>en-us</language>
// <lastBuildDate>Mon, 06 Feb 2017 08:21:52 +0000</lastBuildDate>
// <managingEditor>me@janedoe.com (Jane Doe)</managingEditor>
// <pubDate>Sat, 04 Feb 2017 08:21:52 +0000</pubDate>
// <image>
// <url>http://janedoe.com/i.jpg</url>
// <title>eduncan911 Podcasts</title>
// <link>http://eduncan911.com/</link>
// <title>arenzana Podcasts</title>
// <link>http://arenzana.org/</link>
// </image>
// <atom:link href="http://eduncan911.com/feed.rss" rel="self" type="application/rss+xml"></atom:link>
// <atom:link href="http://arenzana.org/feed.rss" rel="self" type="application/rss+xml"></atom:link>
// <itunes:author>me@janedoe.com (Jane Doe)</itunes:author>
// <itunes:summary><![CDATA[link <a href="http://example.com">example.com</a>]]></itunes:summary>
// <itunes:image href="http://janedoe.com/i.jpg"></itunes:image>
@ -170,7 +170,7 @@ func Example_ioWriter() {
// <title>Sample Podcasts</title>
// <link>http://example.com/</link>
// <description>An example Podcast</description>
// <generator>go podcast v1.3.1 (github.com/eduncan911/podcast)</generator>
// <generator>go podcast v1.3.1 (github.com/arenzana/podcast)</generator>
// <language>en-us</language>
// <lastBuildDate>Mon, 06 Feb 2017 08:21:52 +0000</lastBuildDate>
// <managingEditor>jane.doe@example.com (Jane Doe)</managingEditor>

16
examples_test.go

@ -5,7 +5,7 @@ import (
"os"
"strconv"
"github.com/eduncan911/podcast"
"github.com/arenzana/podcast"
)
func ExampleNew() {
@ -145,8 +145,8 @@ See more at our website: <a href="http://example.com">example.com</a>
func ExamplePodcast_Bytes() {
p := podcast.New(
"eduncan911 Podcasts",
"http://eduncan911.com/",
"arenzana Podcasts",
"http://arenzana.org/",
"An example Podcast",
&pubDate, &updatedDate,
)
@ -180,18 +180,18 @@ See more at our website: <a href="http://example.com">example.com</a>
// <?xml version="1.0" encoding="UTF-8"?>
// <rss version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
// <channel>
// <title>eduncan911 Podcasts</title>
// <link>http://eduncan911.com/</link>
// <title>arenzana Podcasts</title>
// <link>http://arenzana.org/</link>
// <description>An example Podcast</description>
// <generator>go podcast v1.3.1 (github.com/eduncan911/podcast)</generator>
// <generator>go podcast v1.3.1 (github.com/arenzana/podcast)</generator>
// <language>en-us</language>
// <lastBuildDate>Mon, 06 Feb 2017 08:21:52 +0000</lastBuildDate>
// <managingEditor>me@janedoe.com (Jane Doe)</managingEditor>
// <pubDate>Sat, 04 Feb 2017 08:21:52 +0000</pubDate>
// <image>
// <url>http://janedoe.com/i.jpg</url>
// <title>eduncan911 Podcasts</title>
// <link>http://eduncan911.com/</link>
// <title>arenzana Podcasts</title>
// <link>http://arenzana.org/</link>
// </image>
// <itunes:author>me@janedoe.com (Jane Doe)</itunes:author>
// <itunes:summary><![CDATA[A very cool podcast with a long summary using Bytes()!

2
go.mod

@ -1,4 +1,4 @@
module github.com/eduncan911/podcast
module github.com/arenzana/podcast
go 1.13

2
item_test.go

@ -3,7 +3,7 @@ package podcast_test
import (
"testing"
"github.com/eduncan911/podcast"
"github.com/arenzana/podcast"
"github.com/stretchr/testify/assert"
)

13
podcast.go

@ -36,6 +36,7 @@ type Podcast struct {
SkipDays string `xml:"skipDays,omitempty"`
TTL int `xml:"ttl,omitempty"`
WebMaster string `xml:"webMaster,omitempty"`
Email string `xml:"email,omitempty"`
Image *Image
TextInput *TextInput
AtomLink *AtomLink
@ -52,8 +53,8 @@ type Podcast struct {
INewFeedURL string `xml:"itunes:new-feed-url,omitempty"`
IOwner *Author // Author is formatted for itunes as-is
ICategories []*ICategory
IType string `xml:"itunes:type,omitempty"`
Items []*Item
IType string `xml:"itunes:type,omitempty"`
Items []*Item
encode func(w io.Writer, o interface{}) error
}
@ -72,7 +73,7 @@ func New(title, link, description string,
PubDate: parseDateRFC1123Z(pubDate),
LastBuildDate: parseDateRFC1123Z(lastBuildDate),
Language: "es-es",
IType: "episodic",
IType: "episodic",
// setup dependency (could inject later)
encode: encoder,
}
@ -331,9 +332,9 @@ func (p *Podcast) AddItem(i Item) (int, error) {
//if episode number is not passed; we will just increase the items by one
if i.IEpisode == 0 && p.IType == "episodic" {
i.IEpisode = len(p.Items) + 1
i.IEpisode = len(p.Items) + 1
}
return len(p.Items), nil
}
@ -393,7 +394,7 @@ func (p *Podcast) AddIType(iType string) {
if len(iType) == 0 {
return
}
if iType == "serial" {
p.IType = "serial"
return

2
podcast_test.go

@ -5,7 +5,7 @@ import (
"testing"
"time"
"github.com/eduncan911/podcast"
"github.com/arenzana/podcast"
"github.com/stretchr/testify/assert"
)

Loading…
Cancel
Save