Python Library Media
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. """
  5. media (Media Tools)
  6. ===================
  7. **Author:**
  8. * Dirk Alders <sudo-dirk@mount-mockery.de>
  9. **Description:**
  10. This module helps on all issues with media files, like tags (e.g. exif, id3) and transformations.
  11. **Submodules:**
  12. * :func:`media.get_media_data`
  13. **Unittest:**
  14. See also the :download:`unittest <../../media/_testresults_/unittest.pdf>` documentation.
  15. """
  16. __DEPENDENCIES__ = []
  17. import logging
  18. from media import metadata
  19. logger_name = 'MEDIA'
  20. logger = logging.getLogger(logger_name)
  21. __DESCRIPTION__ = """The Module {\\tt %s} is designed to help on all issues with media files, like tags (e.g. exif, id3) and transformations.
  22. For more Information read the documentation.""" % __name__.replace('_', '\_')
  23. """The Module Description"""
  24. __INTERPRETER__ = (3, )
  25. """The Tested Interpreter-Versions"""
  26. def get_media_data(full_path):
  27. ft = metadata.get_filetype(full_path)
  28. #
  29. if ft == metadata.FILETYPE_AUDIO:
  30. return metadata.get_audio_data(full_path)
  31. elif ft == metadata.FILETYPE_IMAGE:
  32. return metadata.get_image_data(full_path)
  33. elif ft == metadata.FILETYPE_VIDEO:
  34. return metadata.get_video_data(full_path)
  35. else:
  36. logger.warning('Filetype not known: %s', full_path)