ROGUE-JCTD / rogue_geonode

GeoSHAPE - A Django package that adds GeoSHAPE functionality to GeoNode.
http://www.geoshape.org
GNU General Public License v3.0
12 stars 25 forks source link

Mpeg4 audio files can not be "viewed" with the fileservice #101

Open jsvrcek opened 8 years ago

jsvrcek commented 8 years ago

Mpeg4 Audio files (.m4a) cannot be "viewed" with the fileservice. This is because the view function in api.py uses mime_type = mime.guess_type(url), and the mime_types dict (as of python 2.7.11) doesn't include a mapping for m4a. A simple solution (tested) could be:

mime_type = mime.guess_type(url)
# If mime_type is unknown, add a known file type.
if not mime_type[0]:
    file_ext = os.path.splitext(url)[1]
    if file_ext == '.mp4':
        mime_type = ('audio/mp4',None)
garnertb commented 8 years ago

@jsvrcek mind submitting a PR?