Skip to content

Commit

Permalink
fixed db init
Browse files Browse the repository at this point in the history
  • Loading branch information
XiovV committed Dec 18, 2019
1 parent be709ce commit 7f53aae
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 25 deletions.
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

18 changes: 1 addition & 17 deletions config/playlists.json
Original file line number Diff line number Diff line change
@@ -1,17 +1 @@
[
{
"URL": "https://www.youtube.com/watch?v=au5Ap5qAWa8\u0026list=PL63ZO-jXFTasqvj7WdEFQ6QtG6UBrl9CR",
"LatestDownloaded": "au5Ap5qAWa8",
"DownloadMode": "Video And Audio",
"Name": "Electronic Gems",
"PreferredExtensionForAudio": "",
"PreferredExtensionForVideo": "any",
"DownloadHistory": [
"au5Ap5qAWa8"
],
"LastChecked": "12-09-2019 20:40:54",
"CheckingInterval": "",
"Type": "Playlist",
"DownloadPath": "/playlists/%(uploader)s/%(playlist)s/video/%(title)s.%(ext)s"
}
]
[]
1 change: 1 addition & 0 deletions config1/channels.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions config1/playlists.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions config1/videos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
2 changes: 1 addition & 1 deletion consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

const (
CONFIG_ROOT = "./config/"
VERSION = "v0.5.7"
VERSION = "v0.5.8"
)

var (
Expand Down
3 changes: 3 additions & 0 deletions database_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ var confs = map[string]*Database{
}

func init() {
initLogFile()
CreateDirIfNotExist("./config")
initDatabase()
for _, v := range confs {
if err := v.load(); err != nil {
log.Fatal(nil)
Expand Down
5 changes: 1 addition & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ func initLogFile() {
}

func initDatabase() {
log.Info("Initiating db")
databases := [3]string{"./config/channels.json", "./config/playlists.json", "./config/videos.json"}
for _, database := range databases {
createDir(database)
}
}

func init() {
initLogFile()
CreateDirIfNotExist("./config")
initDatabase()
flag.StringVar(&port, "port", "8080", "port to listen")
flag.StringVar(&dlRoot, "dl", "./downloads", "root download folder")
}
Expand Down Expand Up @@ -86,7 +84,6 @@ func uploadCheckerPlaylists() {
func main() {
flag.Parse()
log.Info("server running on port " + port)

go uploadCheckerChannels()
go uploadCheckerPlaylists()

Expand Down

0 comments on commit 7f53aae

Please sign in to comment.