def __init__(self): c.log('debug', 'Init Backup') self.path = c.cfg('backup-dir')
dest='backup-dir', metavar='PATH', default='backup', help='directory to store data [%default]') c.option( '--download-threads', type='int', dest='download-threads', metavar='NUM', default=16, help= 'number of simultaneous media downloads, 0 - disables download at all [%default]' ) c.init_end() if c.cfg('user') == None: parser.error('Unable to get email from the user option') if c.cfg('password') == None: c.cfg('password', getpass.getpass()) if c.cfg('download-threads') < 0: parser.error('Number of download threads can\'t be lower then zero') class Backup: def __init__(self): c.log('debug', 'Init Backup') self.path = c.cfg('backup-dir')
''' from lib import Common as c from lib import vk_auth import getpass, os from sys import exit c.init_begin(__doc__) c.option('-u', '--user', type='string', dest='user', metavar='EMAIL', default=None, help='vk.com account user email (<user>@<host>) (required)') c.option('-p', '--password', type='string', dest='password', metavar='PASSWORD', default=None, help='vk.com account password (will be requested if not set)') c.option('-d', '--backup-dir', type='string', dest='backup-dir', metavar='PATH', default='backup', help='directory to store data [%default]') c.option('--download-threads', type='int', dest='download-threads', metavar='NUM', default=16, help='number of simultaneous media downloads, 0 - disables download at all [%default]') c.init_end() if c.cfg('user') == None: c.log('error', 'Unable to get email from the user option') exit(1) if c.cfg('password') == None: c.cfg('password', getpass.getpass()) if c.cfg('download-threads') < 0: c.log('error', 'Number of download threads can\'t be lower then zero') exit(1) class Backup: def __init__(self): c.log('debug', 'Init Backup') self.path = c.cfg('backup-dir')