![]() |
Retrieve bitrate info from MPD - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3) +--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7) +--- Thread: Retrieve bitrate info from MPD (/showthread.php?tid=318) |
Retrieve bitrate info from MPD - mancio61 - 07-18-2018 Hi I successfully built my own network streamer, using an OLED 16x2 display to show info about artist, title track, elapsed time, etc. I show also the "audio" info, getting those info using the statements: audio = m_status['audio'].split(':') if len(audio) == 3: sample = round(float(audio[0])/1000,1) bits = audio[1] if audio[2] == '1': channels = 'Mono' elif audio[2] == '2': channels = 'Stereo' elif int(audio[2]) > 2: channels = 'Multi' else: channels = u"" if channels == u"": tracktype = "{0} bit, {1} kHz".format(bits, sample) else: tracktype = "{0}, {1} bit, {2} kHz".format(channels, bits, sample) else: # If audio information not available just send that MPD is the source tracktype = u"MPD" The result on the display can be, for example, "24bits, Stereo, 192/96 kHz". I'd like to show also the bitrate (e.g. 320 kbs), but this value is never filled up in the m_status structure (it's always = 0). I saw instead that from Moode web UI, clicking on the "Audio Info", it shows me , for example, 24 bit, 44.1 kHz, Stereo, 320 kbps. That means that in some way this info can be retrieved from MPD. Anybody can help me how to? thanks Andrea RE: Retrieve bitrate info from MPD - Tim Curtis - 07-18-2018 its a field named bitrate returned by the MPD status command. pi@rp3:~ $ telnet localhost 6600 Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. OK MPD 0.20.0 status volume: 18 repeat: 0 random: 0 single: 0 consume: 0 playlist: 86 playlistlength: 87 mixrampdb: 0.000000 state: play song: 47 songid: 48 time: 125:272 elapsed: 125.039 bitrate: 482 duration: 272.066 audio: 44100:16:2 nextsong: 48 nextsongid: 49 OK RE: Retrieve bitrate info from MPD - mancio61 - 07-18-2018 yes, I saw that field 'bitrate' is part of the structure returned by the statement m_status = client.status(). The problem is that its value is always 0 ! I don't understand why (the other ones like elapsed, audio, duration,...etc are correctly filled...). I also try to insert in the code some print (bitrate) statement to see its values on the console, but it sadly always = 0... RE: Retrieve bitrate info from MPD - Tim Curtis - 07-18-2018 You will probably need to examine the source code for the client.status() function to see what its doing RE: Retrieve bitrate info from MPD - mancio61 - 07-25-2018 At the end I was able to show it on the display. There was an erroneus indentation in a line of code, that skips the capture of kbps from MPD.... |