mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-31 14:33:50 -04:00
Hardcode transcoder prefix to /video
This commit is contained in:
parent
4188e7bcd3
commit
c90d0e7ffc
@ -109,8 +109,6 @@ For example, if your library is split into multiples paths you can edit the `vol
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
- ./.env
|
- ./.env
|
||||||
environment:
|
|
||||||
- GOCODER_PREFIX=/video
|
|
||||||
volumes:
|
volumes:
|
||||||
- - ${LIBRARY_ROOT}:/video:ro
|
- - ${LIBRARY_ROOT}:/video:ro
|
||||||
+ - /my_path/number1:/video/1:ro
|
+ - /my_path/number1:/video/1:ro
|
||||||
|
@ -59,8 +59,6 @@ spec:
|
|||||||
value: "/cache"
|
value: "/cache"
|
||||||
- name: GOCODER_METADATA_ROOT
|
- name: GOCODER_METADATA_ROOT
|
||||||
value: "/metadata"
|
value: "/metadata"
|
||||||
- name: GOCODER_PREFIX
|
|
||||||
value: "/video"
|
|
||||||
- name: GOCODER_SAFE_PATH
|
- name: GOCODER_SAFE_PATH
|
||||||
value: {{ .Values.media.baseMountPath | quote }}
|
value: {{ .Values.media.baseMountPath | quote }}
|
||||||
- name: POSTGRES_USER
|
- name: POSTGRES_USER
|
||||||
|
@ -7,8 +7,6 @@ x-transcoder: &transcoder-base
|
|||||||
restart: on-failure
|
restart: on-failure
|
||||||
env_file:
|
env_file:
|
||||||
- ./.env
|
- ./.env
|
||||||
environment:
|
|
||||||
- GOCODER_PREFIX=/video
|
|
||||||
volumes:
|
volumes:
|
||||||
- ${LIBRARY_ROOT}:/video:ro
|
- ${LIBRARY_ROOT}:/video:ro
|
||||||
- ${CACHE_ROOT}:/cache
|
- ${CACHE_ROOT}:/cache
|
||||||
@ -120,7 +118,6 @@ services:
|
|||||||
device_ids:
|
device_ids:
|
||||||
- nvidia.com/gpu=all
|
- nvidia.com/gpu=all
|
||||||
environment:
|
environment:
|
||||||
- GOCODER_PREFIX=/video
|
|
||||||
- GOCODER_HWACCEL=nvidia
|
- GOCODER_HWACCEL=nvidia
|
||||||
profiles: ['nvidia']
|
profiles: ['nvidia']
|
||||||
|
|
||||||
@ -129,7 +126,6 @@ services:
|
|||||||
devices:
|
devices:
|
||||||
- /dev/dri:/dev/dri
|
- /dev/dri:/dev/dri
|
||||||
environment:
|
environment:
|
||||||
- GOCODER_PREFIX=/video
|
|
||||||
- GOCODER_HWACCEL=vaapi
|
- GOCODER_HWACCEL=vaapi
|
||||||
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||||
profiles: ['vaapi']
|
profiles: ['vaapi']
|
||||||
@ -139,7 +135,6 @@ services:
|
|||||||
devices:
|
devices:
|
||||||
- /dev/dri:/dev/dri
|
- /dev/dri:/dev/dri
|
||||||
environment:
|
environment:
|
||||||
- GOCODER_PREFIX=/video
|
|
||||||
- GOCODER_HWACCEL=qsv
|
- GOCODER_HWACCEL=qsv
|
||||||
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||||
profiles: ['qsv']
|
profiles: ['qsv']
|
||||||
|
@ -12,8 +12,6 @@ x-transcoder: &transcoder-base
|
|||||||
cpus: 1
|
cpus: 1
|
||||||
env_file:
|
env_file:
|
||||||
- ./.env
|
- ./.env
|
||||||
environment:
|
|
||||||
- GOCODER_PREFIX=/video
|
|
||||||
volumes:
|
volumes:
|
||||||
- ${LIBRARY_ROOT}:/video:ro
|
- ${LIBRARY_ROOT}:/video:ro
|
||||||
- ${CACHE_ROOT}:/cache
|
- ${CACHE_ROOT}:/cache
|
||||||
@ -147,7 +145,6 @@ services:
|
|||||||
device_ids:
|
device_ids:
|
||||||
- nvidia.com/gpu=all
|
- nvidia.com/gpu=all
|
||||||
environment:
|
environment:
|
||||||
- GOCODER_PREFIX=/video
|
|
||||||
- GOCODER_HWACCEL=nvidia
|
- GOCODER_HWACCEL=nvidia
|
||||||
profiles: ['nvidia']
|
profiles: ['nvidia']
|
||||||
transcoder-vaapi:
|
transcoder-vaapi:
|
||||||
@ -155,7 +152,6 @@ services:
|
|||||||
devices:
|
devices:
|
||||||
- /dev/dri:/dev/dri
|
- /dev/dri:/dev/dri
|
||||||
environment:
|
environment:
|
||||||
- GOCODER_PREFIX=/video
|
|
||||||
- GOCODER_HWACCEL=vaapi
|
- GOCODER_HWACCEL=vaapi
|
||||||
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||||
profiles: ['vaapi']
|
profiles: ['vaapi']
|
||||||
@ -165,7 +161,6 @@ services:
|
|||||||
devices:
|
devices:
|
||||||
- /dev/dri:/dev/dri
|
- /dev/dri:/dev/dri
|
||||||
environment:
|
environment:
|
||||||
- GOCODER_PREFIX=/video
|
|
||||||
- GOCODER_HWACCEL=qsv
|
- GOCODER_HWACCEL=qsv
|
||||||
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||||
profiles: ['qsv']
|
profiles: ['qsv']
|
||||||
|
@ -7,8 +7,6 @@ x-transcoder: &transcoder-base
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
- ./.env
|
- ./.env
|
||||||
environment:
|
|
||||||
- GOCODER_PREFIX=/video
|
|
||||||
volumes:
|
volumes:
|
||||||
- ${LIBRARY_ROOT}:/video:ro
|
- ${LIBRARY_ROOT}:/video:ro
|
||||||
- ${CACHE_ROOT}:/cache
|
- ${CACHE_ROOT}:/cache
|
||||||
@ -105,7 +103,6 @@ services:
|
|||||||
device_ids:
|
device_ids:
|
||||||
- nvidia.com/gpu=all
|
- nvidia.com/gpu=all
|
||||||
environment:
|
environment:
|
||||||
- GOCODER_PREFIX=/video
|
|
||||||
- GOCODER_HWACCEL=nvidia
|
- GOCODER_HWACCEL=nvidia
|
||||||
profiles: ['nvidia']
|
profiles: ['nvidia']
|
||||||
|
|
||||||
@ -114,7 +111,6 @@ services:
|
|||||||
devices:
|
devices:
|
||||||
- /dev/dri:/dev/dri
|
- /dev/dri:/dev/dri
|
||||||
environment:
|
environment:
|
||||||
- GOCODER_PREFIX=/video
|
|
||||||
- GOCODER_HWACCEL=vaapi
|
- GOCODER_HWACCEL=vaapi
|
||||||
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||||
profiles: ['vaapi']
|
profiles: ['vaapi']
|
||||||
@ -124,7 +120,6 @@ services:
|
|||||||
devices:
|
devices:
|
||||||
- /dev/dri:/dev/dri
|
- /dev/dri:/dev/dri
|
||||||
environment:
|
environment:
|
||||||
- GOCODER_PREFIX=/video
|
|
||||||
- GOCODER_HWACCEL=qsv
|
- GOCODER_HWACCEL=qsv
|
||||||
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||||
profiles: ['qsv']
|
profiles: ['qsv']
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
# where to store temporary transcoded files
|
# where to store temporary transcoded files
|
||||||
GOCODER_CACHE_ROOT="/cache"
|
GOCODER_CACHE_ROOT="/cache"
|
||||||
# path prefix needed to reach the http endpoint
|
|
||||||
GOCODER_PREFIX=""
|
|
||||||
# base absolute path that contains video files (everything in this directory can be served)
|
# base absolute path that contains video files (everything in this directory can be served)
|
||||||
GOCODER_SAFE_PATH="/video"
|
GOCODER_SAFE_PATH="/video"
|
||||||
# hardware acceleration profile (valid values: disabled, vaapi, qsv, nvidia)
|
# hardware acceleration profile (valid values: disabled, vaapi, qsv, nvidia)
|
||||||
|
@ -383,7 +383,7 @@ func run(e *echo.Echo) (err error) {
|
|||||||
metadata: metadata,
|
metadata: metadata,
|
||||||
}
|
}
|
||||||
|
|
||||||
g := e.Group(src.Settings.RoutePrefix)
|
g := e.Group("/video")
|
||||||
g.GET("/:path/direct", DirectStream)
|
g.GET("/:path/direct", DirectStream)
|
||||||
g.GET("/:path/direct/:identifier", DirectStream)
|
g.GET("/:path/direct/:identifier", DirectStream)
|
||||||
g.GET("/:path/master.m3u8", h.GetMaster)
|
g.GET("/:path/master.m3u8", h.GetMaster)
|
||||||
|
@ -285,7 +285,7 @@ func RetriveMediaInfo(path string, sha string) (*MediaInfo, error) {
|
|||||||
extension := OrNull(SubtitleExtensions[stream.CodecName])
|
extension := OrNull(SubtitleExtensions[stream.CodecName])
|
||||||
var link string
|
var link string
|
||||||
if extension != nil {
|
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)
|
lang, _ := language.Parse(stream.Tags.Language)
|
||||||
idx := uint32(i)
|
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 {
|
Fonts: MapStream(mi.Streams, ffprobe.StreamAttachment, func(stream *ffprobe.Stream, i uint32) string {
|
||||||
font, _ := stream.TagList.GetString("filename")
|
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
|
var codecs []string
|
||||||
|
@ -256,8 +256,7 @@ func (s *MetadataService) getMetadata(path string, sha string) (*MediaInfo, erro
|
|||||||
}
|
}
|
||||||
if s.Extension != nil {
|
if s.Extension != nil {
|
||||||
link := fmt.Sprintf(
|
link := fmt.Sprintf(
|
||||||
"%s/%s/subtitle/%d.%s",
|
"video/%s/subtitle/%d.%s",
|
||||||
Settings.RoutePrefix,
|
|
||||||
base64.RawURLEncoding.EncodeToString([]byte(ret.Path)),
|
base64.RawURLEncoding.EncodeToString([]byte(ret.Path)),
|
||||||
*s.Index,
|
*s.Index,
|
||||||
*s.Extension,
|
*s.Extension,
|
||||||
|
@ -15,7 +15,6 @@ func GetEnvOr(env string, def string) string {
|
|||||||
|
|
||||||
type SettingsT struct {
|
type SettingsT struct {
|
||||||
Outpath string
|
Outpath string
|
||||||
RoutePrefix string
|
|
||||||
SafePath string
|
SafePath string
|
||||||
HwAccel HwAccelT
|
HwAccel HwAccelT
|
||||||
}
|
}
|
||||||
@ -31,7 +30,6 @@ type HwAccelT struct {
|
|||||||
var Settings = SettingsT{
|
var Settings = SettingsT{
|
||||||
// we manually add a folder to make sure we do not delete user data.
|
// we manually add a folder to make sure we do not delete user data.
|
||||||
Outpath: path.Join(GetEnvOr("GOCODER_CACHE_ROOT", "/cache"), "kyoo_cache"),
|
Outpath: path.Join(GetEnvOr("GOCODER_CACHE_ROOT", "/cache"), "kyoo_cache"),
|
||||||
RoutePrefix: GetEnvOr("GOCODER_PREFIX", ""),
|
|
||||||
SafePath: GetEnvOr("GOCODER_SAFE_PATH", "/video"),
|
SafePath: GetEnvOr("GOCODER_SAFE_PATH", "/video"),
|
||||||
HwAccel: DetectHardwareAccel(),
|
HwAccel: DetectHardwareAccel(),
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,7 @@ outer:
|
|||||||
for codec, ext := range SubtitleExtensions {
|
for codec, ext := range SubtitleExtensions {
|
||||||
if strings.HasSuffix(match, ext) {
|
if strings.HasSuffix(match, ext) {
|
||||||
link := fmt.Sprintf(
|
link := fmt.Sprintf(
|
||||||
"%s/%s/direct/%s",
|
"video/%s/direct/%s",
|
||||||
Settings.RoutePrefix,
|
|
||||||
base64.RawURLEncoding.EncodeToString([]byte(match)),
|
base64.RawURLEncoding.EncodeToString([]byte(match)),
|
||||||
filepath.Base(match),
|
filepath.Base(match),
|
||||||
)
|
)
|
||||||
|
@ -145,10 +145,9 @@ func (s *MetadataService) extractThumbnail(ctx context.Context, path string, sha
|
|||||||
timestamps := ts
|
timestamps := ts
|
||||||
ts += interval
|
ts += interval
|
||||||
vtt += fmt.Sprintf(
|
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(timestamps),
|
||||||
tsToVttTime(ts),
|
tsToVttTime(ts),
|
||||||
Settings.RoutePrefix,
|
|
||||||
base64.RawURLEncoding.EncodeToString([]byte(path)),
|
base64.RawURLEncoding.EncodeToString([]byte(path)),
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user