16
16
17
17
#include < iostream>
18
18
19
+ #define SSTR ( x ) dynamic_cast < std::ostringstream & >(( std::ostringstream() << std::dec << x ) ).str()
20
+
19
21
// http://<ip_address>:8080/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22Player.GetActivePlayers%22,%22id%22:1}
20
22
// {"id":1,"jsonrpc":"2.0","result":[{"playerid":1,"type":"video"}]}
21
23
@@ -166,7 +168,7 @@ void CKodi::Do_Node_Work(const KodiNode &Node)
166
168
if (sMedia == " video" ) nStatus = MSTAT_VIDEO;
167
169
if (sMedia == " audio" ) nStatus = MSTAT_AUDIO;
168
170
if (sMedia == " picture" ) nStatus = MSTAT_PHOTO;
169
- sPlayerId = std::to_string ((int )root[" result" ][0 ][" playerid" ].asInt ());
171
+ sPlayerId = SSTR ((int )root[" result" ][0 ][" playerid" ].asInt ());
170
172
}
171
173
172
174
// If player is active then pick up additional details
@@ -204,12 +206,12 @@ void CKodi::Do_Node_Work(const KodiNode &Node)
204
206
if (root[" result" ][" item" ][" season" ].empty () != true )
205
207
{
206
208
sTitle += " [S" ;
207
- sTitle += std::to_string ((int )root[" result" ][" item" ][" season" ].asInt ());
209
+ sTitle += SSTR ((int )root[" result" ][" item" ][" season" ].asInt ());
208
210
}
209
211
if (root[" result" ][" item" ][" episode" ].empty () != true )
210
212
{
211
213
sTitle += " E" ;
212
- sTitle += std::to_string ((int )root[" result" ][" item" ][" episode" ].asInt ());
214
+ sTitle += SSTR ((int )root[" result" ][" item" ][" episode" ].asInt ());
213
215
sTitle += " ], " ;
214
216
}
215
217
}
@@ -233,7 +235,7 @@ void CKodi::Do_Node_Work(const KodiNode &Node)
233
235
}
234
236
if (root[" result" ][" item" ][" year" ].empty () != true )
235
237
{
236
- std::string sYear = std::to_string ((int )root[" result" ][" item" ][" year" ].asInt ());
238
+ std::string sYear = SSTR ((int )root[" result" ][" item" ][" year" ].asInt ());
237
239
if (sYear .length () > 2 ) sTitle += " (" + sYear + " )" ;
238
240
}
239
241
}
@@ -249,7 +251,7 @@ void CKodi::Do_Node_Work(const KodiNode &Node)
249
251
int iSpeed = root[" result" ][" speed" ].asInt ();
250
252
if (iSpeed == 0 ) nStatus = MSTAT_PAUSED;
251
253
float fPercent = root[" result" ][" percentage" ].asFloat ();
252
- if (fPercent > 1.0 ) sPercent = std::to_string ((int )round (fPercent )) + " %" ;
254
+ if (fPercent > 1.0 ) sPercent = SSTR ((int )round (fPercent )) + " %" ;
253
255
}
254
256
}
255
257
0 commit comments