This file is indexed.

/usr/lib/python2.7/dist-packages/pymecavideo/testfilm.py is in python-mecavideo 6.3-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys
import threading
import os.path

import cv2.cv as cv
import cv2


class film:
    """
    Une classe pour accéder aux images d'un film
    """

    def __init__(self, filename):
        """
        le constructeur
        @param filename le nom d'un fichier video
        """
        try:
            filename = unicode(filename, 'utf8')
        except TypeError:
            pass
        self.filename = filename
        try:
            self.filesize = os.path.getsize(self.filename.encode('utf8'))
            self.capture = cv2.VideoCapture(self.filename.encode('utf8'))
        except WindowsError:
            self.filesize = os.path.getsize(self.filename.encode('cp1252'))
            self.capture = cv2.VideoCapture(self.filename.encode('cp1252'))

        t = threading.Thread(target=self.autoTest)
        t.start()
        t.join(5.0)  # attente de 5 secondes au plus


    def autoTest(self):
        self.ok = False

        try:
            self.frame = self.capture.read()
            self.num = 0
            self.fps = self.capture.get(cv.CV_CAP_PROP_FPS)
            self.framecount = self.capture.get(cv.CV_CAP_PROP_FRAME_COUNT)
            assert 1.0 * self.filesize / self.framecount > 60.0, "fichier aberrant en taille"
            self.ok = True
        except AssertionError:
            print "assertion"+str(self.fps)+str(self.framecount)
            pass
        except ZeroDivisionError:
            print "szero"+str(self.fps)+str(self.framecount)

            pass
        #if self.filename.split('.')[-1].lower() == "ogv":  # never work with ogv. need encoding.
        #self.ok = False

    def __int__(self):
        return int(self.ok)

    def __nonzero__(self):
        return self.ok


if __name__ == '__main__':
    if len(sys.argv) > 1:
        vidfile = sys.argv[1]
        if film(vidfile):
            sys.exit(0)
        else:
            sys.exit(1)