Skip to content

Commit 5ef0ac0

Browse files
implemented scheduler
1 parent 68e2fb1 commit 5ef0ac0

File tree

5 files changed

+48
-25
lines changed

5 files changed

+48
-25
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
/__pycache__
1+
*__pycache__
2+
*venuspy.egg-info
3+

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,19 @@ Here is an example:
7777
```
7878
OUTPUT_PATH = /home/user/Pictures
7979
```
80+
81+
Venus has the option of using a timer to change your wallpaper given an interval in seconds.
82+
83+
Here is an example that changes the wallpaper every 60 seconds (1 minute):
84+
85+
```
86+
WAIT_TIME = 60
87+
```
88+
8089
8190

8291

83-
Current Verion 0.1.4 - verified working on
92+
Current Verion 0.1.6 - verified working on
8493
-----------------
8594
- [x] Arch Linux [Feh 2.28]
8695
- [x] Ubuntu 18.04.1 LTS [Gnome 3.28]

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818

1919
setup(
2020
name='venuspy',
21-
version='0.1.5',
21+
version='0.1.6',
2222
author="Alfredo Sequeida",
2323
description='A cross platform tool for setting a random wallpaper image from unsplash.com',
2424
long_description=long_description,
2525
long_description_content_type="text/markdown",
2626
url='https://github.com/AlfredoSequeida/venus',
27-
download_url='https://github.com/AlfredoSequeida/venus/archive/0.1.5.tar.gz',
27+
download_url='https://github.com/AlfredoSequeida/venus/archive/0.1.6.tar.gz',
2828
keywords ='wallpaper unsplash randomwallpaper',
2929
platforms ='any',
3030
classifiers=[

venus/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22

3-
__version__ = "0.1.5"
3+
__version__ = "0.1.6"
44

55
dir_path_to_conf = os.path.join(os.path.expanduser('~'), '.config/venus')
66

@@ -12,6 +12,7 @@
1212
text = """[SETTINGS]
1313
SEARCH_TERMS =
1414
OUTPUT_PATH =
15+
WAIT_TIME =
1516
"""
1617

1718
if not os.path.exists(dir_path_to_conf):

venus/venus.py

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import tempfile
44
import os
55
import configparser
6+
import time
67

78
def get_wall(resolution="1920x1080", search_term=None, output_path=None):
89
"""
@@ -49,37 +50,47 @@ def main():
4950
try:
5051
search_term_config = config['SETTINGS']['SEARCH_TERMS']
5152
output_path_config = config['SETTINGS']['OUTPUT_PATH']
52-
53+
wait_time_config = config['SETTINGS']['WAIT_TIME']
5354

5455
except KeyError:
5556
print ('Incorrect config file in $HOME/.config/venus'
5657
+ '\nPlease make sure all config options are present:'
5758
+ '\nSEARCH_TERMS'
58-
+ '\nOUTPUT_PATH')
59+
+ '\nOUTPUT_PATH'
60+
+ '\nWAIT_TIME')
5961
exit()
6062

6163
#default path for empty OUTPUT_PATH setting
6264
if not output_path_config:
6365
output_path_config = None
6466

65-
66-
if 'linux' in platform:
67-
from venus.os_tools import linux
68-
linux.set_wall(get_wall(resolution=linux.get_screen_resolution(),
69-
search_term=search_term_config,
70-
output_path = output_path_config))
71-
72-
elif 'win32' in platform:
73-
from venus.os_tools import windows
74-
windows.set_wall(get_wall(resolution=windows.get_screen_resolution(),
75-
search_term = search_term_config,
76-
output_path = output_path_config))
77-
78-
elif 'darwin' in platform:
79-
from venus.os_tools import darwin
80-
darwin.set_wall(get_wall(resolution=darwin.get_screen_resolution(),
81-
search_term = search_term_config,
82-
output_path = output_path_config))
67+
#loop control var
68+
run = True
69+
70+
while run:
71+
72+
if 'linux' in platform:
73+
from venus.os_tools import linux
74+
linux.set_wall(get_wall(resolution=linux.get_screen_resolution(),
75+
search_term=search_term_config,
76+
output_path = output_path_config))
77+
78+
elif 'win32' in platform:
79+
from venus.os_tools import windows
80+
windows.set_wall(get_wall(resolution=windows.get_screen_resolution(),
81+
search_term = search_term_config,
82+
output_path = output_path_config))
83+
84+
elif 'darwin' in platform:
85+
from venus.os_tools import darwin
86+
darwin.set_wall(get_wall(resolution=darwin.get_screen_resolution(),
87+
search_term = search_term_config,
88+
output_path = output_path_config))
89+
90+
if not wait_time_config:
91+
run = False
92+
else:
93+
time.sleep(int(wait_time_config))
8394

8495
if __name__ == "__main__":
8596
main()

0 commit comments

Comments
 (0)