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

saving md to files in stor before path creation.
This commit is contained in:
Naomi Aro 2011-07-29 16:38:57 +02:00
parent 6d8e7b5dca
commit a1158af93b
2 changed files with 24 additions and 1 deletions

View file

@ -593,7 +593,7 @@ class Airtime190Upgrade{
$dumpFile = __DIR__."/storDump.txt"; $dumpFile = __DIR__."/storDump.txt";
$fh = fopen($dumpFile, 'w') or die("can't open file to backup stor."); $fh = fopen($dumpFile, 'w') or die("can't open file to backup stor.");
$s = "SF_BACKUP"; $s = "SF_BACKUP_1.9.0";
foreach ($files as $file) { foreach ($files as $file) {

View file

@ -45,6 +45,29 @@ except Exception, e:
mmc.set_needed_file_permissions(stor_dir, True) mmc.set_needed_file_permissions(stor_dir, True)
mmc.set_needed_file_permissions(organize_dir, True) mmc.set_needed_file_permissions(organize_dir, True)
f = open('storDump.txt','r')
for line in f.readlines():
db_md = line.split("SF_BACKUP_1.9.0")
file_md = {}
file_md['MDATA_KEY_FILEPATH'] = db_md[1]
#file is recorded
#format 1 title year month day hour min
if db_md[0]:
file_md["MDATA_KEY_TITLE"] = db_md[2]
file_md["MDATA_KEY_YEAR"] = db_md[3]+"-"+db_md[4]+"-"+db_md[5]
#file is regular audio file
#format 0 title artist album track
else:
file_md["MDATA_KEY_TITLE"] = db_md[2]
file_md["MDATA_KEY_CREATOR"] = db_md[3]
file_md["MDATA_KEY_SOURCE"] = db_md[4]
file_md["MDATA_KEY_TRACKNUMBER"] = db_md[5]
mmc.md_manager.save_md_to_file()
f.close()
#read list of all files in stor location.....and one-by-one pass this through to #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 #mmc.organize_files. print out json encoding of before and after
pairs = [] pairs = []