cc-4227
Added comments. Removed bad/old upgrade code.
This commit is contained in:
parent
e46f0d2b4d
commit
48ae4a578f
3 changed files with 2 additions and 7 deletions
|
@ -2,7 +2,6 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
from configobj import ConfigObj
|
from configobj import ConfigObj
|
||||||
import upgrade2dot2
|
|
||||||
|
|
||||||
def get_current_script_dir():
|
def get_current_script_dir():
|
||||||
return os.path.dirname(os.path.realpath(__file__))
|
return os.path.dirname(os.path.realpath(__file__))
|
||||||
|
@ -21,8 +20,6 @@ current_script_dir = get_current_script_dir()
|
||||||
if not os.path.exists(PATH_INI_FILE):
|
if not os.path.exists(PATH_INI_FILE):
|
||||||
shutil.copy('%s/../api_client.cfg'%current_script_dir, PATH_INI_FILE)
|
shutil.copy('%s/../api_client.cfg'%current_script_dir, PATH_INI_FILE)
|
||||||
|
|
||||||
upgrade2dot2.upgrade('%s/../api_client.cfg'% current_script_dir, PATH_INI_FILE)
|
|
||||||
|
|
||||||
"""load config file"""
|
"""load config file"""
|
||||||
try:
|
try:
|
||||||
config = ConfigObj("%s/../api_client.cfg" % current_script_dir)
|
config = ConfigObj("%s/../api_client.cfg" % current_script_dir)
|
||||||
|
|
|
@ -4,7 +4,6 @@ import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
import upgrade2dot2
|
|
||||||
from configobj import ConfigObj
|
from configobj import ConfigObj
|
||||||
|
|
||||||
if os.geteuid() != 0:
|
if os.geteuid() != 0:
|
||||||
|
@ -63,9 +62,6 @@ try:
|
||||||
mm2_source = os.path.realpath(os.path.join(current_script_dir,
|
mm2_source = os.path.realpath(os.path.join(current_script_dir,
|
||||||
"../../media-monitor2"))
|
"../../media-monitor2"))
|
||||||
copy_dir(mm2_source, os.path.join( config["bin_dir"], "mm2" ))
|
copy_dir(mm2_source, os.path.join( config["bin_dir"], "mm2" ))
|
||||||
# upgrade mm2 config
|
|
||||||
upgrade2dot2.upgrade(('%s/../media-monitor.cfg'%current_script_dir),
|
|
||||||
PATH_INI_FILE)
|
|
||||||
|
|
||||||
#copy init.d script
|
#copy init.d script
|
||||||
shutil.copy(config["bin_dir"]+"/airtime-media-monitor-init-d", "/etc/init.d/airtime-media-monitor")
|
shutil.copy(config["bin_dir"]+"/airtime-media-monitor-init-d", "/etc/init.d/airtime-media-monitor")
|
||||||
|
|
|
@ -273,6 +273,8 @@ def organized_path(old_path, root_path, orig_md):
|
||||||
def default_f(dictionary, key):
|
def default_f(dictionary, key):
|
||||||
if key in dictionary: return len(dictionary[key]) == 0
|
if key in dictionary: return len(dictionary[key]) == 0
|
||||||
else: return True
|
else: return True
|
||||||
|
# We set some metadata elements to a default "unknown" value because we use
|
||||||
|
# these fields to create a path hence they cannot be empty
|
||||||
normal_md = default_to_f(orig_md, path_md, unicode_unknown, default_f)
|
normal_md = default_to_f(orig_md, path_md, unicode_unknown, default_f)
|
||||||
if is_airtime_recorded(normal_md):
|
if is_airtime_recorded(normal_md):
|
||||||
fname = u'%s-%s-%s.%s' % ( normal_md['MDATA_KEY_YEAR'],
|
fname = u'%s-%s-%s.%s' % ( normal_md['MDATA_KEY_YEAR'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue