def __init__(self): "Class constructor." config = DriveConfig() pidfile = config.getPidFile() loglevel = config.getLogLevel() logfile = config.getLogFile() super(DriveDaemon, self).__init__(pidfile, loglevel, logfile)
def md5(argv): """Print the MD5 checksums of the local and remote copies of the specified remote file path. gdrive md5 <path> prints the local and remote MD5 checksums of the specified path. """ path = None if len(argv) == 0: return usage() else: path = argv[0] config = DriveConfig() rhash = session.getRemoteFileChecksum(path) lpath = config.getLocalPath(path) lhash = session.getLocalFileChecksum(lpath) print "Local: path=%s md5=%s Remote: path=%s md5=%s" % (lpath, lhash, path, rhash)
def __init__(self, verbose=False, debug=False, logger=None): "Class constructor." self._debug = debug self._verbose = verbose self._config = DriveConfig(verbose, debug, logger) self._token = None ## OAuth 2,0 token object. self._client = None ## Google Docs API client object. self._metadata = {} ## Metadata dict. self._metadata[ "changestamp"] = 0 ## Stores the last changestamp, if any. self._metadata["map"] = {} self._metadata["map"]["bypath"] = DirectoryTree( ) ## Maps paths to resource IDs. self._metadata["map"]["byid"] = {} ## Maps resource IDs to paths. self._folder_count = 0 self._file_count = 0 self._bar = None self._authorise() if self._token == None: # TODO: throw exception. sys.exit("Error: failed to authorise with service!") self._setup() if self._client == None: # TODO: throw exception. sys.exit("Error: failed to create Docs client!") # Load cached metadata, if any. loaded = self._load() if not loaded: # Initialise metadata. self._walk() # Save metadata to cache. self._save() # Ensure local storage tree is available. self._config.checkLocalRoot()