The duplicate song removal logic for OpenLP.

class openlp.plugins.songs.forms.duplicatesongremovalform.DuplicateSongRemovalForm(plugin)[source]

Bases: openlp.core.ui.lib.wizard.OpenLPWizard, openlp.core.common.registryproperties.RegistryProperties

This is the Duplicate Song Removal Wizard. It provides functionality to search for and remove duplicate songs in the database.


Add song wizard specific pages.

add_duplicates_to_song_list(search_song, duplicate_song)[source]

Inserts a song duplicate (two similar songs) to the duplicate song list. If one of the two songs is already part of the duplicate song list, don’t add another duplicate group but add the other song to that group. Returns True if at least one of the songs was added, False if both were already member of a group.

  • search_song – The song we searched the duplicate for.
  • duplicate_song – The duplicate song.

Called when changing the wizard page.

Parameters:page_id – ID of the page the wizard changed to.

Song wizard specific signals.


Notifies the user, that there were no duplicates found in the database.


Once the wizard is finished, refresh the song list, since we potentially removed songs from it.


Removes the previous review UI elements and calls process_current_duplicate_entry.


Update the review counter in the wizard header, add song widgets for the current duplicate group to review, if it’s the last duplicate song group, hide the “next” button and show the “finish” button.


Removes a song from the database, removes the GUI element representing the song on the review page, and disable the remove button if only one duplicate is left.

Parameters:song_review_widget – The SongReviewWidget whose song we should delete.

Song wizard localisation.


Set default form values for the song import wizard.


Set the wizard review page header text.


Controls whether we should switch to the next wizard page. This method loops on the review page as long as there are more song duplicates to review.


This is a generator function to return tuples of tuple with two songs and their position in the song array. When completed then all songs have once been returned combined with any other songs.

Parameters:songs – All songs in the database.