diff --git a/bridges/python/Pipfile b/bridges/python/Pipfile index 5af4c007c..4e7695306 100644 --- a/bridges/python/Pipfile +++ b/bridges/python/Pipfile @@ -8,5 +8,6 @@ requests = "==2.21.0" pytube = "==9.5.0" tinydb = "==3.9.0" beautifulsoup4 = "==4.7.1" +tmdbsimple = "==2.2.0" [dev-packages] diff --git a/bridges/python/Pipfile.lock b/bridges/python/Pipfile.lock index 54fc9aed1..9da87c6fa 100644 --- a/bridges/python/Pipfile.lock +++ b/bridges/python/Pipfile.lock @@ -1,12 +1,10 @@ { "_meta": { "hash": { - "sha256": "73bde89b379ffec7cec145fa30f1ebb49c349204b730a94108151fd9b71b31ec" + "sha256": "18fcaba60d56141e0e72fe9b030659fbcef1065ed0a3d73e8832b1dabf994a4c" }, "pipfile-spec": 6, - "requires": { - "python_version": "3.6" - }, + "requires": {}, "sources": [ { "name": "pypi", @@ -77,6 +75,14 @@ "index": "pypi", "version": "==3.9.0" }, + "tmdbsimple": { + "hashes": [ + "sha256:3383780ae40fbc2b5197feb06496f81f3a5c0ff3336a2a971a51e638fb10c895", + "sha256:cd8c5bc3599e803f1f908339b3d010e138722d147f10ed410b3205c72db0c00c" + ], + "index": "pypi", + "version": "==2.2.0" + }, "urllib3": { "hashes": [ "sha256:2393a695cd12afedd0dcb26fe5d50d0cf248e5a66f75dbd89a3d4eb333a61af4", diff --git a/packages/Pipfile b/packages/Pipfile new file mode 100644 index 000000000..e69de29bb diff --git a/packages/cinema/README.md b/packages/cinema/README.md new file mode 100644 index 000000000..f94806130 --- /dev/null +++ b/packages/cinema/README.md @@ -0,0 +1,51 @@ +# Cinema Package + +![](https://media.discordapp.net/attachments/587078058130014240/601166722061434937/cinema.png) + +## Introduction + +This package add cinema skills for Leon. He can recommend to you series and movies, tell you wich movies are in theatre or provide information about movie, serie or people (related with cinema btw). + +### Traduction + +| Language / Module | Recommend | Movie in theatre | Info m/t/p | +| ----------------- | --------- | ---------------- | ---------- | +| EN-US | X | X | X | +| FR | | | | +| IT | | | | + + + +## Commands + + ``` +Leon, can you recommend a movie ? +or +Leon, can you recommend a serie ? + ``` + +Leon random choose an movie or an serie. + +``` +What movies are in theatres ? +``` + +Leon tell you which movies are actually in theatres. It's the **international** box office, if your country have a specific day in the week for movie release he doesn't take it into account. + +``` +Can you provide information about Star Wars/Capitain Marvel/Game of Thrones/ Tom Cruz with moviedb ? +``` + +It's going to give you some information about movies collection, movie, serie or people. + +## Dev part + +As you can see on the last sentence we can specify the API, default API is The Movie DB (TMDB) but the entity actually exist, you can use it. + + + +## Licence + +Data DB : https://www.themoviedb.org/ + +Librairie : https://pypi.org/project/tmdbsimple/ diff --git a/packages/cinema/__init__.py b/packages/cinema/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/packages/cinema/cinema.py b/packages/cinema/cinema.py new file mode 100644 index 000000000..729b354be --- /dev/null +++ b/packages/cinema/cinema.py @@ -0,0 +1,198 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- + +import utils +import tmdbsimple as tmdb +import functools +import random as ran +import datetime as dt +import json + +# Package database +db = utils.db()['db'] + +# Query +Query = utils.db()['query']() + + +def load_config(func): + @functools.wraps(func) + def wrapper_load_config(string, entities): + # Init "payload" as dictionary + payload = dict() + # Put data in payload + payload["string"] = string + payload["entities"] = entities + # ISO 639-1 language code + payload["lang"] = utils.getqueryobj()["lang"][:2] + payload["today"] = dt.date.today() + + # Load API key + payload["API_KEY"] = utils.config('API_KEY') + tmdb.API_KEY = payload["API_KEY"] + if payload["API_KEY"] == "YOUR_API_KEY": + return utils.output("end", "wrong_key", utils.translate("wrong_key")) + + # Load words files who permit to check if user ask for a serie or a movie in every language + with open('packages/cinema/data/words/movie.json') as json_data: + payload["trl_movie"] = json.load(json_data) + with open('packages/cinema/data/words/serie.json') as json_data: + payload["trl_serie"] = json.load(json_data) + + return func(payload) + + return wrapper_load_config + + +@load_config +def recommend(payload): + """ + Recommend Series or Movies. (random movies/series on movieDB with > 7 stars) + """ + # Init flags for movie and serie + flag_movie = 0 + flag_serie = 0 + + # Search the type of requested data (movie or serie) with regex (translate it) + for item in payload["entities"]: + if item["entity"] == "Movie": + flag_movie = 1 + elif item["entity"] == "Serie": + flag_serie = 1 + else: + return utils.output('end', 'Error', utils.translate('Error')) + + # In case of the user ask strange things. + if flag_serie == 0 and flag_movie == 0 : + return utils.output("end", "not_found", utils.translate("not_found")) + + # If user request a movie + elif flag_movie == 1: + # If database exist he don't request + if db.search(Query.type == 'rmovie_request'): + payload["movie"] = db.search(Query.type == 'rmovie_request')[0]['content'] + o_id = db.search(Query.type == 'rmovie_request')[0]['old_id'] + o_id = o_id + 1 + db.update({"old_id": o_id}, Query.type == 'rmovie_request') + # Remove information from database after 10 utilisations + db.remove(Query.type == 'rmovie_request' and Query.old_id > 10) + else: + # Get an random movie with user's language + payload["movie"] = tmdb.Discover().movie( + page=ran.randint(0, 1000), + language=payload["lang"], + vote_average_gte=7.00) + # Insert JSON file in the database + db.insert({'type': 'rmovie_request','old_id': 0, 'content': payload["movie"]}) + + # Reach some information + movie_nO = ran.randint(0, 20) + movie = payload["movie"]["results"][movie_nO] + movie_title = movie["title"] + movie_rdate = movie["release_date"] + movie_sum = movie["overview"] + + return utils.output('end', 'recommend-m', utils.translate('recommend-m', { + "movie_title": movie_title, + "release_date": movie_rdate, + "summarize": movie_sum})) + # same here but with serie + elif flag_serie == 1: + if db.search(Query.type == 'rserie_request'): + payload["serie"] = db.search(Query.type == 'rserie_request')[0]['content'] + o_id = db.search(Query.type == 'rserie_request')[0]['old_id'] + o_id = o_id + 1 + db.update({"old_id": o_id}, Query.type == 'rserie_request') + db.remove(Query.type == 'rserie_request' and Query.old_id > 10) + else: + # Get an random serie with user's language + payload["serie"] = tmdb.Discover().tv( + page=ran.randint(0, 1000), + language=payload["lang"], + vote_average_gte=7.00) + db.insert({'type': 'rserie_request', 'old_id': 0, 'content': payload["serie"]}) + + serie_nO = ran.randint(0, 20) + serie = payload["serie"]["results"][serie_nO] + serie_title = serie["name"] + serie_rdate = serie["first_air_date"] + serie_sum = serie["overview"] + + return utils.output('end', 'recommend-t', utils.translate('recommend-t', { + "serie_title": serie_title, + "release_date": serie_rdate, + "summarize": serie_sum})) + + +@load_config +def now_theatres(payload): + """ + Displays the list of recently released movies + """ + #Ask API about movies + now_in_theatres = tmdb.Discover().movie( + primary_release_date=payload["today"], + language=payload["lang"]) + res = '" + + return utils.output("end", "nit_list", utils.translate('nit_list', { + "nit_title": res + })) + +@load_config +def info(payload): + """ + Give information about movies, collections, series and peoples. + """ + for item in payload["entities"]: + if item["entity"] == "title": + data_title = item["sourceText"] + + # Search if it's an collection + data_info = tmdb.Search().collection(query=data_title, language=payload["lang"]) + # If not re-ask API with multi research + if data_info["total_results"] == 0: + data_info = tmdb.Search().multi(query=data_title, language=payload["lang"]) + if data_info["total_results"] == 0: + return utils.output('end', 'not_found_title', utils.translate('not_found_title',{ + "idk_request": data_title + })) + elif data_info["results"][0]["media_type"] == "movie": + movie_overview = data_info["results"][0]["overview"] + movie_rdate = data_info["results"][0]["release_date"] + movie_title = data_info["results"][0]["title"] + + return utils.output("end", "info-m", utils.translate("info-m", { + "title": movie_title.title(), + "release_date": movie_rdate, + "overview": movie_overview + })) + elif data_info["results"][0]["media_type"] == "tv": + tv_overview = data_info["results"][0]["overview"] + tv_rdate = data_info["results"][0]["first_air_date"] + tv_title = data_info["results"][0]["name"] + + return utils.output("end", "info-t", utils.translate("info-t", { + "title": tv_title.title(), + "release_date": tv_rdate, + "overview": tv_overview + })) + elif data_info["results"][0]["media_type"] == "person": + people_name = data_info["results"][0]["name"] + title_know_for = data_info["results"][0]["known_for"][0]["title"] + rdate_know_for = data_info["results"][0]["known_for"][0]["release_date"] + + return utils.output("end", "info-p", utils.translate("info-p", { + "name": people_name.title(), + "release_date": rdate_know_for, + "maj-movie-title": title_know_for + })) + else: + data_overview = data_info["results"][0]["overview"] + + return utils.output("end", "info-c", utils.translate('info-c', { + "title": data_title.title(), + "overview": data_overview})) diff --git a/packages/cinema/config/config.sample.json b/packages/cinema/config/config.sample.json new file mode 100644 index 000000000..00e58759e --- /dev/null +++ b/packages/cinema/config/config.sample.json @@ -0,0 +1,6 @@ +{ + "cinema": { + "API_KEY": "YOUR_API_KEY", + "options": {} + } +} diff --git a/packages/cinema/data/answers/en.json b/packages/cinema/data/answers/en.json new file mode 100644 index 000000000..0b4cf1df4 --- /dev/null +++ b/packages/cinema/data/answers/en.json @@ -0,0 +1,46 @@ +{ + "cinema": { + "recommend-m": [ + "I advise you to watch %movie_title% released on %release_date%, it can be summarized as follows :\n %summarize%.", + "I recommend you to watch %movie_title% released on %release_date%, it can be summarized as follows :\n %summarize%.", + "One day, you should watch %movie_title% released on %release_date%, I tought it was a nice movie, I can summarize it as follows :\n %summarize%." + ], + "recommend-t": [ + "I advise you to watch %serie_title% released on %release_date%, it can be summarized as follows :\n %summarize%.", + "I recommend you to watch %serie_title% released on %release_date%, it can be summarized as follows :\n %summarize%.", + "One day, you should watch %serie_title% released on %release_date%, I tought it was a nice serie, I can summarize it as follows :\n %summarize%." + ], + "test":[ + "%test%." + ], + "nit_list":[ + "The films currently in the cinema are: \n %nit_title%\n It's internationnal box office." + ], + "info-c":[ + "%title% can be summarized as follows : %overview%." + ], + "info-m":[ + "%title% was released on %release_date%, it can be summarized as follows :\n %overview%.", + "I can summarize %title% as follows:\n %overview% \n did you know that it released on %release_date% ? Now you know." + ], + "info-t":[ + "%title% was released on %release_date%, it can be summarized as follows :\n %overview%." + ], + "info-p":[ + "%name% was know for %maj-movie-title% it released on %release_date%." + ], + "wrong_key":[ + "You have not entered any API key. If you don't have one yet you can go here and once retrieved go modify the configuration file." + ], + "error":[ + "Error." + ], + "not_found":[ + "I don't know this word." + ], + "not_found_title":[ + "I don't know \"%idk_request%\".", + "I found nothing about \"%idk_request%\"." + ] + } +} diff --git a/packages/cinema/data/expressions/en.json b/packages/cinema/data/expressions/en.json new file mode 100644 index 000000000..04628ecc5 --- /dev/null +++ b/packages/cinema/data/expressions/en.json @@ -0,0 +1,62 @@ +{ + "cinema": { + "recommend":{ + "expressions":[ + "Leon, can you recommend a ?", + "Can you recommend a ?", + "Do you have a to recommend ?" + ], + "entities": [ + { + "type": "regex", + "name": "Movie", + "regex": "film|movie" + }, + { + "type": "regex", + "name": "Serie", + "regex": "serie|show" + } + ] + }, + "now_theatres":{ + "expressions":[ + "What movies are in theatres ?" + ] + }, + "info":{ + "expressions":[ + "Can you provide information about with moviedb?", + "Give information about with moviedb" + ], + "entities": [ + { + "type": "trim", + "name": "title", + "conditions": [ + { + "type": "between", + "from": "about", + "to": "with" + }, + { + "type": "after_last", + "from": "about" + } + ] + }, + { + "type": "trim", + "name": "API", + "conditions": [ + { + "type": "between", + "from": "with", + "to": "?" + } + ] + } + ] + } + } +} diff --git a/packages/cinema/data/words/movie.json b/packages/cinema/data/words/movie.json new file mode 100644 index 000000000..e6772ca5b --- /dev/null +++ b/packages/cinema/data/words/movie.json @@ -0,0 +1 @@ +[{"locale":"af","country":"Afrikaans","string":"Fliek"},{"locale":"ar","country":"Arabic","string":"فيلم"},{"locale":"az","country":"Azerbaijani","string":"film"},{"locale":"be","country":"Belarusian","string":"фільм"},{"locale":"bg","country":"Bulgarian","string":"филм"},{"locale":"bn","country":"Bengali","string":"সিনেমা"},{"locale":"bs","country":"Bosnian","string":"film"},{"locale":"ca","country":"Catalan","string":"pel·lícula"},{"locale":"ceb","country":"Cebuano","string":"movie"},{"locale":"cs","country":"Czech","string":"film"},{"locale":"cy","country":"Welsh","string":"ffilm"},{"locale":"da","country":"Danish","string":"film"},{"locale":"de","country":"German","string":"Film"},{"locale":"el","country":"Greek","string":"ταινία"},{"locale":"en","country":"English","string":"movie"},{"locale":"eo","country":"Esperanto","string":"movie"},{"locale":"es","country":"Spanish","string":"película"},{"locale":"et","country":"Estonian","string":"Film"},{"locale":"eu","country":"Basque","string":"movie"},{"locale":"fa","country":"Persian","string":"فیلم سینما"},{"locale":"fi","country":"Finnish","string":"elokuva"},{"locale":"fr","country":"French","string":"film"},{"locale":"ga","country":"Irish","string":"scannán"},{"locale":"gl","country":"Galician","string":"película"},{"locale":"gu","country":"Gujarati","string":"મૂવી"},{"locale":"ha","country":"Hausa","string":"fim"},{"locale":"hi","country":"Hindi","string":"चलचित्र"},{"locale":"hmn","country":"Hmong","string":"movie"},{"locale":"hr","country":"Croatian","string":"film"},{"locale":"ht","country":"Haitian Creole","string":"fim"},{"locale":"hu","country":"Hungarian","string":"film"},{"locale":"hy","country":"Armenian","string":"ֆիլմը"},{"locale":"id","country":"Indonesian","string":"film"},{"locale":"ig","country":"Igbo","string":"ihe nkiri"},{"locale":"is","country":"Icelandic","string":"bíómynd"},{"locale":"it","country":"Italian","string":"film"},{"locale":"iw","country":"Hebrew","string":"סרט"},{"locale":"ja","country":"Japanese","string":"映画"},{"locale":"jw","country":"Javanese","string":"film"},{"locale":"ka","country":"Georgian","string":"ფილმი"},{"locale":"kk","country":"Kazakh","string":"фильм"},{"locale":"km","country":"Khmer","string":"ខ្សែភាពយន្ត"},{"locale":"kn","country":"Kannada","string":"ಚಲನಚಿತ್ರ"},{"locale":"ko","country":"Korean","string":"영화"},{"locale":"la","country":"Latin","string":"movie"},{"locale":"lo","country":"Lao","string":"ຮູບ​ເງົາ"},{"locale":"lt","country":"Lithuanian","string":"filmas"},{"locale":"lv","country":"Latvian","string":"filmu"},{"locale":"mg","country":"Malagasy","string":"sarimihetsika"},{"locale":"mi","country":"Maori","string":"kiriata"},{"locale":"mk","country":"Macedonian","string":"филм"},{"locale":"ml","country":"Malayalam","string":"സിനിമ"},{"locale":"mn","country":"Mongolian","string":"кино"},{"locale":"mr","country":"Marathi","string":"चित्रपट"},{"locale":"ms","country":"Malay","string":"filem"},{"locale":"mt","country":"Maltese","string":"film"},{"locale":"my","country":"Myanmar (Burmese)","string":"ရုပ်ရှင်"},{"locale":"ne","country":"Nepali","string":"चलचित्र"},{"locale":"nl","country":"Dutch","string":"film"},{"locale":"no","country":"Norwegian","string":"film"},{"locale":"ny","country":"Chichewa","string":"kanema"},{"locale":"pa","country":"Punjabi","string":"ਫਿਲਮ"},{"locale":"pl","country":"Polish","string":"film"},{"locale":"pt","country":"Portuguese","string":"filme"},{"locale":"ro","country":"Romanian","string":"film"},{"locale":"ru","country":"Russian","string":"кино"},{"locale":"si","country":"Sinhala","string":"චිත්රපටය"},{"locale":"sk","country":"Slovak","string":"film"},{"locale":"sl","country":"Slovenian","string":"film"},{"locale":"so","country":"Somali","string":"filim"},{"locale":"sq","country":"Albanian","string":"film"},{"locale":"sr","country":"Serbian","string":"филм"},{"locale":"st","country":"Sesotho","string":"filimi"},{"locale":"su","country":"Sundanese","string":"Pilem"},{"locale":"sv","country":"Swedish","string":"film"},{"locale":"sw","country":"Swahili","string":"movie"},{"locale":"ta","country":"Tamil","string":"திரைப்பட"},{"locale":"te","country":"Telugu","string":"సినిమా"},{"locale":"tg","country":"Tajik","string":"филм"},{"locale":"th","country":"Thai","string":"หนัง"},{"locale":"tl","country":"Filipino","string":"pelikula"},{"locale":"tr","country":"Turkish","string":"film"},{"locale":"uk","country":"Ukrainian","string":"фільм"},{"locale":"ur","country":"Urdu","string":"فلم"},{"locale":"uz","country":"Uzbek","string":"film"},{"locale":"vi","country":"Vietnamese","string":"bộ phim"},{"locale":"yi","country":"Yiddish","string":"פֿילם"},{"locale":"yo","country":"Yoruba","string":"fiimu"},{"locale":"zh","country":"Chinese","string":"电影"},{"locale":"zh-CN","country":"Chinese (Simplified)","string":"电影"},{"locale":"zh-TW","country":"Chinese (Traditional)","string":"電影"},{"locale":"zu","country":"Zulu","string":"movie"}] diff --git a/packages/cinema/data/words/serie.json b/packages/cinema/data/words/serie.json new file mode 100644 index 000000000..0fc363cdb --- /dev/null +++ b/packages/cinema/data/words/serie.json @@ -0,0 +1 @@ +[{"locale":"af","country":"Afrikaans","string":"reeks"},{"locale":"ar","country":"Arabic","string":"سلسلة"},{"locale":"az","country":"Azerbaijani","string":"seriya"},{"locale":"be","country":"Belarusian","string":"серыя"},{"locale":"bg","country":"Bulgarian","string":"серия"},{"locale":"bn","country":"Bengali","string":"ক্রম"},{"locale":"bs","country":"Bosnian","string":"serija"},{"locale":"ca","country":"Catalan","string":"sèrie"},{"locale":"ceb","country":"Cebuano","string":"sunod-sunod nga"},{"locale":"cs","country":"Czech","string":"série"},{"locale":"cy","country":"Welsh","string":"cyfres"},{"locale":"da","country":"Danish","string":"serie"},{"locale":"de","country":"German","string":"serie"},{"locale":"el","country":"Greek","string":"σειρά"},{"locale":"en","country":"English","string":"serie"},{"locale":"eo","country":"Esperanto","string":"serie"},{"locale":"es","country":"Spanish","string":"serie"},{"locale":"et","country":"Estonian","string":"seeria"},{"locale":"eu","country":"Basque","string":"series"},{"locale":"fa","country":"Persian","string":"سلسله"},{"locale":"fi","country":"Finnish","string":"sarja"},{"locale":"fr","country":"French","string":"série"},{"locale":"ga","country":"Irish","string":"sraith"},{"locale":"gl","country":"Galician","string":"serie"},{"locale":"gu","country":"Gujarati","string":"શ્રેણી"},{"locale":"ha","country":"Hausa","string":"jerin"},{"locale":"hi","country":"Hindi","string":"शृंखला"},{"locale":"hmn","country":"Hmong","string":"serie"},{"locale":"hr","country":"Croatian","string":"serija"},{"locale":"ht","country":"Haitian Creole","string":"seri"},{"locale":"hu","country":"Hungarian","string":"sorozat"},{"locale":"hy","country":"Armenian","string":"շարք"},{"locale":"id","country":"Indonesian","string":"seri"},{"locale":"ig","country":"Igbo","string":"usoro"},{"locale":"is","country":"Icelandic","string":"röð"},{"locale":"it","country":"Italian","string":"serie"},{"locale":"iw","country":"Hebrew","string":"סדרה"},{"locale":"ja","country":"Japanese","string":"シリーズ"},{"locale":"jw","country":"Javanese","string":"seri"},{"locale":"ka","country":"Georgian","string":"სერია"},{"locale":"kk","country":"Kazakh","string":"серия"},{"locale":"km","country":"Khmer","string":"ស៊េរី"},{"locale":"kn","country":"Kannada","string":"ಸರಣಿ"},{"locale":"ko","country":"Korean","string":"시리즈"},{"locale":"la","country":"Latin","string":"serie"},{"locale":"lo","country":"Lao","string":"ຊຸດ"},{"locale":"lt","country":"Lithuanian","string":"serija"},{"locale":"lv","country":"Latvian","string":"sērija"},{"locale":"mg","country":"Malagasy","string":"andian-dahatsoratra"},{"locale":"mi","country":"Maori","string":"raupapa"},{"locale":"mk","country":"Macedonian","string":"серија"},{"locale":"ml","country":"Malayalam","string":"പരമ്പര"},{"locale":"mn","country":"Mongolian","string":"цуврал"},{"locale":"mr","country":"Marathi","string":"मालिका"},{"locale":"ms","country":"Malay","string":"siri"},{"locale":"mt","country":"Maltese","string":"serje"},{"locale":"my","country":"Myanmar (Burmese)","string":"စီးရီး"},{"locale":"ne","country":"Nepali","string":"श्रृंखला"},{"locale":"nl","country":"Dutch","string":"serie"},{"locale":"no","country":"Norwegian","string":"serien"},{"locale":"ny","country":"Chichewa","string":"mndandanda"},{"locale":"pa","country":"Punjabi","string":"ਲੜੀ '"},{"locale":"pl","country":"Polish","string":"seria"},{"locale":"pt","country":"Portuguese","string":"série"},{"locale":"ro","country":"Romanian","string":"serie"},{"locale":"ru","country":"Russian","string":"серия"},{"locale":"si","country":"Sinhala","string":"මාලාවක්"},{"locale":"sk","country":"Slovak","string":"séria"},{"locale":"sl","country":"Slovenian","string":"serija"},{"locale":"so","country":"Somali","string":"taxane"},{"locale":"sq","country":"Albanian","string":"seri"},{"locale":"sr","country":"Serbian","string":"серија"},{"locale":"st","country":"Sesotho","string":"letoto la lihlooho"},{"locale":"su","country":"Sundanese","string":"runtuyan"},{"locale":"sv","country":"Swedish","string":"serie"},{"locale":"sw","country":"Swahili","string":"mfululizo"},{"locale":"ta","country":"Tamil","string":"தொடர்"},{"locale":"te","country":"Telugu","string":"సిరీస్"},{"locale":"tg","country":"Tajik","string":"силсила"},{"locale":"th","country":"Thai","string":"ชุด"},{"locale":"tl","country":"Filipino","string":"serye"},{"locale":"tr","country":"Turkish","string":"dizi"},{"locale":"uk","country":"Ukrainian","string":"серія"},{"locale":"ur","country":"Urdu","string":"سلسلہ"},{"locale":"uz","country":"Uzbek","string":"qator"},{"locale":"vi","country":"Vietnamese","string":"loạt"},{"locale":"yi","country":"Yiddish","string":"סעריע"},{"locale":"yo","country":"Yoruba","string":"jara"},{"locale":"zh","country":"Chinese","string":"系列"},{"locale":"zh-CN","country":"Chinese (Simplified)","string":"系列"},{"locale":"zh-TW","country":"Chinese (Traditional)","string":"系列"},{"locale":"zu","country":"Zulu","string":"uchungechunge"}] diff --git a/packages/cinema/test/cinema.spec.js b/packages/cinema/test/cinema.spec.js new file mode 100644 index 000000000..496a5403c --- /dev/null +++ b/packages/cinema/test/cinema.spec.js @@ -0,0 +1,109 @@ +'use strict' + +describe('cinema:cinema', async () => { + test('[Feature] Recommend movie', async () => { + global.nlu.brain.execute = jest.fn() + await global.nlu.process('Can you recommend a movie ?') + + const [obj] = global.nlu.brain.execute.mock.calls + await global.brain.execute(obj[0]) + + expect(global.brain.finalOutput.codes).toIncludeSameMembers(['recommend-m']) + }) +}) + +describe('cinema:cinema', async () => { + test('[Feature] Recommend serie', async () => { + global.nlu.brain.execute = jest.fn() + await global.nlu.process('Can you recommend a serie ?') + + const [obj] = global.nlu.brain.execute.mock.calls + await global.brain.execute(obj[0]) + + expect(global.brain.finalOutput.codes).toIncludeSameMembers(['recommend-t']) + }) +}) + +describe('cinema:cinema', async () => { + test('[Error management] Recommend failed error message', async () => { + global.nlu.brain.execute = jest.fn() + await global.nlu.process('Can you recommend a blublu ?') + + const [obj] = global.nlu.brain.execute.mock.calls + await global.brain.execute(obj[0]) + + expect(global.brain.finalOutput.codes).toIncludeSameMembers(['not_found']) + }) +}) + +describe('cinema:cinema', async () => { + test('[Feature] Request information about an movie', async () => { + global.nlu.brain.execute = jest.fn() + await global.nlu.process('Can you provide information about Captain Marvel ?') + + const [obj] = global.nlu.brain.execute.mock.calls + await global.brain.execute(obj[0]) + + expect(global.brain.finalOutput.codes).toIncludeSameMembers(['info-m']) + }) +}) + +describe('cinema:cinema', async () => { + test('[Feature] Request information about an serie or tv show', async () => { + global.nlu.brain.execute = jest.fn() + await global.nlu.process('Can you provide information about Big Bang Theory ?') + + const [obj] = global.nlu.brain.execute.mock.calls + await global.brain.execute(obj[0]) + + expect(global.brain.finalOutput.codes).toIncludeSameMembers(['info-t']) + }) +}) + +describe('cinema:cinema', async () => { + test('[Feature] Request information about an actor/realisator/productor', async () => { + global.nlu.brain.execute = jest.fn() + await global.nlu.process('Can you provide information about Tom Cruz ?') + + const [obj] = global.nlu.brain.execute.mock.calls + await global.brain.execute(obj[0]) + + expect(global.brain.finalOutput.codes).toIncludeSameMembers(['info-p']) + }) +}) + +describe('cinema:cinema', async () => { + test('[Feature] Request information about an collection of movie', async () => { + global.nlu.brain.execute = jest.fn() + await global.nlu.process('Can you provide information about Star Wars ?') + + const [obj] = global.nlu.brain.execute.mock.calls + await global.brain.execute(obj[0]) + + expect(global.brain.finalOutput.codes).toIncludeSameMembers(['info-c']) + }) +}) + +describe('cinema:cinema', async () => { + test('[Error management] Info failed error message', async () => { + global.nlu.brain.execute = jest.fn() + await global.nlu.process('Can you provide information about blublu ?') + + const [obj] = global.nlu.brain.execute.mock.calls + await global.brain.execute(obj[0]) + + expect(global.brain.finalOutput.codes).toIncludeSameMembers(['not_found_title']) + }) +}) + +describe('cinema:cinema', async () => { + test('[Feature] List of movies actually in theatres (internationnal box office)', async () => { + global.nlu.brain.execute = jest.fn() + await global.nlu.process('What movies are in theatres ?') + + const [obj] = global.nlu.brain.execute.mock.calls + await global.brain.execute(obj[0]) + + expect(global.brain.finalOutput.codes).toIncludeSameMembers(['nit_list']) + }) +}) diff --git a/packages/cinema/version.txt b/packages/cinema/version.txt new file mode 100644 index 000000000..3eefcb9dd --- /dev/null +++ b/packages/cinema/version.txt @@ -0,0 +1 @@ +1.0.0