Basic S3 implementation

This commit is contained in:
Ismael Arenzana 2020-11-02 16:16:52 -05:00
parent e6ed60bcf6
commit 81072606a9
15 changed files with 281 additions and 113 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt"
"io"
"os"
"path/filepath"
"strings"
"time"
@ -57,7 +58,7 @@ var addCmd = &cobra.Command{
}
episode := objects.Episode{
newEpisode := objects.Episode{
Title: source.Title(),
Description: description,
PubDate: pubTime.Format(layout),
@ -66,7 +67,7 @@ var addCmd = &cobra.Command{
}
if verbose {
log.WithFields(log.Fields{"payload": fmt.Sprintf("%+v", episode)}).Error("Got good episode")
log.WithFields(log.Fields{"payload": fmt.Sprintf("%+v", newEpisode)}).Info("Got good episode")
}
episodesInJSON, err := getPodcastEpisodesFromJSON(GlobalCfg.Items)
@ -75,18 +76,42 @@ var addCmd = &cobra.Command{
os.Exit(-1)
}
//Upload file if desired
if upload {
s, err := createS3Session()
if err != nil {
log.WithFields(log.Fields{"payload": err}).Error("Error establishing S3 session")
os.Exit(-1)
}
file := filepath.Base(mp3File)
mp3URL, err := uploadFile(s, mp3File, fmt.Sprintf("episodes/%v", file))
if err != nil {
log.WithFields(log.Fields{"payload": err}).Error("Error uploading to S3")
os.Exit(-1)
}
if verbose {
log.WithFields(log.Fields{"payload": mp3URL}).Info("MP3 successfully uploaded to S3")
}
newEpisode.FileURL = mp3URL
}
//Prepend Element to the list
var newEpisodesInJSON []objects.Episode
var newEpisodeNumber int
newEpisodesInJSON = append(newEpisodesInJSON, episode)
newEpisodesInJSON = append(newEpisodesInJSON, newEpisode)
for _, episode := range episodesInJSON.Episodes {
if episode.Episode > newEpisodeNumber {
newEpisodeNumber = episode.Episode
for _, existingEpisode := range episodesInJSON.Episodes {
if existingEpisode.Episode > newEpisodeNumber {
newEpisodeNumber = existingEpisode.Episode
}
newEpisodesInJSON = append(newEpisodesInJSON, episode)
newEpisodesInJSON = append(newEpisodesInJSON, existingEpisode)
}
newEpisodesInJSON[0].Link = fmt.Sprintf("%v/podcast/%v", GlobalCfg.Link, newEpisodeNumber+1)
newEpisodesInJSON[0].Episode = newEpisodeNumber + 1
episodesInJSON.Episodes = newEpisodesInJSON

View File

@ -6,6 +6,7 @@ import (
"io"
"io/ioutil"
"os"
"path/filepath"
"strconv"
"strings"
"time"
@ -94,6 +95,26 @@ var generateCmd = &cobra.Command{
os.Exit(-1)
}
//Upload file if desired
if upload {
s, err := createS3Session()
if err != nil {
log.WithFields(log.Fields{"payload": err}).Error("Error establishing S3 session")
os.Exit(-1)
}
rssFileName := filepath.Base(GlobalCfg.RSSOut)
mp3URL, err := uploadFile(s, GlobalCfg.RSSOut, rssFileName)
if err != nil {
log.WithFields(log.Fields{"payload": err}).Error("Error uploading to S3")
os.Exit(-1)
}
if verbose {
log.WithFields(log.Fields{"payload": mp3URL}).Info("RSS Feed successfully uploaded to S3")
}
}
},
}

View File

@ -10,8 +10,9 @@ import (
"gitlab.com/iarenzana/feeder/objects"
)
var verbose bool
var verbose, upload bool
var cfgFile string
var S3_BUCKET, S3_REGION string
//GlobalCfg is a struct with all the global configuration available
var GlobalCfg objects.Podcast
@ -36,6 +37,7 @@ func init() {
cobra.OnInitialize(initConfig)
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Verbose output")
rootCmd.PersistentFlags().BoolVarP(&upload, "upload", "u", false, "Upload to S3")
}
// initConfig reads in config file and ENV variables if set.
@ -67,6 +69,8 @@ func initConfig() {
GlobalCfg.Items = viper.GetString("podcast_items")
GlobalCfg.RSSURL = viper.GetString("podcast_rss_url")
GlobalCfg.RSSOut = viper.GetString("rss_file")
S3_BUCKET = viper.GetString("s3_bucket")
S3_REGION = viper.GetString("s3_region")
} else {
fmt.Printf("Error parsing config!")
}

View File

@ -15,3 +15,5 @@ podcast_description: "Tres españoles en tres ciudades distintas. Desde el Reino
podcast_items: "/Users/isma/mentidero_episodes.json"
podcast_rss_url: "https://elmentidero.rss.xml"
rss_file: "/Users/isma/Downloads/mentidero.rss.xml"
s3_bucket: "elmentidero"
s3_region: "us-east-1"

View File

@ -4,13 +4,13 @@
"title": "Una Movida Muy Tocha",
"link": "https://elmentidero.net/podcast/33",
"description": "Sam nos cuenta las aventuras de arriesgarse a hacer bromas en un tercer idioma. ¿Empieza con una broma y acaba con una cita? Continuamos hablando de las leyes más absurdas de Francia, desde las relacionadas con la música hasta los derechos de autor de las luces de la Torre Eiffel. \nIsma nos comenta la polémica situación que ha dejado en Estados Unidos la muerte de la jefa del tribunal supremo Ruth Bader Ginsburg a pocas semanas de las elecciones nacionales.\nAlcohol en el trabajo, multas por saltarse la fila, cantos obscenos en la calle y otros desvaríos hoy en El Mentidero. ¿Nos acompañas?",
"summary": "Sam nos cuenta las aventuras de arriesgarse a hacer bromas en un tercer idioma. ¿Empieza con una broma y acaba con una cita? Continuamos hablando de las leyes más absurdas de Francia, desde las relacionadas con la música hasta los derechos de autor de las luces de la Torre Eiffel. \nIsma nos comenta la polémica situación que ha dejado en Estados Unidos la muerte de la jefa del tribunal supremo Ruth Bader Ginsburg a pocas semanas de las elecciones nacionales.\nAlcohol en el trabajo, multas por saltarse la fila, cantos obscenos en la calle y otros desvaríos hoy en El Mentidero. ¿Nos acompañas?",
"summary": "",
"is_explicit": false,
"duration": "2137",
"episode": 33,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero032.mp3",
"pubdate": "2020-10-30T7:28:26 EDT",
"subtitle": "Sam nos cuenta las aventuras de arriesgarse a hacer bromas en un tercer idioma. ¿Empieza con una broma y acaba con una cita? Continuamos hablando de las leyes más absurdas de Francia, desde las relacionadas con la música hasta los derechos de autor de las luces de la Torre Eiffel. \nIsma nos comenta la polémica situación que ha dejado en Estados Unidos la muerte de la jefa del tribunal supremo Ruth Bader Ginsburg a pocas semanas de las elecciones nacionales.\nAlcohol en el trabajo, multas por saltarse la fila, cantos obscenos en la calle y otros desvaríos hoy en El Mentidero. ¿Nos acompañas?",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero33.mp3",
"pubdate": "2020-11-02T16:12:38 EST",
"subtitle": "",
"bytes": 1046814
},
{
@ -21,7 +21,7 @@
"is_explicit": false,
"duration": "2081",
"episode": 32,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero032.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero32.mp3",
"pubdate": "2020-10-28T16:26:07 EDT",
"subtitle": "",
"bytes": 178349
@ -34,7 +34,7 @@
"is_explicit": false,
"duration": "00:33:43",
"episode": 31,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero031.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero31.mp3",
"pubdate": "2020-10-16T11:30:14 EDT",
"subtitle": "Hablamos de pasar tiempo en hogares extranjeros, nuestras zapatillas de andar por casa favoritas y el hacha que tiene Isma colgada de la pared.",
"bytes": 178349
@ -47,7 +47,7 @@
"is_explicit": false,
"duration": "00:34:38",
"episode": 30,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero030.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero30.mp3",
"pubdate": "2020-10-09T11:30:14 EDT",
"subtitle": "",
"bytes": 178349
@ -60,7 +60,7 @@
"is_explicit": false,
"duration": "00:34:06",
"episode": 29,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero029.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero29.mp3",
"pubdate": "2020-10-02T11:22:14 EDT",
"subtitle": "Hoy tenemos a José como invitado que nos habla de Panamá, de las cosas que nos unen y de las cosas que nos diferencian",
"bytes": 178349
@ -73,7 +73,7 @@
"is_explicit": false,
"duration": "00:35:41",
"episode": 28,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero028.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero28.mp3",
"pubdate": "2020-09-25T12:58:14 EDT",
"subtitle": "",
"bytes": 178349
@ -86,7 +86,7 @@
"is_explicit": false,
"duration": "00:36:23",
"episode": 27,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero027.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero27.mp3",
"pubdate": "2020-09-18T12:00:14 EDT",
"subtitle": "El Mentidero vuelve de las vacaciones con mucha ilusión, risas y ganas de volver con todos vosotros.",
"bytes": 178349
@ -99,7 +99,7 @@
"is_explicit": false,
"duration": "00:36:24",
"episode": 26,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero026.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero26.mp3",
"pubdate": "2020-07-31T11:30:14 EDT",
"subtitle": "Despedimos nuestra primera temporada de «El Mentidero» echando la vista atrás y comentando nuestros momentos favoritos grabando el podcast.",
"bytes": 178349
@ -112,7 +112,7 @@
"is_explicit": false,
"duration": "00:36:30",
"episode": 25,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero025.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero25.mp3",
"pubdate": "2020-07-24T12:34:14 EDT",
"subtitle": "Comentamos los protocolos necesarios para cruzar fronteras. Anunciamos las primeras vacaciones de «El Mentidero», descansamos en agosto para volver en septiembre con fuerza. Leemos comentarios de nuestros oyentes: menú del día en un pub. En el programa de hoy tratamos el tema de las oficinas abierta",
"bytes": 178349
@ -125,7 +125,7 @@
"is_explicit": false,
"duration": "00:33:13",
"episode": 24,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero024.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero24.mp3",
"pubdate": "2020-07-17T11:30:14 EDT",
"subtitle": "¡Empezamos fuerte! Isma nos cuenta los secretos de edición detrás del podcast. Admitimos becarios para darle un respiro. Sacamos a la luz la existencia de un episodio 0. Nos comprometemos a avisar por escrito si nos toca la lotería y nos mudamos a Bora Bora. En el episodio de hoy hablamos de la locura de la apertura de los pubs en Reino Unido. Pubs ingleses e irlandeses por el mundo. Nuestras actividades favoritas en los pubs Hablamos de la \"comida de pub\" y la influencia de la cocina india en ellos. Terminamos desmigando el concepto de Pub Quiz, con sorpresa al final.",
"bytes": 178349
@ -138,7 +138,7 @@
"is_explicit": false,
"duration": "00:29:50",
"episode": 23,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero023.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero23.mp3",
"pubdate": "2020-07-10T11:30:14 EDT",
"subtitle": "Debatimos sobre las diferentes redes sociales y su uso en plataformas oficiales. Dedicamos el episodio de hoy a hablar del día de la independencia en Estados Unidos.",
"bytes": 178349
@ -151,7 +151,7 @@
"is_explicit": false,
"duration": "00:33:51",
"episode": 22,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero022.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero22.mp3",
"pubdate": "2020-07-03T12:46:14 EDT",
"subtitle": "BlaBlaCar, AVE y Greyhounds",
"bytes": 178349
@ -164,7 +164,7 @@
"is_explicit": false,
"duration": "00:33:51",
"episode": 22,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero022.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero22.mp3",
"pubdate": "2020-06-26T12:10:08 EDT",
"subtitle": "BlaBlaCar, AVE y Greyhounds",
"bytes": 178349
@ -177,7 +177,7 @@
"is_explicit": false,
"duration": "00:36:58",
"episode": 21,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero021.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero21.mp3",
"pubdate": "2020-06-26T12:10:08 EDT",
"subtitle": "En el episodio de hoy tratamos el tema de la experiencia universitaria. ¿Qué es más importante, el título o los conocimientos adquiridos en la carrera?",
"bytes": 178349
@ -190,7 +190,7 @@
"is_explicit": false,
"duration": "00:34:47",
"episode": 20,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero020.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero20.mp3",
"pubdate": "2020-06-19T11:30:00 EDT",
"subtitle": "Comentamos sin entrar en detalles las dificultades que entraña grabar un podcast y editarlo. En el episodio de hoy compartimos nuestras experiencias de desescalada en los diferentes países en los que vivimos.",
"bytes": 178349
@ -203,7 +203,7 @@
"is_explicit": false,
"duration": "00:36:54",
"episode": 19,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero018.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero18.mp3",
"pubdate": "2020-06-12T18:00:00 EDT",
"subtitle": "Nos despedimos de Pau Donés, vocalista del grupo Jarabe de Palo hablando de su música y compartiendo las canciones que más nos han tocado. En este episodio tratamos el tema del derribo de estatuas durante las protestas del movimiento Black Lives Matter, avivado por el asesinato de George Floyd.",
"bytes": 178349
@ -216,7 +216,7 @@
"is_explicit": false,
"duration": "00:35:50",
"episode": 18,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero018.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero18.mp3",
"pubdate": "2020-06-06T18:00:00 EDT",
"subtitle": "Abrimos nuestro episodio con tés, antihistamínicos y sidras. ¿Existen más tés que el de las cinco en Inglaterra? Exploramos los efectos de la teína/cafeína en nosotros, o la falta de ellos. En el programa de hoy tratamos el tema de los horarios en los distintos países en los que vivimos",
"bytes": 178349
@ -229,7 +229,7 @@
"is_explicit": false,
"duration": "00:38:07",
"episode": 17,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero017.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero17.mp3",
"pubdate": "2020-05-29T18:00:00 EDT",
"subtitle": "Una semana más nos reunimos alrededor de unas cervezas para charlar. Nos planteamos cómo sería montar un bar entre los tres. Acompañamos la conversación de Leffe y Oberon, mientras exploramos el concepto de «microcervecería». Comentamos lo que hace que Rebeca ya sea más que parisina.",
"bytes": 178349
@ -242,7 +242,7 @@
"is_explicit": false,
"duration": "00:35:56",
"episode": 16,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero016.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero16.mp3",
"pubdate": "2020-05-22T11:41:26 EDT",
"subtitle": "Pubs y París",
"bytes": 178349
@ -255,7 +255,7 @@
"is_explicit": false,
"duration": "00:32:44",
"episode": 15,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero015.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero15.mp3",
"pubdate": "2020-05-15T11:58:33 EDT",
"subtitle": "Bourbon, aguas de grifo y cervezas italianas",
"bytes": 10000
@ -268,7 +268,7 @@
"is_explicit": false,
"duration": "00:39:22",
"episode": 14,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero014.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero14.mp3",
"pubdate": "2020-05-08T12:09:14 EDT",
"subtitle": "Mentideros de Madrid y en nuestros paises.",
"bytes": 10000
@ -281,7 +281,7 @@
"is_explicit": false,
"duration": "00:36:50",
"episode": 13,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero013.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero13.mp3",
"pubdate": "2020-05-01T11:53:14 EDT",
"subtitle": "Decidimos empezar a acompañar la conversación durante los podcasts de una bebida diferente cada semana. En el episodio de hoy tratamos el tema de volar.",
"bytes": 10000
@ -294,7 +294,7 @@
"is_explicit": false,
"duration": "00:33:54",
"episode": 12,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero012.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero12.mp3",
"pubdate": "2020-04-24T17:00:00 EDT",
"subtitle": "Esta semana tratamos el tema lingüístico; ¿cómo fue su transición de vivir en español a vivir en inglés?",
"bytes": 10000
@ -307,7 +307,7 @@
"is_explicit": false,
"duration": "00:34:12",
"episode": 11,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero011.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero11.mp3",
"pubdate": "2020-04-17T12:20:45 EDT",
"subtitle": "Eduardo Moreno, un joven mexicano que emigró a Estados Unidos. Hablamos con Eduardo sobre las dificultades a las que tuvo que enfrentarse al mudarse a otro país, qué es lo que más echa de menos y la verdad sobre la cocina mexicana.",
"bytes": 10000
@ -320,7 +320,7 @@
"is_explicit": false,
"duration": "00:36:14",
"episode": 10,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero010.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero10.mp3",
"pubdate": "2020-04-10T12:45:04 EDT",
"subtitle": "Productividad en tiempos de cuarentena y Semana Santa desde el balcón",
"bytes": 10000
@ -333,7 +333,7 @@
"is_explicit": false,
"duration": "00:34:22",
"episode": 9,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero009.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero09.mp3",
"pubdate": "2020-04-03T12:28:00 EDT",
"subtitle": "El campo de patatas de Sam, Isma limpia pistolas y Rebeca va a la Ópera en pijama.",
"bytes": 10000
@ -346,7 +346,7 @@
"is_explicit": false,
"duration": "00:34:48",
"episode": 8,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero008.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero08.mp3",
"pubdate": "2020-03-27T18:00:00 EDT",
"subtitle": "Isma necesita unas bravas del Docamar, Sam come pipas y Rebeca echa de menos el Mercadona.",
"bytes": 10000
@ -359,7 +359,7 @@
"is_explicit": false,
"duration": "00:39:21",
"episode": 7,
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero007.mp3",
"file_url": "https://elmentidero.s3.amazonaws.com/episodes/elmentidero07.mp3",
"pubdate": "2020-03-20T18:00:00 EDT",
"subtitle": "Entramos de lleno en el tema que toca al mundo: ¿Cómo estamos viviendo el Coronavirus? Teletrabajo y supermercados. Debatimos sobre la adecuación de la temporalidad de las medidas de confinamiento tomadas por ciertos países. Intentamos sacar el lado positivo de las consecuencias de esta pandemia. Isma nos cuenta el resultado de su reto para traducir gezellig al español. Terminamos con recomendaciones de libros, series y películas para pasar la cuarentena.",
"bytes": 10000
@ -443,4 +443,4 @@
"bytes": 10000
}
]
}
}

