Exemplo n.º 1
0
 def testThumbnailFlv(self):
     '''Tests thumbnailing of a flash file'''
     thumbnailer = VideoThumbnailer(
         THIS_DIR + '/data/VideoThumbnailer/test.avi', src='video')
     if os.path.exists(thumbnailer._thumb_file):
         os.remove(thumbnailer._thumb_file)
     thumbnailer.create_thumbnail()
     if self.debug:
         print 'Expecting thumbnail : %s' % (self.thumbnailer._thumb_file)
     self.assertTrue(os.path.exists(thumbnailer._thumb_file))
Exemplo n.º 2
0
 def testThumbnailFlv(self):
     '''Tests thumbnailing of a flash file'''
     thumbnailer = VideoThumbnailer(THIS_DIR +
                                    '/data/VideoThumbnailer/test.avi',
                                    src='video')
     if os.path.exists(thumbnailer._thumb_file):
         os.remove(thumbnailer._thumb_file)
     thumbnailer.create_thumbnail()
     if self.debug:
         print 'Expecting thumbnail : %s' % (self.thumbnailer._thumb_file)
     self.assertTrue(os.path.exists(thumbnailer._thumb_file))
Exemplo n.º 3
0
    def _add_file(self, filename):
        '''Add a video.'''
        video_file = models.VideoFile()
        video_file.filename = unicode(filename)
        thumbnailer = VideoThumbnailer(filename)
        thumbnailer.create_thumbnail()
        video_file.thumbnail = thumbnailer.filename

        self._store.add(video_file)
        self._store.commit()

        return video_file
Exemplo n.º 4
0
    def _add_file(self, filename):
        '''Add a video.'''
        video_file = models.VideoFile()
        video_file.filename = unicode(filename)
        thumbnailer = VideoThumbnailer(filename)
        thumbnailer.create_thumbnail()
        video_file.thumbnail = thumbnailer.filename

        self._store.add(video_file)
        self._store.commit()

        return video_file
Exemplo n.º 5
0
    def _addVideoFile(self, filename):
        """Add video file to the video cache."""
        # Generate thumbnail
        thumbnailer = VideoThumbnailer(filename)
        thumbnailer.create_thumbnail()
        thash = thumbnailer.get_hash()
        del thumbnailer

        self.__db_cursor.execute("""INSERT INTO videofile(filename, hash)
                                    VALUES (:fn, :hash)""",
                                    { 'fn': filename, 'hash': thash, } )
        self.__db_cursor.execute("""INSERT INTO metadata(filename)
                                    VALUES (:fn)""",
                                    { "fn" : filename } )
        self.__db_conn.commit()
        if self.config.download_metadata:
            self.__searchMetadata(filename)
Exemplo n.º 6
0
 def testThumbnailerConstructor(self):
     '''Tests instantiation of thumbnailer class'''
     self.thumbnailer = VideoThumbnailer(THIS_DIR +
                                         '/data/VideoThumbnailer/test.avi',
                                         src='video')
     self.assertTrue(isinstance(self.thumbnailer, VideoThumbnailer))