práce na archivu
This commit is contained in:
		
							parent
							
								
									03696d79ab
								
							
						
					
					
						commit
						3b4daeb9a1
					
				
					 2 changed files with 3 additions and 56 deletions
				
			
		|  | @ -23,6 +23,9 @@ | |||
|       {% if c.pdf %} | ||||
|         (<a href='{{ c.pdf.url }}'>pdf</a>) | ||||
|       {% endif %} | ||||
|       {% if c.titulka_nahled %} | ||||
|       <img src="{{ c.titulka_nahled.url }}" alt=""> | ||||
|       {% endif %} | ||||
|   {% endfor %} | ||||
|   </ul> | ||||
| 
 | ||||
|  |  | |||
|  | @ -319,33 +319,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: | ||||
|  | @ -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): | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Kateřina Čížková
						Kateřina Čížková