Fix issue with UpdateDate

master
Uriel Fanelli 2023-07-15 00:25:03 +02:00
parent e96053d8e7
commit 34caf24f6c
7 changed files with 55 additions and 13 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
*.sh
zorg.conf
zorg
feeds.conf
.vscode/*

BIN
createtoken/createtoken Executable file

Binary file not shown.

23
createtoken/gettoken.go Normal file
View File

@ -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)
}

14
feed.go
View File

@ -26,6 +26,7 @@ func forwardLastFeed(url string) {
}
var b *gofeed.Item
var postAge time.Time
if len(feed.Items) > 0 {
b = feed.Items[0]
@ -34,7 +35,18 @@ func forwardLastFeed(url string) {
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)
log.Println("New content from: ", feed.Title, b.Title)

View File

@ -1,10 +1,5 @@
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
https://keinpfusch.net/feed.xml
https://git.keinpfusch.net/loweel/zangtumb.rss
https://git.keinpfusch.net/loweel/zoreide.rss
https://git.keinpfusch.net/loweel/zorg.rss
https://git.keinpfusch.net/loweel/zabov.rss

10
feeds.conf.example Normal file
View File

@ -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

View File

@ -3,6 +3,7 @@ package main
import (
"os"
"os/signal"
"syscall"
)
func main() {
@ -10,7 +11,7 @@ func main() {
// Just a nice way to wait until the Operating system sends a kill signal.
// select{} was just horrible.
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
<-c
os.Exit(0)