Small fixes

This commit is contained in:
BasioMeusPuga
2018-03-19 18:26:43 +05:30
parent 7bdf01a67e
commit b5acce6449
4 changed files with 10 additions and 4 deletions

1
TODO
View File

@@ -1,5 +1,6 @@
TODO
General:
✓ Internationalization
Application icon
.desktop file
Options:

View File

@@ -226,6 +226,7 @@ class SettingsUI(QtWidgets.QDialog, settingswindow.Ui_Dialog):
# The books the search thread has found
# are now in self.thread.valid_files
if not self.thread.valid_files:
self.parent.move_on()
return
# Hey, messaging is important, okay?

View File

@@ -151,7 +151,7 @@ class BookSorter:
# is already in the database and it remains at its original path
if self.mode == 'addition' and file_md5 in self.hashes_and_paths:
if (self.hashes_and_paths[file_md5] == filename
and os.path.exists(self.hashes_and_paths[file_md5])):
or os.path.exists(self.hashes_and_paths[file_md5])):
if not self.hashes_and_paths[file_md5] == filename:
print(f'{os.path.basename(filename)} is already in database')

View File

@@ -89,7 +89,8 @@ class BackGroundBookSearch(QtCore.QThread):
# Filter for checked directories
self.valid_directories = [
[i[0], i[1], i[2]] for i in data_list if i[3] == QtCore.Qt.Checked]
[i[0], i[1], i[2]] for i in data_list if i[
3] == QtCore.Qt.Checked and os.path.exists(i[0])]
self.unwanted_directories = [
pathlib.Path(i[0]) for i in data_list if i[3] == QtCore.Qt.Unchecked]
@@ -117,8 +118,11 @@ class BackGroundBookSearch(QtCore.QThread):
_pool.close()
_pool.join()
initiate_threads()
print(len(self.valid_files), 'books found')
if self.valid_directories:
initiate_threads()
print(len(self.valid_files), 'books found')
else:
print('No valid directories')
class BackGroundCacheRefill(QtCore.QThread):