Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
autoradio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ale
autoradio
Commits
828c8956
Commit
828c8956
authored
5 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Fix reading the "quality" parameter in the icecast JSON status
It's a float encoded as a string.
parent
e32b64ec
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
v2.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
node/icecast/status.go
+19
-15
19 additions, 15 deletions
node/icecast/status.go
with
19 additions
and
15 deletions
node/icecast/status.go
+
19
−
15
View file @
828c8956
...
...
@@ -9,6 +9,7 @@ import (
"log"
"net/http"
"net/url"
"strconv"
"time"
"git.autistici.org/ale/autoradio"
...
...
@@ -22,20 +23,20 @@ var (
// TODO: deserialize properly the time format used by Icecast.
type
icecastMountStatus
struct
{
Artist
string
`json:"artist"`
BitRate
int32
`json:"audio_bitrate"`
Channels
int32
`json:"audio_channels"`
AudioInfo
string
`json:"audio_info"`
SampleRate
int32
`json:"audio_samplerate"`
Genre
string
`json:"genre"`
Listeners
int32
`json:"listeners"`
ListenURL
string
`json:"listenurl"`
Quality
float32
`json:"quality"`
Description
string
`json:"server_description"`
Name
string
`json:"server_name"`
Type
string
`json:"server_type"`
Subtype
string
`json:"subtype"`
Title
string
`json:"title"`
Artist
string
`json:"artist"`
BitRate
int32
`json:"audio_bitrate"`
Channels
int32
`json:"audio_channels"`
AudioInfo
string
`json:"audio_info"`
SampleRate
int32
`json:"audio_samplerate"`
Genre
string
`json:"genre"`
Listeners
int32
`json:"listeners"`
ListenURL
string
`json:"listenurl"`
Quality
string
`json:"quality"`
Description
string
`json:"server_description"`
Name
string
`json:"server_name"`
Type
string
`json:"server_type"`
Subtype
string
`json:"subtype"`
Title
string
`json:"title"`
//StreamStart time.Time `json:"stream_start_iso8601"`
}
...
...
@@ -99,13 +100,16 @@ func convertIcecastStatus(status []icecastMountStatus) []*pb.IcecastMount {
Listeners
:
m
.
Listeners
,
BitRate
:
m
.
BitRate
,
SampleRate
:
m
.
SampleRate
,
Quality
:
m
.
Quality
,
Channels
:
m
.
Channels
,
Name
:
m
.
Name
,
Description
:
m
.
Description
,
Title
:
m
.
Title
,
Artist
:
m
.
Artist
,
}
// For whatever reason, quality is a string in Icecast's JSON.
if
q
,
err
:=
strconv
.
ParseFloat
(
m
.
Quality
,
32
);
err
==
nil
{
outm
.
Quality
=
float32
(
q
)
}
out
=
append
(
out
,
&
outm
)
}
return
out
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment