- Timestamp:
- Dec 22, 2017, 2:07:25 PM (3 years ago)
- Location:
- lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/loadStore.py
r6458 r6547 14 14 import gettext 15 15 from bs4 import BeautifulSoup 16 gettext.textdomain('python3-lliurex-store')17 _=gettext.gettext18 16 19 17 class loadstore: 20 18 def __init__(self): 21 19 self.dbg=0 22 self.pluginInfo={'load':'*' }20 self.pluginInfo={'load':'*','load_bundles':'*'} 23 21 self.store='' 24 22 self.progress=0 … … 50 48 self.store=appstream.Store() 51 49 if action=='load': 52 self._load_store(self.store,loadBundles) 53 # self.progress=100 50 self._load_store(self.store) 51 if action=='load_bundles': 52 self._load_store(self.store,loadBundles=True) 53 self.progress=100 54 54 return (self.store) 55 55 #def execute_action … … 93 93 def _generic_file_load(self,filesDir,store): 94 94 iconPath='/usr/share/icons/hicolor/128x128' 95 files=os.listdir(filesDir) 95 96 for appFile in os.listdir(filesDir): 96 97 if appFile.endswith('appdata.xml'): … … 147 148 app.set_priority(0) 148 149 if app.get_id_filename() in lliurexApps.keys(): 149 # app.set_merge_kind(appstream.AppMergeKind.APPEND)150 150 self._debug("Mergin app "+str(app.get_id())+" as is in Lliurex") 151 # app.set_id(lliurexApps[app.get_id_filename()])152 151 lliurexApps[app.get_id_filename()].subsume_full(app,appstream.AppSubsumeFlags.BOTH_WAYS) 153 152 store.remove_app(app) … … 219 218 self._debug("Blacklisted app: "+blApp) 220 219 resultRe=re.search('([^a-zA-Z0-9_-])',blApp) 221 # if blApp[-1]!='*':222 220 if resultRe: 223 221 if blApp[0]=='*': … … 238 236 resultRe=re.search(blApp,app.get_id()) 239 237 if resultRe: 240 # if blApp.lower() in app.get_id_filename().lower():241 238 store.remove_app(app) 242 239 self._debug("Removed "+str(app.get_id()) +" as matches with "+blApp) … … 268 265 for repo in repoTypeList: 269 266 self._debug(("Fetching repo %s")%(repo)) 270 print (_("Fetching %s catalogue: "+progressBar)%repoType,end="\r")271 progressBar=progressBar+"#"272 print (_("Fetching %s catalogue: "+progressBar)%repoType,end="\r")267 # print (("Fetching %s catalogue: "+progressBar)%repoType,end="\r") 268 # progressBar=progressBar+"#" 269 # print (("Fetching %s catalogue: "+progressBar)%repoType,end="\r") 273 270 applist=self._generate_applist(self._fetch_repo(repo)) 274 progressBar=progressBar+"##"275 print (_("Fetching %s catalogue: "+progressBar)%repoType,end="\r")271 # progressBar=progressBar+"##" 272 # print (("Fetching %s catalogue: "+progressBar)%repoType,end="\r") 276 273 self._debug("Processing info...") 277 274 self._th_generate_xml_catalog(applist,outdir,infoPage,repoType,progressBar) 278 275 self._debug("Fetched repo "+repo) 279 print (_("Removing old entries..."))276 # print (("Removing old entries...")) 280 277 self._clean_bundle_catalogue(applist,outdir) 281 278 else: … … 318 315 lenAppList=len(randomList) 319 316 inc=30/lenAppList 320 print (CURSOR_UP)317 # print (CURSOR_UP) 321 318 for app in randomList: 322 319 th=threading.Thread(target=self._th_write_xml, args = (app,outdir,infoPage,semaphore,inc)) … … 327 324 progressBar='#'+progressBar 328 325 # print (CURSOR_UP) 329 print (_("Fetching %s catalogue: "+progressBar)%repoType,end="\r")326 # print (("Fetching %s catalogue: "+progressBar)%repoType,end="\r") 330 327 os.system('setterm -cursor on') 331 328 print('') … … 338 335 version=nameSplitted[1] 339 336 arch=nameSplitted[2] 340 # filename=outdir+name+"_"+version+".appdata.xml"341 337 filename=outdir+app.lower().replace('appimage',"appdata.xml") 342 338 self._debug("checking if we need to download "+filename) -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/searchManager.py
r5591 r6547 55 55 self.result['status']={'status':-1,'msg':''} 56 56 self.result['data']=[] 57 if action=='list': 58 self._list_category(tokens) 59 if action=='list_sections': 60 self._list_sections() 61 if (action=='search' or action=='info'): 62 self._search_app(tokens,exact_match_for_search) 57 if self.store: 58 if action=='list': 59 self._list_category(tokens) 60 if action=='list_sections': 61 self._list_sections() 62 if (action=='search' or action=='info'): 63 self._search_app(tokens,exact_match_for_search) 63 64 self.progress=100 64 65 return(self.result) -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/storeManager.py
r6458 r6547 17 17 class StoreManager: 18 18 def __init__(self,args=()): 19 # self.store=appstream.Store() 19 self.dbg=0 20 self._propagate_dbg=0 20 21 self.store=None 21 22 self.relatedActions={ … … 29 30 } 30 31 self.loadBundles=False 31 self.dbg=032 self._propagate_dbg=033 32 if args: 34 33 if args[0]==1: … … 51 50 self._define_functions_for_threads() #Function that loads the dictionary self.threads 52 51 self.__init_plugins__() #Function that loads the plugins 53 self.execute_action('load') #Initial load of the store 52 self._debug("Load bundles %s"%self.loadBundles) 53 if self.loadBundles: 54 self.execute_action('load_bundles') #Initial load of the store 55 else: 56 self.execute_action('load') #Initial load of the store 54 57 #def main 55 58 … … 108 111 def _define_functions_for_threads(self): 109 112 self.threads['load']="threading.Thread(target=self._load_Store)" 113 self.threads['load_bundles']="threading.Thread(target=self._load_Store)" 110 114 self.threads['get_info']="threading.Thread(target=self._get_App_Info,args=[args])" 111 115 self.threads['pkginfo']="threading.Thread(target=self._get_Extended_App_Info,args=[args])" … … 128 132 if self.is_action_running('load'): 129 133 self._join_action('load') 134 if self.is_action_running('load_bundles'): 135 self._join_action('load_bundles') 130 136 sw_withoutStatus=False 131 137 if action not in self.threads.keys(): … … 218 224 status=True 219 225 break 220 # self._debug(action+" running: "+str(status))221 226 return(status) 222 227 #def is_action_running … … 280 285 for action in actionList: 281 286 if parentAction in self.threadsProgress.keys(): 282 # self._debug(str(len(self.threadsProgress[parentAction]))+" Threads for action "+parentAction+": "+str(self.threadsProgress[parentAction]))283 287 acumProgress=0 284 288 for threadfunction,function in self.threadsProgress[parentAction].items(): 285 # function=self.threadsProgress[parentAction][threadfunction]286 # self._debug(str(function)+" "+ str(threadfunction) + " "+parentAction)287 289 acumProgress=acumProgress+function.progress 288 # self._debug("Acum for process "+parentAction+": "+str(acumProgress))289 290 290 291 count=len(self.relatedActions[parentAction]) 291 # self._debug("Assign result for action" +action)292 292 self.progressActions[parentAction]=round(acumProgress/count,0) 293 293 progress[parentAction]=self.progressActions[parentAction] … … 295 295 #put a 100% just in case 296 296 if parentAction in self.progressActions.keys(): 297 # if self.progressActions[parentAction]:298 # self.progressActions[parentAction]=100299 297 self.progressActions[parentAction]=100 300 298 self.lock.release() 301 # self._debug("Progress :"+str(progress))302 299 return(self.progressActions) 303 300 #def get_progress … … 363 360 #def get_status 364 361 365 def load_bundles(self):366 self.loadBundles=True367 self._load_Store()368 369 362 #### 370 363 #Loads the store 371 364 #### 372 365 def _load_Store(self): 373 action='load' 374 loadFunction=self._execute_class_method(action) 366 if self.loadBundles: 367 action='load_bundles' 368 else: 369 action='load' 370 loadFunction=self._execute_class_method(action,None,None) 375 371 self.store=loadFunction.execute_action(action,self.store,self.loadBundles) 376 372 #def _load_Store
Note: See TracChangeset
for help on using the changeset viewer.