CC-2279: Upgrade script for converting stor directory to new format
-even more fixes..
This commit is contained in:
parent
d52857ea8b
commit
07b1686643
|
@ -421,7 +421,7 @@ mkdir("/var/log/airtime/media-monitor/", 755, true);
|
||||||
touch("/var/log/airtime/media-monitor/media-monitor.log");
|
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("sudo python $mediaMonitorUpgradePath", $output);
|
exec("su -c \"python $mediaMonitorUpgradePath\"", $output);
|
||||||
|
|
||||||
print_r($output);
|
print_r($output);
|
||||||
|
|
||||||
|
@ -430,9 +430,9 @@ $oldAndNewFileNames = json_decode($output[0]);
|
||||||
print_r($oldAndNewFileNames);
|
print_r($oldAndNewFileNames);
|
||||||
|
|
||||||
foreach ($oldAndNewFileNames as $pair){
|
foreach ($oldAndNewFileNames as $pair){
|
||||||
$relPathNew = substr($pair[1], 0, strlen($stor_dir));
|
$relPathNew = substr($pair[1], strlen($stor_dir));
|
||||||
$absPathOld = $pair[0];
|
$absPathOld = $pair[0];
|
||||||
$sql = "UPDATE cc_music_dirs SET filepath = \"$relPathNew\", directory=1 WHERE filepath = \"$absPathOld\"";
|
$sql = "UPDATE cc_files SET filepath = \"$relPathNew\", directory=1 WHERE filepath = \"$absPathOld\"";
|
||||||
echo $sql.PHP_EOL;
|
echo $sql.PHP_EOL;
|
||||||
execSqlQuery($sql);
|
execSqlQuery($sql);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ mmconfig = AirtimeMediaConfig(logger)
|
||||||
#get stor folder location from /etc/airtime/airtime.conf
|
#get stor folder location from /etc/airtime/airtime.conf
|
||||||
config = ConfigParser.RawConfigParser()
|
config = ConfigParser.RawConfigParser()
|
||||||
config.read('/etc/airtime/airtime.conf')
|
config.read('/etc/airtime/airtime.conf')
|
||||||
stor_dir = config.get('general', 'base_files_dir')
|
stor_dir = config.get('general', 'base_files_dir') + "/stor"
|
||||||
|
|
||||||
mmconfig.storage_directory = os.path.normpath(stor_dir)
|
mmconfig.storage_directory = os.path.normpath(stor_dir)
|
||||||
mmconfig.imported_directory = os.path.normpath(stor_dir + '/imported')
|
mmconfig.imported_directory = os.path.normpath(stor_dir + '/imported')
|
||||||
|
@ -34,7 +34,7 @@ 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 = []
|
||||||
for root, dirs, files in os.walk(stor_dir):
|
for root, dirs, files in os.walk(mmconfig.storage_directory):
|
||||||
for f in files:
|
for f in files:
|
||||||
#print os.path.join(root, f)
|
#print os.path.join(root, f)
|
||||||
#print mmc.organize_new_file(os.path.join(root, f))
|
#print mmc.organize_new_file(os.path.join(root, f))
|
||||||
|
|
Loading…
Reference in New Issue