User-Agent for FFmpeg and VLC

This commit is contained in:
marmei
2019-12-08 17:33:46 +01:00
parent 1a1e37fe15
commit f0a49788cc
4 changed files with 71 additions and 41 deletions

View File

@@ -366,7 +366,7 @@
},
"userAgent": {
"title": "User Agent",
"description": "User Agent for HTTP requests. Only used if xTeVe is selected as the buffer.",
"description": "User Agent for HTTP requests. For every HTTP connection, this value is used for the user agent. Should only be changed if xTeVe is blocked.",
"placeholder": "xTeVe"
},
"backupPath": {

View File

@@ -1418,8 +1418,38 @@ func thirdPartyBuffer(streamID int, playlistID string) {
return
}
var args = strings.Replace(options, "[URL]", url, -1)
var cmd = exec.Command(path, strings.Split(args, " ")...)
//args = strings.Replace(args, "[USER-AGENT]", Settings.UserAgent, -1)
// User-Agent setzen
var args []string
for i, a := range strings.Split(options, " ") {
fmt.Println(a)
switch bufferType {
case "FFMPEG":
a = strings.Replace(a, "[URL]", url, -1)
if i == 0 {
args = []string{"-user-agent", Settings.UserAgent}
}
args = append(args, a)
case "VLC":
if a == "[URL]" {
a = strings.Replace(a, "[URL]", url, -1)
args = append(args, a)
args = append(args, fmt.Sprintf(":http-user-agent=%s", Settings.UserAgent))
} else {
args = append(args, a)
}
}
}
var cmd = exec.Command(path, args...)
debug = fmt.Sprintf("%s:%s %s", bufferType, path, args)
showDebug(debug, 1)

File diff suppressed because one or more lines are too long

View File

@@ -48,7 +48,7 @@ const DBVersion = "2.1.0"
const APIVersion = "1.1.0"
// Dev : Aktiviert den Entwicklungsmodus. Für den Webserver werden dann die lokalen Dateien verwendet.
const Dev = false
const Dev = true
var homeDirectory = fmt.Sprintf("%s%s.%s%s", src.GetUserHomeDirectory(), string(os.PathSeparator), strings.ToLower(Name), string(os.PathSeparator))
var samplePath = fmt.Sprintf("%spath%sto%sxteve%s", string(os.PathSeparator), string(os.PathSeparator), string(os.PathSeparator), string(os.PathSeparator))