CC-2612 : Upgrade: Push DB metadata into the file before upgrade

This commit is contained in:
Naomi Aro 2011-08-01 12:22:20 +02:00
parent 03dc7d7bfa
commit d606b4b173
4 changed files with 48 additions and 7 deletions

View file

@ -46,12 +46,17 @@ except Exception, e:
mmc.set_needed_file_permissions(stor_dir, True)
mmc.set_needed_file_permissions(organize_dir, True)
#read list of all files in stor location.....and one-by-one pass this through to
#mmc.organize_files. print out json encoding of before and after
pairs = []
f = open('storDump.txt','r')
for line in f.readlines():
db_md = line.split("SF_BACKUP_1.9.0")
logger.debug(db_md)
file_md = {}
file_md['MDATA_KEY_FILEPATH'] = db_md[1]
old_filepath = db_md[1]
file_md["MDATA_KEY_FILEPATH"] = old_filepath
#file is recorded
#format 1 title year month day hour min
@ -63,7 +68,13 @@ for line in f.readlines():
if match:
file_md["MDATA_KEY_TITLE"] = match.group(0)
file_md["MDATA_KEY_TITLE"] = db_md[6]+"-"+db_md[7]+"-00-"+file_md["MDATA_KEY_TITLE"]
file_md["MDATA_KEY_YEAR"] = db_md[3]+"-"+db_md[4]+"-"+db_md[5]
file_md["MDATA_KEY_CREATOR"] = "Airtime Show Recorder".encode('utf-8')
#mmc.md_manager.save_md_to_file(file_md)
#file is regular audio file
#format 0 title artist album track
else:
@ -80,11 +91,15 @@ for line in f.readlines():
mmc.md_manager.save_md_to_file(file_md)
#new_filepath = mmc.organize_new_file(old_filepath)
#if new_filepath is not None:
#pair = old_filepath, new_filepath
#pairs.append(pair)
#mmc.set_needed_file_permissions(new_filepath, False)
f.close()
#read list of all files in stor location.....and one-by-one pass this through to
#mmc.organize_files. print out json encoding of before and after
pairs = []
for root, dirs, files in os.walk(mmconfig.storage_directory):
for f in files:
old_filepath = os.path.join(root, f)