summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-07-22 19:23:12 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-07-22 19:23:12 (GMT)
commit1a87cad022b9e838a08dd1f4cb39f55b91d99de3 (patch)
tree43b43c926c4ec6306dbf5def6e183204cd7248e8
parent405e7fa98878a61185d72f4bc5c9dede3f45f336 (diff)
reliability fix and vet
-rw-r--r--rhimport/converter.go4
-rw-r--r--rhimport/session_store.go8
2 files changed, 8 insertions, 4 deletions
diff --git a/rhimport/converter.go b/rhimport/converter.go
index 72f746d..6c63657 100644
--- a/rhimport/converter.go
+++ b/rhimport/converter.go
@@ -189,9 +189,11 @@ func NewBS1770FetchConverter(filename string, metadata map[string]string, sample
res, err := NewBS1770ResultFromXML(&bsStdout)
if err != nil {
bs.result <- FetchConverterResult{bsStdout.String(), err, 0.0}
+ return
}
if len(res.Album.Tracks) == 0 {
bs.result <- FetchConverterResult{bsStdout.String(), fmt.Errorf("bs1770gain returned no/invalid result"), 0.0}
+ return
}
bs.result <- FetchConverterResult{"", nil, res.Album.Tracks[0].Integrated.LU}
}()
@@ -285,9 +287,11 @@ func NewFFMpegBS1770FetchConverter(filename string, metadata map[string]string,
res, err := NewBS1770ResultFromXML(&bsStdout)
if err != nil {
ff.resultBS <- FetchConverterResult{bsStdout.String(), err, 0.0}
+ return
}
if len(res.Album.Tracks) == 0 {
ff.resultBS <- FetchConverterResult{bsStdout.String(), fmt.Errorf("bs1770gain returned no/invalid result"), 0.0}
+ return
}
ff.resultBS <- FetchConverterResult{"", nil, res.Album.Tracks[0].Integrated.LU}
}()
diff --git a/rhimport/session_store.go b/rhimport/session_store.go
index a511d52..4139f99 100644
--- a/rhimport/session_store.go
+++ b/rhimport/session_store.go
@@ -190,7 +190,7 @@ func (store *SessionStore) get(username, id string) (resp getSessionResponse) {
user, exists := store.store[username]
if !exists {
resp.responsecode = http.StatusNotFound
- resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", user, id)
+ resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", username, id)
}
if session, exists := user.sessions[id]; exists {
@@ -198,7 +198,7 @@ func (store *SessionStore) get(username, id string) (resp getSessionResponse) {
resp.refId = session.refId
} else {
resp.responsecode = http.StatusNotFound
- resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", user, id)
+ resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", username, id)
}
return
}
@@ -241,7 +241,7 @@ func (store *SessionStore) remove(username, id string) (resp removeSessionRespon
user, exists := store.store[username]
if !exists {
resp.responsecode = http.StatusNotFound
- resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", user, id)
+ resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", username, id)
}
if session, exists := user.sessions[id]; exists {
@@ -257,7 +257,7 @@ func (store *SessionStore) remove(username, id string) (resp removeSessionRespon
}
} else {
resp.responsecode = http.StatusNotFound
- resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", user, id)
+ resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", username, id)
}
return
}