<commit_before>from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from media_tree import media_types
from django.utils.datastructures import SortedDict


MEDIA_TREE_STORAGE = getattr(settings, 'MEDIA_TREE_STORAGE', None)
"""
File storage class to be used for any file-related operations when dealing with
media files.

This is not set by default, meaning that Django's ```DEFAULT_FILE_STORAGE``
<https://docs.djangoproject.com/en/dev/ref/settings/#default-file-storage>`_
will be used. Please refer to the relevant Django documentation on `file storage
<https://docs.djangoproject.com/en/dev/ref/files/storage/#module-django.core.files.storage>`_.
"""

MEDIA_TREE_MEDIA_BACKENDS = getattr(settings, 'MEDIA_TREE_MEDIA_BACKENDS', ())
"""
A tuple of media backends for thumbnail generation and other media-related
tasks.

Currently, the only supported backend is
``media_tree.contrib.media_backends.easy_thumbnails.EasyThumbnailsBackend``,
which depends on ``easy_thumbnails`` to be installed. Please refer to
:ref:`media-backends` for more information.
"""

MEDIA_TREE_MEDIA_BACKEND_DEBUG = getattr(settings,
    'MEDIA_TREE_MEDIA_BACKEND_DEBUG', settings.DEBUG)
"""
Specifies whether exceptions caused by media backends, such as
``ThumbnailError``, should be raised or silently ignored.
"""

MEDIA_TREE_LIST_DISPLAY = getattr(settings, 'MEDIA_TREE_LIST_DISPLAY',
    ('browse_controls', 'size_formatted', 'extension', 'resolution_formatted',
    'get_descendant_count_display', 'modified', 'modified_by', 'metadata_check',
    'position', 'node_tools'))
"""
A tuple containing the columns that should be displayed in the
``FileNodeAdmin``. Note that the ``browse_controls`` column is necessary for the
admin to function properly.
"""

MEDIA_TREE_LIST_FILTER = getattr(settings, 'MEDIA_TREE_LIST_FILTER',
    ('media_type', 'extension', 'has_metadata'))
"""
A tuple containing the fields that nodes can be filtered by in the
``FileNodeAdmin``.
"""

#MEDIA_TREE_LIST_DISPLAY_LINKS = ('name',)

MEDIA_TREE_SEARCH_FIELDS = getattr(settings, 'MEDIA_TREE_SEARCH_FIELDS',
    ('name', 'title', 'description', 'author', 'copyright', 'override_caption',
    'override_alt'))
"""
A tuple containing the fields that nodes can be searched by in the
``FileNodeAdmin``.
"""

MEDIA_TREE_UPLOAD_SUBDIR = getattr(settings, 'MEDIA_TREE_UPLOAD_SUBDIR',
    'upload')
"""
The name of the folder under your ``MEDIA_ROOT`` where media files are stored.
"""

MEDIA_TREE_PREVIEW_SUBDIR = getattr(settings, 'MEDIA_TREE_PREVIEW_SUBDIR',
    'upload/_preview')
"""
The name of the folder under your ``MEDIA_ROOT`` where cached versions of media
files, e.g. thumbnails, are stored.
"""

MEDIA_TREE_STATIC_SUBDIR = 'media_tree'

MEDIA_TREE_ICON_DIRS = getattr(settings, 'MEDIA_TREE_ICON_DIRS', (
    'media_tree/img/icons/mimetypes',
))
"""
A tuple containing all icon directories. See :ref:`install-icon-sets`
for more information.
"""

MEDIA_TREE_ICON_FINDERS = getattr(settings, 'MEDIA_TREE_ICON_FINDERS', (
    'media_tree.utils.staticfiles.MimetypeStaticIconFileFinder',
))

MEDIA_TREE_ADMIN_THUMBNAIL_SIZES = SortedDict((
    ('tiny', (20, 20)),
    ('small', (70, 70)),
    ('default', (100, 100)),
    ('medium', (250, 250)),
    ('large', (400, 400)),
))

