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