diff --git a/openlp/plugins/songs/forms/duplicatesongremovalform.py b/openlp/plugins/songs/forms/duplicatesongremovalform.py index ee27d77a6..5a01ede47 100644 --- a/openlp/plugins/songs/forms/duplicatesongremovalform.py +++ b/openlp/plugins/songs/forms/duplicatesongremovalform.py @@ -29,6 +29,7 @@ """ The duplicate song removal logic for OpenLP. """ +from __future__ import division import logging import os @@ -161,7 +162,7 @@ class DuplicateSongRemovalForm(OpenLPWizard): self.notify_no_duplicates() return # With x songs we have x*(x - 1) / 2 comparisons. - max_progress_count = max_songs * (max_songs - 1) / 2 + max_progress_count = max_songs * (max_songs - 1) // 2 self.duplicate_search_progress_bar.setMaximum(max_progress_count) songs = self.plugin.manager.get_all_objects(Song) for outer_song_counter in range(max_songs - 1): @@ -194,7 +195,6 @@ class DuplicateSongRemovalForm(OpenLPWizard): translate(u'Wizard', u'No duplicate songs have been found in the database.'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) - def add_duplicates_to_song_list(self, search_song, duplicate_song): """ Inserts a song duplicate (two similar songs) to the duplicate song list. diff --git a/openlp/plugins/songs/lib/songcompare.py b/openlp/plugins/songs/lib/songcompare.py index a98e61380..f69c5c827 100644 --- a/openlp/plugins/songs/lib/songcompare.py +++ b/openlp/plugins/songs/lib/songcompare.py @@ -43,6 +43,7 @@ Finally two conditions can qualify a song tuple to be a duplicate: This condition should hit if one of the two songs (or both) is small (smaller than the min_block_size), but most of the song is contained in the other song. """ +from __future__ import division import difflib @@ -85,7 +86,7 @@ def songs_probably_equal(song1, song2): for element in diff_no_typos: if element[0] == "equal" and _op_length(element) > length_of_longest_equal_block: length_of_longest_equal_block = _op_length(element) - if length_of_equal_blocks >= MIN_BLOCK_SIZE or length_of_longest_equal_block > len(small) * 2 / 3: + if length_of_equal_blocks >= MIN_BLOCK_SIZE or length_of_longest_equal_block > len(small) * 2 // 3: return True # Both checks failed. We assume the songs are not equal. return False