Skip to content

Commit e5f7bc2

Browse files
author
Vladimir Tolstov
committed
fixed bugs and created some changes
Signed-off-by: Vladimir Tolstov <[email protected]>
1 parent 7155285 commit e5f7bc2

File tree

11 files changed

+79
-2678
lines changed

11 files changed

+79
-2678
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
__pycache__/
2-
assets/music/main.mp3
3-
venv/
2+
venv/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ make setup run
2121

2222
### 3. If you want change settings, edit file [config.cfg](https://github.com/githubVladimirT/Cardioid/blob/main/config.cfg).
2323

24-
### *. For add the background music, add music file to folder assets/music/ then in file [config.cfg](https://github.com/githubVladimirT/Cardioid/blob/main/config.cfg), finally paste path to file in the const "music_path" after char equals.
24+
### *. For add the background music, in file [config.cfg](https://github.com/githubVladimirT/Cardioid/blob/main/config.cfg) paste path to file in the const "music_path" after char equals.
2525

2626
### For exit from app hit 'ESC', 'Ctrl+w', 'Ctrl+q' or 'Alt+F4'.

assets/img/icon.png

39.7 KB
Loading

assets/img/icon.svg

Lines changed: 0 additions & 2631 deletions
This file was deleted.

assets/img/icon_min.png

-27.5 KB
Binary file not shown.

assets/img/main.png

4.6 KB
Loading
8.67 MB
Binary file not shown.

config.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Screen resolution in pixels (type:int) x, y
33
# screen_res=1366, 768
44
# Radius of cardioid (type:int)
5-
radius=300
5+
radius=500
66
# Number of lines (type:int)
77
num_lines=200
88
# Animation speed (in sec) (type:float) //0.0001
@@ -26,4 +26,4 @@ multi_color_2=black
2626

2727
[MUSIC]
2828
# Path to music file (type:none/string) for example: "/home/user/Music/example.mp3"
29-
music_path=none
29+
music_path=./assets/music/Miracle of Sound — valhalla calling.mp3

confparse.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
"""Config file reader for master moudle"""
1+
"""Config file reader"""
22
import configparser
33
import logging
4+
import sys
45

56
def read(file="config.cfg"):
67
config = configparser.ConfigParser()
@@ -35,21 +36,30 @@ def read(file="config.cfg"):
3536
elif conf["pulsing"].lower() == "true":
3637
conf["pulsing"] = True
3738
else:
38-
print("Error: unknow type")
39-
return
39+
logging.fatal("error: unknow type - file: config_reader.py")
40+
return None
4041

4142
# conf["screen_res"] = [int(n) for n in conf["screen_res"].split(', ')]
4243

4344
return conf
4445

4546

4647
if __name__ == "__main__":
47-
logging.basicConfig(filename='main.log',
48-
filemode='a',
49-
format='%(asctime)s - %(name)s - [ %(levelname)s ] - %(message)s')
48+
logging.basicConfig(
49+
filename='main.log',
50+
filemode='a',
51+
format='%(asctime)s - %(name)s - [ %(levelname)s ] - %(message)s'
52+
)
53+
54+
if "--help" in sys.argv:
55+
print("this moudle reading config file and outputting in python dict format")
56+
sys.exit(0)
5057

5158
try:
52-
if read() is not None:
53-
print(read())
59+
parsed_config = read()
60+
61+
if parsed_config is not None:
62+
print(parsed_config)
63+
5464
except Exception as err:
55-
logging.fatal("error: %s - file: config_reader.py", err)
65+
logging.fatal("error: %s - file:config_reader.py", err)

main.log

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
Cardioid logs:
2+
2022-07-01 14:18:22,559 - root - [ WARNING ] - interrupted. - file:main.py
3+
2022-07-01 14:19:33,823 - root - [ WARNING ] - interrupted. - file:main.py
4+
2022-07-01 14:19:46,347 - root - [ WARNING ] - interrupted. - file:main.py
5+
2022-07-01 14:20:03,934 - root - [ WARNING ] - interrupted. - file:main.py
6+
2022-07-01 14:20:13,247 - root - [ CRITICAL ] - error: music file not found. - file:main.py
7+
2022-07-01 14:20:27,855 - root - [ WARNING ] - interrupted. - file:main.py

0 commit comments

Comments
 (0)