now detects existing files

This commit is contained in:
AustrianToast 2024-07-11 23:35:59 +02:00
parent e433c4b048
commit 93b4258dd5
Signed by: AustrianToast
GPG Key ID: 378A29F999424B1C
2 changed files with 44229 additions and 0 deletions

18
main.go
View File

@ -64,6 +64,24 @@ func main() {
} }
} }
files, err := os.ReadDir(uploadFolder)
if err != nil {
panic(err)
}
if len(files) != 0 {
for _, file := range files {
if file.IsDir() {
continue
}
_, err = dbpool.Exec(context.Background(), "insert into videos(filepath) values($1)", fmt.Sprintf("%s/%s", uploadFolder, file.Name()))
if err != nil {
log.Panicf("main: %v\n", err)
}
}
}
router := gin.Default() router := gin.Default()
router.SetTrustedProxies(nil) router.SetTrustedProxies(nil)

44211
upload/sys.tree Normal file

File diff suppressed because it is too large Load Diff