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
|
@author: alice
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import shelve
|
||||||
import pickle
|
import pickle
|
||||||
import json
|
|
||||||
|
|
||||||
class film():
|
class film():
|
||||||
|
|
||||||
|
@ -72,8 +72,12 @@ class film():
|
||||||
res += "\centerline{\emph{\Large " + self.nom + "}} \n"
|
res += "\centerline{\emph{\Large " + self.nom + "}} \n"
|
||||||
res += "\centerline{" + self.realisateur + " (" + str(self.annee) + ") } \n"
|
res += "\centerline{" + self.realisateur + " (" + str(self.annee) + ") } \n"
|
||||||
res += "\medskip \n"
|
res += "\medskip \n"
|
||||||
#res += "\centerline{" + !!ACTEURS!! + "}\n"
|
if len(self.acteurs) == 1 :
|
||||||
#res += "\centerline{" + !!ACTEURS bis!! + "}\n"
|
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 += "\medskip \n"
|
||||||
res += "\centerline{\\textit{" + self.duree + "}}\n \n"
|
res += "\centerline{\\textit{" + self.duree + "}}\n \n"
|
||||||
res += "\medskip\n"
|
res += "\medskip\n"
|
||||||
|
@ -125,13 +129,7 @@ def strListe(liste):
|
||||||
|
|
||||||
i = 38
|
i = 38
|
||||||
|
|
||||||
def nouveauFilm(dicFilms = {}, index = {}):
|
def nouveauFilmIn(dicFilms, index = {}):
|
||||||
ind, dic = True, True
|
|
||||||
if dicFilms == {}:
|
|
||||||
with open('filmsCode', 'rb') as file:
|
|
||||||
pickler = pickle.Unpickler(file)
|
|
||||||
dicFilms = pickler.load()
|
|
||||||
dic = False
|
|
||||||
if index == {}:
|
if index == {}:
|
||||||
with open('index', 'rb') as index:
|
with open('index', 'rb') as index:
|
||||||
pickler = pickle.Unpickler(index)
|
pickler = pickle.Unpickler(index)
|
||||||
|
@ -158,34 +156,40 @@ def nouveauFilm(dicFilms = {}, index = {}):
|
||||||
pickler = pickle.Pickler(index)
|
pickler = pickle.Pickler(index)
|
||||||
pickler.dump(dicIndex)
|
pickler.dump(dicIndex)
|
||||||
pickler.dump(i)
|
pickler.dump(i)
|
||||||
if not(dic):
|
|
||||||
with open('filmsCode', 'wb') as fichier:
|
|
||||||
mon_pickler = pickle.Pickler(fichier)
|
|
||||||
mon_pickler.dump(dicFilms)
|
|
||||||
return seance
|
return seance
|
||||||
|
|
||||||
|
def nouveauFilm():
|
||||||
|
with shelve.open('filmsShelve') as db:
|
||||||
|
nouveauFilmIn(db)
|
||||||
|
|
||||||
def getIndex():
|
def getIndex():
|
||||||
with open('index', 'rb') as index:
|
with open('index', 'rb') as index:
|
||||||
pickler = pickle.Unpickler(index)
|
pickler = pickle.Unpickler(index)
|
||||||
dicIndex = pickler.load()
|
dicIndex = pickler.load()
|
||||||
i = pickler.load() + 1
|
|
||||||
return dicIndex
|
return dicIndex
|
||||||
|
|
||||||
def getFilms():
|
def getFilms():
|
||||||
with open('filmsCode2', 'rb') as file:
|
res = {}
|
||||||
pickler = pickle.Unpickler(file)
|
with shelve.open('filmsShelve') as db:
|
||||||
dicFilms = pickler.load()
|
for f in db:
|
||||||
return dicFilms
|
res[f] = updateFilm(db[f])
|
||||||
|
return res
|
||||||
|
|
||||||
def setFilms(dico):
|
def setFilms(dico):
|
||||||
with open('filmsCode', 'wb') as fichier:
|
with shelve.open('filmsShelve', writeback = True) as db:
|
||||||
mon_pickler = pickle.Pickler(fichier)
|
for f in dico:
|
||||||
mon_pickler.dump(dico)
|
db[f] = updateFilm(dico[f])
|
||||||
|
|
||||||
def updateFilm(a):
|
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)
|
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
|
return res
|
||||||
|
|
||||||
|
def updateShelve():
|
||||||
|
with shelve.open('filmsShelve') as db:
|
||||||
|
for f in db:
|
||||||
|
db[f] = updateFilm(db[f])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#print(enqSex.mail())
|
#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