|
@ -2,6 +2,7 @@ package main |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
_ "embed" |
|
|
_ "embed" |
|
|
|
|
|
"flag" |
|
|
"fmt" |
|
|
"fmt" |
|
|
"net/http" |
|
|
"net/http" |
|
|
"os" |
|
|
"os" |
|
@ -11,10 +12,10 @@ import ( |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
func main() { |
|
|
func main() { |
|
|
path := os.Getenv("directory") |
|
|
var path string |
|
|
if path == "" { |
|
|
flag.StringVar(&path, "path", "./", "the full path to the ytdlp archive (with a / suffix)") |
|
|
path = "/home/latte/NFS/MainArchive/" |
|
|
|
|
|
} |
|
|
flag.Parse() |
|
|
|
|
|
|
|
|
var FL DirectoryIndexers.FileList |
|
|
var FL DirectoryIndexers.FileList |
|
|
go func() { |
|
|
go func() { |
|
@ -29,13 +30,6 @@ func main() { |
|
|
} |
|
|
} |
|
|
}() |
|
|
}() |
|
|
|
|
|
|
|
|
/*FL.RLock() |
|
|
|
|
|
fmt.Println(strconv.Itoa(len(FL.Files))) |
|
|
|
|
|
for _, file := range FL.Files { |
|
|
|
|
|
fmt.Println("Name:", file.Title,"Extension:", file.Extension, "ID:", file.Id) |
|
|
|
|
|
} |
|
|
|
|
|
FL.RUnlock()*/ |
|
|
|
|
|
|
|
|
|
|
|
http.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) { |
|
|
http.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) { |
|
|
fmt.Println(time.Now().String(),request.URL) |
|
|
fmt.Println(time.Now().String(),request.URL) |
|
|
PageHandlers.Index(writer, request, &FL) |
|
|
PageHandlers.Index(writer, request, &FL) |
|
|