diff --git a/pyproject.toml b/pyproject.toml index 2f4cdab..2500efa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,9 @@ dependencies = [ "IPTCInfo3", "numpy", "ninepatch@git+https://github.com/vindolin/ninepatch", - "pi_heif>=0.8.0" + "pi_heif>=0.8.0", + 'pysdl2-dll ; platform_system == "Windows"', + 'pygame ; platform_system == "Windows"' ] [project.urls] diff --git a/src/picframe/controller.py b/src/picframe/controller.py index 7ba1b34..beeab22 100644 --- a/src/picframe/controller.py +++ b/src/picframe/controller.py @@ -52,7 +52,7 @@ def __init__(self, model, viewer): self.__paused = False self.__force_navigate = False self.__next_tm = 0 - self.__date_from = make_date('1901/12/15') # TODO This seems to be the minimum date to be handled by date functions # noqa: E501 + self.__date_from = make_date('1970/1/2') # TODO This seems to be the minimum date to be handled by date functions # noqa: E501 self.__date_to = make_date('2038/1/1') self.__location_filter = "" self.__where_clauses = {} @@ -132,7 +132,7 @@ def date_from(self, val): try: self.__date_from = float(val) except ValueError: - self.__date_from = make_date(val if len(val) > 0 else '1901/12/15') + self.__date_from = make_date(val if len(val) > 0 else '1970/1/2') if len(val) > 0: self.__model.set_where_clause('date_from', "exif_datetime > {:.0f}".format(self.__date_from)) else: diff --git a/src/picframe/start.py b/src/start.py similarity index 95% rename from src/picframe/start.py rename to src/start.py index cf37fbe..e95741a 100644 --- a/src/picframe/start.py +++ b/src/start.py @@ -1,9 +1,10 @@ import logging import argparse +import ctypes import os import locale import sys -from distutils.dir_util import copy_tree +from shutil import copytree from picframe import model, viewer_display, controller, __version__ @@ -15,7 +16,7 @@ def copy_files(pkgdir, dest, target): fullpath = os.path.join(pkgdir, target) destination = os.path.join(dest, PICFRAME_DATA_DIR) destination = os.path.join(destination, target) - copy_tree(fullpath, destination) + copytree(fullpath, destination) except Exception: raise @@ -97,7 +98,11 @@ def main(): group.add_argument("configfile", nargs='?', help="/path/to/configuration.yaml") args = parser.parse_args() if args.initialize: - if os.geteuid() == 0: + try: + is_admin = os.getuid() == 0 + except AttributeError: + is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0 + if is_admin: print("Don't run the initialize step with sudo. It might put the files in the wrong place!") return pkgdir = sys.modules['picframe'].__path__[0]