Added Last Chapter functionality to see how many more chapters you have, also kinda works as update Status bar
changed it to only load latest chapter instead of all chapters for manga Added develop and release db from different locations Added stopwatch for future performance improvement metrics
This commit is contained in:
7
cmd/mangaGetter/develop.go
Normal file
7
cmd/mangaGetter/develop.go
Normal file
@@ -0,0 +1,7 @@
|
||||
//go:build Develop
|
||||
|
||||
package main
|
||||
|
||||
func getDbPath() string {
|
||||
return "db.sqlite"
|
||||
}
|
||||
@@ -9,44 +9,15 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
dir, err := os.UserCacheDir()
|
||||
if err != nil {
|
||||
fmt.Println(nil)
|
||||
return
|
||||
}
|
||||
|
||||
dirPath := filepath.Join(dir, "MangaGetter")
|
||||
filePath := filepath.Join(dirPath, "db.sqlite")
|
||||
|
||||
if _, err := os.Stat(dirPath); os.IsNotExist(err) {
|
||||
err = os.Mkdir(dirPath, os.ModePerm)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := os.Stat(filePath); os.IsNotExist(err) {
|
||||
f, err := os.Create(filePath)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
filePath := getDbPath()
|
||||
|
||||
db := database.NewDatabase(filePath, true)
|
||||
err = db.Open()
|
||||
err := db.Open()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
|
||||
38
cmd/mangaGetter/release.go
Normal file
38
cmd/mangaGetter/release.go
Normal file
@@ -0,0 +1,38 @@
|
||||
//go:build !Develop
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func getDbPath() string {
|
||||
dir, err := os.UserCacheDir()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
dirPath := filepath.Join(dir, "MangaGetter")
|
||||
filePath := filepath.Join(dirPath, "db.sqlite")
|
||||
|
||||
if _, err := os.Stat(dirPath); os.IsNotExist(err) {
|
||||
err = os.Mkdir(dirPath, os.ModePerm)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := os.Stat(filePath); os.IsNotExist(err) {
|
||||
f, err := os.Create(filePath)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
return filePath
|
||||
}
|
||||
Reference in New Issue
Block a user