Load XSPF title as playlist name
This commit is contained in:
@@ -281,7 +281,7 @@ SongLoader::Result SongLoader::LoadLocalAsync(const QString &filename) {
|
||||
// It's a CUE - create virtual tracks
|
||||
QFile cue(matching_cue);
|
||||
if (cue.open(QIODevice::ReadOnly)) {
|
||||
const SongList songs = cue_parser_->Load(&cue, matching_cue, QDir(filename.section(u'/', 0, -2)));
|
||||
const SongList songs = cue_parser_->Load(&cue, matching_cue, QDir(filename.section(u'/', 0, -2))).songs;
|
||||
cue.close();
|
||||
for (const Song &song : songs) {
|
||||
if (song.is_valid()) songs_ << song;
|
||||
@@ -348,7 +348,9 @@ void SongLoader::LoadPlaylist(ParserBase *parser, const QString &filename) {
|
||||
|
||||
QFile file(filename);
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
songs_ = parser->Load(&file, filename, QFileInfo(filename).path());
|
||||
const ParserBase::LoadResult result = parser->Load(&file, filename, QFileInfo(filename).path());
|
||||
songs_ = result.songs;
|
||||
playlist_name_ = result.playlist_name;
|
||||
file.close();
|
||||
}
|
||||
else {
|
||||
@@ -424,7 +426,9 @@ void SongLoader::StopTypefind() {
|
||||
// Parse the playlist
|
||||
QBuffer buf(&buffer_);
|
||||
if (buf.open(QIODevice::ReadOnly)) {
|
||||
songs_ = parser_->Load(&buf);
|
||||
const ParserBase::LoadResult result = parser_->Load(&buf);
|
||||
songs_ = result.songs;
|
||||
playlist_name_ = result.playlist_name;
|
||||
buf.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ class SongLoader : public QObject {
|
||||
|
||||
const QUrl &url() const { return url_; }
|
||||
const SongList &songs() const { return songs_; }
|
||||
const QString &playlist_name() const { return playlist_name_; }
|
||||
|
||||
int timeout() const { return timeout_; }
|
||||
void set_timeout(int msec) { timeout_ = msec; }
|
||||
@@ -141,6 +142,7 @@ class SongLoader : public QObject {
|
||||
|
||||
QUrl url_;
|
||||
SongList songs_;
|
||||
QString playlist_name_;
|
||||
|
||||
const SharedPtr<UrlHandlers> url_handlers_;
|
||||
const SharedPtr<CollectionBackendInterface> collection_backend_;
|
||||
|
||||
Reference in New Issue
Block a user