mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-15 11:40:36 +03:00
fix(server): allow extra spaces in transcoding commands
This commit is contained in:
parent
bbb3182bc9
commit
8808eaddda
@ -171,7 +171,7 @@ func createProbeCommand(cmd string, inputs []string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func fixCmd(cmd string) []string {
|
func fixCmd(cmd string) []string {
|
||||||
split := strings.Split(cmd, " ")
|
split := strings.Fields(cmd)
|
||||||
cmdPath, _ := ffmpegCmd()
|
cmdPath, _ := ffmpegCmd()
|
||||||
for i, s := range split {
|
for i, s := range split {
|
||||||
if s == "ffmpeg" || s == "ffmpeg.exe" {
|
if s == "ffmpeg" || s == "ffmpeg.exe" {
|
||||||
|
@ -27,6 +27,10 @@ var _ = Describe("ffmpeg", func() {
|
|||||||
args := createFFmpegCommand("ffmpeg -i %s -b:a %bk mp3 -", "/music library/file.mp3", 123, 0)
|
args := createFFmpegCommand("ffmpeg -i %s -b:a %bk mp3 -", "/music library/file.mp3", 123, 0)
|
||||||
Expect(args).To(Equal([]string{"ffmpeg", "-i", "/music library/file.mp3", "-b:a", "123k", "mp3", "-"}))
|
Expect(args).To(Equal([]string{"ffmpeg", "-i", "/music library/file.mp3", "-b:a", "123k", "mp3", "-"}))
|
||||||
})
|
})
|
||||||
|
It("handles extra spaces in the command string", func() {
|
||||||
|
args := createFFmpegCommand("ffmpeg -i %s -b:a %bk mp3 -", "/music library/file.mp3", 123, 0)
|
||||||
|
Expect(args).To(Equal([]string{"ffmpeg", "-i", "/music library/file.mp3", "-b:a", "123k", "mp3", "-"}))
|
||||||
|
})
|
||||||
Context("when command has time offset param", func() {
|
Context("when command has time offset param", func() {
|
||||||
It("creates a valid command line with offset", func() {
|
It("creates a valid command line with offset", func() {
|
||||||
args := createFFmpegCommand("ffmpeg -i %s -b:a %bk -ss %t mp3 -", "/music library/file.mp3", 123, 456)
|
args := createFFmpegCommand("ffmpeg -i %s -b:a %bk -ss %t mp3 -", "/music library/file.mp3", 123, 456)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user