Benjamin-Loison / termux-app

Termux - a terminal emulator application for Android OS extendible by variety of packages.
https://f-droid.org/en/packages/com.termux
Other
0 stars 0 forks source link

[Feature]: Scan in realtime a barcode (assuming that the current camera picture is not detecting a barcode) #5

Closed Benjamin-Loison closed 7 months ago

Benjamin-Loison commented 7 months ago

Feature description

https://github.com/vaites/termux-scripts/issues/3 I was about to answer:

Interesting, thank you for your feedback but as I need to web-scrape following the barcode scanning, I cannot rely on such web-based solutions

but I realized that we could proceed to the web-scraping and parsing on a proxy (as unable to retrieve the wanted webpage with XHR due to CORS), that way it even reduce the phone workload. However, the mentioned library seems to be the most starred one I found for the web-browser but I get only very rarely results, even if it draws a green rectangle around the barcode: https://serratus.github.io/quaggaJS/examples/live_w_locator.html. Could try with multiple barcodes, assuming it does not notify again about an identical barcode. Well it works not that badly in fact. Note that Barcode Detection API is not compatible with Firefox...

<label>Product:</label>
<select>
    <option value="1">Thon au naturel, thon à l'huile</option>
    <option value="3">Maquereau</option>
    <option value="2">Autres</option>
</select>

<br/>

<label>Country:</label>
<select>
    <option value="1">Ghana</option>
    <option value="2">Seychelles</option>
    <option value="7">Portugal</option>
    <option value="5">Autres</option>
</select>

<br/>

<input type="text" size="4" maxlength="4" pattern="\d{4}"/>

OpenFoodFacts is a workaround when do not need interactivity but for Petit Navire I need interactiveness. I could try make a dedicated Android app. Firstly making sure being able to run Android Studio in an open-source manner (it requires about 32 GB for the download), then exploring Android Studio would be a good start. View what we are currently video streaming. https://github.com/Benjamin-Loison/android_packages_apps_Aperture/issues/3

Maybe can workaround Marine Traffic vessel id search by name security, by enumerating vessels, as these webpages do not some protected.

Currently, we are actively monitoring 316806 vessels

https://www.marinetraffic.com

image

This vessel has an id greater than the limit, but maybe they do not monitor anymore all vessels, but as the id are not that great, let us proceed.

Note that do not find BELLE RIVE. But it can help give us an idea of many vessels are tracked, by considering the highest vessel id. Have some ids being base64 (double decoding leads to a great number). Highest ids among the 2757 numeric ones is 995628. Note that forcing an IP that worked does not help. As we face random responses, could give a try to selenium but let us for the moment try many times until a request success, that way we will see if some entries are really unavailable. It seems that there are holes for instance 16 is not accessible after more than 100 requests. While it is accessible: https://www.marinetraffic.com/en/ais/details/ships/shipid:16

https://en.wikipedia.org/wiki/Maritime_Mobile_Service_Identity

Unclear if we can get a ship by its name and especially its country with AISStream: https://github.com/aisstream/example/tree/main/python https://github.com/aisstream/ais-message-models/blob/master/python/aisStream/docs/ShipStaticData.md https://github.com/aisstream/ais-message-models/blob/master/python/aisStream/aisStream/model/ship_static_data.py https://opendata.stackexchange.com/a/20812

torsocks does not help as it requires JavaScript.

Could continue investigating opensource marinetraffic search engine results.

Selenium seems to work quite well, at least not under heavy usage, PHP selenium would be nice.

Additional information

Not read.

Benjamin-Loison commented 7 months ago

Concerning https://codeberg.org/Benjamin_Loison/Food would like to have barcode scanning interactivity (to provide the expiration date) and local filesystem interaction (loading and saving the database is not user-friendly but would still be an improvement I guess).

With a PHP local website we can take arbitrary actions on local filesystem.