prochains films dans filmsCode2 ; pb à régler

This commit is contained in:
Alice 2017-09-25 20:38:02 +02:00
parent f1a4a5ccea
commit 2acb5f034d
2 changed files with 27 additions and 17 deletions

View file

@ -50,7 +50,7 @@ class film():
return res return res
def calendrier(self): def calendrier(self):
res = '<!-- Film #' + str(self.i) + ' --> <div class="entry-mainblock"> <div class="entry-separator">' res = '<!-- Film #' + str(self.i) + ' --> \n \n <div class="entry-mainblock"> <div class="entry-separator">'
res += '<img class="entry-poster" src="http://www.cof.ens.fr/cineclub/blogImages/2016-2017/affiche-1-thumbnail200.jpg" alt="" /></div>' res += '<img class="entry-poster" src="http://www.cof.ens.fr/cineclub/blogImages/2016-2017/affiche-1-thumbnail200.jpg" alt="" /></div>'
res += '<div class="entry-text-info"><br /><br /><b>' + self.date +', 20h30 <br /><i>' res += '<div class="entry-text-info"><br /><br /><b>' + self.date +', 20h30 <br /><i>'
res += self.nom + '</i> de ' + self.realisateur +' (' +str(self.annee) + ')</b><br /><br />' res += self.nom + '</i> de ' + self.realisateur +' (' +str(self.annee) + ')</b><br /><br />'
@ -62,7 +62,7 @@ class film():
res += " . " + self.pays + ". <br /> Avec : " + strListe(self.acteurs) + ".<br/><br/>" res += " . " + self.pays + ". <br /> Avec : " + strListe(self.acteurs) + ".<br/><br/>"
res += '<span class="entry-synopsis">' + self.synopsis + '</span><br/><br/></div>' res += '<span class="entry-synopsis">' + self.synopsis + '</span><br/><br/></div>'
res += '</div><br/><a style="float: right;" href="#haut">Retour en haut de page</a>' res += '</div><br/><a style="float: right;" href="#haut">Retour en haut de page</a>'
res += "<br/><!-- END OF POST --><br/>" res += "<br/>\n \n<!-- END OF POST --><br/>"
return res return res
def bocal(self): def bocal(self):
@ -122,14 +122,22 @@ def strListe(liste):
res += liste[-1] res += liste[-1]
return res return res
def nouveauFilm(): i = 38
with open('filmsCode', 'rb') as file:
pickler = pickle.Unpickler(file) def nouveauFilm(dicFilms = {}, index = {}):
dicFilms = pickler.load() ind, dic = True, True
with open('index', 'rb') as index: if dicFilms == {}:
pickler = pickle.Unpickler(index) with open('filmsCode', 'rb') as file:
dicIndex = pickler.load() pickler = pickle.Unpickler(file)
i = pickler.load() + 1 dicFilms = pickler.load()
dic = False
if index == {}:
with open('index', 'rb') as index:
pickler = pickle.Unpickler(index)
dicIndex = pickler.load()
i = pickler.load() + 1
ind = False
i += 1
idN = input("identifiant du film ? ") idN = input("identifiant du film ? ")
date = input("date de la séance (format mardi JJ MOIS AAAA) ") date = input("date de la séance (format mardi JJ MOIS AAAA) ")
nom = input("titre ? ") nom = input("titre ? ")
@ -144,13 +152,15 @@ def nouveauFilm():
seance = film(i, idN, date, nom, acteurs, realisateur, duree, synopsis, pays, annee, youtube, couleur) seance = film(i, idN, date, nom, acteurs, realisateur, duree, synopsis, pays, annee, youtube, couleur)
dicIndex[i] = idN dicIndex[i] = idN
dicFilms[idN] = seance dicFilms[idN] = seance
with open('index', 'wb') as index: if not(ind) :
pickler = pickle.Pickler(index) with open('index', 'wb') as index:
pickler.dump(dicIndex) pickler = pickle.Pickler(index)
pickler.dump(i) pickler.dump(dicIndex)
with open('filmsCode', 'wb') as fichier: pickler.dump(i)
mon_pickler = pickle.Pickler(fichier) if not(dic):
mon_pickler.dump(dicFilms) with open('filmsCode', 'wb') as fichier:
mon_pickler = pickle.Pickler(fichier)
mon_pickler.dump(dicFilms)
return seance return seance
def getIndex(): def getIndex():

BIN
filmsCode2 Normal file

Binary file not shown.