system_config, system_status, user_config, dropbox_images ) from general.data.sql_types import JobEnum from general.utils.path import data_uri from general.io import lazy_files from general.utils.base_daemon import BaseDaemon from general.utils.loggers import get_logger from general.utils.dropbox_data import compare_images_to_sync from general.utils.network import get_lan_ip from general.models.dropbox_external import DropboxAPIFacade logger = get_logger("service_daemon") def test_internet_connection(): """Checks whether the is a network and internet connection.""" logger.info("<< Testing internet connection") if get_lan_ip() == None: logger.warning(" + No network connection") logger.warning(" + No internet connection") system_status.set_network_connection(False) system_status.set_internet_connection(False) logger.info(">> Testing internet connection complete") return time.time()
from general.utils.loggers import get_logger logger = get_logger("content_display") import os, sys, pygame from pygame.locals import * def set_driver(): """Sets video driver to use directly in framebuffer. This function is used when you are going to use video functionality with pygame but without using X/Wayland. This function should be ran before initializing pygame. """ logger.info("Setting display to use framebuffer") display_number = os.getenv("DISPLAY") if display_number: logger.info("X found: %r" % display_number) drivers = ["fbcon", "directfb", "svgalib"] found = False for driver in drivers: if not os.getenv("SDL_VIDEODRIVER"): os.putenv("SDL_VIDEODRIVER", driver) try: pygame.display.init()
from config_server.models import ( system_status, user_account, user_config ) from flask import ( render_template, redirect, request, url_for, flash ) logger = get_logger("config_server") def page(): """Creates a page where users can connect to dropbox or manually sync against dropbox.""" auth_callback_url = url_for("dropbox_authorize_page", _external = True) data = { "current_page" : "dropbox_page", "status" : gsystem_status.retrieve_status(), "dropbox_auth_url" : static_facade.get_authorize_url(auth_callback_url), "logged_in" : user_account.is_logged_in(), "user_name" : user_account.current_user_name() } return render_template("dropbox.html", **data)