2020-01-27 09:16:53 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
"""
|
|
|
|
media (Media Tools)
|
|
|
|
===================
|
|
|
|
|
|
|
|
**Author:**
|
|
|
|
|
|
|
|
* Dirk Alders <sudo-dirk@mount-mockery.de>
|
|
|
|
|
|
|
|
**Description:**
|
|
|
|
|
|
|
|
This module helps on all issues with media files, like tags (e.g. exif, id3) and transformations.
|
|
|
|
|
|
|
|
**Submodules:**
|
|
|
|
|
2020-01-30 22:07:50 +01:00
|
|
|
* :func:`media.get_media_data`
|
2020-01-27 09:16:53 +01:00
|
|
|
|
|
|
|
**Unittest:**
|
|
|
|
|
|
|
|
See also the :download:`unittest <../../media/_testresults_/unittest.pdf>` documentation.
|
|
|
|
"""
|
|
|
|
__DEPENDENCIES__ = []
|
|
|
|
|
|
|
|
import logging
|
2020-01-30 23:37:29 +01:00
|
|
|
from media import metadata
|
2020-01-27 09:16:53 +01:00
|
|
|
|
2020-01-30 22:07:50 +01:00
|
|
|
logger_name = 'MEDIA'
|
2020-01-27 09:16:53 +01:00
|
|
|
logger = logging.getLogger(logger_name)
|
|
|
|
|
|
|
|
|
|
|
|
__DESCRIPTION__ = """The Module {\\tt %s} is designed to help on all issues with media files, like tags (e.g. exif, id3) and transformations.
|
|
|
|
For more Information read the documentation.""" % __name__.replace('_', '\_')
|
|
|
|
"""The Module Description"""
|
2020-01-30 22:07:50 +01:00
|
|
|
__INTERPRETER__ = (3, )
|
2020-01-27 09:16:53 +01:00
|
|
|
"""The Tested Interpreter-Versions"""
|
|
|
|
|
|
|
|
|
2020-01-30 22:07:50 +01:00
|
|
|
def get_media_data(full_path):
|
|
|
|
ft = metadata.get_filetype(full_path)
|
2020-01-27 09:16:53 +01:00
|
|
|
#
|
2020-01-30 22:07:50 +01:00
|
|
|
if ft == metadata.FILETYPE_AUDIO:
|
|
|
|
return metadata.get_audio_data(full_path)
|
|
|
|
elif ft == metadata.FILETYPE_IMAGE:
|
|
|
|
return metadata.get_image_data(full_path)
|
|
|
|
elif ft == metadata.FILETYPE_VIDEO:
|
|
|
|
return metadata.get_video_data(full_path)
|
2020-01-27 09:16:53 +01:00
|
|
|
else:
|
2020-01-30 22:07:50 +01:00
|
|
|
logger.warning('Filetype not known: %s', full_path)
|