diff --git a/common.py b/common.py index e6b819b..a4a6ed0 100644 --- a/common.py +++ b/common.py @@ -11,11 +11,15 @@ import uuid CAMERA_CONFIG = { + 'default': {'desc_file': os.path.join('dlna_web_root', + 'samsungautobackupdesc.ini')}, + 'SAMSUNG DV300': {'desc_file': os.path.join('DLNA_WEB_ROOT', + 'SAMSUNGAutoBackupDESC.ini')}, 'SAMSUNG WB150': {'desc_file': os.path.join('DLNA_WEB_ROOT', 'SAMSUNGAUTOBACKUPDESC.INI')}, 'SAMSUNG NX1000': {'desc_file': os.path.join('dlna_web_root', 'SAMSUNGAutoBackupDESC.ini')}} -CONFIG_FILE = os.path.expanduser("~/pc_autobackup.cfg") +CONFIG_FILE = os.path.expanduser("~/.pc_autobackup.cfg") CAMERA_INFO_FILE = [os.path.join('system', 'device.xml'), os.path.join('SYSTEM', 'DEVICE.XML'), os.path.join('SYSTEM', 'Device.xml')] diff --git a/pc_autobackup.py b/pc_autobackup.py index 504a1bd..2728239 100755 --- a/pc_autobackup.py +++ b/pc_autobackup.py @@ -37,12 +37,9 @@ device_xml = f.read() m = common.CAMERA_MODEL.search(device_xml) if m: - camera_config = common.CAMERA_CONFIG.get(m.group(1)) - if camera_config: - return camera_config - else: - logger.error('Unsupported camera: %s', m.group(1)) - sys.exit(1) + camera_config = common.CAMERA_CONFIG.get( + m.group(1), common.CAMERA_CONFIG['default']) + return camera_config logger.error('Unable to determine camera model') sys.exit(1) @@ -162,7 +159,7 @@ help='output directory for files', metavar='DIR') parser.add_option('-q', '--quiet', dest='quiet', action='store_true', default=False, help='only log errors to console') - parser.add_option('--update_camera', dest='update_camera', + parser.add_option('--update_camera_config', dest='update_camera_config', help='update camera with this servers configuration', metavar='MOUNTPOINT') (options, args) = parser.parse_args() @@ -213,8 +210,8 @@ ImportCameraConfig(options.import_camera_config) sys.exit(0) - if options.update_camera: - UpdateCameraConfig(options.update_camera) + if options.update_camera_config: + UpdateCameraConfig(options.update_camera_config) sys.exit(0) logger = logging.getLogger('PCAutoBackup')