option to disable downsampling

This commit is contained in:
Deluan
2016-03-09 22:21:11 -05:00
parent 031738f1eb
commit de6bd1eb17
2 changed files with 10 additions and 6 deletions
+8 -5
View File
@@ -1,4 +1,5 @@
appname = github.com/deluan/gosonic appname = github.com/deluan/gosonic
serverName = GoSonic
httpPort = 8080 httpPort = 8080
runMode = dev runMode = dev
autoRender = false autoRender = false
@@ -13,19 +14,21 @@ musicFolder=./iTunes1.xml
user=deluan user=deluan
password=wordpass password=wordpass
dbPath=./devDb dbPath=./devDb
enableDownsampling = true
downsampleCommand=ffmpeg -i %s -map 0:0 -b:a %bk -v 0 -f mp3 - downsampleCommand=ffmpeg -i %s -map 0:0 -b:a %bk -v 0 -f mp3 -
plsIgnoreFolders = true plsIgnoreFolders = true
plsIgnoredPatterns = ^iCloud;^CDs para;^Skipped;Christian plsIgnoredPatterns = ^iCloud;^CDs para;^Skipped;Christian
[dev] [dev]
disableValidation = true disableValidation = false
enableDownsampling = false
enableAdmin = true enableAdmin = true
[test] [test]
disableValidation = false disableValidation = false
httpPort = 8081 httpPort = 8081
user=deluan user = deluan
password=wordpass password = wordpass
dbPath = /tmp/testDb dbPath = /tmp/testDb
musicFolder=./tests/itunes-library.xml musicFolder = ./tests/itunes-library.xml
downsampleCommand=ffmpeg -i %s -b:a %bk mp3 - downsampleCommand = ffmpeg -i %s -b:a %bk mp3 -
+2 -1
View File
@@ -14,7 +14,8 @@ import (
func Stream(path string, bitRate int, maxBitRate int, w io.Writer) error { func Stream(path string, bitRate int, maxBitRate int, w io.Writer) error {
var f io.Reader var f io.Reader
var err error var err error
if maxBitRate > 0 && bitRate > maxBitRate { ds, _ := beego.AppConfig.Bool("enableDownsampling")
if ds && maxBitRate > 0 && bitRate > maxBitRate {
f, err = downsample(path, maxBitRate) f, err = downsample(path, maxBitRate)
} else { } else {
f, err = os.Open(path) f, err = os.Open(path)