2025-04-09 17:58:24 +05:00

44 lines
1.4 KiB
Go

package main
import (
"fmt"
"go.uber.org/zap"
"os"
"reader/internal/config"
logger "reader/internal/log"
"reader/internal/metrics"
"reader/internal/unpacker"
)
func main() {
//port := 8080
//
//http.HandleFunc("GET /api/v1/download/", handlers.Download) // example request: {"date": "07-03-2025", "start_time": "16-43", "end_time": "16-44"}
//http.HandleFunc("GET /api/v1/hls/", handlers.HLS)
//http.HandleFunc("GET /api/v1/vods/", handlers.ListVodsHandler)
//http.HandleFunc("GET /api/v1/vods/{id}/", handlers.ConfigVodsHandler)
//http.HandleFunc("DELETE /api/v1/vods/{id}/", handlers.DelVodsHandler)
//http.HandleFunc("GET /api/v1/vods/{id}/files/", handlers.ListFilesVodsHandler)
//http.HandleFunc("GET /api/v1/vods/{id}/{res}/{file}", handlers.SingleVodsHandler)
//http.HandleFunc("DELETE /api/v1/vods/{id}/{res}/{file}", handlers.DelSingleVodsHandler)
//
//log.Println("Starting server on:")
//log.Printf("Serving on HTTP port: %d\n", port)
//
//log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))
go metrics.Metrics()
logger.StartMainLogger(config.Local, "reader")
// Check if the data folder in the directory.
homeDir, err := os.UserHomeDir()
if err != nil {
}
config.DirData = fmt.Sprintf("%s/%s/vod", homeDir, config.Local)
err = unpacker.CreateVideo()
if err != nil {
logger.Log.Error("failed to create flow", zap.Error(err))
}
}