Make bitrate a real attribute instead of calculating in jinja
This commit is contained in:
		
							parent
							
								
									a5924b4642
								
							
						
					
					
						commit
						a485be3c64
					
				
					 2 changed files with 3 additions and 1 deletions
				
			
		|  | @ -499,6 +499,8 @@ class Photo(ObjectBase): | ||||||
|         self.ratio = db_row['ratio'] |         self.ratio = db_row['ratio'] | ||||||
|         self.thumbnail = db_row['thumbnail'] |         self.thumbnail = db_row['thumbnail'] | ||||||
| 
 | 
 | ||||||
|  |         if self.duration: | ||||||
|  |             self.bitrate = (self.bytes / 128) / self.duration | ||||||
|         self.mimetype = helpers.get_mimetype(self.real_filepath) |         self.mimetype = helpers.get_mimetype(self.real_filepath) | ||||||
|         if self.mimetype is None: |         if self.mimetype is None: | ||||||
|             self.simple_mimetype = None |             self.simple_mimetype = None | ||||||
|  |  | ||||||
|  | @ -183,7 +183,7 @@ | ||||||
|         <li>Size: {{photo.bytestring()}}</li> |         <li>Size: {{photo.bytestring()}}</li> | ||||||
|         {% if photo.duration %} |         {% if photo.duration %} | ||||||
|             <li>Duration: {{photo.duration_string}}</li> |             <li>Duration: {{photo.duration_string}}</li> | ||||||
|             <li>Overall Bitrate: {{((photo.bytes / 128) / photo.duration)|int}} kbps</li> |             <li>Overall Bitrate: {{photo.bitrate|int}} kbps</li> | ||||||
|         {% endif %} |         {% endif %} | ||||||
|         <li><a href="/file/{{photo.id}}{{photo.dot_extension}}?download=true&original_filename=true">Download as original filename</a></li> |         <li><a href="/file/{{photo.id}}{{photo.dot_extension}}?download=true&original_filename=true">Download as original filename</a></li> | ||||||
|         <li><a href="/file/{{photo.id}}{{photo.dot_extension}}?download=true">Download as {{photo.id}}.{{photo.extension}}</a></li> |         <li><a href="/file/{{photo.id}}{{photo.dot_extension}}?download=true">Download as {{photo.id}}.{{photo.extension}}</a></li> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue