Update import script to not update hash db and let the filesystem module do it
This commit is contained in:
parent
f86932df29
commit
18633e6095
16
import.py
16
import.py
|
@ -47,7 +47,6 @@ def main(argv):
|
||||||
if(config['source'] is not None):
|
if(config['source'] is not None):
|
||||||
source = config['source']
|
source = config['source']
|
||||||
|
|
||||||
write_counter = 0
|
|
||||||
for current_file in filesystem.get_all_files(source, media_type.get_valid_extensions()):
|
for current_file in filesystem.get_all_files(source, media_type.get_valid_extensions()):
|
||||||
media = media_type(current_file)
|
media = media_type(current_file)
|
||||||
|
|
||||||
|
@ -55,23 +54,16 @@ def main(argv):
|
||||||
filesystem.set_date_from_path_video(media)
|
filesystem.set_date_from_path_video(media)
|
||||||
|
|
||||||
dest_path = filesystem.process_file(current_file, destination, media, allowDuplicate=False, move=False)
|
dest_path = filesystem.process_file(current_file, destination, media, allowDuplicate=False, move=False)
|
||||||
print '%s -> %s' % (current_file, dest_path)
|
if(dest_path is not None):
|
||||||
# Write to the hash database every 10 iterations
|
print '%s -> %s' % (current_file, dest_path)
|
||||||
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()
|
|
||||||
elif(config['file'] is not None):
|
elif(config['file'] is not None):
|
||||||
media = media_type(config['file'])
|
media = media_type(config['file'])
|
||||||
if(media_type.__name__ == 'Video'):
|
if(media_type.__name__ == 'Video'):
|
||||||
filesystem.set_date_from_path_video(media)
|
filesystem.set_date_from_path_video(media)
|
||||||
|
|
||||||
dest_path = filesystem.process_file(config['file'], destination, media, allowDuplicate=False, move=False)
|
dest_path = filesystem.process_file(config['file'], destination, media, allowDuplicate=False, move=False)
|
||||||
print '%s -> %s' % (current_file, dest_path)
|
if(dest_path is not None):
|
||||||
db.update_hash_db()
|
print '%s -> %s' % (current_file, dest_path)
|
||||||
else:
|
else:
|
||||||
help()
|
help()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue