@@ -97,8 +97,8 @@ RhythmboxFeature::~RhythmboxFeature() {
9797}
9898
9999std::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 }
0 commit comments