mirror of
https://github.com/gryf/pygtktalog.git
synced 2026-03-27 06:33:30 +01:00
Compare commits
3 Commits
c74174fc8f
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 85ab034a36 | |||
| 4b02641481 | |||
| 51e3bfa441 |
@@ -34,6 +34,7 @@ pycatalog requires python and following libraries:
|
|||||||
* `python 3.10`_ and up
|
* `python 3.10`_ and up
|
||||||
* `sqlalchemy 1.4`_
|
* `sqlalchemy 1.4`_
|
||||||
* `exifread`_ for parse EXIF information
|
* `exifread`_ for parse EXIF information
|
||||||
|
* `mutagen`_ for extracting tags from audio files
|
||||||
|
|
||||||
Pycatalog extensively uses external programs in unix spirit, however there is
|
Pycatalog extensively uses external programs in unix spirit, however there is
|
||||||
small possibility of using it Windows (probably with limitations) and quite big
|
small possibility of using it Windows (probably with limitations) and quite big
|
||||||
@@ -88,3 +89,4 @@ file in top-level directory.
|
|||||||
.. _sqlalchemy 1.4: http://www.sqlalchemy.org
|
.. _sqlalchemy 1.4: http://www.sqlalchemy.org
|
||||||
.. _tagging files: http://en.wikipedia.org/wiki/tag_%28metadata%29
|
.. _tagging files: http://en.wikipedia.org/wiki/tag_%28metadata%29
|
||||||
.. _tox: https://testrun.org/tox
|
.. _tox: https://testrun.org/tox
|
||||||
|
.. _mutagen: https://github.com/quodlibet/mutagen
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import re
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import mimetypes
|
import mimetypes
|
||||||
|
|
||||||
|
import exifread
|
||||||
|
import mutagen
|
||||||
|
|
||||||
from pycatalog.dbobjects import File, TYPE
|
from pycatalog.dbobjects import File, TYPE
|
||||||
from pycatalog import dbcommon
|
from pycatalog import dbcommon
|
||||||
from pycatalog.logger import get_logger
|
from pycatalog.logger import get_logger
|
||||||
@@ -212,13 +215,28 @@ class Scan(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def _audio(self, fobj, filepath):
|
def _audio(self, fobj, filepath):
|
||||||
# tags, depending on the format?
|
tags = mutagen.File(filepath)
|
||||||
|
if not tags:
|
||||||
return
|
return
|
||||||
|
fobj.description = tags.pprint()
|
||||||
|
|
||||||
def _image(self, fobj, filepath):
|
def _image(self, fobj, filepath):
|
||||||
# exif?
|
"""Read exif if exists, add it to description"""
|
||||||
|
with open(filepath, 'rb') as obj:
|
||||||
|
exif = exifread.process_file(obj)
|
||||||
|
if not exif:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
data = []
|
||||||
|
# longest key + 2, since we need a colon and a space after it
|
||||||
|
longest_key = max([len(k) for k in exif]) + 2
|
||||||
|
for key in exif:
|
||||||
|
if 'thumbnail' in key.lower() and isinstance(exif[key], bytes):
|
||||||
|
data.append(f"{key + ':' :<{longest_key}}thumbnail present")
|
||||||
|
continue
|
||||||
|
data.append(f"{key + ':' :<{longest_key}}{exif[key]}")
|
||||||
|
fobj.description = "\n".join(data)
|
||||||
|
|
||||||
def _video(self, fobj, filepath):
|
def _video(self, fobj, filepath):
|
||||||
"""
|
"""
|
||||||
Make captures for a movie. Save it under uniq name.
|
Make captures for a movie. Save it under uniq name.
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
Pillow
|
|
||||||
exifread
|
|
||||||
sqlalchemy
|
|
||||||
Reference in New Issue
Block a user