Commit 4e5839a7 authored by Jean-Francois Dockes's avatar Jean-Francois Dockes
Browse files

factorize common utility function

parent bea96351
......@@ -121,22 +121,6 @@ OHPlaylist::OHPlaylist(UpMpd *dev, unsigned int cssleep)
static const int tracksmax = 16384;
static string mpdstatusToTransportState(MpdStatus::State st)
{
string tstate;
switch(st) {
case MpdStatus::MPDS_PLAY:
tstate = "Playing";
break;
case MpdStatus::MPDS_PAUSE:
tstate = "Paused";
break;
default:
tstate = "Stopped";
}
return tstate;
}
// The data format for id lists is an array of msb 32 bits ints
// encoded in base64...
static string translateIdArray(const vector<UpSong>& in)
......
......@@ -225,22 +225,6 @@ bool OHRadio::readRadios()
return true;
}
static string mpdstatusToTransportState(MpdStatus::State st)
{
string tstate;
switch (st) {
case MpdStatus::MPDS_PLAY:
tstate = "Playing";
break;
case MpdStatus::MPDS_PAUSE:
tstate = "Paused";
break;
default:
tstate = "Stopped";
}
return tstate;
}
// The data format for id lists is an array of msb 32 bits ints
// encoded in base64. The values could be anything, but, for us, they
// are just the indices into o_radios(), beginning at 1 because 0 is
......
......@@ -24,6 +24,7 @@
#include "libupnpp/device/device.hxx"
#include "upmpdutils.hxx"
#include "upmpd.hxx"
#include "mpdcli.hxx"
using namespace UPnPP;
......@@ -59,6 +60,17 @@ public:
return true;
}
static std::string mpdstatusToTransportState(MpdStatus::State st) {
switch (st) {
case MpdStatus::MPDS_PLAY:
return "Playing";
case MpdStatus::MPDS_PAUSE:
return "Paused";
default:
return "Stopped";
}
}
protected:
virtual bool makestate(std::unordered_map<std::string, std::string> &) = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment