Exemple #1
0
	pickle.dump(state,fyle)
	fyle.close()
	
if __name__ == '__main__':	
	token_filename = 'dropbox_sync.token'
	app_key = 'xxxxxx'
	app_secret = 'xxxxxx'
	
	console.show_activity()
	
	print """
****************************************
*     Dropbox File Syncronization      *
****************************************"""
	
	_, client = dropboxsetup.init(token_filename, app_key, app_secret)
	print '\nLoading local state'
	# lets see if we can unpickle
	try:
		state = loadstate()
	except:
		print '\nCannot find state file. ***Making new local state***'
		# Aaaah, we have nothing, probably first run
		state = dropbox_state()
		
		print '\nDownloading everything from Dropbox'
		# no way to check what we have locally is newer, gratuitous dl
		state.download_all(client)
 
	print '\nUpdating state from Dropbox'
	state.execute_delta(client)
	fyle = open(STATE_FILE,'w')
	pickle.dump(state,fyle)
	fyle.close()
	
if __name__ == '__main__':
	
	print """
****************************************
*     Dropbox File Syncronization      *
****************************************"""
	
	print '\nLoading local state...'
	# lets see if we can unpickle
	try:
		state = loadstate(ROOT + '/' + STATEFILE)
		_, client = dropboxsetup.init(state.get_token_filename(), state.get_app_key(), state.get_app_secret())
		print '\tLoaded successfuly!'
	except:
		print '\tCannot find state file! ***Making new local state***'
		# Aaaah, we have nothing, probably first run
		state = dropbox_state()

		temp_input= ROOT + '/.dropboxToken'
		state.set_token_file_name(temp_input)
		temp_input=''
		state.set_app_key(temp_input)		
		temp_input=''
		state.set_app_secret(temp_input)
		
		_, client = dropboxsetup.init(state.get_token_file_name(), state.get_app_key(), state.get_app_secret())
	
Exemple #3
0

if __name__ == '__main__':
    token_filename = 'dropbox_sync.token'
    app_key = 'xxxxxx'
    app_secret = 'xxxxxx'

    console.show_activity()

    print("""
****************************************
*     Dropbox File Syncronization      *
****************************************""")
    console.set_idle_timer_disabled(True)

    _, client = dropboxsetup.init(token_filename, app_key, app_secret)
    print('\nLoading local state')
    # lets see if we can unpickle
    try:
        state = loadstate()
    except:
        print('\nCannot find state file. ***Making new local state***')
        # Aaaah, we have nothing, probably first run
        state = dropbox_state()

        print('\nDownloading everything from Dropbox')
        # no way to check what we have locally is newer, gratuitous dl
        state.download_all(client)

    print('\nUpdating state from Dropbox')
    state.execute_delta(client)
Exemple #4
0
	pickle.dump(state,fyle)
	fyle.close()
	
if __name__ == '__main__':
	console.show_activity()
	
	print """
****************************************
*     Dropbox File Syncronization      *
****************************************"""
	
	print '\nLoading local state'
	# lets see if we can unpickle
	try:
		state = loadstate()
		_, client = dropboxsetup.init(state.get_token_filename(), state.get_app_key(), state.get_app_secret())
	except:
		print '\nCannot find state file. ***Making new local state***\n'
		# Aaaah, we have nothing, probably first run
		state = dropbox_state()

		print("We need a few setup details.\n")
		print("What do you want to call the Dropbox token file?")
		temp_input=raw_input()
		state.set_token_file_name(temp_input)
		print("What's your Dropbox app key?")
		temp_input=raw_input()
		state.set_app_key(temp_input)		
		print("What's your Dropbox app secret?")
		temp_input=raw_input()
		state.set_app_secret(temp_input)