示例#1
0
    def store(self):
        c.log('debug', 'Store data')

        Users.store()
        Dialogs.store()
        Chats.store()
        Media.store()

        with open(os.path.join(self.path, 'backup.id'), 'w') as outfile:
            outfile.write(str(Api.getUserId()))
示例#2
0
    def store(self):
        c.log('debug', 'Store data')

        Users.store()
        Dialogs.store()
        Chats.store()
        Media.store()

        with open(os.path.join(self.path, 'backup.id'), 'w') as outfile:
            outfile.write(str(Api.getUserId()))
示例#3
0
    def process(self):
        c.log('debug', 'Start processing')

        try:
            Users.requestUsers([Api.getUserId()])

            # Get friends of user & load them
            Users.requestUsers(Users.requestFriends(Api.getUserId()))

            # Get user photos
            Users.requestUserPhotos(Api.getUserId())

            # Get user blog
            Users.requestBlog(Api.getUserId())

            # Get dialogs info
            Dialogs.requestDialogs()

            # Store data
            backup.store()
        except (Exception, KeyboardInterrupt) as e:
            Media.stopDownloads()
            c.log('error', 'Exception: %s' % str(e))
示例#4
0
    def process(self):
        c.log('debug', 'Start processing')

        try:
            Users.requestUsers([Api.getUserId()])

            # Get friends of user & load them
            Users.requestUsers(Users.requestFriends(Api.getUserId()))

            # Get user photos
            Users.requestUserPhotos(Api.getUserId())

            # Get user blog
            Users.requestBlog(Api.getUserId())

            # Get dialogs info
            Dialogs.requestDialogs()

            # Store data
            backup.store()
        except (Exception, KeyboardInterrupt) as e:
            Media.stopDownloads()
            c.log('error', 'Exception: %s' % str(e))
示例#5
0
    def __init__(self):
        c.log('debug', 'Init Backup')

        self.path = c.cfg('backup-dir')
示例#6
0
            # Get friends of user & load them
            Users.requestUsers(Users.requestFriends(Api.getUserId()))

            # Get user photos
            Users.requestUserPhotos(Api.getUserId())

            # Get user blog
            Users.requestBlog(Api.getUserId())

            # Get dialogs info
            Dialogs.requestDialogs()

            # Store data
            backup.store()
        except (Exception, KeyboardInterrupt) as e:
            Media.stopDownloads()
            c.log('error', 'Exception: %s' % str(e))


from lib import Api

from lib.Users import S as Users
from lib.Dialogs import S as Dialogs
from lib.Chats import S as Chats
from lib.Media import S as Media

backup = Backup()
backup.process()

c.log('info', 'DONE')
示例#7
0
         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')
示例#8
0
    def __init__(self):
        c.log('debug', 'Init Backup')

        self.path = c.cfg('backup-dir')
示例#9
0
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')
示例#10
0
            # Get friends of user & load them
            Users.requestUsers(Users.requestFriends(Api.getUserId()))

            # Get user photos
            Users.requestUserPhotos(Api.getUserId())

            # Get user blog
            Users.requestBlog(Api.getUserId())

            # Get dialogs info
            Dialogs.requestDialogs()

            # Store data
            backup.store()
        except (Exception, KeyboardInterrupt) as e:
            Media.stopDownloads()
            c.log('error', 'Exception: %s' % str(e))

from lib import Api

from lib.Users import S as Users
from lib.Dialogs import S as Dialogs
from lib.Chats import S as Chats
from lib.Media import S as Media

backup = Backup()
backup.process()

c.log('info', 'DONE')