Just another project I have been messing around with for a few years and never really released...
Introducing
www.TheCocktailDB.com!
What is it?
Its an open online database of cocktail recipes. There are many other sites online but none offered a nice API, so I wrote one myself
How to use it with Kodi?
You don't yet... but there is a very simple JSON API that any developer can use to write a simple add-on. The vision is to be able to use Kodi in my kitchen/bar area to look up cocktail recipes with the remote. Hopefully a developer will jump on board and write the add-on (*Cough* Enen if you want a new project
).
Why?
Many years ago there was a plugin for Meedio called the barback script. It had lots of cocktail recipes and I missed it. I also have a
big bar in my apartment
Limitations
The online site can currently only accept user images. Adding new cocktails may come in the future depending on demand. I've already imported a load of them. There are also a load of missing ingredient pictures but I will add those over time.
How can I help?
At the moment, try uploading pictures of the cocktails you make. There are 3,000+ cocktails that need images 700x700 pixels in size.
Future
I might introduce food recipes at some point which could be very cool for a kitchen based HTPC.
API
These examples use the test Api key of "1". Please post if you want your own key for larger projects. The test key may be removed at any time if it's abused.
Code:
Search cocktail by name
http://www.thecocktaildb.com/api/json/v1/1/search.php?s=margarita
Search ingredient by name
http://www.thecocktaildb.com/api/json/v1/1/search.php?i=vodka
Lookup full cocktail details by id
http://www.thecocktaildb.com/api/json/v1/1/lookup.php?i=15112
Lookup a random cocktail
http://www.thecocktaildb.com/api/json/v1/1/random.php
Search by ingredient
http://www.thecocktaildb.com/api/json/v1/1/filter.php?i=Gin
http://www.thecocktaildb.com/api/json/v1/1/filter.php?i=Vodka
Search by alcoholic?
http://www.thecocktaildb.com/api/json/v1/1/filter.php?a=Alcoholic
http://www.thecocktaildb.com/api/json/v1/1/filter.php?a=Non_Alcoholic
Filter by Category
http://www.thecocktaildb.com/api/json/v1/1/filter.php?c=Ordinary_Drink
http://www.thecocktaildb.com/api/json/v1/1/filter.php?c=Cocktail
Filter by Glass
http://www.thecocktaildb.com/api/json/v1/1/filter.php?g=Cocktail_glass
http://www.thecocktaildb.com/api/json/v1/1/filter.php?g=Champagne_flute
List the categories, glasses, ingredients or alcoholic filters
http://www.thecocktaildb.com/api/json/v1/1/list.php?c=list
http://www.thecocktaildb.com/api/json/v1/1/list.php?g=list
http://www.thecocktaildb.com/api/json/v1/1/list.php?i=list
http://www.thecocktaildb.com/api/json/v1/1/list.php?a=list
Images
Image name corresponds to returned API ingredient name exactly
Code:
http://www.thecocktaildb.com/images/ingredients/ice-Small.png (100x100 pixels)
http://www.thecocktaildb.com/images/ingredients/ice-Medium.png (350x350 pixels)
http://www.thecocktaildb.com/images/ingredients/ice.png (700x700 pixels)
NOTE: If you have a finished project, you will need an API key, please PM me or post in this thread or email me at zag (at) kodi.tv
Added loads of drink images myself for the most popular cocktails.
Nobody else interested in drinking?
Funny project
The site looks beautiful but I can't see how this would fit at all into kodi. Do you have any examples of the meedio script you mention?
I might think about it later but the only option I see here at all is for a screensaver. Probably an excuse to look into how they work
PS: Probably a good idea to add a random method to the db. And (best) a random method that returns only complete drinks.
Basically it was just a cocktail browser idea, with a search ect. Next/Previous/Random cocktail browse. Similar to a movie showcase view.
I could make some API methods to browse the cocktails by ingredients with filters or something.
There is a nice android app that I use on my phone but it would be nice to have it inside Kodi one day.
https://play.google.com/store/apps/detai...tion.cflow
EDIT: API random (must contain cocktail image)
Code:
http://www.thecocktaildb.com/api/json/v1/1/random.php
Ok, it seems it is your lucky day (...or not since you just got Ola John in Reading FC
)
It is both a program addon and an interactive screensaver for Kodi (Feedreader was used as a base so thanks to the developer). At the moment the program addon just executes the same code as the screensaver but it is pretty simple to develop a browsing interface using the default kodi views to browse categories and drinks. The "cocktail recipe window" is prepared to receive also a simple cocktail and act as a "player" once (and if) you get there on the api side.
Normally screensavers will be closed as soon as you hit any input. This one is a bit different and locks specific keys:
* Context menu key (or C on a regular keyboard) will let you search cocktails
* Left or right will change the presented cocktail to a new random (*and different*) one (if quioske mode is not enabled in the addon settings).
* In case the drink has more than 6 ingredients (example Ramos Fizz #2) left and right will manually change the ingredients from 1-6 7-13 13-15. The addon switches them also without user input at 10% (fast mode) or 20% (slow mode) of the time defined to randomly present new cocktails
Screenshot of the init screen (instructions can be disabled but by default are presented on init for 2 seconds - before getting the first random drink):
In case you want a browsing interface (I think the default kodi thumbnail view will work perfectly fine for this) just add the required methods to the api. We need a way of getting all the categories in the db (by glass, by type - alchoolic etc, by genre (ordinary etc), a way to get drinks passed the filter key, and a way to retrieve drinks given the drink_id for that to be a reality.
Download here:
https://github.com/enen92/script.screensaver.cocktail
I was not expecting it but this one ended up being probably the funniest addon I've made.
Congratulations, you now officially owe me a few drinks
Regards
Superb! I knew I could tempt you
Seriously, many thanks for this, its something I've always wanted in the living room TV, and can imagine the possibilites to use Kodi in a bar now!
I cant test for a few days due to a house move, but here are a few new API methods, most are currently limited to 250 records.
Code:
Search by ingredient
http://www.thecocktaildb.com/api/json/v1/1/filter.php?i=Gin
http://www.thecocktaildb.com/api/json/v1/1/filter.php?i=Vodka
Search by alcoholic?
http://www.thecocktaildb.com/api/json/v1/1/filter.php?a=Alcoholic
http://www.thecocktaildb.com/api/json/v1/1/filter.php?a=Non_Alcoholic
Filter by Category
http://www.thecocktaildb.com/api/json/v1/1/filter.php?c=Ordinary_Drink
http://www.thecocktaildb.com/api/json/v1/1/filter.php?c=Cocktail
Filter by Glass
http://www.thecocktaildb.com/api/json/v1/1/filter.php?g=Cocktail_glass
http://www.thecocktaildb.com/api/json/v1/1/filter.php?g=Champagne_flute
List the categories, glasses, ingredients or alcoholic filters
http://www.thecocktaildb.com/api/json/v1/1/list.php?c=list
http://www.thecocktaildb.com/api/json/v1/1/list.php?g=list
http://www.thecocktaildb.com/api/json/v1/1/list.php?i=list
http://www.thecocktaildb.com/api/json/v1/1/list.php?a=list
Fair enough
Let's see where I can get with it
edit: Added a few thumbnails to the site as well so we can have some more random drinks. We should now have ~ 50.
@
zag it looks you forgot the most important method:
Given the id, return the recipe
Also (not that it matters much) you have a typo on the post above on the search by glass. The variable should be $g.
The addon is almost done. I am trying to add YouTube queries now. Later today (if I manage to finish it) I'll push to GitHub.
Cheers
As usual, nothing is that simple. It looks like an addon can't be a plugin and a screensaver at the same time (only a script + screensaver). So, I had to create the whole interface. Luckily, I borrowed a few textures from the amazing extended info script.
Just finished the plugin, it's ready for submission so please test it (when you can), see if you need anything implemented or modified and let me know.
I won't talk much about the functionalities of the script, the screenshots are self-explanatory (first 2 are the screensaver). Gotta love clearart
watch gallery
Source code: https://github.com/enen92/script.screensaver.cocktail
Download: https://github.com/enen92/script.screens...-0.0.2.zip
GPL 2 as usual.
Hope you like it
Can't thank you enough for this, its pretty much exactly how I envisioned it.
Tested it properly today, and works nicely, very fast too. Are you using the small preview images for the smaller thumbnails?
Only a few minor comments that I can think of:
- Screensaver initial message moves away a bit too fast, maybe needs another second delay.
- Clicking on the ingredients in the lookup view could go back to the cocktail browser (or maybe a description of the ingredient if I put that in the DB)
Overall fantastic work, and also great GUI design, I love the soft edge selection textures.
Get it submitted to the Official Kodi Repo and I will try to get it mentioned in the next blog add-on showcase news item.
EDIT: Oh and could you make a new thread for the add-on? So we can keep this thread seperate for the site.
I am using the default images (700x700 & 1000x1000) you have on the db, the interface despite looking different is pretty small hence the speed. Also Kodi caches the images and you don't have to grab them again if loaded once.
The initial instructions delay can be configured on the addon settings but I'll add another second to the default value.
As for the second request, it might be a bit tricky. Is doable but it will require a bit of time to implement since the xmlwindow is the same for screensaver & lookup (hence a few keys locked). I'll leave that for a further update after submission (when u implement description of ingredients on the db).
Don't know if you plan to add API keys to the site but it would be cool to use a proper key instead of '1'.
Also, I will add a way to mark drinks as favourites + a new item on the menu. Think it will be quick to implement.
If you don't like any of the builtin images for the menus just send me new ones (same size) and I will replace them.
Glad you like it
Ps: rounded textures stolen from script.extendedinfo so credits to phil (mentioned on README on GitHub)