Update of /cvsroot/freevo/freevo/src
In directory sc8-pr-cvs1:/tmp/cvs-serv6850
Modified Files:
osd.py
Log Message:
_getbitmap now generates and stores thumbnails for large images without
EXIF header and thumb:// in the url. This speeds up the image menu
(and most of it the extended version). This requires fchksum (should
be added to the runtime)
Index: osd.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/osd.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** osd.py 24 Feb 2003 06:00:30 -0000 1.18
--- osd.py 1 Mar 2003 17:26:40 -0000 1.19
***************
*** 10,13 ****
--- 10,19 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.19 2003/03/01 17:26:40 dischi
+ # _getbitmap now generates and stores thumbnails for large images without
+ # EXIF header and thumb:// in the url. This speeds up the image menu
+ # (and most of it the extended version). This requires fchksum (should
+ # be added to the runtime)
+ #
# Revision 1.18 2003/02/24 06:00:30 outlyer
# Allow update to optionally use a screen region rather than flipping the whole
***************
*** 105,108 ****
--- 111,116 ----
import sys
import os
+ import stat
+ import Image
import re
import traceback
***************
*** 113,116 ****
--- 121,131 ----
import util
+ try:
+ import fchksum
+ thumbs_fchksum = 1
+ except:
+ print 'fchksum not available, thumbnails deactivated'
+ thumbs_fchksum = 0
+
# Configuration file. Determines where to look for AVI/MP3 files, etc
import config
***************
*** 1361,1364 ****
--- 1376,1380 ----
try:
+ thumb = None
if DEBUG >= 3:
print 'Trying to load file "%s"' % filename
***************
*** 1368,1374 ****
if tmp:
filename = tmp
!
tmp = pygame.image.load(filename) # XXX Cannot load everything
image = tmp.convert_alpha() # XXX Cannot load everything
except pygame.error, e:
print 'SDL image load problem: %s' % e
--- 1384,1413 ----
if tmp:
filename = tmp
! elif thumbs_fchksum:
! if os.stat(filename)[stat.ST_SIZE] > 50000:
! thumb = os.path.join('%s/%s.thumb.png' % \
! (config.FREEVO_CACHEDIR,
! fchksum.fmd5t(filename)[0]))
! if not os.path.isfile(thumb):
! # convert with Imaging, pygame doesn't work
! image = Image.open(filename)
! width = 300
! height = 300
!
! w, h = image.size
! if int(float(width * h) / w) > height:
! width = int(float(height * w) / h)
! else:
! height = int(float(width * h) / w)
! image = image.resize((width, height), Image.BICUBIC)
! image.save(thumb, 'PNG')
!
!
! filename = thumb
!
!
tmp = pygame.image.load(filename) # XXX Cannot load everything
image = tmp.convert_alpha() # XXX Cannot load everything
+
except pygame.error, e:
print 'SDL image load problem: %s' % e
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog