Exemplo n.º 1
0
def sync_dropbox_images():
	"""Compares images on dropbox and locally to sync."""

	logger.info("<< Sync dropbox images")

	system_status.set_current_job(JobEnum.SYNC)

	facade = DropboxAPIFacade(True)

	if facade.is_authorized() is False:
		logger.warning(" + No dropbox account connected when syncing images")
		logger.info(">> Sync dropbox images aborted")
		system_status.set_current_job(JobEnum.IDLE)
		return time.time()

	external_images = facade.get_appfolder_imagedata()
	local_images = dropbox_images.get_all_images()

	logger.info(" + Images found in dropbox account %d" % len(external_images))
	logger.info(" + Images found locally %d" % len(local_images))

	sorted_images = compare_images_to_sync(external_images, local_images)
	download_dropbox_images(facade, sorted_images)

	system_status.set_current_job(JobEnum.IDLE)
	logger.info(">> Sync dropbox images complete")

	return time.time()
Exemplo n.º 2
0
def page():
	"""Creates a page with list of images."""

	data = {
		"current_page" : "images_page",
		"status" : system_status.retrieve_status(),
		"logged_in" : user_account.is_logged_in(),
		"user_name" : user_account.current_user_name(),
		"images" : dropbox_images.get_all_images()
	}

	return render_template("images.html", **data)
Exemplo n.º 3
0
    def refresh_data(self):
        """Retrieves new data from the system."""

        logger.info("<< Refreshing data")

        self.image_revision = 0
        self.local_images = dropbox_images.get_all_images()
        self.user_config = user_config.retrieve_config()
        self.current_ip = network.get_lan_ip()

        logger.info(" + Images found in database: %d" % len(self.local_images))
        logger.info(" + Wait until image switch: %ds" % self.user_config.image_switch_wait)
        logger.info(">> Refreshing data complete")

        self.refresh_time = time.time()