From 18633e609522800c7b6b446e5a9c2c796f36d0e3 Mon Sep 17 00:00:00 2001 From: Jaisen Mathai Date: Wed, 14 Oct 2015 23:41:15 -0700 Subject: [PATCH] Update import script to not update hash db and let the filesystem module do it --- import.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/import.py b/import.py index 4aa6fcd..7392620 100755 --- a/import.py +++ b/import.py @@ -47,7 +47,6 @@ def main(argv): if(config['source'] is not None): source = config['source'] - write_counter = 0 for current_file in filesystem.get_all_files(source, media_type.get_valid_extensions()): media = media_type(current_file) @@ -55,23 +54,16 @@ def main(argv): filesystem.set_date_from_path_video(media) dest_path = filesystem.process_file(current_file, destination, media, allowDuplicate=False, move=False) - print '%s -> %s' % (current_file, dest_path) - # Write to the hash database every 10 iterations - write_counter += 1 - if(write_counter % 10 == 0): - db.update_hash_db() - - # If there's anything we haven't written to the hash database then write it now - if(write_counter % 10 != 10): - db.update_hash_db() + if(dest_path is not None): + print '%s -> %s' % (current_file, dest_path) elif(config['file'] is not None): media = media_type(config['file']) if(media_type.__name__ == 'Video'): filesystem.set_date_from_path_video(media) dest_path = filesystem.process_file(config['file'], destination, media, allowDuplicate=False, move=False) - print '%s -> %s' % (current_file, dest_path) - db.update_hash_db() + if(dest_path is not None): + print '%s -> %s' % (current_file, dest_path) else: help()