https://github.com/tito/pymoodstocks
Kivy/Python wrapper for the Moodstocks SDK, iOS and Android supported
https://github.com/tito/pymoodstocks
Last synced: about 1 year ago
JSON representation
Kivy/Python wrapper for the Moodstocks SDK, iOS and Android supported
- Host: GitHub
- URL: https://github.com/tito/pymoodstocks
- Owner: tito
- License: mit
- Created: 2015-02-27T17:52:39.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-09-04T10:48:17.000Z (almost 11 years ago)
- Last Synced: 2025-04-23T13:44:16.799Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 336 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Moodstocks Python wrapper
This wrapper allow you to use the Moodstock iOS and Android SDK with Kivy /
Python. This current version include an UI for both iOS and Android, and do all
the effort to display it correctly. The default configuration searchs for
qrcode, barcode and image.


## Installation
### iOS
You need to use the latest kivy-ios toolchain:
./toolchain.py build pymoodstocks
Then either create or update an Xcode project with the toolchain. It will add
the frameworks necessary for Moodstocks and libraries for pymoodstocks.
### Android
With buildozer, you need to download the SDK for eclipse, and extract the libs/
directory into a directory named sdk (for example). Then changes in the
buildozer.spec:
[app]
source.exclude_dirs = sdk
android.permissions = INTERNET, CAMERA, WRITE_EXTERNAL_STORAGE
android.add_libs_armeabi = sdk/libs/armeabi/*.so
android.add_libs_armeabi_v7a = sdk/libs/armeabi-v7a/*.so
android.add_libs_x86 = sdk/libs/x86/*.so
android.add_libs_mips = sdk/libs/mips/*.so
Then (currently), you need to copy the pymoodstocks directory into your app.
## Usage
Create a Moodstocks instance and pass your Moodstocks API key/secret:
from pymoodstocks import Moodstocks
moodstocks = Moodstocks(KEY, SECRET)
Then, you can bind a method to get the scan result on the fly:
def on_scan(self, result_type, result_data):
print("I got something of type {}: {}".format(
result_type, result_data))
moodstocks.stop()
def on_button_clicked(self, result_type, result_data):
print("Button DONE click, stop the scanner")
moodstocks.stop()
moodstocks.bind(on_scan=self.on_scan,
on_button_clicked=self.on_button_clicked)
At any time, you can start the scanner:
moodstocks.start()
The scanner will stop processing after it detect something / on_scan method is
called. You could resume the scanner instead of closing it by calling:
moodstocks.resume()
## Todo
- Let the user choose which type to search for
- Implement synchronisation callback on iOS