CC-2279: Upgrade script for converting stor directory to new format

-further fixes..
This commit is contained in:
martin 2011-07-14 17:13:11 -04:00
parent 1aa1500d0c
commit d52857ea8b
2 changed files with 8 additions and 4 deletions

View File

@ -417,12 +417,15 @@ execSqlQuery($sql);
//old database had a "fullpath" column that stored the absolute path of each track. We have to //old database had a "fullpath" column that stored the absolute path of each track. We have to
//change it so that the "fullpath" column has path relative to the "directory" column. //change it so that the "fullpath" column has path relative to the "directory" column.
mkdir("/var/log/airtime/media-monitor/", 755, true);
touch("/var/log/airtime/media-monitor/media-monitor.log");
$mediaMonitorUpgradePath = realpath(__DIR__."/../../../python_apps/media-monitor/media-monitor-upgrade.py"); $mediaMonitorUpgradePath = realpath(__DIR__."/../../../python_apps/media-monitor/media-monitor-upgrade.py");
exec("python $mediaMonitorUpgradePath", $output); exec("sudo python $mediaMonitorUpgradePath", $output);
print_r($output); print_r($output);
$oldAndNewFileNames = json_decode($output); $oldAndNewFileNames = json_decode($output[0]);
print_r($oldAndNewFileNames); print_r($oldAndNewFileNames);

View File

@ -8,9 +8,11 @@ import os
import json import json
import ConfigParser import ConfigParser
import os.path
# configure logging # configure logging
try: try:
logging.config.fileConfig("logging.cfg") logging.config.fileConfig("%s/logging.cfg"%os.path.dirname(__file__))
except Exception, e: except Exception, e:
print 'Error configuring logging: ', e print 'Error configuring logging: ', e
sys.exit(1) sys.exit(1)
@ -32,7 +34,6 @@ mmc = MediaMonitorCommon(mmconfig)
#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 = []
print "walking through %s" % stor_dir
for root, dirs, files in os.walk(stor_dir): for root, dirs, files in os.walk(stor_dir):
for f in files: for f in files:
#print os.path.join(root, f) #print os.path.join(root, f)