A bunch of Changes
Docker is broken as of now, will fix later
This commit is contained in:
parent
1a6953900c
commit
6375fe5af1
27 changed files with 258 additions and 81 deletions
|
@ -14,9 +14,10 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"watn3y/bloaterbot/botIO"
|
||||
"watn3y/bloaterbot/commonlogic"
|
||||
"watn3y/bloaterbot/config"
|
||||
|
||||
"watn3y.de/bloaterbot/botIO"
|
||||
"watn3y.de/bloaterbot/commonlogic"
|
||||
"watn3y.de/bloaterbot/config"
|
||||
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
@ -61,7 +62,7 @@ func Download(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
|
|||
return
|
||||
}
|
||||
|
||||
files, err := os.ReadDir("./videos/" + downloadTarget)
|
||||
files, err := os.ReadDir("data/videos/" + downloadTarget)
|
||||
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("failed to download. unable to read target directory")
|
||||
|
@ -112,7 +113,7 @@ func randomString(n int) string {
|
|||
|
||||
func runYTDL(URL string, targetDir string) (success bool) {
|
||||
|
||||
cmd := exec.Command("yt-dlp", "-f", "bv*[ext=mp4]+ba[ext=m4a] / bv*+ba/b", "--no-playlist", "-o", "videos/"+targetDir+"/"+"%(title)s.%(ext)s", "--write-thumbnail", "--convert-thumbnails", "jpg", "-o", "thumbnail:videos/"+targetDir+"thumb"+"/"+"%(title)s.%(ext)s", URL)
|
||||
cmd := exec.Command("yt-dlp", "-f", "bv*[ext=mp4]+ba[ext=m4a] / bv*+ba/b", "--no-playlist", "-o", "data/videos/"+targetDir+"/"+"%(title)s.%(ext)s", "--write-thumbnail", "--convert-thumbnails", "jpg", "-o", "thumbnail:data/videos/"+targetDir+"thumb"+"/"+"%(title)s.%(ext)s", URL)
|
||||
|
||||
out, err := cmd.CombinedOutput()
|
||||
var (
|
||||
|
@ -181,8 +182,8 @@ func shortURL(URL string) (shorturl string) {
|
|||
}
|
||||
|
||||
func serveMedia(update tgbotapi.Update, bot *tgbotapi.BotAPI, randomNoise string, file string) {
|
||||
fsPath := "./videos/" + randomNoise + "/" + file
|
||||
fsThumbPath := "./videos/" + randomNoise + "thumb" + "/" + strings.TrimSuffix(file, "mp4") + "jpg"
|
||||
fsPath := "data/videos/" + randomNoise + "/" + file
|
||||
fsThumbPath := "data/videos/" + randomNoise + "thumb" + "/" + strings.TrimSuffix(file, "mp4") + "jpg"
|
||||
fExt := filepath.Ext(fsPath)
|
||||
|
||||
imageTypes := []string{".jpg", ".jpeg", ".png"}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue