This file is indexed.

/usr/share/pyshared/dmedia/constants.py is in python-dmedia 0.6.0~repack-1build1.

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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Authors:
#   Jason Gerard DeRose <jderose@novacut.com>
#   David Green <david4dev@gmail.com>
#
# dmedia: distributed media library
# Copyright (C) 2010 Jason Gerard DeRose <jderose@novacut.com>
#
# This file is part of `dmedia`.
#
# `dmedia` is free software: you can redistribute it and/or modify it under the
# terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# `dmedia` is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with `dmedia`.  If not, see <http://www.gnu.org/licenses/>.

"""
Various constants conveniently located in one place.
"""

import mimetypes
mimetypes.init()

DBNAME = 'dmedia'

# Standard read/write buffer size:
CHUNK_SIZE = 2**20  # 1 MiB

# Size of leaves in tree-hash:
LEAF_SIZE = 8 * 2**20  # 8 MiB


# FileStore path compotents
TRANSFERS_DIR = 'transfers'  # downloads/uploads
IMPORTS_DIR = 'imports'  # eg importing from CF card
WRITES_DIR = 'writes'  # eg transcoding or rendering


# Normalized file extension
EXT_PAT = '^[a-z0-9]+(\.[a-z0-9]+)?$'


# D-Bus releated:
BUS = 'org.freedesktop.DMedia'
IFACE = BUS
IMPORT_BUS = 'org.freedesktop.DMediaImporter'
IMPORT_IFACE = IMPORT_BUS
DC_BUS = 'org.desktopcouch.CouchDB'
DC_INTERFACE = DC_BUS


# Standard format for TypeError message:
TYPE_ERROR = '%s: need a %r; got a %r: %r'

# Stardard format for TypeError message when a callable is expected:
CALLABLE_ERROR = '%s: need a callable; got a %r: %r'

def get_extensions_for_type(general_type):
    """
    An iterator that yields the file extensions for files of a general type.
    eg. 'image'
    """
    for ext in mimetypes.types_map:
        if mimetypes.types_map[ext].split('/')[0] == general_type:
            yield ext.strip('.')

VIDEO = tuple(get_extensions_for_type('video'))

AUDIO = tuple(get_extensions_for_type('audio'))

IMAGE = tuple(get_extensions_for_type('image'))

EXTENSIONS = VIDEO + AUDIO + IMAGE

EXT_MAP = {
    'video': VIDEO,
    'audio': AUDIO,
    'image': IMAGE,
    'all': EXTENSIONS,
}