+ int random = docElem.namedItem("random").toElement().text().toInt();
+ int loop = docElem.namedItem("loop").toElement().text().toInt();
+ int repeat = docElem.namedItem("repeat").toElement().text().toInt();
+ QString state = docElem.namedItem("state").toElement().text();
+ QDomNode infoNode = docElem.namedItem("information");
+ QDomNode metaInfoNode = infoNode.namedItem("meta-information");
+ QString title = metaInfoNode.namedItem("title").toElement().text().replace("\\\\", "\\");
+ QString artist = metaInfoNode.namedItem("artist").toElement().text();
+ QString album = metaInfoNode.namedItem("album").toElement().text();
+ QString now_playing = metaInfoNode.namedItem("now_playing").toElement().text();
+ QString art_url = metaInfoNode.namedItem("art_url").toElement().text();
+ // Populate the current status structure
+ // now would be a good time to work out if we are a new track / file or not.
+ // key if we are going to look for album art later
+ // for now we check length and title this will require further examination later
+ mCurrentStatus.newtrack = true;
+ if (mCurrentStatus.length == length && !mCurrentStatus.title.isNull() && 0 == QString::compare(mCurrentStatus.title, title)) {
+ mCurrentStatus.newtrack = false;
+ }
+ mCurrentStatus.volume = volume;
+ mCurrentStatus.length = length;
+ mCurrentStatus.time = time;
+ mCurrentStatus.position = position;
+ mCurrentStatus.random = (1 == random);
+ mCurrentStatus.loop = (1 == loop);
+ mCurrentStatus.repeat = (1 == repeat);
+ mCurrentStatus.title = title;
+ mCurrentStatus.artist = artist;
+ mCurrentStatus.album = album;
+ mCurrentStatus.nowplaying = now_playing;
+ mCurrentStatus.hasart = (!art_url.isNull() && !art_url.isEmpty());
+ if (!state.isNull() && !state.isEmpty()) {
+ if (0 == QString::compare("playing", state, Qt::CaseInsensitive)) {
+ mCurrentStatus.state = PLAYING;
+ }
+ else if (0 == QString::compare("paused", state, Qt::CaseInsensitive)) {
+ mCurrentStatus.state = PAUSED;
+ }
+ else if (0 == QString::compare("stop", state, Qt::CaseInsensitive)) {
+ mCurrentStatus.state = STOP;
+ }
+ else {
+ mCurrentStatus.state = UNKNOWN;
+ }
+ }
+ else {
+ mCurrentStatus.state = UNKNOWN;
+ }
+ // What's our mute status?
+ if (0 < mCurrentStatus.volume) {
+ this->mVolume = mCurrentStatus.volume;