Beispiel #1
0
def load_user_config():
    global personal_client, business_client, user_conf
    global account_store, drive_store
    user_conf = get_current_user_config()
    user_conf.take_effect()
    network_monitor.start()
    personal_client = clients.PersonalClient(proxies=user_conf.proxies, net_monitor=network_monitor)
    business_client = None
    account_store = account_db.AccountStorage(CONFIG_DIR + '/accounts.db',
                                              personal_client=personal_client, business_client=business_client)
    drive_store = drives_db.DriveStorage(CONFIG_DIR + '/drives.db', account_store)
    account_store.get_all_accounts()
Beispiel #2
0
def load_user_config():
    global personal_client, business_client, user_conf
    global account_store, drive_store
    user_conf = get_current_user_config()
    user_conf.take_effect()
    network_monitor.start()
    personal_client = clients.PersonalClient(proxies=user_conf.proxies,
                                             net_monitor=network_monitor)
    business_client = None
    account_store = account_db.AccountStorage(CONFIG_DIR + '/accounts.db',
                                              personal_client=personal_client,
                                              business_client=business_client)
    drive_store = drives_db.DriveStorage(CONFIG_DIR + '/drives.db',
                                         account_store)
    account_store.get_all_accounts()
Beispiel #3
0
from onedrived import OS_USER_NAME, OS_USER_HOME, mkdir, get_content
from onedrived.api import accounts, clients
from onedrived.cli import CONFIG_DIR, get_current_user_config
from onedrived.common import drive_config, netman
from onedrived.store import account_db, drives_db
from onedrived.vendor.utils import pretty_print_bytes

try:
    if not os.path.exists(CONFIG_DIR):
        mkdir(CONFIG_DIR)
        default_ignore_list_data = get_content("default_ignore_list.txt", is_text=True)
        with open(CONFIG_DIR + "/odignore.txt", "w") as f:
            f.write(default_ignore_list_data)
        print(colored.green('Created path "' + CONFIG_DIR + '".'))
    user_conf = get_current_user_config()
    network_monitor = netman.NetworkMonitor()
    personal_client = clients.PersonalClient(proxies=user_conf.proxies, net_monitor=network_monitor)
    business_client = None
    account_store = account_db.AccountStorage(
        CONFIG_DIR + "/accounts.db", personal_client=personal_client, business_client=business_client
    )
    drive_store = drives_db.DriveStorage(CONFIG_DIR + "/drives.db", account_store)
except Exception as e:
    print(colored.red("Fatal error: " + str(e)))
    sys.exit(1)


def add_personal_account():
    puts(colored.green("Link with an OneDrive Personal account:"))
    puts(
Beispiel #4
0
from onedrived import OS_USER_NAME, OS_USER_HOME, mkdir, get_content
from onedrived.api import accounts, clients
from onedrived.cli import CONFIG_DIR, get_current_user_config
from onedrived.common import drive_config, netman
from onedrived.store import account_db, drives_db
from onedrived.vendor.utils import pretty_print_bytes

try:
    if not os.path.exists(CONFIG_DIR):
        mkdir(CONFIG_DIR)
        default_ignore_list_data = get_content('default_ignore_list.txt', is_text=True)
        with open(CONFIG_DIR + '/odignore.txt', 'w') as f:
            f.write(default_ignore_list_data)
        print(colored.green('Created path "' + CONFIG_DIR + '".'))
    user_conf = get_current_user_config()
    network_monitor = netman.NetworkMonitor()
    personal_client = clients.PersonalClient(proxies=user_conf.proxies, net_monitor=network_monitor)
    business_client = None
    account_store = account_db.AccountStorage(
            CONFIG_DIR + '/accounts.db', personal_client=personal_client, business_client=business_client)
    drive_store = drives_db.DriveStorage(CONFIG_DIR + '/drives.db', account_store)
except Exception as e:
    print(colored.red('Fatal error: ' + str(e)))
    sys.exit(1)


def add_personal_account():
    puts(colored.green('Link with an OneDrive Personal account:'))
    puts(colored.cyan(
            'Please use your browser to visit the following URL, sign in with your OneDrive account and '