From a898f5edd185757262b8ff7265c488c0902ed0d6 Mon Sep 17 00:00:00 2001 From: Arthur Date: Sun, 3 Jul 2022 17:46:29 +0500 Subject: [PATCH] =?UTF-8?q?=D0=BE=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 - func.py | 19 ++++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index fb53bea..7653ae1 100644 --- a/README.md +++ b/README.md @@ -90,5 +90,4 @@ exec wallpyper ``` Author - Karimullin Arthur - Mail - KarimullinArthur@riseup.net diff --git a/func.py b/func.py index dc0552e..2dcf174 100644 --- a/func.py +++ b/func.py @@ -21,20 +21,15 @@ def kill(): def configParsing(): pathToConfig = os.path.expanduser('~')+'/.config/wallpyper/config' - try: - with open(pathToConfig) as file: - contentFile = file.read() - config = json.loads(contentFile) - return config - except FileNotFoundError: - createConfig() + with open(pathToConfig) as file: + contentFile = file.read() + config = json.loads(contentFile) + return config def setWallPaper(): - config = configParsing() - - PATH = configParsing['path_to_wallpapers'] + PATH = configParsing()['path_to_wallpapers'] files = os.listdir(PATH) - + media = random.choices(files)[0] if media[-4:] != '.gif': @@ -42,5 +37,3 @@ def setWallPaper(): else: run(f"back4.sh auto {PATH}{media} & echo $! > /tmp/back4.sh.pid",True) # > tmp/back4.sh.pid write PID for kill() - -setWallPaper()