初始化

初始化项目
This commit is contained in:
truewhile
2026-08-23 22:12:32 +08:00
parent 0bcb1fec87
commit 71bf60c69c
631 changed files with 2121 additions and 76050 deletions
+4 -24
View File
@@ -31,24 +31,13 @@ import (
// SubtitleService is the discovery + conversion entry point.
type SubtitleService struct {
log *zap.Logger
repo *repository.Container
storage *StorageConfigService
log *zap.Logger
repo *repository.Container
}
// NewSubtitleService is the constructor.
func NewSubtitleService(log *zap.Logger, repo *repository.Container, storage ...*StorageConfigService) *SubtitleService {
s := &SubtitleService{log: log, repo: repo}
if len(storage) > 0 {
s.storage = storage[0]
}
return s
}
func (s *SubtitleService) SetStorageConfig(storage *StorageConfigService) {
if s != nil {
s.storage = storage
}
func NewSubtitleService(log *zap.Logger, repo *repository.Container) *SubtitleService {
return &SubtitleService{log: log, repo: repo}
}
// SubtitleTrack describes one external subtitle file.
@@ -79,9 +68,6 @@ func (s *SubtitleService) Discover(ctx context.Context, mediaID string) ([]Subti
if m == nil {
return nil, errors.New("media not found")
}
if strings.HasPrefix(strings.ToLower(strings.TrimSpace(m.Path)), "cloud://") {
return discoverCloudSubtitles(ctx, s, *m), nil
}
dir := filepath.Dir(m.Path)
base := strings.TrimSuffix(filepath.Base(m.Path), filepath.Ext(m.Path))
@@ -148,9 +134,6 @@ func (s *SubtitleService) Serve(ctx context.Context, mediaID, sub string, w io.W
if err != nil || m == nil {
return errors.New("media not found")
}
if typ, ref, name, ok := parseCloudSubtitlePath(sub); ok {
return serveCloudSubtitle(ctx, s, *m, typ, ref, name, w)
}
abs, err := filepath.Abs(sub)
if err != nil {
return err
@@ -195,9 +178,6 @@ func (s *SubtitleService) ServeRaw(ctx context.Context, mediaID, sub string, w i
if err != nil || m == nil {
return errors.New("media not found")
}
if typ, ref, name, ok := parseCloudSubtitlePath(sub); ok {
return serveCloudSubtitleRaw(ctx, s, *m, typ, ref, name, w)
}
abs, err := filepath.Abs(sub)
if err != nil {
return err