màj prochains films, problème de décalage de i
This commit is contained in:
parent
ddd7d5df56
commit
ca9efc0c87
3 changed files with 26 additions and 22 deletions
|
@ -5,8 +5,8 @@ Created on Mon Aug 21 13:54:39 2017
|
|||
@author: alice
|
||||
"""
|
||||
|
||||
import shelve
|
||||
import pickle
|
||||
import json
|
||||
|
||||
class film():
|
||||
|
||||
|
@ -72,8 +72,12 @@ class film():
|
|||
res += "\centerline{\emph{\Large " + self.nom + "}} \n"
|
||||
res += "\centerline{" + self.realisateur + " (" + str(self.annee) + ") } \n"
|
||||
res += "\medskip \n"
|
||||
#res += "\centerline{" + !!ACTEURS!! + "}\n"
|
||||
#res += "\centerline{" + !!ACTEURS bis!! + "}\n"
|
||||
if len(self.acteurs) == 1 :
|
||||
res += "\centerline{" + self.acteurs[0] + "}\n"
|
||||
if len(self.acteurs) >= 2 :
|
||||
res += "\centerline{" + self.acteurs[0]+ ', ' + self.acteurs[1] + "}\n"
|
||||
if len(self.acteurs) > 2 :
|
||||
res += "\centerline{" + self.acteurs[2] + "}\n"
|
||||
res += "\medskip \n"
|
||||
res += "\centerline{\\textit{" + self.duree + "}}\n \n"
|
||||
res += "\medskip\n"
|
||||
|
@ -125,13 +129,7 @@ def strListe(liste):
|
|||
|
||||
i = 38
|
||||
|
||||
def nouveauFilm(dicFilms = {}, index = {}):
|
||||
ind, dic = True, True
|
||||
if dicFilms == {}:
|
||||
with open('filmsCode', 'rb') as file:
|
||||
pickler = pickle.Unpickler(file)
|
||||
dicFilms = pickler.load()
|
||||
dic = False
|
||||
def nouveauFilmIn(dicFilms, index = {}):
|
||||
if index == {}:
|
||||
with open('index', 'rb') as index:
|
||||
pickler = pickle.Unpickler(index)
|
||||
|
@ -158,34 +156,40 @@ def nouveauFilm(dicFilms = {}, index = {}):
|
|||
pickler = pickle.Pickler(index)
|
||||
pickler.dump(dicIndex)
|
||||
pickler.dump(i)
|
||||
if not(dic):
|
||||
with open('filmsCode', 'wb') as fichier:
|
||||
mon_pickler = pickle.Pickler(fichier)
|
||||
mon_pickler.dump(dicFilms)
|
||||
return seance
|
||||
|
||||
def nouveauFilm():
|
||||
with shelve.open('filmsShelve') as db:
|
||||
nouveauFilmIn(db)
|
||||
|
||||
def getIndex():
|
||||
with open('index', 'rb') as index:
|
||||
pickler = pickle.Unpickler(index)
|
||||
dicIndex = pickler.load()
|
||||
i = pickler.load() + 1
|
||||
return dicIndex
|
||||
|
||||
def getFilms():
|
||||
with open('filmsCode2', 'rb') as file:
|
||||
pickler = pickle.Unpickler(file)
|
||||
dicFilms = pickler.load()
|
||||
return dicFilms
|
||||
res = {}
|
||||
with shelve.open('filmsShelve') as db:
|
||||
for f in db:
|
||||
res[f] = updateFilm(db[f])
|
||||
return res
|
||||
|
||||
def setFilms(dico):
|
||||
with open('filmsCode', 'wb') as fichier:
|
||||
mon_pickler = pickle.Pickler(fichier)
|
||||
mon_pickler.dump(dico)
|
||||
with shelve.open('filmsShelve', writeback = True) as db:
|
||||
for f in dico:
|
||||
db[f] = updateFilm(dico[f])
|
||||
|
||||
def updateFilm(a):
|
||||
res = film(a.i, a.idN, a.date, a.nom, a.acteurs, a.realisateur, a.duree, a.synopsis, a.pays, a.annee, a.youtube, a.couleur)
|
||||
return res
|
||||
|
||||
def updateShelve():
|
||||
with shelve.open('filmsShelve') as db:
|
||||
for f in db:
|
||||
db[f] = updateFilm(db[f])
|
||||
|
||||
|
||||
|
||||
#print(enqSex.mail())
|
||||
|
||||
|
|
BIN
filmsShelve
BIN
filmsShelve
Binary file not shown.
BIN
index
BIN
index
Binary file not shown.
Loading…
Reference in a new issue