-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPattern.py
61 lines (54 loc) · 2.26 KB
/
Pattern.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
57
58
59
60
61
from typing import Pattern
from clint.textui import puts, colored, indent
class Pattern:
def __init__(self):
self.standard = {
'Documents': ['zip', 'rar', 'pdf', 'doc', 'docx', 'xls', 'csv', 'txt', 'ppt', 'pptx', 'cpp', 'py', 'js'],
'Videos': ['mp4', 'flv', 'avi', 'mkv'],
'Music': ['mp3', 'wav'],
'Images': ['png', 'jpg', 'jpeg', 'webp', 'gif']
}
def update(self):
newUpdate = True
while newUpdate:
puts(colored.green('Do you want to '), False)
puts(colored.magenta('ADD '), False)
puts(colored.green('a new group, '), False)
puts(colored.magenta('DEL '), False)
puts(colored.green('an existing group? '), False)
action = input()
if action == 'ADD' or action == 'add':
self.newGroup()
elif action == 'DEL' or action == 'del':
self.delGroup()
else:
puts(colored.magenta("Invalid option"))
puts(colored.green('Do you want to make another update?[Y/N] '), False)
choice = input()
if not (choice == 'Y' or choice == 'y'):
newUpdate = False
def printPattern(self):
for key, value in self.standard.items():
puts(colored.magenta(key+': '+str(value)))
def create(self):
self.standard = {}
self.newGroup()
puts(colored.green('Are you finished?[Y/N] '), False)
choice = input()
if not (choice == 'N' or choice == 'n'):
self.update()
def newGroup(self):
puts(colored.green("What's the name of the new group "), False)
groupName = input()
puts(colored.green("What are the extensions for this group? Separate them with a comma "), False)
groupExt = input().split(',')
self.standard[groupName] = groupExt
puts(colored.magenta("Group created"))
def delGroup(self):
puts(colored.green("What group do you want to delete? "), False)
groupToDelete = input()
if groupToDelete in self.standard:
self.standard.pop(groupToDelete, None)
puts(colored.magenta("Group removed"))
else:
puts(colored.magenta("This group doesn't exists "))