node build fixed

This commit is contained in:
ra_ma
2025-09-20 14:08:38 +01:00
parent c6ebbe069d
commit 3d298fa434
1516 changed files with 535727 additions and 2 deletions

View File

@@ -0,0 +1,74 @@
package mediastream
import (
"errors"
"net/url"
"path/filepath"
"seanime/internal/events"
"seanime/internal/mediastream/videofile"
"github.com/labstack/echo/v4"
)
func (r *Repository) ServeEchoExtractedSubtitles(c echo.Context) error {
if !r.IsInitialized() {
r.wsEventManager.SendEvent(events.MediastreamShutdownStream, "Module not initialized")
return errors.New("module not initialized")
}
if !r.TranscoderIsInitialized() {
r.wsEventManager.SendEvent(events.MediastreamShutdownStream, "Transcoder not initialized")
return errors.New("transcoder not initialized")
}
// Get the parameter group
subFilePath := c.Param("*")
// Get current media
mediaContainer, found := r.playbackManager.currentMediaContainer.Get()
if !found {
return errors.New("no file has been loaded")
}
retPath := videofile.GetFileSubsCacheDir(r.cacheDir, mediaContainer.Hash)
if retPath == "" {
return errors.New("could not find subtitles")
}
r.logger.Trace().Msgf("mediastream: Serving subtitles from %s", retPath)
return c.File(filepath.Join(retPath, subFilePath))
}
func (r *Repository) ServeEchoExtractedAttachments(c echo.Context) error {
if !r.IsInitialized() {
r.wsEventManager.SendEvent(events.MediastreamShutdownStream, "Module not initialized")
return errors.New("module not initialized")
}
if !r.TranscoderIsInitialized() {
r.wsEventManager.SendEvent(events.MediastreamShutdownStream, "Transcoder not initialized")
return errors.New("transcoder not initialized")
}
// Get the parameter group
subFilePath := c.Param("*")
// Get current media
mediaContainer, found := r.playbackManager.currentMediaContainer.Get()
if !found {
return errors.New("no file has been loaded")
}
retPath := videofile.GetFileAttCacheDir(r.cacheDir, mediaContainer.Hash)
if retPath == "" {
return errors.New("could not find subtitles")
}
subFilePath, _ = url.PathUnescape(subFilePath)
return c.File(filepath.Join(retPath, subFilePath))
}