diff --git a/handlers/torrent/main.go b/handlers/torrent/main.go index 591795b..24ab8e2 100644 --- a/handlers/torrent/main.go +++ b/handlers/torrent/main.go @@ -11,6 +11,7 @@ import ( "local/storage" "log" "net/http" + "path" "regexp" "strings" "time" @@ -99,12 +100,12 @@ func config() (*Config, error) { } func pull(db storage.DB, vpntor, outdir, url string) error { - gofeed, err := getGoFeed(url) + gfeed, err := getGoFeed(url) if err != nil { return err } - log.Printf("feed: %v", gofeed.Title) - for _, item := range gofeed.Items { + log.Printf("feed: %v", gfeed.Title) + for _, item := range gfeed.Items { if ok, err := isDone(db, item.Link); err != nil { return err } else if ok { @@ -114,7 +115,10 @@ func pull(db storage.DB, vpntor, outdir, url string) error { if err != nil { return err } - if err := handle(vpntor, outdir, s); err != nil { + if item.Author == nil { + item.Author = &gofeed.Person{Name: "."} + } + if err := handle(vpntor, path.Join(outdir, item.Author.Name), s); err != nil { return err } if err := db.Set(item.Link, []byte{}); err != nil { diff --git a/rss/feed.go b/rss/feed.go index 5063c17..4247db1 100644 --- a/rss/feed.go +++ b/rss/feed.go @@ -21,6 +21,7 @@ type Feed struct { TitleFilter string ContentFilter string Tags []string + Copyright string } func SubmitFeed(f *Feed) error { @@ -72,7 +73,7 @@ func (f *Feed) Pull() error { itemTSs := []*time.Time{} for _, i := range gofeed.Items { - item, err := newItem(i, f.ContentFilter) + item, err := newItem(i, f.ContentFilter, f.Copyright) if err != nil { log.Println("[Pull]", err) continue diff --git a/rss/item.go b/rss/item.go index 5cbe794..77dff2f 100644 --- a/rss/item.go +++ b/rss/item.go @@ -16,20 +16,22 @@ import ( const nsItems = "nsItems" type Item struct { - Title string - Link string - Content string - TS time.Time + Title string + Link string + Content string + TS time.Time + Copyright string } type Items []*Item -func newItem(i *gofeed.Item, contentFilter string) (*Item, error) { +func newItem(i *gofeed.Item, contentFilter, copyright string) (*Item, error) { item := &Item{ - Title: i.Title, - Link: i.Link, - Content: i.Content, - TS: latestTSPtr(i.UpdatedParsed, i.PublishedParsed), + Title: i.Title, + Link: i.Link, + Content: i.Content, + TS: latestTSPtr(i.UpdatedParsed, i.PublishedParsed), + Copyright: copyright, } if item.Content == "" { diff --git a/rss/item_test.go b/rss/item_test.go index 6c4f5ba..56a9ac2 100644 --- a/rss/item_test.go +++ b/rss/item_test.go @@ -30,12 +30,12 @@ func TestRSSItemNewEncodeDecode(t *testing.T) { gofeed.Items[0].Content = "" gofeed.Items[0].Description = "" - item, err := newItem(gofeed.Items[0], ".*") + item, err := newItem(gofeed.Items[0], ".*", "") if err != nil { t.Fatal(err) } - itemB, err := newItem(gofeed.Items[0], "Podcast") + itemB, err := newItem(gofeed.Items[0], "Podcast", "") if err != nil { t.Fatal(err) } diff --git a/rss/serialize.go b/rss/serialize.go index e3ad4b1..9878eb3 100644 --- a/rss/serialize.go +++ b/rss/serialize.go @@ -43,6 +43,7 @@ func WriteFeed(w io.Writer, tag string, items []*Item) error { Title: item.Title, Link: &feeds.Link{Href: item.Link}, Description: item.Content, + Author: &feeds.Author{Name: item.Copyright}, Created: item.TS, } } diff --git a/rss/serialize_test.go b/rss/serialize_test.go index 19f91d3..6a7fb10 100644 --- a/rss/serialize_test.go +++ b/rss/serialize_test.go @@ -47,6 +47,7 @@ func TestRSSWriteFeed(t *testing.T) { f.ContentFilter = "b" f.Tags = []string{"c"} f.URL = s.URL + f.Copyright = "copyright" log.SetOutput(bytes.NewBuffer(nil)) defer log.SetOutput(os.Stderr) diff --git a/rss/testdata/rss.xml b/rss/testdata/rss.xml index d36f6c9..346f21b 100644 --- a/rss/testdata/rss.xml +++ b/rss/testdata/rss.xml @@ -11,6 +11,7 @@ Rooster Teeth On a weekly basis the Rooster Teeth crew discuss gaming, films, popular culture, the internet, and projects that they're currently working on. Watch LIVE every Monday at 5PM CT on svod.roosterteeth.com. Watch the free video version at YouTube.com/RoosterTeeth. On a weekly basis the Rooster Teeth crew discuss gaming, films, popular culture, the internet, and projects that they're currently working on. Watch LIVE every Monday at 5PM CT on svod.roosterteeth.com. Watch the free video version at YouTube.com/RoosterTeeth. + my content here Gus Sorola, Rooster Teeth podcast@roosterteeth.com @@ -24,6 +25,8 @@ Rooster Teeth Podcast Tue, 18 Jun 2019 19:00:00 +0000 Join Gus Sorola, Chris Demarais, Blaine Gibson, and Gavin Free as they discuss raditation, toilet paper face, Chris's continued haircuts, and more on this week's RT Podcast! + my content here + my copyright here 549 01:33:59 @@ -35,6 +38,8 @@ Rooster Teeth Podcast Tue, 11 Jun 2019 19:00:00 +0000 Join Gus Sorola, Chris Demarais, Barbara Dunkelman, and Geoff Ramsey as they discuss haircuts, old apartments, reality television, and more on this week's RT Podcast! + my content here + my copyright here 548 01:31:10 @@ -46,6 +51,8 @@ Rooster Teeth Podcast Tue, 04 Jun 2019 19:00:00 +0000 Join Gus Sorola, Miles Luna, Ellie Main, and Becca Frasier as they discuss Apple’s WWDC event, going to space, school, and more on this week's RT Podcast! + my content here + my copyright here 547 01:36:49 @@ -57,6 +64,8 @@ Rooster Teeth Podcast Tue, 28 May 2019 19:00:00 +0000 Join Gus Sorola, Gavin Free, Blaine Gibson, and Burnie Burns as they discuss decimation, Chernobyl, recasting the MCU, frumpy Vader and more on this week's RT Podcast! + my content here + my copyright here 546 01:36:13 @@ -68,6 +77,8 @@ Rooster Teeth Podcast Tue, 21 May 2019 19:00:00 +0000 Join Gus Sorola, Gavin Free, Barbara Dunkelman, and Burnie Burns as they discuss steaks, sleep apnea, the Game of Thrones finale (in the final 30 minutes), and more on this week's RT Podcast! + my content here + my copyright here 545 01:43:16 @@ -79,6 +90,8 @@ Rooster Teeth Podcast Tue, 14 May 2019 19:00:00 +0000 Join Gus Sorola, Barbara Dunkelman, Burnie Burns, and special guest Markiplier as they discuss medical issues, live-streaming, Game of Thrones (in the final 30 minutes), and more on this week's RT Podcast! + my content here + my copyright here 544 01:37:03 @@ -90,6 +103,8 @@ Rooster Teeth Podcast Tue, 07 May 2019 19:00:00 +0000 Join Gus Sorola, Chris Demarais, Barbara Dunkelman, and Burnie Burns as they discuss VR games, Chris’ car accident, Avengers Endgame (in the final 25 minutes), and more on this week's RT Podcast! + my content here + my copyright here 543 01:49:39 @@ -101,6 +116,8 @@ Rooster Teeth Podcast Tue, 30 Apr 2019 19:00:00 +0000 Join Gus Sorola, Gavin Free, Barbara Dunkelman, and Burnie Burns as they discuss horizontal vs vertical videos, cats, Game of Thrones (in the last 15 minutes), and more on this week's RT Podcast! + my content here + my copyright here 542 01:47:22 @@ -112,6 +129,8 @@ Rooster Teeth Podcast Tue, 23 Apr 2019 19:00:00 +0000 Join Gus Sorola, Gavin Free, and Jon Risinger as they discuss computer problems, rideshare stories, a weird form of vaping, and more on this week's RT Podcast! + my content here + my copyright here 541 01:37:42 @@ -123,6 +142,8 @@ Rooster Teeth Podcast Tue, 16 Apr 2019 19:00:00 +0000 Join Gus Sorola, Gavin Free, Barbara Dunkelman, and Blaine Gibson as they discuss the world’s biggest plane, black holes, getting your car towed, and more on this week's RT Podcast! + my content here + my copyright here 540 01:35:07 @@ -134,6 +155,8 @@ Rooster Teeth Podcast Tue, 09 Apr 2019 19:00:00 +0000 Join Gus Sorola, Gavin Free, Barbara Dunkelman, and Burnie Burns as they discuss Game of Thrones, food poisoning, the American flag, Stuber, and more on this week's RT Podcast! + my content here + my copyright here 539 01:43:39 @@ -145,6 +168,8 @@ Rooster Teeth Podcast Tue, 02 Apr 2019 19:00:00 +0000 Join Matt Hullum, Gavin Free, Ellie Main, Burnie Burns, and Chad James as they discuss glitter, companies Rooster Teeth has outlasted, timesheets, and more on this week's RT Podcast! + my content here + my copyright here 538 01:45:00 @@ -156,6 +181,7 @@ Rooster Teeth Podcast Tue, 26 Mar 2019 19:00:00 +0000 Join Ashley Jenkins, Ellie Main, Barbara Dunkelman, Burnie Burns, and Chad James as they discuss Marvel and DC, stand-up comedy, pregnancy, and more on this week's RT Podcast! + my content here 537 01:37:44 @@ -167,6 +193,7 @@ Rooster Teeth Podcast Tue, 19 Mar 2019 19:00:00 +0000 Join Gus Sorola, Gavin Free, Barbara Dunkelman and special guest James Willems as they discuss firework holidays, Benson the dog, failed conventions, and more on this week's RT Podcast! + my content here 536 01:54:54 @@ -178,6 +205,7 @@ Rooster Teeth Podcast Tue, 12 Mar 2019 19:00:00 +0000 Join Gus Sorola, Burnie Burns, and special guests Rhett and Link as they discuss kolaches, internetainment, the history of the business, and more on this week's RT Podcast! + my content here 535 01:36:22 @@ -189,6 +217,7 @@ Rooster Teeth Podcast Tue, 05 Mar 2019 20:00:00 +0000 Join Gus Sorola, Gavin Free, Barbara Dunkelman, and Burnie Burns as they discuss pancakes, flat-earthers, Fyre Festival, and more on this week's RT Podcast! And be sure to stick around for a special post-show interview with Zachary Levi. + my content here 534 02:10:36 @@ -200,6 +229,7 @@ Rooster Teeth Podcast Tue, 26 Feb 2019 20:00:00 +0000 Join Gus Sorola, Gavin Free, Ellie Main, and Burnie Burns as they discuss s’mores, Brexit, conspiracy theories, and more on this week's RT Podcast! + my content here 533 01:41:56 @@ -211,6 +241,7 @@ Rooster Teeth Podcast Tue, 19 Feb 2019 20:00:00 +0000 Join Gus Sorola, Gavin Free, Barbara Dunkelman, and Burnie Burns as they discuss Apex Legends, printer technology, time zones, and more on this week's RT Podcast! + my content here 532 01:35:25 @@ -222,6 +253,7 @@ Rooster Teeth Podcast Tue, 12 Feb 2019 20:00:00 +0000 Join Gus Sorola, Gavin Free, Barbara Dunkelman, and Burnie Burns as they discuss internet outrage, a Vine quiz, YouTube changes, and more on this week's RT Podcast! + my content here 531 01:39:09 @@ -233,6 +265,7 @@ Rooster Teeth Podcast Tue, 05 Feb 2019 20:00:00 +0000 Join Blaine Gibson, Gavin Free, Barbara Dunkelman, and Burnie Burns as they discuss movie effects and if they hold up, the Marvel Cinematic Universe, Gavin getting shot with a paintball, and more on this week's RT Podcast! + my content here 530 01:33:55 @@ -244,6 +277,7 @@ Rooster Teeth Podcast Tue, 29 Jan 2019 20:00:00 +0000 Join Gus Sorola, Mariel Salcedo, Barbara Dunkelman, and Burnie Burns as they discuss nutmeg heroin, French trailer parks, Glass, and Mariel crying on this week's RT Podcast! + my content here 529 01:32:22 @@ -255,6 +289,7 @@ Rooster Teeth Podcast Tue, 22 Jan 2019 20:00:00 +0000 Join Gus Sorola, Geoff Ramsey, and Burnie Burns as they discuss Cheez Balls and black coffee, getting old, a bunch of ways to die, and more on this week's RT Podcast! + my content here 528 01:44:59 @@ -266,6 +301,7 @@ Rooster Teeth Podcast Tue, 15 Jan 2019 20:00:00 +0000 Join Gus Sorola, Chad James, Barbara Dunkelman, and Burnie Burns as they discuss toilet paper, customer service, sunburns, and more on this week's RT Podcast! + my content here 527 01:30:24 @@ -277,6 +313,7 @@ Rooster Teeth Podcast Tue, 08 Jan 2019 20:00:00 +0000 Join Gus Sorola, Gavin Free, Barbara Dunkelman, and Burnie Burns as they discuss Tik Tok, CES 2019, the government shutdown, and more on this week's RT Podcast! + my content here 526 01:35:08 @@ -288,6 +325,7 @@ Rooster Teeth Podcast Tue, 01 Jan 2019 21:25:00 +0000 Join Gus Sorola and Gavin Free and even Jack Patillo, along with other special guests as they wrap up 2018 and look ahead to 2019...and Gus has another lost package story. + my content here 525 01:27:31 @@ -299,6 +337,7 @@ Rooster Teeth Podcast Tue, 25 Dec 2018 20:00:00 +0000 Join Gus Sorola, Chris Demarais, Jon Risinger, and Barbara Dunkelman as they discuss Santa Claus, falling down, favorite movies of the year, and more on this week's RT Podcast! + my content here 524 01:33:41 @@ -310,6 +349,7 @@ Rooster Teeth Podcast Tue, 18 Dec 2018 20:00:00 +0000 Join Gus Sorola, Blaine Gibson, Barbara Dunkelman, and Burnie Burns as they discuss the Licki cat brush, the RT holiday party, best movies of the year, and more on this week's RT Podcast! + my content here 523 01:36:34 @@ -321,6 +361,7 @@ Rooster Teeth Podcast Tue, 11 Dec 2018 20:00:00 +0000 Join Gus Sorola, Gavin Free, Barbara Dunkelman, and Burnie Burns as they discuss ten years of the podcast, bets, YouTube Rewind, and more on this week's RT Podcast! + my content here 522 01:35:10 @@ -332,6 +373,7 @@ Rooster Teeth Podcast Tue, 04 Dec 2018 20:00:00 +0000 Join Gus Sorola, Gavin Free, Barbara Dunkelman, Burnie Burns, and special guest Grace Helbig as they discuss cats, hang gliding gone wrong, Tumblr banning adult content, and more on this week's RT Podcast! + my content here 521 01:33:55 @@ -343,6 +385,7 @@ Rooster Teeth Podcast Tue, 27 Nov 2018 20:00:00 +0000 Join Gus Sorola, Geoff Ramsey, and Burnie Burns as they discuss the post office, coming up with names and titles, ghosts, and more on this week's RT Podcast! + my content here 520 01:30:27 @@ -354,6 +397,7 @@ Rooster Teeth Podcast Tue, 20 Nov 2018 20:00:00 +0000 Join Gus Sorola, Gavin Free, Chris Demarais, and Burnie Burns as they discuss the Gus calendar, the Star Wars movies, circumcision, and more on this week's RT Podcast! + my content here 519 01:34:45 @@ -365,6 +409,7 @@ Rooster Teeth Podcast Tue, 13 Nov 2018 20:00:00 +0000 Join Gus Sorola, Gavin Free, Blaine Gibson, Burnie Burns, and special guest Sally Le Page as they discuss Extra Life aftermath, plane stories, cats, and more on this week's RT Podcast! + my content here 518 01:39:31 @@ -376,6 +421,7 @@ Rooster Teeth Podcast Tue, 06 Nov 2018 20:00:00 +0000 Join Gus Sorola, Becca Frasier, Barbara Dunkelman, and Jon Risinger as they discuss voting, documentaries, mall Santas, and more on this week's RT Podcast! + my content here 517 01:32:43 @@ -5997,6 +6043,8 @@ Rooster Teeth Podcast Wed, 29 Aug 2012 15:18:32 +0000 RT farts on Gavin + my content here + my copyright here 181 00:00:00 @@ -6008,6 +6056,8 @@ Rooster Teeth Podcast Wed, 05 Sep 2012 22:38:48 +0000 RT does not know emotion. + my content here + my copyright here 182 00:00:00 @@ -6019,6 +6069,8 @@ Rooster Teeth Podcast Wed, 12 Sep 2012 15:59:03 +0000 RT sits down with Hannah Hart and Shira Lazar! + my content here + my copyright here 183 00:00:00 @@ -6030,6 +6082,8 @@ Rooster Teeth Podcast Wed, 19 Sep 2012 15:44:51 +0000 RT does not wear seat belts in taxis. + my content here + my copyright here 184 00:00:00 @@ -6041,6 +6095,8 @@ Rooster Teeth Podcast Tue, 19 Nov 2013 22:55:27 +0000 RT Discusses Wild Videos + my content here + my copyright here 245 01:35:28 @@ -6052,6 +6108,8 @@ Rooster Teeth Podcast Tue, 30 Dec 2014 19:54:50 +0000 RT Discusses ASMR Triggers + my content here + my copyright here 304 01:40:02 diff --git a/server/routes.go b/server/routes.go index bce9f91..06a4b93 100644 --- a/server/routes.go +++ b/server/routes.go @@ -79,6 +79,7 @@ func (s *Server) feed(w http.ResponseWriter, r *http.Request) { URL string `json:"url"` Interval string `json:"refresh"` TitleFilter string `json:"items"` + Copyright string `json:"copyright"` ContentFilter string `json:"content"` Tags []string `json:"tags"` } @@ -97,6 +98,7 @@ func (s *Server) feed(w http.ResponseWriter, r *http.Request) { TitleFilter: putFeed.TitleFilter, ContentFilter: putFeed.ContentFilter, Tags: putFeed.Tags, + Copyright: putFeed.Copyright, } if err := rss.SubmitFeed(f); err != nil { s.error(w, r, err) diff --git a/tmpUuCa b/tmpUuCa new file mode 100644 index 0000000..0c88b21 --- /dev/null +++ b/tmpUuCa @@ -0,0 +1,16 @@ + +FROM alpine as certs +RUN apk update && apk add --no-cache ca-certificates + +FROM busybox:glibc +RUN mkdir -p /var/log +WORKDIR /main +COPY --from=certs /etc/ssl/certs /etc/ssl/certs + +COPY . . + +ENV GOPATH="" +ENV MNT="/mnt/" +ENTRYPOINT ["/main/exec-rssmon3"] +CMD [] +