diff --git a/README.md b/README.md index 2d9677c..c3abe90 100644 --- a/README.md +++ b/README.md @@ -26,16 +26,22 @@ Arch: pacman -S feh ``` + + **foo-Wallpaper-feh-gif** is just bash script, you can download it [here](https://github.com/thomas10-10/foo-Wallpaper-Feh-Gif/blob/master/back4.sh) ``` curl -L https://raw.githubusercontent.com/thomas10-10/foo-Wallpaper-Feh-Gif/master/install.sh | bash ``` + + Install apscheduler ``` pip install apscheduler ``` + + Then download WallPyPer and make main.py an run file. ``` git clone https://github.com/KarimullinArthur/WallPyPer.git @@ -55,9 +61,38 @@ ln -s /main.py wallpyper The absolute path you cat get via command *pwd* +## Configuration + +Create conifg in *~/.config/wallpyper/config* +and put this: +``` +{ + "path_to_wallpapers":"your_path", + "second":"*", + "minute":"*/1", + "hour":"*" +} +``` + +Where *path_to_wallpapers* is *absolute* path to wallpapers. +*second*, *minute* and *hour* set auto change via cron. + + +[More infarmation about cron](https://en.wikipedia.org/wiki/Cron) + +[crontab.guru](https://crontab.guru) + ## Auto Start For **i3wm** add in your ~/.conifg/i3/config one string: ``` exec wallpyper ``` + +Author - Karimullin Arthur +<<<<<<< HEAD + Mail - KarimullinArthur@riseup.net +======= + +Mail - KarimullinArthur@riseup.net +>>>>>>> ab56d78a72b6396219c6b4014216fc6001b0c265 diff --git a/docs/README_ru.md b/docs/README_ru.md index da284a9..bfcb51e 100644 --- a/docs/README_ru.md +++ b/docs/README_ru.md @@ -47,6 +47,24 @@ ln -s <абсолютный_путь_к_скачанному_репозитор Абсолютный путь можно получить командной pwd в катологе WallPyPery. +## Настройка + +Создайте конфигурационный факл в ~/.config/wallpyper/config +И запиши туда этот конфиг: +``` +{ + "path_to_wallpapers":"your_path", + "second":"*", + "minute":"*/1", + "hour":"*" +} +``` +Где *path_to_wallpapers* это *абсолютный* путь к твоим обоям. +*second*, *minute* и *hour* устанавливают интервал изменения с помощью крона. + +(Больше информации о Cron)[https://ru.wikipedia.org/wiki/Cron] +(crontab.guru)[https://crontab.guru] + ## Автозагрузка Для **i3wm** добавте в свой ~/.config/i3/config строчку: diff --git a/func.py b/func.py index 908eb29..2dcf174 100644 --- a/func.py +++ b/func.py @@ -1,14 +1,7 @@ +import json import os import random import sys -home = os.path.expanduser('~') -sys.path.insert(0, home+"/.config") -#sys.path.insert(0, '.config/wallpyper') -from wallpyper import config - - -PATH = config.path_to_wallpapers -files = os.listdir(PATH) def run(command,output=False): devNull = ">/dev/null" @@ -26,7 +19,17 @@ def kill(): for pid in file: run(f'kill {pid}') +def configParsing(): + pathToConfig = os.path.expanduser('~')+'/.config/wallpyper/config' + with open(pathToConfig) as file: + contentFile = file.read() + config = json.loads(contentFile) + return config + def setWallPaper(): + PATH = configParsing()['path_to_wallpapers'] + files = os.listdir(PATH) + media = random.choices(files)[0] if media[-4:] != '.gif': diff --git a/main.py b/main.py index 0446342..b71e19e 100755 --- a/main.py +++ b/main.py @@ -15,5 +15,10 @@ if __name__ == '__main__': start() sched = BlockingScheduler() - sched.add_job(start,'interval',minutes=1) - sched.start() + + sched.add_job(start,'cron',\ + second=configParsing()['second'],\ + minute=configParsing()['minute'],\ + hour=configParsing()['hour']) + + sched.start()