mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-23 07:50:13 +01:00
commit
6dee2d5e4f
@ -21,6 +21,7 @@
|
|||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "core/taskmanager.h"
|
#include "core/taskmanager.h"
|
||||||
|
#include "playlistparsers/playlistparser.h"
|
||||||
|
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
@ -65,15 +66,19 @@ void SomaFMUrlHandler::LoadPlaylistFinished() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Replace with some more robust .pls parsing :(
|
// Parse the playlist
|
||||||
QTemporaryFile temp_file;
|
PlaylistParser parser(NULL);
|
||||||
temp_file.open();
|
QList<Song> songs = parser.LoadFromDevice(reply);
|
||||||
temp_file.write(reply->readAll());
|
|
||||||
temp_file.flush();
|
|
||||||
|
|
||||||
QSettings s(temp_file.fileName(), QSettings::IniFormat);
|
qLog(Info) << "Loading station finished, got" << songs.count() << "songs";
|
||||||
s.beginGroup("playlist");
|
|
||||||
|
// Failed to get playlist?
|
||||||
|
if (songs.count() == 0) {
|
||||||
|
qLog(Error) << "Error loading soma.fm playlist";
|
||||||
|
emit AsyncLoadComplete(LoadResult(original_url, LoadResult::NoMoreTracks));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
emit AsyncLoadComplete(LoadResult(original_url, LoadResult::TrackAvailable,
|
emit AsyncLoadComplete(LoadResult(original_url, LoadResult::TrackAvailable,
|
||||||
s.value("File1").toString()));
|
songs[0].url()));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user