mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-05-13 10:52:28 -04:00
Hardcode transcoder prefix to /video
This commit is contained in:
@@ -285,7 +285,7 @@ func RetriveMediaInfo(path string, sha string) (*MediaInfo, error) {
|
||||
extension := OrNull(SubtitleExtensions[stream.CodecName])
|
||||
var link string
|
||||
if extension != nil {
|
||||
link = fmt.Sprintf("%s/%s/subtitle/%d.%s", Settings.RoutePrefix, base64.RawURLEncoding.EncodeToString([]byte(path)), i, *extension)
|
||||
link = fmt.Sprintf("video/%s/subtitle/%d.%s", base64.RawURLEncoding.EncodeToString([]byte(path)), i, *extension)
|
||||
}
|
||||
lang, _ := language.Parse(stream.Tags.Language)
|
||||
idx := uint32(i)
|
||||
@@ -312,7 +312,7 @@ func RetriveMediaInfo(path string, sha string) (*MediaInfo, error) {
|
||||
}),
|
||||
Fonts: MapStream(mi.Streams, ffprobe.StreamAttachment, func(stream *ffprobe.Stream, i uint32) string {
|
||||
font, _ := stream.TagList.GetString("filename")
|
||||
return fmt.Sprintf("%s/%s/attachment/%s", Settings.RoutePrefix, base64.RawURLEncoding.EncodeToString([]byte(path)), font)
|
||||
return fmt.Sprintf("video/%s/attachment/%s", base64.RawURLEncoding.EncodeToString([]byte(path)), font)
|
||||
}),
|
||||
}
|
||||
var codecs []string
|
||||
|
||||
@@ -256,8 +256,7 @@ func (s *MetadataService) getMetadata(path string, sha string) (*MediaInfo, erro
|
||||
}
|
||||
if s.Extension != nil {
|
||||
link := fmt.Sprintf(
|
||||
"%s/%s/subtitle/%d.%s",
|
||||
Settings.RoutePrefix,
|
||||
"video/%s/subtitle/%d.%s",
|
||||
base64.RawURLEncoding.EncodeToString([]byte(ret.Path)),
|
||||
*s.Index,
|
||||
*s.Extension,
|
||||
|
||||
@@ -15,7 +15,6 @@ func GetEnvOr(env string, def string) string {
|
||||
|
||||
type SettingsT struct {
|
||||
Outpath string
|
||||
RoutePrefix string
|
||||
SafePath string
|
||||
HwAccel HwAccelT
|
||||
}
|
||||
@@ -31,7 +30,6 @@ type HwAccelT struct {
|
||||
var Settings = SettingsT{
|
||||
// we manually add a folder to make sure we do not delete user data.
|
||||
Outpath: path.Join(GetEnvOr("GOCODER_CACHE_ROOT", "/cache"), "kyoo_cache"),
|
||||
RoutePrefix: GetEnvOr("GOCODER_PREFIX", ""),
|
||||
SafePath: GetEnvOr("GOCODER_SAFE_PATH", "/video"),
|
||||
HwAccel: DetectHardwareAccel(),
|
||||
}
|
||||
|
||||
@@ -31,8 +31,7 @@ outer:
|
||||
for codec, ext := range SubtitleExtensions {
|
||||
if strings.HasSuffix(match, ext) {
|
||||
link := fmt.Sprintf(
|
||||
"%s/%s/direct/%s",
|
||||
Settings.RoutePrefix,
|
||||
"video/%s/direct/%s",
|
||||
base64.RawURLEncoding.EncodeToString([]byte(match)),
|
||||
filepath.Base(match),
|
||||
)
|
||||
|
||||
@@ -145,10 +145,9 @@ func (s *MetadataService) extractThumbnail(ctx context.Context, path string, sha
|
||||
timestamps := ts
|
||||
ts += interval
|
||||
vtt += fmt.Sprintf(
|
||||
"%s --> %s\n%s/%s/thumbnails.png#xywh=%d,%d,%d,%d\n\n",
|
||||
"%s --> %s\nvideo/%s/thumbnails.png#xywh=%d,%d,%d,%d\n\n",
|
||||
tsToVttTime(timestamps),
|
||||
tsToVttTime(ts),
|
||||
Settings.RoutePrefix,
|
||||
base64.RawURLEncoding.EncodeToString([]byte(path)),
|
||||
x,
|
||||
y,
|
||||
|
||||
Reference in New Issue
Block a user