def Submit(self): self.d = self.l self.d.remove({}) Rec(self.userr_coll,self.userr_name) from movies import movie c = movie(self.lst, self.master, self.userr_coll,self.userr_name) self.destroy()
def show_movie(self, event_=None): from movies import movie from info import userinfo try: self.dict = self.userr_coll.aggregate([{ '$match': { '_id': self.userr } }]) x = list(self.dict)[0] except: self.userr_coll.insert_one({ '_id': f'{self.userr}', 'movie': [], 'recommanded': [] }) self.dict = self.userr_coll.aggregate([{ '$match': { '_id': self.userr } }]) x = list(self.dict)[0] docs = x['movie'] if len(docs) == 0: c = userinfo(self.master, self.lst, self.userr_coll, self.userr) else: c = movie(self.lst, self.master, self.userr_coll, self.userr)
def show_movie(self): from info import userinfo from movies import movie if self.db.userr.movie.find({}).count() == 0: c = userinfo(self.master, self.lst, self.db, self.userr) else: c = movie(self.lst,self.master) self.destroy()
def show_movie(self, ): from movies import movie from info import userinfo self.dict = self.userr_coll.aggregate([{ '$match': { '_id': self.userr_name } }]) x = list(self.dict)[0] docs = x['movie'] if len(docs) == 0: c = userinfo(self.master, self.lst, self.userr_coll, self.userr_name) else: c = movie(self.lst, self.master, self.userr_coll, self.userr_name) self.destroy()
def movie_info(bot, update): query = update.callback_query mid = query.message.message_id cid = query.message.chat_id bot.delete_message(chat_id=cid, message_id=mid) movieid = query.data.split(',')[1] md = movies.movie(movieid) directors = [i.data.get('name') for i in md.data.get('directors')] cast = [i.data.get('name') for i in md.data.get('cast')[:4]] countries = [i for i in md.data.get('countries')] air_date = md.data.get('original air date') rating = md.data.get('rating') votes = md.data.get('votes') cover = md.data.get('cover url') plot = md.data.get('plot')[0] # if len(plot) > 1: # plot = plot[1] # else: # plot = plot[0] title = md.data.get('title') year = md.data.get('year') box_office = md.data.get('box office') if box_office: budget = box_office.get('Budget') gross = box_office.get('Cumulative Worldwide Gross') message = f'*{title} - {year} - {", ".join(countries)} *\n' message += f'*Rating:* {rating}, *Votes:* {votes}\n' message += f"*Directors:* {', '.join(directors)}\n" message += f"*Cast:* {', '.join(cast)}\n" if box_office: message += f"*Budget:* {budget}, *Gross:* {gross},\n" message += "*Plot:*\n\n" message += f"{plot}\n\n" message += f'{cover}\n\n' logger.info(f'Sending {title}') bot.send_message(chat_id=cid, text=message, parse_mode=telegram.ParseMode.MARKDOWN, timeout=150)
import movies toy_story = movies.movie( "TOY STORY", "A Story Of A Boy Whose Toy Comes To LIfe", "https://en.wikipedia.org/wiki/Toy_Story#/media/File:Toy_Story.jpg", "https://www.youtube.com/watch?v=rNk1Wi8SvNc") print(toy_story.title)