garminexport/garminbackup.py

30 lines
1.1 KiB
Python
Raw Normal View History

2014-11-11 13:45:11 +01:00
#! /usr/bin/env python
"""This python script calls garminexport.garminbackup module with CLI parsed arguments
and performs (incremental) backups of activities for a given Garmin Connect account.
2014-11-11 13:45:11 +01:00
The activities are stored in a local directory on the user's computer.
The backups are incremental, meaning that only activities that aren't already
stored in the backup directory will be downloaded.
"""
import logging
from garminexport.cli import parse_args
from garminexport.incremental_backup import incremental_backup
from garminexport.logging_config import LOG_LEVELS
logging.basicConfig(level=logging.INFO, format="%(asctime)-15s [%(levelname)s] %(message)s")
log = logging.getLogger(__name__)
2014-11-11 13:45:11 +01:00
if __name__ == "__main__":
args = parse_args()
2014-11-11 13:45:11 +01:00
logging.root.setLevel(LOG_LEVELS[args.log_level])
2014-11-11 13:45:11 +01:00
try:
incremental_backup(username=args.username,
password=args.password,
backup_dir=args.backup_dir,
format=args.format,
max_retries=args.max_retries)
2014-11-11 13:45:11 +01:00
except Exception as e:
log.error(u"failed with exception: %s", str(e))