Skip to content

Commit c1239d9

Browse files
authored
Merge pull request mixxxdj#15798 from daladim/fixed_rhythmbox_imports
Fixed rhythmbox imports
2 parents 7b7c531 + 5fe17d9 commit c1239d9

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

src/library/rhythmbox/rhythmboxfeature.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ RhythmboxFeature::~RhythmboxFeature() {
9797
}
9898

9999
std::unique_ptr<BaseSqlTableModel>
100-
RhythmboxFeature::createPlaylistModelForPlaylist(const QVariant& data) {
101-
VERIFY_OR_DEBUG_ASSERT(data.canConvert<QString>()) {
100+
RhythmboxFeature::createPlaylistModelForPlaylist(const QVariant& playlist_name) {
101+
VERIFY_OR_DEBUG_ASSERT(playlist_name.canConvert<QString>()) {
102102
return {};
103103
}
104104
auto pModel = std::make_unique<BaseExternalPlaylistModel>(this,
@@ -107,7 +107,7 @@ RhythmboxFeature::createPlaylistModelForPlaylist(const QVariant& data) {
107107
"rhythmbox_playlists",
108108
"rhythmbox_playlist_tracks",
109109
m_trackSource);
110-
pModel->setPlaylist(data.toString());
110+
pModel->setPlaylist(playlist_name.toString());
111111
return pModel;
112112
}
113113

@@ -250,8 +250,10 @@ TreeItem* RhythmboxFeature::importPlaylists() {
250250
if (attr.value("type").toString() == "static") {
251251
QString playlist_name = attr.value("name").toString();
252252

253-
//Construct the childmodel
254-
rootItem->appendChild(playlist_name);
253+
// Construct the childmodel
254+
// For Rhythmbox, the playlist name _is_ the unique identifier,
255+
// so we're using it for both the label and data.
256+
rootItem->appendChild(playlist_name, playlist_name);
255257

256258
//Execute SQL statement
257259
query_insert_to_playlists.bindValue(":name", playlist_name);
@@ -266,7 +268,9 @@ TreeItem* RhythmboxFeature::importPlaylists() {
266268
int playlist_id = query_insert_to_playlists.lastInsertId().toInt();
267269

268270
//Process playlist entries
271+
ScopedTransaction transaction(m_database);
269272
importPlaylist(xml, query_insert_to_playlist_tracks, playlist_id);
273+
transaction.commit();
270274
}
271275
}
272276
}

src/library/rhythmbox/rhythmboxfeature.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class RhythmboxFeature : public BaseExternalLibraryFeature {
3333

3434
protected:
3535
std::unique_ptr<BaseSqlTableModel> createPlaylistModelForPlaylist(
36-
const QVariant& data) override;
36+
const QVariant& playlist_name) override;
3737

3838
private:
3939
// Removes all rows from a given table

0 commit comments

Comments
 (0)