diff --git a/import_media.py b/import_media.py index 80fbfbb..6fc0013 100644 --- a/import_media.py +++ b/import_media.py @@ -46,6 +46,11 @@ args = parser.parse_args() if args.event: event = args.event +def dump_yaml(dictionary, file): + """ dump a dictionary to a yaml file """ + with open(file, 'w') as f: + yaml.dump(dictionary, f) + def md5_hash(f): """ calculates and returns md5 hash """ #print("calculating md5 for ", f) @@ -273,7 +278,6 @@ def cleanup_sd(): if files[file]['source_cleanable'] is True: os.remove(os.path.join(files[file]['folders']['source_path'],files[file]['name'])) -#pprint(files) go = validate_config_dir_access() if go is True: find_files(config['folders']['source']['base']) @@ -284,4 +288,5 @@ if go is True: else: print("There was a problem accessing one or more directories defined in the configuration.") +dump_yaml(files, 'files_dict.yaml') print('done.')