Package elisa :: Package core :: Package tests :: Module test_thumbnailer_profiling
[hide private]
[frames] | no frames]

Source Code for Module elisa.core.tests.test_thumbnailer_profiling

 1  # Elisa - Home multimedia server 
 2  # Copyright (C) 2006-2008 Fluendo Embedded S.L. (www.fluendo.com). 
 3  # All rights reserved. 
 4  # 
 5  # This file is available under one of two license agreements. 
 6  # 
 7  # This file is licensed under the GPL version 3. 
 8  # See "LICENSE.GPL" in the root of this distribution including a special 
 9  # exception to use Elisa with Fluendo's plugins. 
10  # 
11  # The GPL part of Elisa is also available under a commercial licensing 
12  # agreement from Fluendo. 
13  # See "LICENSE.Elisa" in the root directory of this distribution package 
14  # for details on that license. 
15   
16  from elisa.core.tests.elisa_test_case import ElisaTestCase, BoilerPlateApp 
17  from elisa.core import plugin 
18  from elisa.core import log, common 
19  from elisa.core import media_manager, metadata_manager, media_uri 
20  from twisted.internet import defer 
21  from elisa.plugins.base.local_media import LocalMedia 
22   
23  import os 
24  import sys 
25   
26 -class FooPlugin(plugin.Plugin):
27 name = 'foo' 28 components = {'local_media': {'path': LocalMedia}}
29
30 -class TestThumbnailer(ElisaTestCase):
31
32 - def setUp(self):
33 34 common.boot() 35 36 if 'ELISA_DEBUG' not in os.environ: 37 log.setDebug('*:0') 38 39 app = BoilerPlateApp('empty.conf') 40 common.set_application(app) 41 42 from elisa.core.common import application 43 44 application.plugin_registry.register_plugin(FooPlugin) 45 46 c = application.plugin_registry.create_component 47 48 m_manager = metadata_manager.MetadataManager() 49 50 application.media_manager = media_manager.MediaManager(m_manager) 51 52 application.media_manager.register_component(c('foo:local_media')) 53 application.media_manager.start() 54 55 from elisa.core.thumbnailer import Thumbnailer 56 57 self._thumbnailer = Thumbnailer()
58 59
60 - def tearDown(self):
64
65 - def test_thumbnail_image(self):
66 from elisa.core.common import application 67 from elisa import statprof 68 import time 69 70 base_path = '/media/nfs/pictures/fafa/famille/' 71 72 73 def walk_path(path): 74 75 for root, dirs, files in os.walk(path): 76 77 for d in dirs: 78 walk_path(root + '/' + d) 79 80 for f in files: 81 uri = media_uri.MediaUri(u'file://' + root + '/' + f) 82 print "uri:",uri 83 ret = ('',) 84 try: 85 ret = self._thumbnailer._retrieve_thumbnail(uri, 255, "image") 86 #time.sleep(0.5) 87 self.failUnless(os.path.exists(ret[0])) 88 except: 89 pass
90 91 92 statprof.start() 93 walk_path(base_path) 94 statprof.stop() 95 statprof.display()
96 97 test_thumbnail_image.skip = "This test does not look like a unit test." 98