MEDIA_TREE_THUMBNAIL_SIZES = MEDIA_TREE_ADMIN_THUMBNAIL_SIZES.copy()
MEDIA_TREE_THUMBNAIL_SIZES.update({
    'full': None, # None means: use original size
})
MEDIA_TREE_THUMBNAIL_SIZES.update(getattr(settings,
    'MEDIA_TREE_THUMBNAIL_SIZES', {}))
"""
A dictionary of default thumbnail sizes. You can pass the dictionary key to the
``thumbnail`` templatetag instead of a numeric size.

Default::

    {
        'small': (80, 80),
        'default': (100, 100),
        'medium': (250, 250),
        'large': (400, 400),
        'full': None, # None means: use original size
    }

"""

MEDIA_TREE_ALLOWED_FILE_TYPES = getattr(settings, 'MEDIA_TREE_ALLOWED_FILE_TYPES', (
    'aac', 'ace', 'ai', 'aiff', 'avi', 'bmp', 'dir', 'doc', 'docx', 'dmg',
    'eps', 'fla', 'flac', 'flv', 'gif', 'gz', 'hqx', 'htm', 'html', 'ico',
    'indd', 'inx', 'jpg', 'jar', 'jpeg', 'key', 'md', 'mov', 'm3u', 'mp3',
    'mp4', 'mpc', 'mkv', 'mpg', 'mpeg', 'numbers', 'ogg', 'odg', 'odf', 'odp',
    'ods', 'odt', 'otf', 'pages', 'pdf', 'pls', 'png', 'pps', 'ppsx', 'ps',
    'psd', 'rar', 'rdf', 'rm', 'rss', 'rst', 'rtf', 'sit', 'svg', 'swf', 'tar', 
    'tga', 'tif', 'tiff', 'ttf', 'txt', 'wav', 'wma', 'wmv', 'xls', 'xlsx', 
    'xml', 'zip'
))
"""<commit_msg>Support .webm<commit_after>from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from media_tree import media_types
from django.utils.datastructures import SortedDict


MEDIA_TREE_STORAGE = getattr(settings, 'MEDIA_TREE_STORAGE', None)
"""
File storage class to be used for any file-related operations when dealing with
media files.

This is not set by default, meaning that Django's ```DEFAULT_FILE_STORAGE``
<https://docs.djangoproject.com/en/dev/ref/settings/#default-file-storage>`_
will be used. Please refer to the relevant Django documentation on `file storage
<https://docs.djangoproject.com/en/dev/ref/files/storage/#module-django.core.files.storage>`_.
"""

MEDIA_TREE_MEDIA_BACKENDS = getattr(settings, 'MEDIA_TREE_MEDIA_BACKENDS', ())
"""
A tuple of media backends for thumbnail generation and other media-related
tasks.

