|
|
@ -320,33 +320,6 @@ class ArchivView(generic.ListView): |
|
|
|
# slovník {(ročník, url obrázku)} |
|
|
|
urls ={} |
|
|
|
|
|
|
|
# for j, rocnik in enumerate(Rocnik.objects.all()): |
|
|
|
# urls_rocnik = {} |
|
|
|
# for i,c in enumerate(rocnik.cisla.all()): |
|
|
|
# if not c.pdf: |
|
|
|
# urls_rocnik[c.poradi] = op.join(settings.MEDIA_URL, "cislo", "png", "default.png") |
|
|
|
# else: |
|
|
|
# filename = os.path.split(c.pdf.file.name)[1].split(".")[0] |
|
|
|
# png_filename = "{}.png".format(filename) |
|
|
|
|
|
|
|
# # Pokud obrázek neexistuje nebo není aktuální, vytvoř jej |
|
|
|
# png_path = op.join(png_dir, png_filename) |
|
|
|
# if not op.exists(png_path) or \ |
|
|
|
# op.getmtime(png_path) < op.getmtime(c.pdf.path): |
|
|
|
|
|
|
|
# subprocess.call([ |
|
|
|
# "convert", |
|
|
|
# "-density", "300x300", |
|
|
|
# "-geometry", "{}x{}".format(vyska, sirka), |
|
|
|
# "-background", "white", |
|
|
|
# "-flatten", |
|
|
|
# "{}[0]".format(c.pdf.path), # titulní strana |
|
|
|
# png_path |
|
|
|
# ]) |
|
|
|
|
|
|
|
# urls_rocnik[c.poradi] = op.join(settings.MEDIA_URL, "cislo", "png", png_filename) |
|
|
|
# urls[rocnik] = urls_rocnik |
|
|
|
|
|
|
|
for i,c in enumerate(cisla): |
|
|
|
if not c.pdf: |
|
|
|
urls[c.rocnik] = op.join(settings.MEDIA_URL, "cislo", "png", "default.png") |
|
|
@ -375,35 +348,6 @@ class ArchivView(generic.ListView): |
|
|
|
|
|
|
|
print(context) |
|
|
|
|
|
|
|
# for i, c in enumerate(cisla): |
|
|
|
# if not c.pdf: |
|
|
|
# continue |
|
|
|
# filename = os.path.split(c.pdf.file.name)[1].split(".")[0] |
|
|
|
# png_filename = "{}-{}px.png".format(filename, vyska) |
|
|
|
|
|
|
|
# # Pokud obrázek neexistuje nebo není aktuální, vytvoř jej |
|
|
|
# png_path = op.join(png_dir, png_filename) |
|
|
|
# if not op.exists(png_path) or \ |
|
|
|
# op.getmtime(png_path) < op.getmtime(c.pdf.path): |
|
|
|
|
|
|
|
# subprocess.call([ |
|
|
|
# "convert", |
|
|
|
# "-density", "300x300", |
|
|
|
# "-geometry", "{}x{}".format(vyska, sirka), |
|
|
|
# "-background", "white", |
|
|
|
# "-flatten", |
|
|
|
# "-rotate", str(90 * i), |
|
|
|
# "{}[0]".format(c.pdf.path), # titulní strana |
|
|
|
# png_path |
|
|
|
# ]) |
|
|
|
|
|
|
|
# urls.append( |
|
|
|
# (op.join(settings.MEDIA_URL, "cislo", "png", png_filename), c) |
|
|
|
# ) |
|
|
|
# vyska, sirka = sirka, vyska / 2 |
|
|
|
|
|
|
|
# tags = [] |
|
|
|
|
|
|
|
# def spirala(urls, tags, idx): |
|
|
|
# """Rekurzivně prochází urls a generuje strom elementů do tags""" |
|
|
|
# if idx >= len(urls): |
|
|
|