|
3 | 3 | import tempfile |
4 | 4 | import os |
5 | 5 | import configparser |
| 6 | +import time |
6 | 7 |
|
7 | 8 | def get_wall(resolution="1920x1080", search_term=None, output_path=None): |
8 | 9 | """ |
@@ -49,37 +50,47 @@ def main(): |
49 | 50 | try: |
50 | 51 | search_term_config = config['SETTINGS']['SEARCH_TERMS'] |
51 | 52 | output_path_config = config['SETTINGS']['OUTPUT_PATH'] |
52 | | - |
| 53 | + wait_time_config = config['SETTINGS']['WAIT_TIME'] |
53 | 54 |
|
54 | 55 | except KeyError: |
55 | 56 | print ('Incorrect config file in $HOME/.config/venus' |
56 | 57 | + '\nPlease make sure all config options are present:' |
57 | 58 | + '\nSEARCH_TERMS' |
58 | | - + '\nOUTPUT_PATH') |
| 59 | + + '\nOUTPUT_PATH' |
| 60 | + + '\nWAIT_TIME') |
59 | 61 | exit() |
60 | 62 |
|
61 | 63 | #default path for empty OUTPUT_PATH setting |
62 | 64 | if not output_path_config: |
63 | 65 | output_path_config = None |
64 | 66 |
|
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)) |
83 | 94 |
|
84 | 95 | if __name__ == "__main__": |
85 | 96 | main() |
|
0 commit comments