|
Lines 42-63
Link Here
|
| 42 |
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); |
42 |
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); |
| 43 |
if (current_info->mpd.file == NULL) |
43 |
if (current_info->mpd.file == NULL) |
| 44 |
current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); |
44 |
current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); |
| 45 |
strncpy(current_info->mpd.name, "Unknown", |
45 |
*current_info->mpd.name=0; |
| 46 |
TEXT_BUFFER_SIZE - 1); |
46 |
*current_info->mpd.file=0; |
| 47 |
strncpy(current_info->mpd.file, "Unknown", |
47 |
*current_info->mpd.artist=0; |
| 48 |
TEXT_BUFFER_SIZE - 1); |
48 |
*current_info->mpd.album=0; |
| 49 |
strncpy(current_info->mpd.artist, "Unknown", |
49 |
*current_info->mpd.title=0; |
| 50 |
TEXT_BUFFER_SIZE - 1); |
50 |
*current_info->mpd.random=0; |
| 51 |
strncpy(current_info->mpd.album, "Unknown", |
51 |
*current_info->mpd.repeat=0; |
| 52 |
TEXT_BUFFER_SIZE - 1); |
52 |
*current_info->mpd.track=0; |
| 53 |
strncpy(current_info->mpd.title, "Unknown", |
|
|
| 54 |
TEXT_BUFFER_SIZE - 1); |
| 55 |
strncpy(current_info->mpd.random, "Unknown", |
| 56 |
TEXT_BUFFER_SIZE - 1); |
| 57 |
strncpy(current_info->mpd.repeat, "Unknown", |
| 58 |
TEXT_BUFFER_SIZE - 1); |
| 59 |
strncpy(current_info->mpd.track, "Unknown", |
| 60 |
TEXT_BUFFER_SIZE - 1); |
| 61 |
strncpy(current_info->mpd.status, "MPD not responding", TEXT_BUFFER_SIZE - 1); |
53 |
strncpy(current_info->mpd.status, "MPD not responding", TEXT_BUFFER_SIZE - 1); |
| 62 |
current_info->mpd.bitrate = 0; |
54 |
current_info->mpd.bitrate = 0; |
| 63 |
current_info->mpd.progress = 0; |
55 |
current_info->mpd.progress = 0; |
|
Lines 97-118
Link Here
|
| 97 |
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); |
89 |
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); |
| 98 |
if (current_info->mpd.file == NULL) |
90 |
if (current_info->mpd.file == NULL) |
| 99 |
current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); |
91 |
current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); |
| 100 |
strncpy(current_info->mpd.name, "Unknown", |
92 |
*current_info->mpd.name=0; |
| 101 |
TEXT_BUFFER_SIZE - 1); |
93 |
*current_info->mpd.file=0; |
| 102 |
strncpy(current_info->mpd.file, "Unknown", |
94 |
*current_info->mpd.artist=0; |
| 103 |
TEXT_BUFFER_SIZE - 1); |
95 |
*current_info->mpd.album=0; |
| 104 |
strncpy(current_info->mpd.artist, "Unknown", |
96 |
*current_info->mpd.title=0; |
| 105 |
TEXT_BUFFER_SIZE - 1); |
97 |
*current_info->mpd.random=0; |
| 106 |
strncpy(current_info->mpd.album, "Unknown", |
98 |
*current_info->mpd.repeat=0; |
| 107 |
TEXT_BUFFER_SIZE - 1); |
99 |
*current_info->mpd.track=0; |
| 108 |
strncpy(current_info->mpd.title, "Unknown", |
|
|
| 109 |
TEXT_BUFFER_SIZE - 1); |
| 110 |
strncpy(current_info->mpd.random, "Unknown", |
| 111 |
TEXT_BUFFER_SIZE - 1); |
| 112 |
strncpy(current_info->mpd.repeat, "Unknown", |
| 113 |
TEXT_BUFFER_SIZE - 1); |
| 114 |
strncpy(current_info->mpd.track, "Unknown", |
| 115 |
TEXT_BUFFER_SIZE - 1); |
| 116 |
strncpy(current_info->mpd.status, "MPD not responding", TEXT_BUFFER_SIZE - 1); |
100 |
strncpy(current_info->mpd.status, "MPD not responding", TEXT_BUFFER_SIZE - 1); |
| 117 |
current_info->mpd.bitrate = 0; |
101 |
current_info->mpd.bitrate = 0; |
| 118 |
current_info->mpd.progress = 0; |
102 |
current_info->mpd.progress = 0; |
|
Lines 158-180
Link Here
|
| 158 |
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); |
142 |
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); |
| 159 |
if (current_info->mpd.file == NULL) |
143 |
if (current_info->mpd.file == NULL) |
| 160 |
current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); |
144 |
current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); |
| 161 |
strncpy(current_info->mpd.name, "Unknown", |
145 |
*current_info->mpd.name=0; |
| 162 |
TEXT_BUFFER_SIZE - 1); |
146 |
*current_info->mpd.file=0; |
| 163 |
strncpy(current_info->mpd.file, "Unknown", |
147 |
*current_info->mpd.artist=0; |
| 164 |
TEXT_BUFFER_SIZE - 1); |
148 |
*current_info->mpd.album=0; |
| 165 |
strncpy(current_info->mpd.artist, "Unknown", |
149 |
*current_info->mpd.title=0; |
| 166 |
TEXT_BUFFER_SIZE - 1); |
150 |
*current_info->mpd.random=0; |
| 167 |
strncpy(current_info->mpd.album, "Unknown", |
151 |
*current_info->mpd.repeat=0; |
| 168 |
TEXT_BUFFER_SIZE - 1); |
152 |
*current_info->mpd.track=0; |
| 169 |
strncpy(current_info->mpd.title, "Unknown", |
153 |
strncpy(current_info->mpd.status, "Stopped", |
| 170 |
TEXT_BUFFER_SIZE - 1); |
|
|
| 171 |
strncpy(current_info->mpd.random, "Unknown", |
| 172 |
TEXT_BUFFER_SIZE - 1); |
| 173 |
strncpy(current_info->mpd.repeat, "Unknown", |
| 174 |
TEXT_BUFFER_SIZE - 1); |
| 175 |
strncpy(current_info->mpd.track, "Unknown", |
| 176 |
TEXT_BUFFER_SIZE - 1); |
| 177 |
strncpy(current_info->mpd.status, "Unknown", |
| 178 |
TEXT_BUFFER_SIZE - 1); |
154 |
TEXT_BUFFER_SIZE - 1); |
| 179 |
} |
155 |
} |
| 180 |
if (status->state == MPD_STATUS_STATE_PAUSE) { |
156 |
if (status->state == MPD_STATUS_STATE_PAUSE) { |
|
Lines 211-234
Link Here
|
| 211 |
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); |
187 |
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); |
| 212 |
if (current_info->mpd.file == NULL) |
188 |
if (current_info->mpd.file == NULL) |
| 213 |
current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); |
189 |
current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); |
| 214 |
strncpy(current_info->mpd.name, "Unknown", |
190 |
*current_info->mpd.name=0; |
| 215 |
TEXT_BUFFER_SIZE - 1); |
191 |
*current_info->mpd.file=0; |
| 216 |
strncpy(current_info->mpd.file, "Unknown", |
192 |
*current_info->mpd.artist=0; |
| 217 |
TEXT_BUFFER_SIZE - 1); |
193 |
*current_info->mpd.album=0; |
| 218 |
strncpy(current_info->mpd.artist, "Unknown", |
194 |
*current_info->mpd.title=0; |
| 219 |
TEXT_BUFFER_SIZE - 1); |
195 |
*current_info->mpd.random=0; |
| 220 |
strncpy(current_info->mpd.album, "Unknown", |
196 |
*current_info->mpd.repeat=0; |
| 221 |
TEXT_BUFFER_SIZE - 1); |
197 |
*current_info->mpd.track=0; |
| 222 |
strncpy(current_info->mpd.title, "Unknown", |
198 |
*current_info->mpd.status=0; |
| 223 |
TEXT_BUFFER_SIZE - 1); |
|
|
| 224 |
strncpy(current_info->mpd.random, "Unknown", |
| 225 |
TEXT_BUFFER_SIZE - 1); |
| 226 |
strncpy(current_info->mpd.repeat, "Unknown", |
| 227 |
TEXT_BUFFER_SIZE - 1); |
| 228 |
strncpy(current_info->mpd.track, "Unknown", |
| 229 |
TEXT_BUFFER_SIZE - 1); |
| 230 |
strncpy(current_info->mpd.status, "Unknown", |
| 231 |
TEXT_BUFFER_SIZE - 1); |
| 232 |
} |
199 |
} |
| 233 |
if (status->state == MPD_STATUS_STATE_PLAY || |
200 |
if (status->state == MPD_STATUS_STATE_PLAY || |
| 234 |
status->state == MPD_STATUS_STATE_PAUSE) { |
201 |
status->state == MPD_STATUS_STATE_PAUSE) { |
|
Lines 248-261
Link Here
|
| 248 |
} else if (status->random == 1) { |
215 |
} else if (status->random == 1) { |
| 249 |
strcpy(current_info->mpd.random, "On"); |
216 |
strcpy(current_info->mpd.random, "On"); |
| 250 |
} else { |
217 |
} else { |
| 251 |
strcpy(current_info->mpd.random, "Unknown"); |
218 |
*current_info->mpd.random=0; |
| 252 |
} |
219 |
} |
| 253 |
if (status->repeat == 0) { |
220 |
if (status->repeat == 0) { |
| 254 |
strcpy(current_info->mpd.repeat, "Off"); |
221 |
strcpy(current_info->mpd.repeat, "Off"); |
| 255 |
} else if (status->repeat == 1) { |
222 |
} else if (status->repeat == 1) { |
| 256 |
strcpy(current_info->mpd.repeat, "On"); |
223 |
strcpy(current_info->mpd.repeat, "On"); |
| 257 |
} else { |
224 |
} else { |
| 258 |
strcpy(current_info->mpd.repeat, "Unknown"); |
225 |
*current_info->mpd.repeat=0; |
| 259 |
} |
226 |
} |
| 260 |
} |
227 |
} |
| 261 |
|
228 |
|
|
Lines 292-328
Link Here
|
| 292 |
strncpy(current_info->mpd.artist, song->artist, |
259 |
strncpy(current_info->mpd.artist, song->artist, |
| 293 |
TEXT_BUFFER_SIZE - 1); |
260 |
TEXT_BUFFER_SIZE - 1); |
| 294 |
} else { |
261 |
} else { |
| 295 |
strcpy(current_info->mpd.artist, "Unknown"); |
262 |
*current_info->mpd.artist=0; |
| 296 |
} |
263 |
} |
| 297 |
if (song->album) { |
264 |
if (song->album) { |
| 298 |
strncpy(current_info->mpd.album, song->album, |
265 |
strncpy(current_info->mpd.album, song->album, |
| 299 |
TEXT_BUFFER_SIZE - 1); |
266 |
TEXT_BUFFER_SIZE - 1); |
| 300 |
} else { |
267 |
} else { |
| 301 |
strcpy(current_info->mpd.album, "Unknown"); |
268 |
*current_info->mpd.album=0; |
| 302 |
} |
269 |
} |
| 303 |
if (song->title) { |
270 |
if (song->title) { |
| 304 |
strncpy(current_info->mpd.title, song->title, |
271 |
strncpy(current_info->mpd.title, song->title, |
| 305 |
TEXT_BUFFER_SIZE - 1); |
272 |
TEXT_BUFFER_SIZE - 1); |
| 306 |
} else { |
273 |
} else { |
| 307 |
strcpy(current_info->mpd.title, "Unknown"); |
274 |
*current_info->mpd.title=0; |
| 308 |
} |
275 |
} |
| 309 |
if (song->track) { |
276 |
if (song->track) { |
| 310 |
strncpy(current_info->mpd.track, song->track, |
277 |
strncpy(current_info->mpd.track, song->track, |
| 311 |
TEXT_BUFFER_SIZE - 1); |
278 |
TEXT_BUFFER_SIZE - 1); |
| 312 |
} else { |
279 |
} else { |
| 313 |
strcpy(current_info->mpd.track, "Unknown"); |
280 |
*current_info->mpd.track=0; |
| 314 |
} |
281 |
} |
| 315 |
if (song->name) { |
282 |
if (song->name) { |
| 316 |
strncpy(current_info->mpd.name, song->name, |
283 |
strncpy(current_info->mpd.name, song->name, |
| 317 |
TEXT_BUFFER_SIZE - 1); |
284 |
TEXT_BUFFER_SIZE - 1); |
| 318 |
} else { |
285 |
} else { |
| 319 |
strcpy(current_info->mpd.name, "Unknown"); |
286 |
*current_info->mpd.name=0; |
| 320 |
} |
287 |
} |
| 321 |
if (song->file) { |
288 |
if (song->file) { |
| 322 |
strncpy(current_info->mpd.file, |
289 |
strncpy(current_info->mpd.file, |
| 323 |
song->file, TEXT_BUFFER_SIZE - 1); |
290 |
song->file, TEXT_BUFFER_SIZE - 1); |
| 324 |
} else { |
291 |
} else { |
| 325 |
strcpy(current_info->mpd.file, "Unknown"); |
292 |
*current_info->mpd.file=0; |
| 326 |
} |
293 |
} |
| 327 |
if (entity != NULL) { |
294 |
if (entity != NULL) { |
| 328 |
mpd_freeInfoEntity(entity); |
295 |
mpd_freeInfoEntity(entity); |