Fix issue with UpdateDate
parent
e96053d8e7
commit
34caf24f6c
|
@ -1,4 +1,5 @@
|
||||||
*.sh
|
*.sh
|
||||||
zorg.conf
|
zorg.conf
|
||||||
zorg
|
zorg
|
||||||
|
feeds.conf
|
||||||
.vscode/*
|
.vscode/*
|
Binary file not shown.
|
@ -0,0 +1,23 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/mattn/go-mastodon"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
app, err := mastodon.RegisterApp(context.Background(), &mastodon.AppConfig{
|
||||||
|
Server: "https://boseburo.ddns.net",
|
||||||
|
ClientName: "zorg",
|
||||||
|
Scopes: "read write follow",
|
||||||
|
Website: "https://git.keinpfusch.net/loweel/zorg.git",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
fmt.Printf("client-id : %s\n", app.ClientID)
|
||||||
|
fmt.Printf("client-secret: %s\n", app.ClientSecret)
|
||||||
|
}
|
16
feed.go
16
feed.go
|
@ -26,6 +26,7 @@ func forwardLastFeed(url string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var b *gofeed.Item
|
var b *gofeed.Item
|
||||||
|
var postAge time.Time
|
||||||
|
|
||||||
if len(feed.Items) > 0 {
|
if len(feed.Items) > 0 {
|
||||||
b = feed.Items[0]
|
b = feed.Items[0]
|
||||||
|
@ -34,7 +35,18 @@ func forwardLastFeed(url string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if time.Since(*b.PublishedParsed) < Zint {
|
postAge = time.Now()
|
||||||
|
log.Println("Post Age: ", postAge)
|
||||||
|
|
||||||
|
if b.PublishedParsed != nil {
|
||||||
|
postAge = *b.PublishedParsed
|
||||||
|
} else {
|
||||||
|
postAge = *b.UpdatedParsed
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Println("Post Age: ", postAge)
|
||||||
|
|
||||||
|
if time.Since(postAge) < Zint {
|
||||||
|
|
||||||
postOnMastodon(b.Link, "["+feed.Title+"] "+b.Title)
|
postOnMastodon(b.Link, "["+feed.Title+"] "+b.Title)
|
||||||
log.Println("New content from: ", feed.Title, b.Title)
|
log.Println("New content from: ", feed.Title, b.Title)
|
||||||
|
@ -44,7 +56,7 @@ func forwardLastFeed(url string) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//but we need to iterate on feeds....
|
// but we need to iterate on feeds....
|
||||||
func feedDaemon() {
|
func feedDaemon() {
|
||||||
|
|
||||||
ticker := time.NewTicker(Zint)
|
ticker := time.NewTicker(Zint)
|
||||||
|
|
15
feeds.conf
15
feeds.conf
|
@ -1,10 +1,5 @@
|
||||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCDmCBKaKOtOrEqgsL4-3C8Q
|
https://keinpfusch.net/feed.xml
|
||||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCYcXk-yEg9LgyAPm7mpIs-g
|
https://git.keinpfusch.net/loweel/zangtumb.rss
|
||||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCNvsIonJdJ5E4EXMa65VYpA
|
https://git.keinpfusch.net/loweel/zoreide.rss
|
||||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCeYbbVx7CQn6tbkkmpPldTg
|
https://git.keinpfusch.net/loweel/zorg.rss
|
||||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCvKejuca1oOhFRXpZpSn3ew
|
https://git.keinpfusch.net/loweel/zabov.rss
|
||||||
https://blog.soykaf.com/post/index.xml
|
|
||||||
https://blog.golang.org/feed.atom
|
|
||||||
https://writings.stephenwolfram.com/feed/
|
|
||||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCwUizOU8pPWXdXNniXypQEQ
|
|
||||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCuCYsYBaq3j0gM4wWo82LkQ
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
https://www.youtube.com/feeds/videos.xml?channel_id=UCDmCBKaKOtOrEqgsL4-3C8Q
|
||||||
|
https://www.youtube.com/feeds/videos.xml?channel_id=UCYcXk-yEg9LgyAPm7mpIs-g
|
||||||
|
https://www.youtube.com/feeds/videos.xml?channel_id=UCNvsIonJdJ5E4EXMa65VYpA
|
||||||
|
https://www.youtube.com/feeds/videos.xml?channel_id=UCeYbbVx7CQn6tbkkmpPldTg
|
||||||
|
https://www.youtube.com/feeds/videos.xml?channel_id=UCvKejuca1oOhFRXpZpSn3ew
|
||||||
|
https://blog.soykaf.com/post/index.xml
|
||||||
|
https://blog.golang.org/feed.atom
|
||||||
|
https://writings.stephenwolfram.com/feed/
|
||||||
|
https://www.youtube.com/feeds/videos.xml?channel_id=UCwUizOU8pPWXdXNniXypQEQ
|
||||||
|
https://www.youtube.com/feeds/videos.xml?channel_id=UCuCYsYBaq3j0gM4wWo82LkQ
|
3
zorg.go
3
zorg.go
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -10,7 +11,7 @@ func main() {
|
||||||
// Just a nice way to wait until the Operating system sends a kill signal.
|
// Just a nice way to wait until the Operating system sends a kill signal.
|
||||||
// select{} was just horrible.
|
// select{} was just horrible.
|
||||||
c := make(chan os.Signal, 1)
|
c := make(chan os.Signal, 1)
|
||||||
signal.Notify(c, os.Interrupt, os.Kill)
|
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||||
<-c
|
<-c
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue