fix: better output

Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
HeshamTB 2024-07-22 14:24:44 +03:00
parent 1850201f68
commit 1dc2dcd539
Signed by: Hesham
GPG Key ID: 74876157D199B09E

View File

@ -1,20 +1,20 @@
package main package main
import ( import (
"context" "context"
"flag" "flag"
"fmt" "fmt"
"io" "io"
"log" "log"
"net/http" "net/http"
"os" "os"
"os/signal" "os/signal"
"strings" "strings"
"time" "time"
"gitea.hbanafa.com/hesham/yttopodcast/bouncer" "gitea.hbanafa.com/hesham/yttopodcast/bouncer"
"gitea.hbanafa.com/hesham/yttopodcast/dylinkprovider" "gitea.hbanafa.com/hesham/yttopodcast/dylinkprovider"
"gitea.hbanafa.com/hesham/yttopodcast/feed" "gitea.hbanafa.com/hesham/yttopodcast/feed"
) )
var ( var (
@ -76,7 +76,7 @@ func main() {
l.Println("channel count: ", len(ids)) l.Println("channel count: ", len(ids))
l.Printf("channels: %v\n", ids) l.Printf("channels: %v\n", ids)
l.Println("initial feed generation") l.Println("[feed] initial feed generation")
genFeeds(ids) genFeeds(ids)
cache := dylinkprovider.NewDynCacheExpLinkProv(&l) cache := dylinkprovider.NewDynCacheExpLinkProv(&l)
@ -134,7 +134,7 @@ func main() {
func genFeeds(ids []string) { func genFeeds(ids []string) {
for _, id := range ids { for _, id := range ids {
l.Printf("generating feed for %s\n", id) l.Printf("[feed] generating feed for %s\n", id)
err := genFeed(id) err := genFeed(id)
if err != nil { if err != nil {
l.Printf(err.Error()) l.Printf(err.Error())
@ -153,10 +153,7 @@ func genFeed(id string) error {
return err return err
} }
defer file.Close() defer file.Close()
defer func() { defer os.Remove(tmpFilename)
l.Printf("removing tempfile %s\n", tmpFilename)
os.Remove(tmpFilename)
}()
err = feed.ConvertYtToRss(file, id, feed.RSSMetadata{ err = feed.ConvertYtToRss(file, id, feed.RSSMetadata{
Languge: *lang, Languge: *lang,