Created
October 5, 2009 20:02
-
-
Save cgrice/202395 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if __name__ == '__main__': | |
| droid = android.Android() | |
| # Scan a CD barcode | |
| barcode = droid.scanBarcode() | |
| droid.makeToast('Fetching product info') | |
| EAN = barcode['result']['SCAN_RESULT'] | |
| Scanner = RIAAScanner() | |
| # Convert EAN-13 barcode to Amazon ASIN | |
| ASIN = Scanner.get_ASIN(EAN) | |
| droid.makeToast('Scanned: '+Scanner.title+' - '+Scanner.artist) | |
| # Check ASIN against RIAA Radar | |
| safe = Scanner.is_riaa_safe(ASIN) | |
| # Notify User! | |
| if safe == 'safe': | |
| notify = '%s - %s is not associated with RIAA' % (Scanner.artist, Scanner.title) | |
| droid.notify(notify, 'Safe Album', notify) | |
| droid.makeToast(notify) | |
| elif safe == 'unsafe': | |
| notify = '%s - %s is associatd with RIAA' % (Scanner.artist, Scanner.title) | |
| droid.notify(notify, 'Unsafe Album', notify) | |
| droid.makeToast(notify) | |
| else: | |
| droid.makeToast('RIAA association unknown') | |
| droid.exitWithResultOk() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment