예제 #1
0
 async def _fetch_fastboot(self, codename) -> Optional[Update]:
     """
     Fetch an update and add it to the database if new
     :param codename: device codename
     :return: Update object
     """
     url: str = await self._request_fastboot(codename)
     if url:
         filename = url.split('/')[-1]
         if update_in_db(filename):
             return
         update = self._get_fastboot_update(filename)
         if update:
             add_to_db(update)
             self._logger.info(f"Added {filename} to db")
         return update
예제 #2
0
 async def _fetch(self, device_id: str) -> List[Update]:
     """
     Fetch an update and add it to the database if new
     :param device_id: device ID
     :return: Update object
     """
     links: List[str] = await self._request(device_id)
     if links:
         updates = []
         for item in links:
             filename = item.split('/')[-1]
             if update_in_db(filename):
                 continue
             update = self._get_update(filename)
             if update:
                 add_to_db(update)
                 self._logger.info(f"Added {filename} to db")
                 updates.append(update)
         return updates
예제 #3
0
 async def _fetch(self, device_id: str) -> List[Update]:
     """
     Fetch an update and add it to the database if new
     :param device_id: device ID
     :return: Update object
     """
     response: List[Dict] = await self._request(device_id)
     if response:
         updates = []
         for item in response:
             filename = item['filename']
             if update_in_db(filename):
                 recovery_update = get_update_by_version(item['version'])
                 update_stable_beta(recovery_update)
                 continue
             update = self._get_update(item)
             if update:
                 if update.branch == "Stable" and not get_update_by_version(update.version, method="Fastboot"):
                     update.branch = "Stable Beta"
                 add_to_db(update)
                 self._logger.info(f"Added {filename} to db")
                 updates.append(update)
         return updates