1
go.mod
View File

@ -6,6 +6,7 @@ replace github.com/arenzana/podcast => ../../../github.com/arenzana/podcast
require (
github.com/arenzana/podcast v1.4.2
github.com/aws/aws-sdk-go v1.35.20
github.com/cpuguy83/go-md2man v1.0.10 // indirect
github.com/djimenez/iconv-go v0.0.0-20160305225143-8960e66bd3da // indirect
github.com/faiface/beep v1.0.2 // indirect

8
go.sum
View File

@ -8,6 +8,8 @@ github.com/arenzana/yessir v0.0.0-20200414181447-2d06b8083100/go.mod h1:CAvCtTXI
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20160717043458-3df31a1ada83/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/aws/aws-sdk-go v1.35.20 h1:Hs7x9Czh+MMPnZLQqHhsuZKeNFA3Vuf7pdy2r5QlVb0=
github.com/aws/aws-sdk-go v1.35.20/go.mod h1:tlPOdRjfxPBpNIwqDj61rmsnA85v9jc0Ps9+muhnW+k=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
@ -74,6 +76,9 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jfreymuth/oggvorbis v1.0.0/go.mod h1:abe6F9QRjuU9l+2jek3gj46lu40N4qlYxh2grqkLEDM=
github.com/jfreymuth/vorbis v1.0.0/go.mod h1:8zy3lUAm9K/rJJk223RKy6vjCZTWC61NA2QD06bfOE0=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
@ -182,6 +187,7 @@ golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -218,5 +224,7 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
projects.indigitaldev.net/iarenzana/ingolib v0.29.0/go.mod h1:AVhmup6pLBEqSMCE4bMnHEqtgIb47qyD87JK2j9oxMo=

View File

@ -68,10 +68,10 @@ func New(title, link, description string,
Title: title,
Link: link,
Description: description,
Generator: fmt.Sprintf("feeder v%s (gitlab.com/iarenzana/feeder)", pVersion),
Generator: fmt.Sprintf("go podcast v%s (github.com/eduncan911/podcast)", pVersion),
PubDate: parseDateRFC1123Z(pubDate),
LastBuildDate: parseDateRFC1123Z(lastBuildDate),
Language: "es-es",
Language: "en-us",
IType: "episodic",
// setup dependency (could inject later)
encode: encoder,
@ -467,9 +467,8 @@ var parseAuthorNameEmail = func(a *Author) string {
var author string
if a != nil {
author = a.Email
if len(a.Name) > 0 {
author = fmt.Sprintf("%s", a.Name)
author = fmt.Sprintf("%s (%s)", a.Email, a.Name)
}
}
return author

18
vendor/gopkg.in/yaml.v2/.travis.yml generated vendored
View File

@ -1,12 +1,16 @@
language: go
go:
- 1.4
- 1.5
- 1.6
- 1.7
- 1.8
- 1.9
- tip
- "1.4.x"
- "1.5.x"
- "1.6.x"
- "1.7.x"
- "1.8.x"
- "1.9.x"
- "1.10.x"
- "1.11.x"
- "1.12.x"
- "1.13.x"
- "tip"
go_import_path: gopkg.in/yaml.v2

48
vendor/gopkg.in/yaml.v2/decode.go generated vendored
View File

@ -229,6 +229,10 @@ type decoder struct {
mapType reflect.Type
terrors []string
strict bool
decodeCount int
aliasCount int
aliasDepth int
}
var (
@ -314,7 +318,43 @@ func (d *decoder) prepare(n *node, out reflect.Value) (newout reflect.Value, unm
return out, false, false
}
const (
// 400,000 decode operations is ~500kb of dense object declarations, or
// ~5kb of dense object declarations with 10000% alias expansion
alias_ratio_range_low = 400000
// 4,000,000 decode operations is ~5MB of dense object declarations, or
// ~4.5MB of dense object declarations with 10% alias expansion
alias_ratio_range_high = 4000000
// alias_ratio_range is the range over which we scale allowed alias ratios
alias_ratio_range = float64(alias_ratio_range_high - alias_ratio_range_low)
)
func allowedAliasRatio(decodeCount int) float64 {
switch {
case decodeCount <= alias_ratio_range_low:
// allow 99% to come from alias expansion for small-to-medium documents
return 0.99
case decodeCount >= alias_ratio_range_high:
// allow 10% to come from alias expansion for very large documents
return 0.10
default:
// scale smoothly from 99% down to 10% over the range.
// this maps to 396,000 - 400,000 allowed alias-driven decodes over the range.
// 400,000 decode operations is ~100MB of allocations in worst-case scenarios (single-item maps).
return 0.99 - 0.89*(float64(decodeCount-alias_ratio_range_low)/alias_ratio_range)
}
}
func (d *decoder) unmarshal(n *node, out reflect.Value) (good bool) {
d.decodeCount++
if d.aliasDepth > 0 {
d.aliasCount++
}
if d.aliasCount > 100 && d.decodeCount > 1000 && float64(d.aliasCount)/float64(d.decodeCount) > allowedAliasRatio(d.decodeCount) {
failf("document contains excessive aliasing")
}
switch n.kind {
case documentNode:
return d.document(n, out)
@ -353,7 +393,9 @@ func (d *decoder) alias(n *node, out reflect.Value) (good bool) {
failf("anchor '%s' value contains itself", n.value)
}
d.aliases[n] = true
d.aliasDepth++
good = d.unmarshal(n.alias, out)
d.aliasDepth--
delete(d.aliases, n)
return good
}
@ -746,8 +788,7 @@ func (d *decoder) merge(n *node, out reflect.Value) {
case mappingNode:
d.unmarshal(n, out)
case aliasNode:
an, ok := d.doc.anchors[n.value]
if ok && an.kind != mappingNode {
if n.alias != nil && n.alias.kind != mappingNode {
failWantMap()
}
d.unmarshal(n, out)
@ -756,8 +797,7 @@ func (d *decoder) merge(n *node, out reflect.Value) {
for i := len(n.children) - 1; i >= 0; i-- {
ni := n.children[i]
if ni.kind == aliasNode {
an, ok := d.doc.anchors[ni.value]
if ok && an.kind != mappingNode {
if ni.alias != nil && ni.alias.kind != mappingNode {
failWantMap()
}
} else if ni.kind != mappingNode {

2
vendor/gopkg.in/yaml.v2/resolve.go generated vendored
View File

@ -81,7 +81,7 @@ func resolvableTag(tag string) bool {
return false
}
var yamlStyleFloat = regexp.MustCompile(`^[-+]?[0-9]*\.?[0-9]+([eE][-+][0-9]+)?$`)
var yamlStyleFloat = regexp.MustCompile(`^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$`)
func resolve(tag string, in string) (rtag string, out interface{}) {
if !resolvableTag(tag) {

125
vendor/gopkg.in/yaml.v2/scannerc.go generated vendored
View File

@ -626,30 +626,17 @@ func trace(args ...interface{}) func() {
func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool {
// While we need more tokens to fetch, do it.
for {
// Check if we really need to fetch more tokens.
need_more_tokens := false
if parser.tokens_head == len(parser.tokens) {
// Queue is empty.
need_more_tokens = true
} else {
// Check if any potential simple key may occupy the head position.
if !yaml_parser_stale_simple_keys(parser) {
if parser.tokens_head != len(parser.tokens) {
// If queue is non-empty, check if any potential simple key may
// occupy the head position.
head_tok_idx, ok := parser.simple_keys_by_tok[parser.tokens_parsed]
if !ok {
break
} else if valid, ok := yaml_simple_key_is_valid(parser, &parser.simple_keys[head_tok_idx]); !ok {
return false
} else if !valid {
break
}
for i := range parser.simple_keys {
simple_key := &parser.simple_keys[i]
if simple_key.possible && simple_key.token_number == parser.tokens_parsed {
need_more_tokens = true
break
}
}
}
// We are finished.
if !need_more_tokens {
break
}
// Fetch the next token.
if !yaml_parser_fetch_next_token(parser) {
@ -678,11 +665,6 @@ func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool {
return false
}
// Remove obsolete potential simple keys.
if !yaml_parser_stale_simple_keys(parser) {
return false
}
// Check the indentation level against the current column.
if !yaml_parser_unroll_indent(parser, parser.mark.column) {
return false
@ -837,29 +819,30 @@ func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool {
"found character that cannot start any token")
}
// Check the list of potential simple keys and remove the positions that
// cannot contain simple keys anymore.
func yaml_parser_stale_simple_keys(parser *yaml_parser_t) bool {
// Check for a potential simple key for each flow level.
for i := range parser.simple_keys {
simple_key := &parser.simple_keys[i]
// The specification requires that a simple key
//
// - is limited to a single line,
// - is shorter than 1024 characters.
if simple_key.possible && (simple_key.mark.line < parser.mark.line || simple_key.mark.index+1024 < parser.mark.index) {
// Check if the potential simple key to be removed is required.
if simple_key.required {
return yaml_parser_set_scanner_error(parser,
"while scanning a simple key", simple_key.mark,
"could not find expected ':'")
}
simple_key.possible = false
}
func yaml_simple_key_is_valid(parser *yaml_parser_t, simple_key *yaml_simple_key_t) (valid, ok bool) {
if !simple_key.possible {
return false, true
}
return true
// The 1.2 specification says:
//
// "If the ? indicator is omitted, parsing needs to see past the
// implicit key to recognize it as such. To limit the amount of
// lookahead required, the “:” indicator must appear at most 1024
// Unicode characters beyond the start of the key. In addition, the key
// is restricted to a single line."
//
if simple_key.mark.line < parser.mark.line || simple_key.mark.index+1024 < parser.mark.index {
// Check if the potential simple key to be removed is required.
if simple_key.required {
return false, yaml_parser_set_scanner_error(parser,
"while scanning a simple key", simple_key.mark,
"could not find expected ':'")
}
simple_key.possible = false
return false, true
}
return true, true
}
// Check if a simple key may start at the current position and add it if
@ -879,13 +862,14 @@ func yaml_parser_save_simple_key(parser *yaml_parser_t) bool {
possible: true,
required: required,
token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head),
mark: parser.mark,
}
simple_key.mark = parser.mark
if !yaml_parser_remove_simple_key(parser) {
return false
}
parser.simple_keys[len(parser.simple_keys)-1] = simple_key
parser.simple_keys_by_tok[simple_key.token_number] = len(parser.simple_keys) - 1
}
return true
}
@ -900,19 +884,33 @@ func yaml_parser_remove_simple_key(parser *yaml_parser_t) bool {
"while scanning a simple key", parser.simple_keys[i].mark,
"could not find expected ':'")
}
// Remove the key from the stack.
parser.simple_keys[i].possible = false
delete(parser.simple_keys_by_tok, parser.simple_keys[i].token_number)
}
// Remove the key from the stack.
parser.simple_keys[i].possible = false
return true
}
// max_flow_level limits the flow_level
const max_flow_level = 10000
// Increase the flow level and resize the simple key list if needed.
func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool {
// Reset the simple key on the next level.
parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{})
parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{
possible: false,
required: false,
token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head),
mark: parser.mark,
})
// Increase the flow level.
parser.flow_level++
if parser.flow_level > max_flow_level {
return yaml_parser_set_scanner_error(parser,
"while increasing flow level", parser.simple_keys[len(parser.simple_keys)-1].mark,
fmt.Sprintf("exceeded max depth of %d", max_flow_level))
}
return true
}
@ -920,11 +918,16 @@ func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool {
func yaml_parser_decrease_flow_level(parser *yaml_parser_t) bool {
if parser.flow_level > 0 {
parser.flow_level--
parser.simple_keys = parser.simple_keys[:len(parser.simple_keys)-1]
last := len(parser.simple_keys) - 1
delete(parser.simple_keys_by_tok, parser.simple_keys[last].token_number)
parser.simple_keys = parser.simple_keys[:last]
}
return true
}
// max_indents limits the indents stack size
const max_indents = 10000
// Push the current indentation level to the stack and set the new level
// the current column is greater than the indentation level. In this case,
// append or insert the specified token into the token queue.
@ -939,6 +942,11 @@ func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml
// indentation level.
parser.indents = append(parser.indents, parser.indent)
parser.indent = column
if len(parser.indents) > max_indents {
return yaml_parser_set_scanner_error(parser,
"while increasing indent level", parser.simple_keys[len(parser.simple_keys)-1].mark,
fmt.Sprintf("exceeded max depth of %d", max_indents))
}
// Create a token and insert it into the queue.
token := yaml_token_t{
@ -989,6 +997,8 @@ func yaml_parser_fetch_stream_start(parser *yaml_parser_t) bool {
// Initialize the simple key stack.
parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{})
parser.simple_keys_by_tok = make(map[int]int)
// A simple key is allowed at the beginning of the stream.
parser.simple_key_allowed = true
@ -1270,7 +1280,11 @@ func yaml_parser_fetch_value(parser *yaml_parser_t) bool {
simple_key := &parser.simple_keys[len(parser.simple_keys)-1]
// Have we found a simple key?
if simple_key.possible {
if valid, ok := yaml_simple_key_is_valid(parser, simple_key); !ok {
return false
} else if valid {
// Create the KEY token and insert it into the queue.
token := yaml_token_t{
typ: yaml_KEY_TOKEN,
@ -1288,6 +1302,7 @@ func yaml_parser_fetch_value(parser *yaml_parser_t) bool {
// Remove the simple key.
simple_key.possible = false
delete(parser.simple_keys_by_tok, simple_key.token_number)
// A simple key cannot follow another simple key.
parser.simple_key_allowed = false

2
vendor/gopkg.in/yaml.v2/yaml.go generated vendored
View File

@ -89,7 +89,7 @@ func UnmarshalStrict(in []byte, out interface{}) (err error) {
return unmarshal(in, out, true)
}
// A Decorder reads and decodes YAML values from an input stream.
// A Decoder reads and decodes YAML values from an input stream.
type Decoder struct {
strict bool
parser *parser

1
vendor/gopkg.in/yaml.v2/yamlh.go generated vendored
View File

@ -579,6 +579,7 @@ type yaml_parser_t struct {
simple_key_allowed bool // May a simple key occur at the current position?
simple_keys []yaml_simple_key_t // The stack of simple keys.
simple_keys_by_tok map[int]int // possible simple_key indexes indexed by token_number
// Parser stuff

50
vendor/modules.txt vendored
View File

@ -1,6 +1,52 @@
# github.com/arenzana/podcast v1.4.2 => ../../../github.com/arenzana/podcast
## explicit
github.com/arenzana/podcast
# github.com/aws/aws-sdk-go v1.35.20
## explicit
github.com/aws/aws-sdk-go/aws
github.com/aws/aws-sdk-go/aws/arn
github.com/aws/aws-sdk-go/aws/awserr
github.com/aws/aws-sdk-go/aws/awsutil
github.com/aws/aws-sdk-go/aws/client
github.com/aws/aws-sdk-go/aws/client/metadata
github.com/aws/aws-sdk-go/aws/corehandlers
github.com/aws/aws-sdk-go/aws/credentials
github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds
github.com/aws/aws-sdk-go/aws/credentials/endpointcreds
github.com/aws/aws-sdk-go/aws/credentials/processcreds
github.com/aws/aws-sdk-go/aws/credentials/stscreds
github.com/aws/aws-sdk-go/aws/csm
github.com/aws/aws-sdk-go/aws/defaults
github.com/aws/aws-sdk-go/aws/ec2metadata
github.com/aws/aws-sdk-go/aws/endpoints
github.com/aws/aws-sdk-go/aws/request
github.com/aws/aws-sdk-go/aws/session
github.com/aws/aws-sdk-go/aws/signer/v4
github.com/aws/aws-sdk-go/internal/context
github.com/aws/aws-sdk-go/internal/ini
github.com/aws/aws-sdk-go/internal/s3shared
github.com/aws/aws-sdk-go/internal/s3shared/arn
github.com/aws/aws-sdk-go/internal/s3shared/s3err
github.com/aws/aws-sdk-go/internal/sdkio
github.com/aws/aws-sdk-go/internal/sdkmath
github.com/aws/aws-sdk-go/internal/sdkrand
github.com/aws/aws-sdk-go/internal/sdkuri
github.com/aws/aws-sdk-go/internal/shareddefaults
github.com/aws/aws-sdk-go/internal/strings
github.com/aws/aws-sdk-go/internal/sync/singleflight
github.com/aws/aws-sdk-go/private/checksum
github.com/aws/aws-sdk-go/private/protocol
github.com/aws/aws-sdk-go/private/protocol/eventstream
github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi
github.com/aws/aws-sdk-go/private/protocol/json/jsonutil
github.com/aws/aws-sdk-go/private/protocol/query
github.com/aws/aws-sdk-go/private/protocol/query/queryutil
github.com/aws/aws-sdk-go/private/protocol/rest
github.com/aws/aws-sdk-go/private/protocol/restxml
github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil
github.com/aws/aws-sdk-go/service/s3
github.com/aws/aws-sdk-go/service/sts
github.com/aws/aws-sdk-go/service/sts/stsiface
# github.com/cpuguy83/go-md2man v1.0.10
## explicit
# github.com/djimenez/iconv-go v0.0.0-20160305225143-8960e66bd3da
@ -25,6 +71,8 @@ github.com/hashicorp/hcl/json/scanner
github.com/hashicorp/hcl/json/token
# github.com/inconshreveable/mousetrap v1.0.0
github.com/inconshreveable/mousetrap
# github.com/jmespath/go-jmespath v0.4.0
github.com/jmespath/go-jmespath
# github.com/konsorten/go-windows-terminal-sequences v1.0.2
## explicit
github.com/konsorten/go-windows-terminal-sequences
@ -77,6 +125,6 @@ golang.org/x/sys/unix
## explicit
golang.org/x/text/transform
golang.org/x/text/unicode/norm
# gopkg.in/yaml.v2 v2.2.2
# gopkg.in/yaml.v2 v2.2.8
gopkg.in/yaml.v2
# github.com/arenzana/podcast => ../../../github.com/arenzana/podcast