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 TODO
General: General:
✓ Internationalization
Application icon Application icon
.desktop file .desktop file
Options: Options:

View File

@@ -226,6 +226,7 @@ class SettingsUI(QtWidgets.QDialog, settingswindow.Ui_Dialog):
# The books the search thread has found # The books the search thread has found
# are now in self.thread.valid_files # are now in self.thread.valid_files
if not self.thread.valid_files: if not self.thread.valid_files:
self.parent.move_on()
return return
# Hey, messaging is important, okay? # 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 # 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.mode == 'addition' and file_md5 in self.hashes_and_paths:
if (self.hashes_and_paths[file_md5] == filename 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: if not self.hashes_and_paths[file_md5] == filename:
print(f'{os.path.basename(filename)} is already in database') print(f'{os.path.basename(filename)} is already in database')

View File

@@ -89,7 +89,8 @@ class BackGroundBookSearch(QtCore.QThread):
# Filter for checked directories # Filter for checked directories
self.valid_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 = [ self.unwanted_directories = [
pathlib.Path(i[0]) for i in data_list if i[3] == QtCore.Qt.Unchecked] 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.close()
_pool.join() _pool.join()
initiate_threads() if self.valid_directories:
print(len(self.valid_files), 'books found') initiate_threads()
print(len(self.valid_files), 'books found')
else:
print('No valid directories')
class BackGroundCacheRefill(QtCore.QThread): class BackGroundCacheRefill(QtCore.QThread):