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

View File

@ -1,4 +1,5 @@
appname = github.com/deluan/gosonic
serverName = GoSonic
httpPort = 8080
runMode = dev
autoRender = false
@ -13,19 +14,21 @@ musicFolder=./iTunes1.xml
user=deluan
password=wordpass
dbPath=./devDb
enableDownsampling = true
downsampleCommand=ffmpeg -i %s -map 0:0 -b:a %bk -v 0 -f mp3 -
plsIgnoreFolders = true
plsIgnoredPatterns = ^iCloud;^CDs para;^Skipped;Christian
[dev]
disableValidation = true
disableValidation = false
enableDownsampling = false
enableAdmin = true
[test]
disableValidation = false
httpPort = 8081
user=deluan
password=wordpass
user = deluan
password = wordpass
dbPath = /tmp/testDb
musicFolder=./tests/itunes-library.xml
downsampleCommand=ffmpeg -i %s -b:a %bk mp3 -
musicFolder = ./tests/itunes-library.xml
downsampleCommand = ffmpeg -i %s -b:a %bk mp3 -

View File

@ -14,7 +14,8 @@ import (
func Stream(path string, bitRate int, maxBitRate int, w io.Writer) error {
var f io.Reader
var err error
if maxBitRate > 0 && bitRate > maxBitRate {
ds, _ := beego.AppConfig.Bool("enableDownsampling")
if ds && maxBitRate > 0 && bitRate > maxBitRate {
f, err = downsample(path, maxBitRate)
} else {
f, err = os.Open(path)