ajout gitignore
feature d'affichage des fichiers facilement ; rend caduc le fichier filmsCode
This commit is contained in:
parent
e66448c381
commit
a2744c844b
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.jpg
|
||||
*.png
|
|
@ -11,6 +11,7 @@ import pickle
|
|||
class film():
|
||||
|
||||
def __init__(self, _i, _idN, _date, _nom, _acteurs, _realisateur, _duree, _synopsis, _pays, _annee, _youtube, _couleur):
|
||||
"""ceci est une aide"""
|
||||
self.i = _i
|
||||
self.idN = _idN
|
||||
self.date = _date
|
||||
|
@ -157,11 +158,45 @@ def nouveauFilmIn(dicFilms, index = {}):
|
|||
pickler.dump(i)
|
||||
return seance
|
||||
|
||||
def updateFilmIn(dicFilms, key, index = {}):
|
||||
if index == {}:
|
||||
with open('index', 'rb') as index:
|
||||
pickler = pickle.Unpickler(index)
|
||||
dicIndex = pickler.load()
|
||||
ind = False
|
||||
i = dicFilms[key].i
|
||||
idN = input("identifiant du film ? ")
|
||||
date = input("date de la séance (format mardi JJ MOIS AAAA) ")
|
||||
nom = input("titre ? ")
|
||||
acteurs = eval(input("acteurs (format [acteur1, acteur2, ..]) ? "))
|
||||
realisateur = input("realisateur ? ")
|
||||
duree = input("durée du film ? ")
|
||||
synopsis = input("Donnez ici un synopsis rapide du film ")
|
||||
pays = input("pays de diffusion du film ? ")
|
||||
annee = input("année de sortie du film (format AAAA) ? ")
|
||||
youtube = input("adresse youtube de la bande-annonce ? ")
|
||||
couleur = eval(input("le film est-il en couleur (format True/False) ? "))
|
||||
seance = film(i, idN, date, nom, acteurs, realisateur, duree, synopsis, pays, annee, youtube, couleur)
|
||||
dicIndex[i] = key
|
||||
dicFilms[idN] = seance
|
||||
dicFilms.remove(key)
|
||||
if not(ind) :
|
||||
with open('index', 'wb') as index:
|
||||
pickler = pickle.Pickler(index)
|
||||
pickler.dump(dicIndex)
|
||||
pickler.dump(i)
|
||||
return seance
|
||||
|
||||
def nouveauFilm():
|
||||
with shelve.open('filmsShelve') as db:
|
||||
seance = nouveauFilmIn(db)
|
||||
return seance
|
||||
|
||||
def updateFilm(key):
|
||||
with shelve.open('filmsShelve') as db:
|
||||
seance = updateFilmIn(db, key)
|
||||
return seance
|
||||
|
||||
def getIndex():
|
||||
with open('index', 'rb') as index:
|
||||
pickler = pickle.Unpickler(index)
|
||||
|
@ -180,15 +215,22 @@ def setFilms(dico):
|
|||
for f in dico:
|
||||
db[f] = updateFilm(dico[f])
|
||||
|
||||
def updateFilm(a):
|
||||
def correctFilm(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():
|
||||
def correctShelf():
|
||||
with shelve.open('filmsShelve') as db:
|
||||
for f in db:
|
||||
db[f] = updateFilm(db[f])
|
||||
db[f] = correctFilm(db[f])
|
||||
|
||||
def liste(db):
|
||||
lis = [(db[k].i, k) for k in db.keys()]
|
||||
lis = sorted(lis)
|
||||
for tup in lis:
|
||||
k = tup[1]
|
||||
print(k, ' : ', db[k].nom)
|
||||
return None
|
||||
|
||||
|
||||
#print(enqSex.mail())
|
||||
|
|
BIN
filmsShelve
BIN
filmsShelve
Binary file not shown.
Loading…
Reference in a new issue