-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExample.py
56 lines (48 loc) · 2.81 KB
/
Example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#Band Jsoner - Simple example script for JsonManager - Written by Patrik Nagy (https://www.lopastudio.sk)
"""
This script demonstrated, how you can use JsonMan in a real project.
It contains every function that JsonMan can provide.
Happy Coding
-- Patrik
"""
import jsonman as e # Importing JsonMan to our project as e
def titlecard():
print('''_______ __ _____ ___ ________ ___ ________ ______ _____ ___ _______ _______
| _ \\ /""\\ (\" \\|" \\ |" "\ |" | /" ) / " \ (\" \\|" \\ /" "| /" \\
(. |_) :) / \\ |.\\\\ \\ |(. ___ :) || |(: \\___/ // ____ \\ |.\\\\ \\ |(: ______)|: |
|: \\/ /' /\\ \\ |: \\. \\\\ ||: \\ ) || |: | \\___ \\ / / ) :)|: \\. \\\\ | \\/ | |_____/ )
(| _ \\\\ // __' \\ |. \\ \\. |(| (___\\ || ___| / __/ \\\\: (____/ // |. \\ \\. | // ___)_ // /
|: |_) :)/ / \\\\ \\| \\ \\ ||: :) / :|_/ ) /" \\ :):\\ / | \\ \\ |(: "||: __ \\
(_______/(___/ \\___)\\___|\\____\\)(________/ (_______/ (_______/ "_____/ \\___|\\____\\) \\_______)|__| \\___)''')# Defining the titlecard
titlecard() # Calling the titlecard
def clear(): # simple screen clear function
for x in range(50): # You can adjust this if you would like to
print("\n")
clear()
titler.titlecard() # Displaying the title card
while True:
itr = input("@/ ") # Getting input from the user
if itr == "add":
key = input("Artist: ") # Getting the key from the user
value = input("Album: ") # Getting the value from the user
e.add(key, value) # Calling the json manager's "add" function
if itr == "rem":
key = input("Artist: ") # Getting the key from the user
value = input("Album: ") # Getting the value from the user
e.remove(key, value) # Calling the json manager's "remove" function
if itr == "view":
key = input("Artist: ") # Getting the key from the user
e.view(key) # Calling the json manager's "view" function
if itr == "edit":
key = input("Artist: ") # Getting the key from the user
new_value = input("New album: ") # Getting the value from the user
e.edit(key, new_value) # Calling the json manager's "edit" function
if itr == "save":
filename = input("Filename (without .json or others): ") # Getting the key from the user
e.save(filename + ".json") # Calling the json manager's "save" function
if itr == "load":
filename = input("Filename: ") # Getting the key from the user
e.load(filename) # Calling the json manager's "load" function
if itr == "exit":
print("Thanks for using Band Jsoner.")
quit() # Stopping the application in a peacefull way.