-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcatalog.py
More file actions
27 lines (23 loc) · 1.11 KB
/
catalog.py
File metadata and controls
27 lines (23 loc) · 1.11 KB
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
from modules.book import Book
from modules.magazine import Magazine
from modules.dvd import Dvd
from modules.cd import Cd
class Catalog():
def __init__ (self,catalog=None):
self.catalog = catalog
def search (self, input_search):
list_result = []
for catalog in self.catalog:
for item in catalog:
if input_search in item.title.lower():
if type(item) == Magazine :
list_result.append('Title: '+ item.title+ ' Volume: '+ item.volume + ' Type Catalog: Magazine')
elif type(item) == Book:
list_result.append('Title: '+ item.title + ' DDS Number: ' + item.dds_number + ' Type Catalog: Book' )
elif type(item) == Dvd:
list_result.append('Title: ' + item.title + ' Genre: ' + item.genre + ' Type Catalog: DVD')
elif type(item) == Cd:
list_result.append('Title: ' + item.title + ' Artist: ' + item.artist + ' Type Catalog: CD')
else:
pass
return list_result