diff --git a/CHANGELOG.md b/CHANGELOG.md index 016a8866..7f5a874f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ===== - Move from MANIFEST.MF to MANIFEST.JSON format for apps - wificonf: scan and connect to wifi in background thread so app stays responsive +- appstore: improve icon download handling 0.0.2 ===== diff --git a/appstore_backend/apps.json b/appstore_backend/apps.json index 72cf44b1..7bf67c32 100644 --- a/appstore_backend/apps.json +++ b/appstore_backend/apps.json @@ -1,72 +1,142 @@ [ - { - "name": "Animation Tester", - "publisher": "ACME Inc", - "short_description": "Testing on-display animations", - "long_description": "Stress testing multiple concurrent animations on the display by adding more and more spinners", - "icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk_icon_64x64.png", - "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk", - "fullname": "com.example.lvgltest", - "version": "0.0.1" - }, - { - "name": "BTC Ticker", - "publisher": "ACME Inc", - "short_description": "Bitcoin Price Ticker", - "long_description": "Uses a websocket to show the current price of Bitcoin in US Dollar.", - "icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.btcticker_0.0.1.mpk_icon_64x64.png", - "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.btcticker_0.0.1.mpk", - "fullname": "com.example.btcticker", - "version": "0.0.1" - }, - { - "name": "Camera Tester", - "publisher": "ACME Inc", - "short_description": "Simple test of the camera", - "long_description": "A simple test of the camera makes it possible to validate the hardware.", - "icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.2.mpk_icon_64x64.png", - "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.2.mpk", - "fullname": "com.example.camtest", - "version": "0.0.2" - }, - { - "name": "CPU Tester", - "publisher": "ACME Inc", - "short_description": "Testing the CPU speed", - "long_description": "Experimentally determines how many idle loops and sha256-hashing loops the CPU can perform per second.", - "icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.cputest_0.0.1.mpk_icon_64x64.png", - "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.cputest_0.0.1.mpk", - "fullname": "com.example.cputest", - "version": "0.0.1" - }, - { - "name": "HelloWorld", - "publisher": "ACME Inc", - "short_description": "Minimal app", - "long_description": "Demonstrates the simplest app.", - "icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.helloworld_0.0.1.mpk_icon_64x64.png", - "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.helloworld_0.0.1.mpk", - "fullname": "com.example.memtest", - "version": "0.0.1" - }, - { - "name": "IMU Tester", - "publisher": "ACME Inc", - "short_description": "Test the Inertial Measurement Unit", - "long_description": "It is always good to make sure the accelerometer is working properly. How else can you measure acceleration and position?", - "icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk_icon_64x64.png", - "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk", - "fullname": "com.example.imutest", - "version": "0.0.1" - }, - { - "name": "Memory Tester", - "publisher": "ACME Inc", - "short_description": "RAM Memory Test", - "long_description": "Experimentally determines how many RAM memory buffers can be allocated.", - "icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.memtest_0.0.1.mpk_icon_64x64.png", - "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.memtest_0.0.1.mpk", - "fullname": "com.example.memtest", - "version": "0.0.1" - } +{ +"name": "BTC Ticker", +"publisher": "ACME Inc", +"short_description": "Bitcoin Price Ticker", +"long_description": "Uses a websocket to show the current price of Bitcoin in US Dollar.", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.btcticker_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.btcticker_0.0.1.mpk", +"fullname": "com.example.btcticker", +"version": "0.0.1", +"entrypoint": "assets/bitcoin_price.py", +"category": "money" +} + +,{ +"name": "Camera Tester", +"publisher": "ACME Inc", +"short_description": "Simple test of the camera", +"long_description": "A simple test of the camera makes it possible to validate the hardware.", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.2.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.2.mpk", +"fullname": "com.example.camtest", +"version": "0.0.2", +"entrypoint": "assets/camtest.py", +"category": "camera" +} + +,{ +"name": "CPU Tester", +"publisher": "ACME Inc", +"short_description": "Testing the CPU speed", +"long_description": "Experimentally determines how many idle loops and sha256-hashing loops the CPU can perform per second.", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.cputest_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.cputest_0.0.1.mpk", +"fullname": "com.example.cputest", +"version": "0.0.1", +"entrypoint": "assets/cputest.py", +"category": "benchmarking" +} + +,{ +"name": "HelloWorld", +"publisher": "ACME Inc", +"short_description": "Minimal app", +"long_description": "Demonstrates the simplest app.", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.helloworld_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.helloworld_0.0.1.mpk", +"fullname": "com.example.memtest", +"version": "0.0.1", +"entrypoint": "assets/hello.py", +"category": "development" +} +,{ +"name": "IMU Tester", +"publisher": "ACME Inc", +"short_description": "Test the Inertial Measurement Unit", +"long_description": "It is always good to make sure the accelerometer is working properly. How else can you measure acceleration and position?", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk", +"fullname": "com.example.imutest", +"version": "0.0.1", +"entrypoint": "assets/imutest.py", +"category": "benchmarking" +} +,{ +"name": "Animation Tester", +"publisher": "ACME Inc", +"short_description": "Testing on-display animations", +"long_description": "Stress testing multiple concurrent animations on the display by adding more and more spinners", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk", +"fullname": "com.example.lvgltest", +"version": "0.0.1", +"entrypoint": "assets/lvgltest.py", +"category": "benchmarking" +} + +,{ +"name": "Memory Tester", +"publisher": "ACME Inc", +"short_description": "RAM Memory Test", +"long_description": "Experimentally determines how many RAM memory buffers can be allocated.", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.memtest_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.memtest_0.0.1.mpk", +"fullname": "com.example.memtest", +"version": "0.0.1", +"entrypoint": "assets/memtest.py" +"category": "benchmarking" +} +,{ +"name": "AppStore", +"publisher": "ACME Inc", +"short_description": "Store for App(lication)s", +"long_description": "", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.appstore_0.0.2.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.appstore_0.0.2.mpk", +"fullname": "com.example.appstore", +"version": "0.0.2", +"entrypoint": "assets/appstore.py", +"category": "appstore" +} + +,{ +"name": "Launcher", +"publisher": "ACME Inc", +"short_description": "Simple launcher to start apps.", +"long_description": "", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.launcher_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.launcher_0.0.1.mpk", +"fullname": "com.example.launcher", +"version": "0.0.1", +"entrypoint": "assets/launcher.py", +"category": "launcher" +} + +,{ +"name": "OSUpdate", +"publisher": "ACME Inc", +"short_description": "Operating System Updater", +"long_description": "", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.osupdate_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.osupdate_0.0.1.mpk", +"fullname": "com.example.osupdate", +"version": "0.0.1", +"entrypoint": "assets/osupdate.py", +"category": "osupdate" +} + +,{ +"name": "WiFiConf", +"publisher": "ACME Inc", +"short_description": "Wireless Network Configuration", +"long_description": "", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.wificonf_0.0.2.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.wificonf_0.0.2.mpk", +"fullname": "com.example.wificonf", +"version": "0.0.2", +"entrypoint": "assets/wificonf.py", +"category": "wificonf" +} + ] diff --git a/internal_filesystem/apps/com.example.btcticker/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.example.btcticker/META-INF/MANIFEST.JSON index d5756be5..9745982b 100644 --- a/internal_filesystem/apps/com.example.btcticker/META-INF/MANIFEST.JSON +++ b/internal_filesystem/apps/com.example.btcticker/META-INF/MANIFEST.JSON @@ -7,6 +7,7 @@ "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.btcticker_0.0.1.mpk", "fullname": "com.example.btcticker", "version": "0.0.1", -"entrypoint": "assets/bitcoin_price.py" +"entrypoint": "assets/bitcoin_price.py", +"category": "money" } diff --git a/internal_filesystem/apps/com.example.camtest/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.example.camtest/META-INF/MANIFEST.JSON index 02768061..4763306b 100644 --- a/internal_filesystem/apps/com.example.camtest/META-INF/MANIFEST.JSON +++ b/internal_filesystem/apps/com.example.camtest/META-INF/MANIFEST.JSON @@ -7,6 +7,7 @@ "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.2.mpk", "fullname": "com.example.camtest", "version": "0.0.2", -"entrypoint": "assets/camtest.py" +"entrypoint": "assets/camtest.py", +"category": "camera" } diff --git a/internal_filesystem/apps/com.example.cputest/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.example.cputest/META-INF/MANIFEST.JSON index 2722304a..44140b6d 100644 --- a/internal_filesystem/apps/com.example.cputest/META-INF/MANIFEST.JSON +++ b/internal_filesystem/apps/com.example.cputest/META-INF/MANIFEST.JSON @@ -7,6 +7,7 @@ "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.cputest_0.0.1.mpk", "fullname": "com.example.cputest", "version": "0.0.1", -"entrypoint": "assets/cputest.py" +"entrypoint": "assets/cputest.py", +"category": "benchmarking" } diff --git a/internal_filesystem/apps/com.example.helloworld/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.example.helloworld/META-INF/MANIFEST.JSON index e5b8978a..7838d78e 100644 --- a/internal_filesystem/apps/com.example.helloworld/META-INF/MANIFEST.JSON +++ b/internal_filesystem/apps/com.example.helloworld/META-INF/MANIFEST.JSON @@ -7,5 +7,6 @@ "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.helloworld_0.0.1.mpk", "fullname": "com.example.memtest", "version": "0.0.1", -"entrypoint": "assets/hello.py" +"entrypoint": "assets/hello.py", +"category": "development" } diff --git a/internal_filesystem/apps/com.example.imutest/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.example.imutest/META-INF/MANIFEST.JSON index 1d02d79a..15d5eed7 100644 --- a/internal_filesystem/apps/com.example.imutest/META-INF/MANIFEST.JSON +++ b/internal_filesystem/apps/com.example.imutest/META-INF/MANIFEST.JSON @@ -7,5 +7,6 @@ "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk", "fullname": "com.example.imutest", "version": "0.0.1", -"entrypoint": "assets/imutest.py" +"entrypoint": "assets/imutest.py", +"category": "benchmarking" } diff --git a/internal_filesystem/apps/com.example.lvgltest/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.example.lvgltest/META-INF/MANIFEST.JSON index 18dcf17e..0d4cf34f 100644 --- a/internal_filesystem/apps/com.example.lvgltest/META-INF/MANIFEST.JSON +++ b/internal_filesystem/apps/com.example.lvgltest/META-INF/MANIFEST.JSON @@ -7,6 +7,7 @@ "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk", "fullname": "com.example.lvgltest", "version": "0.0.1", -"entrypoint": "assets/lvgltest.py" +"entrypoint": "assets/lvgltest.py", +"category": "benchmarking" } diff --git a/internal_filesystem/apps/com.example.memtest/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.example.memtest/META-INF/MANIFEST.JSON index 15e7b975..2dab86f8 100644 --- a/internal_filesystem/apps/com.example.memtest/META-INF/MANIFEST.JSON +++ b/internal_filesystem/apps/com.example.memtest/META-INF/MANIFEST.JSON @@ -8,4 +8,5 @@ "fullname": "com.example.memtest", "version": "0.0.1", "entrypoint": "assets/memtest.py" +"category": "benchmarking" } diff --git a/internal_filesystem/builtin/apps/com.example.appstore/assets/appstore.py b/internal_filesystem/builtin/apps/com.example.appstore/assets/appstore.py index 9acd2983..d4c02e9d 100644 --- a/internal_filesystem/builtin/apps/com.example.appstore/assets/appstore.py +++ b/internal_filesystem/builtin/apps/com.example.appstore/assets/appstore.py @@ -49,20 +49,22 @@ def is_installed_by_name(app_fullname): return is_installed_by_path(f"/apps/{app_fullname}") or is_installed_by_path(f"/builtin/apps/{app_fullname}") def download_icon(url): - print(f"downloading icon from {url}") - response = urequests.get(url, timeout=5) - if response.status_code == 200: - image_data = response.content - print("Downloaded image, size:", len(image_data), "bytes") - image_dsc = lv.image_dsc_t({ - 'data_size': len(image_data), - 'data': image_data - }) - return image_dsc - else: - print("Failed to download image: Status code", response.status_code) - return None - + print(f"Downloading icon from {url}") + try: + response = urequests.get(url, timeout=5) + if response.status_code == 200: + image_data = response.content + print("Downloaded image, size:", len(image_data), "bytes") + image_dsc = lv.image_dsc_t({ + 'data_size': len(image_data), + 'data': image_data + }) + return image_dsc + else: + print("Failed to download image: Status code", response.status_code) + except Exception as e: + print(f"Exception during download of icon: {e}") + return None try: import zipfile diff --git a/internal_filesystem/builtin/apps/com.example.osupdate/META-INF/MANIFEST.JSON b/internal_filesystem/builtin/apps/com.example.osupdate/META-INF/MANIFEST.JSON index fbbce7f5..edd988a9 100644 --- a/internal_filesystem/builtin/apps/com.example.osupdate/META-INF/MANIFEST.JSON +++ b/internal_filesystem/builtin/apps/com.example.osupdate/META-INF/MANIFEST.JSON @@ -2,7 +2,7 @@ "name": "OSUpdate", "publisher": "ACME Inc", "short_description": "Operating System Updater", -"long_description": "" +"long_description": "", "icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.osupdate_0.0.1.mpk_icon_64x64.png", "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.osupdate_0.0.1.mpk", "fullname": "com.example.osupdate", diff --git a/internal_filesystem/builtin/apps/com.example.wificonf/META-INF/MANIFEST.JSON b/internal_filesystem/builtin/apps/com.example.wificonf/META-INF/MANIFEST.JSON index e04b623b..f9675635 100644 --- a/internal_filesystem/builtin/apps/com.example.wificonf/META-INF/MANIFEST.JSON +++ b/internal_filesystem/builtin/apps/com.example.wificonf/META-INF/MANIFEST.JSON @@ -2,7 +2,7 @@ "name": "WiFiConf", "publisher": "ACME Inc", "short_description": "Wireless Network Configuration", -"long_description": "" +"long_description": "", "icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.wificonf_0.0.2.mpk_icon_64x64.png", "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.wificonf_0.0.2.mpk", "fullname": "com.example.wificonf", diff --git a/internal_filesystem/main.py b/internal_filesystem/main.py index c7055dad..da4338ab 100644 --- a/internal_filesystem/main.py +++ b/internal_filesystem/main.py @@ -265,7 +265,7 @@ def parse_manifest(manifest_path): app_info=ujson.load(f) name = app_info.get("name") start_script = app_info.get("entrypoint") - print(f"parse_manifest: got app_info: {app_info}") + #print(f"parse_manifest: got app_info: {app_info}") except OSError: access_points={} print(f"parse_manifest: error loading manifest_path: {manifest_path}") diff --git a/scripts/bundleapps.sh b/scripts/bundleapps.sh index 573b3dda..6ddc6788 100755 --- a/scripts/bundleapps.sh +++ b/scripts/bundleapps.sh @@ -1,14 +1,24 @@ output=appstore_backend/bundled_apps/ +outputjson=appstore_backend/apps.json output=$(readlink -f "$output") +outputjson=$(readlink -f "$outputjson") + mkdir -p "$output" + rm "$output"/*.mpk +rm "$outputjson" + +echo "[" | tee -a "$outputjson" for apprepo in internal_filesystem/apps internal_filesystem/builtin/apps; do echo "Listing apps in $apprepo" ls -1 "$apprepo" | while read appdir; do echo "Bundling $apprepo/$appdir" pushd "$apprepo"/"$appdir" - version=$( grep "^Version:" META-INF/MANIFEST.MF | cut -d " " -f 2) + manifest=META-INF/MANIFEST.JSON + version=$( jq -r '.version' "$manifest" ) + cat "$manifest" | tee -a "$outputjson" + echo -n "," | tee -a "$outputjson" mpkname="$output"/"$appdir"_"$version".mpk echo "Creating $mpkname" zip -r0 "$mpkname" . @@ -16,3 +26,9 @@ for apprepo in internal_filesystem/apps internal_filesystem/builtin/apps; do popd done done + +# remove the last , to have valid json: + +truncate -s -1 "$outputjson" + +echo "]" | tee -a "$outputjson"