add auto cheng in interval via apscheduler
This commit is contained in:
parent
e68aecde6c
commit
0823c0638e
@ -1,6 +1,8 @@
|
|||||||
# WallPyper
|
# WallPyper
|
||||||
|
|
||||||
WallPyper - is small utility, work via
|
WallPyPer - is small utility, work via
|
||||||
[foo-Wallpaper-Feh-Gif ](https://github.com/thomas10-10/foo-Wallpaper-Feh-Gif) and [feh](https://github.com/derf/feh).
|
[foo-Wallpaper-Feh-Gif ](https://github.com/thomas10-10/foo-Wallpaper-Feh-Gif) and [feh](https://github.com/derf/feh).
|
||||||
|
|
||||||
<img src="./docs/media/demo.gif" />
|
<img src="./docs/media/demo.gif" />
|
||||||
|
|
||||||
|
WallPyPer can work with images and gifs.
|
||||||
|
7
func.py
7
func.py
@ -1,12 +1,11 @@
|
|||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
|
||||||
PATH = '/home/arthur/img/Wallpapers/media/'# path to media
|
from apscheduler.schedulers.background import BlockingScheduler
|
||||||
|
|
||||||
|
PATH = '/home/arthur/img/Wallpapers/test/'# path to media
|
||||||
files = os.listdir(PATH)
|
files = os.listdir(PATH)
|
||||||
|
|
||||||
media = random.choices(files)[0]
|
|
||||||
|
|
||||||
def run(command,output=False):
|
def run(command,output=False):
|
||||||
devNull = ">/dev/null"
|
devNull = ">/dev/null"
|
||||||
if output == True:
|
if output == True:
|
||||||
@ -20,6 +19,8 @@ def kill():
|
|||||||
run(f'kill {pid}')
|
run(f'kill {pid}')
|
||||||
|
|
||||||
def setWallPeper():
|
def setWallPeper():
|
||||||
|
media = random.choices(files)[0]
|
||||||
|
|
||||||
if media[-4:] != '.gif':
|
if media[-4:] != '.gif':
|
||||||
run(f"feh --bg-scale {PATH}{media}")
|
run(f"feh --bg-scale {PATH}{media}")
|
||||||
else:
|
else:
|
||||||
|
7
main.py
7
main.py
@ -6,8 +6,11 @@ def start():
|
|||||||
try:
|
try:
|
||||||
kill()
|
kill()
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
setWallPeper()
|
setWallPeper()
|
||||||
|
|
||||||
setWallPeper()
|
setWallPeper()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
start()
|
sched = BlockingScheduler()
|
||||||
|
sched.add_job(start,'interval',minutes=1)
|
||||||
|
sched.start()
|
||||||
|
Loading…
Reference in New Issue
Block a user