Refactoring.
This commit is contained in:
parent
1980e45fde
commit
530896a015
@ -1,10 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"git.insit.tech/psa/rtsp_reader-writer/reader/internal/config"
|
||||
"git.insit.tech/psa/rtsp_reader-writer/reader/internal/handlers"
|
||||
logger "git.insit.tech/psa/rtsp_reader-writer/reader/internal/log"
|
||||
"git.insit.tech/psa/rtsp_reader-writer/reader/internal/metrics"
|
||||
jwtware "github.com/gofiber/contrib/jwt"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/sirupsen/logrus"
|
||||
"reader/internal/handlers"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -18,14 +24,14 @@ func main() {
|
||||
//
|
||||
//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)
|
||||
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 {
|
||||
@ -34,7 +40,7 @@ func main() {
|
||||
|
||||
app := fiber.New()
|
||||
|
||||
authStorage := &handlers.AuthStorage{map[string]handlers.User{}}
|
||||
authStorage := &handlers.AuthStorage{Users: map[string]handlers.User{}}
|
||||
authHandler := &handlers.AuthHandler{Storage: authStorage}
|
||||
userHandler := &handlers.UserHandler{Storage: authStorage}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
module reader
|
||||
module git.insit.tech/psa/rtsp_reader-writer/reader
|
||||
|
||||
go 1.24.1
|
||||
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
jwtware "github.com/gofiber/contrib/jwt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
@ -12,12 +11,13 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.insit.tech/psa/rtsp_reader-writer/reader/internal/config"
|
||||
"git.insit.tech/psa/rtsp_reader-writer/reader/internal/processor"
|
||||
"git.insit.tech/psa/rtsp_reader-writer/writer/pkg/storage"
|
||||
jwtware "github.com/gofiber/contrib/jwt"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
"github.com/sirupsen/logrus"
|
||||
"reader/internal/config"
|
||||
"reader/internal/processor"
|
||||
)
|
||||
|
||||
type VideoRequest struct {
|
||||
@ -168,6 +168,7 @@ func ListVodsHandler(c *fiber.Ctx) error {
|
||||
// Read directory.
|
||||
entries, err := os.ReadDir(config.DirData)
|
||||
if err != nil {
|
||||
log.Println("StatusInternalServerError")
|
||||
return c.SendStatus(fiber.StatusInternalServerError)
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,9 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"git.insit.tech/psa/rtsp_reader-writer/reader/internal/config"
|
||||
log2 "git.insit.tech/sas/rtsp_proxy/core/log"
|
||||
"go.uber.org/zap"
|
||||
"reader/internal/config"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -8,18 +8,18 @@ import (
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"reader/internal/config"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.insit.tech/psa/rtsp_reader-writer/reader/internal/config"
|
||||
logger "git.insit.tech/psa/rtsp_reader-writer/reader/internal/log"
|
||||
"git.insit.tech/psa/rtsp_reader-writer/reader/internal/processor"
|
||||
"git.insit.tech/psa/rtsp_reader-writer/writer/pkg/storage"
|
||||
"git.insit.tech/sas/rtsp_proxy/core/gen"
|
||||
log2 "git.insit.tech/sas/rtsp_proxy/core/log"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"go.uber.org/zap"
|
||||
logger "reader/internal/log"
|
||||
"reader/internal/processor"
|
||||
)
|
||||
|
||||
// CreateVideo generate TS files and M3U8 playlists.
|
||||
|
Loading…
x
Reference in New Issue
Block a user