def create(self, the_file=None, **kwargs):
        name = kwargs.get('name')
        description = kwargs.get('description')
        creator = kwargs.get('creator')
        contribution = kwargs.get('contribution')

        content_type = the_file.content_type.split('/')
        converted_file = None

        # Using avconv to scan and convert 3gpp/3gpp2 audio files to mp3
        if content_type[1] in ['3gpp', '3gpp2']:
            import time
            import shlex
            import subprocess
            from django.core.files import File
            from django.core.files.storage import default_storage
            from django.core.files.base import ContentFile

            filename, extension = os.path.splitext(the_file.name)
            filename = self._normalise_filename(filename)

            path = default_storage.save(
                'tmp/' + filename + extension,
                ContentFile(the_file.read())
            )
            tmp_file = os.path.join(settings.MEDIA_ROOT, path)

            cmd = shlex.split('avconv -i %s' % tmp_file)
            pipe = subprocess.Popen(
                cmd,
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE
            )
            output, error = pipe.communicate()

            video_stream = re.compile(
                r"Stream #\d*\.\d*.*\:\s*Video",
                re.MULTILINE
            )

            # Using error because output file is not specified
            if not video_stream.search(error):
                content_type[0] = 'audio'

                converted_file = os.path.join(
                    settings.MEDIA_ROOT,
                    'tmp',
                    '%s_%s.mp3' % (filename, int(time.time()))
                )

                cmd = shlex.split(
                    'avconv -nostats -loglevel 0 -y -i %s -c:a libmp3lame -q:a 4 -ar 44100 %s' % (
                        tmp_file,
                        converted_file
                    )
                )
                pipe = subprocess.Popen(
                    cmd,
                    stdout=subprocess.PIPE,
                    stderr=subprocess.PIPE
                )
                output, error = pipe.communicate()

                if not error:
                    the_file = File(open(converted_file, 'rb'))
                    the_file.name = '%s.mp3' % filename

            os.remove(tmp_file)

        if (content_type[0] == 'image' and
                content_type[1] in ACCEPTED_IMAGE_FORMATS):
            return self._create_image_file(
                name,
                description,
                creator,
                contribution,
                the_file
            )
        elif (content_type[0] == 'audio' and
                content_type[1] in ACCEPTED_AUDIO_FORMATS):
            audio_file = self._create_audio_file(
                name,
                description,
                creator,
                contribution,
                the_file
            )

            if converted_file is not None and os.path.isfile(converted_file):
                os.remove(converted_file)

            return audio_file
        elif (content_type[0] == 'video' and
                settings.ENABLE_VIDEO and
                content_type[1] in ACCEPTED_VIDEO_FORMATS):
            return self._create_video_file(
                name,
                description,
                creator,
                contribution,
                the_file
            )
        else:
            raise FileTypeError('Files of type %s are currently not supported.'
                                % the_file.content_type)
Create a new file. Evaluates the file's content type and creates either
dataset/ETHPy150Open ExCiteS/geokey/geokey/contributions/managers.py/MediaFileManager.create