Currently, the only supported backend is
``media_tree.contrib.media_backends.easy_thumbnails.EasyThumbnailsBackend``,
which depends on ``easy_thumbnails`` to be installed. Please refer to
:ref:`media-backends` for more information.
"""

MEDIA_TREE_MEDIA_BACKEND_DEBUG = getattr(settings,
    'MEDIA_TREE_MEDIA_BACKEND_DEBUG', settings.DEBUG)
"""
Specifies whether exceptions caused by media backends, such as
``ThumbnailError``, should be raised or silently ignored.
"""

MEDIA_TREE_LIST_DISPLAY = getattr(settings, 'MEDIA_TREE_LIST_DISPLAY',
    ('browse_controls', 'size_formatted', 'extension', 'resolution_formatted',
    'get_descendant_count_display', 'modified', 'modified_by', 'metadata_check',
    'position', 'node_tools'))
"""
A tuple containing the columns that should be displayed in the
``FileNodeAdmin``. Note that the ``browse_controls`` column is necessary for the
admin to function properly.
"""

MEDIA_TREE_LIST_FILTER = getattr(settings, 'MEDIA_TREE_LIST_FILTER',
    ('media_type', 'extension', 'has_metadata'))
"""
A tuple containing the fields that nodes can be filtered by in the
``FileNodeAdmin``.
"""

#MEDIA_TREE_LIST_DISPLAY_LINKS = ('name',)

MEDIA_TREE_SEARCH_FIELDS = getattr(settings, 'MEDIA_TREE_SEARCH_FIELDS',
    ('name', 'title', 'description', 'author', 'copyright', 'override_caption',
    'override_alt'))
"""
A tuple containing the fields that nodes can be searched by in the
``FileNodeAdmin``.
"""

MEDIA_TREE_UPLOAD_SUBDIR = getattr(settings, 'MEDIA_TREE_UPLOAD_SUBDIR',
    'upload')
"""
The name of the folder under your ``MEDIA_ROOT`` where media files are stored.
"""

MEDIA_TREE_PREVIEW_SUBDIR = getattr(settings, 'MEDIA_TREE_PREVIEW_SUBDIR',
    'upload/_preview')
"""
The name of the folder under your ``MEDIA_ROOT`` where cached versions of media
files, e.g. thumbnails, are stored.
"""

MEDIA_TREE_STATIC_SUBDIR = 'media_tree'

MEDIA_TREE_ICON_DIRS = getattr(settings, 'MEDIA_TREE_ICON_DIRS', (
    'media_tree/img/icons/mimetypes',
))
"""
A tuple containing all icon directories. See :ref:`install-icon-sets`
for more information.
"""

MEDIA_TREE_ICON_FINDERS = getattr(settings, 'MEDIA_TREE_ICON_FINDERS', (
    'media_tree.utils.staticfiles.MimetypeStaticIconFileFinder',
))

MEDIA_TREE_ADMIN_THUMBNAIL_SIZES = SortedDict((
    ('tiny', (20, 20)),
    ('small', (70, 70)),
    ('default', (100, 100)),
    ('medium', (250, 250)),
    ('large', (400, 400)),
))

MEDIA_TREE_THUMBNAIL_SIZES = MEDIA_TREE_ADMIN_THUMBNAIL_SIZES.copy()
MEDIA_TREE_THUMBNAIL_SIZES.update({
    'full': None, # None means: use original size
})
MEDIA_TREE_THUMBNAIL_SIZES.update(getattr(settings,
    'MEDIA_TREE_THUMBNAIL_SIZES', {}))
"""
A dictionary of default thumbnail sizes. You can pass the dictionary key to the
``thumbnail`` templatetag instead of a numeric size.

Default::

    {
        'small': (80, 80),
        'default': (100, 100),
        'medium': (250, 250),
        'large': (400, 400),
        'full': None, # None means: use original size
    }

"""

MEDIA_TREE_ALLOWED_FILE_TYPES = getattr(settings, 'MEDIA_TREE_ALLOWED_FILE_TYPES', (
    'aac', 'ace', 'ai', 'aiff', 'avi', 'bmp', 'dir', 'doc', 'docx', 'dmg',
    'eps', 'fla', 'flac', 'flv', 'gif', 'gz', 'hqx', 'htm', 'html', 'ico',
    'indd', 'inx', 'jpg', 'jar', 'jpeg', 'key', 'md', 'mov', 'm3u', 'mp3',
    'mp4', 'mpc', 'mkv', 'mpg', 'mpeg', 'numbers', 'ogg', 'odg', 'odf', 'odp',
    'ods', 'odt', 'otf', 'pages', 'pdf', 'pls', 'png', 'pps', 'ppsx', 'ps',
    'psd', 'rar', 'rdf', 'rm', 'rss', 'rst', 'rtf', 'sit', 'svg', 'swf', 'tar', 
    'tga', 'tif', 'tiff', 'ttf', 'txt', 'wav', 'webm', 'wma', 'wmv', 'xls', 'xlsx', 
    'xml', 'zip'
))
"""
{'fraction_non_alphanumeric': 0.15612560813799203, 'fraction_numerical': 0.011278195488721804, 'mean_word_length': 5.433143669985776, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5863549', 'n_tokens_mistral': 3328, 'n_tokens_neox': 3277, 'n_words': 816}