Line | |
---|
1 | import lliurexstore.storeManager |
---|
2 | import time |
---|
3 | import Package |
---|
4 | |
---|
5 | class LliurexStoreManager: |
---|
6 | |
---|
7 | def __init__(self): |
---|
8 | |
---|
9 | self.store=lliurexstore.storeManager.StoreManager(0) |
---|
10 | |
---|
11 | |
---|
12 | |
---|
13 | #http://appstream.ubuntu.com/data/xenial/universe/ |
---|
14 | |
---|
15 | #def init |
---|
16 | |
---|
17 | def list_sections(self): |
---|
18 | action="list_sections" |
---|
19 | self.store.execute_action(action,True) |
---|
20 | |
---|
21 | while self.store.is_action_running(): |
---|
22 | print(self.store.get_progress()) |
---|
23 | time.sleep(0.2) |
---|
24 | |
---|
25 | print(self.store.get_status(action)) |
---|
26 | print(self.store.get_result(action)) |
---|
27 | |
---|
28 | print("DONE") |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | #def search |
---|
33 | |
---|
34 | def search_package(self,search_text): |
---|
35 | |
---|
36 | action="search" |
---|
37 | self.store.execute_action(action,search_text) |
---|
38 | |
---|
39 | packages=[] |
---|
40 | |
---|
41 | while self.store.is_action_running("search"): |
---|
42 | time.sleep(0.2) |
---|
43 | |
---|
44 | ret=self.store.get_status(action) |
---|
45 | |
---|
46 | if ret["status"]==0: |
---|
47 | data=self.store.get_result(action) |
---|
48 | for item in data["search"]: |
---|
49 | |
---|
50 | p=Package.Package(item) |
---|
51 | packages.append(item) |
---|
52 | |
---|
53 | return packages |
---|
54 | |
---|
55 | #def search_package |
---|
56 | |
---|
57 | |
---|
58 | #class StoreManager |
---|
Note: See
TracBrowser
for help on using the repository browser.