diff --git a/.gitignore b/.gitignore index 38d2912..b5b4739 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .idea *.iml *.db3 +*.db3-* *.bak* /downloads/ /temp/ diff --git a/main.go b/main.go index 8f27242..0eb1310 100644 --- a/main.go +++ b/main.go @@ -1,25 +1,31 @@ package main +import ( + "flag" + "github.com/playwright-community/playwright-go" + "log" +) + func main() { - //var err error - //var onlyInstall = flag.Bool("install", false, "install the required browser and do nothing else") - //flag.Parse() - // - //options := &playwright.RunOptions{ - // Browsers: []string{"firefox"}, - //} - //err = playwright.Install(options) - //if err != nil { - // log.Panicf("error installing playwright: %v", err) - //} - // - //if *onlyInstall { - // return - //} - // - //db := openDatabase() - //defer db.Close() - // + var err error + var onlyInstall = flag.Bool("install", false, "install the required browser and do nothing else") + flag.Parse() + + options := &playwright.RunOptions{ + Browsers: []string{"firefox"}, + } + err = playwright.Install(options) + if err != nil { + log.Panicf("error installing playwright: %v", err) + } + + if *onlyInstall { + return + } + + db := openDatabase() + defer db.MustClose() + //sleepTimeStr := os.Getenv("VIVAPLUS_SLEEPTIME") //sleepTime := 15 //if sleepTimeStr != "" { @@ -65,5 +71,5 @@ func main() { // log.Printf("Sleeping %d minutes until next run", sleepTime) // time.Sleep(time.Duration(sleepTime) * time.Minute) //} - serveWebview() + serveWebview(db) } diff --git a/migrations/5_add_watch_state.sql b/migrations/5_add_watch_state.sql new file mode 100644 index 0000000..cb1c592 --- /dev/null +++ b/migrations/5_add_watch_state.sql @@ -0,0 +1 @@ +ALTER TABLE videos ADD COLUMN watch_state TEXT; \ No newline at end of file diff --git a/res/index.html b/res/index.html new file mode 100644 index 0000000..e69de29 diff --git a/viewmodels.go b/viewmodels.go index 9c6fd2a..f7685d1 100644 --- a/viewmodels.go +++ b/viewmodels.go @@ -3,4 +3,5 @@ package main type VideoInfoVM struct { Title string Description string + Thumbnail string } diff --git a/web/index.gohtml b/web/index.gohtml index 45d2b06..0c2945a 100644 --- a/web/index.gohtml +++ b/web/index.gohtml @@ -11,6 +11,7 @@