diff --git a/chaineTV.py b/chaineTV.py index a38d8ca..e75c6a7 100644 --- a/chaineTV.py +++ b/chaineTV.py @@ -1,4 +1,3 @@ -from tkinter import Label,Button,Frame,Tk,Entry,StringVar,LEFT,RIGHT import json import sys import os @@ -6,7 +5,12 @@ import unicodedata import webbrowser import urllib.request import re +import io +from PIL import Image,ImageTk from bs4 import BeautifulSoup +from tkinter import Label,Button,Frame,Tk,Entry,StringVar,LEFT,RIGHT,PhotoImage,Image + + class Labbelink (Label): @@ -65,17 +69,21 @@ class Interface: print(self.data[self.value.get()]) self.resultframe.update() emision=parse_emmission(strlink) + if emision: if emision == "can't find show": Label(self.resultframe,text="impssible de parser cette chaine").pack() else: + raw_data = urllib.request.urlopen(emision['img']).read() + image = ImageTk.PhotoImage(file=io.BytesIO(raw_data)) + photolabel=Label(self.resultframe,image=image) + photolabel.image = image + photolabel.pack() Labbelink(self.resultframe,("emmision ce soir: "+emision["title"]),emision['href']).pack() if len(emision['casting']) > 0: Label(self.resultframe,text="réalisateur: "+emision['casting'][0]).pack() Label(self.resultframe,text="acteur: "+str(emision['casting'][1:])).pack() - Label(self.resultframe,text="synopsys: " +emision['synopsis'],wraplength=350).pack() - - + Label(self.resultframe,text="synopsys: " +emision['synopsis'],wraplength=350).pack() else: Label(self.resultframe,text="pas de connection internet impossible de determiner l'émission du soir").pack()