Read up on Part One before continuing on – otherwise this post makes no sense. Why are you reading it out of order?
Day Four – Things Are Working
You’ll remember at the end of Day Three I was getting frustrated with how things were working out, and that I might need to head to a different direction. In fact, in the intervening days between pausing the project, moving to a new house, and continuing today (Tuesday), I even came across ANOTHER option that might even take all the hard work away from me:
I think this project sounds awesome and is probably a better implementation of what I want to do, but at this point it’s merely a back-up option that I’m going to hold onto.
So I know for sure that using the “auto input” option (described in Day Three) definitely works – but to me that’s very clunky and goes against the entire point of what I’m trying to do with this project. I did some extra digging and found a barcode for Maroon 5’s Red Pill Blues album (Best Buy is very handy with listing EAN barcode numbers, it turns out).
I went back to AutoSpotify and figured out how to get it to search and return results properly. I fiddled around briefly with broadcasting intents, and they worked to some extent – but not the way I wanted.
In the end I realized there was a “play media” function with AutoSpotify that I wasn’t leveraging before. I was able to play the album directly from the URL (obtained from the AutoSpotify Search).
Just to drive the point home, I want to say again – it worked. I took the barcode from the album (Red Pill Blues), searched the EAN database for the name, plugged the name into a search of Spotify’s database, and then automatically played the album.
I haven’t tested it fully with the barcode scan – that’s next. But just a quick summary again of the apps I needed to make this work:
- AutoTools (JSON Read)
- AutoSpotify (Search & Play Media)
- Also need an EAN Database API login (free version)
Full barcode test is next.
Day Five – Putting It All Together (Again)
Finally, it all came together! I grabbed some CDs from my collection. Only one of them worked – The Sheepdogs’ Learn & Burn. That’s okay – I fully expect some of these scans not to return any information (or the correct information).
The ultimate point is that I was able to scan a barcode, look up the album name in Spotify, and play it automatically. It took me a while to get there, but I’ve got it all set now.
I think the next step will be to add some checks – for example, if it can’t find product information, tell me so that I can decide to try to look it up via image search (the one I mentioned from Day Four). That type of thing. Make it a little smarter.
Anyway, if you want a copy of the task (assuming you have Android, and all of the required apps / plugins), let me know and I’ll make it available after I clean it up.