57 lines
2.6 KiB
Diff
57 lines
2.6 KiB
Diff
--- nemo-media-columns.orig/nemo-media-columns.py
|
|
+++ nemo-media-columns/nemo-media-columns.py
|
|
@@ -29,7 +29,7 @@ from gi.repository import Nemo, GObject,
|
|
from mutagen.easyid3 import EasyID3
|
|
from mutagen.mp3 import MPEGInfo
|
|
# for exif support
|
|
-import pyexiv2
|
|
+import json, subprocess
|
|
# for reading videos. for future improvement, this can also read mp3!
|
|
import kaa.metadata
|
|
# for reading image dimensions
|
|
@@ -141,32 +141,32 @@ class ColumnExtension(GObject.GObject, N
|
|
if file.is_mime_type('image/jpeg') or file.is_mime_type('image/png') or file.is_mime_type('image/gif') or file.is_mime_type('image/bmp'):
|
|
# EXIF handling routines
|
|
try:
|
|
- metadata = pyexiv2.ImageMetadata(filename)
|
|
- metadata.read()
|
|
+ metadata = json.loads(subprocess.check_output(['exiftool', '-j', filename]))[0]
|
|
+
|
|
try:
|
|
- exif_datetimeoriginal = metadata['Exif.Photo.DateTimeOriginal']
|
|
- file.add_string_attribute('exif_datetime_original',str(exif_datetimeoriginal.raw_value))
|
|
+ exif_datetimeoriginal = metadata['DateTimeOriginal']
|
|
+ file.add_string_attribute('exif_datetime_original',str(exif_datetimeoriginal))
|
|
except:
|
|
file.add_string_attribute('exif_datetime_original',"")
|
|
try:
|
|
- exif_imagesoftware = metadata['Exif.Image.Software']
|
|
- file.add_string_attribute('exif_software',str(exif_imagesoftware.raw_value))
|
|
+ exif_imagesoftware = metadata['Software']
|
|
+ file.add_string_attribute('exif_software',str(exif_imagesoftware))
|
|
except:
|
|
file.add_string_attribute('exif_software',"")
|
|
try:
|
|
- exif_photoflash = metadata['Exif.Photo.Flash']
|
|
- file.add_string_attribute('exif_flash',str(exif_photoflash.raw_value))
|
|
+ exif_photoflash = metadata['Flash']
|
|
+ file.add_string_attribute('exif_flash',str(exif_photoflash))
|
|
except:
|
|
file.add_string_attribute('exif_flash',"")
|
|
try:
|
|
- exif_pixelydimension = metadata['Exif.Photo.PixelYDimension']
|
|
+ exif_pixelydimension = metadata['PixelYDimension']
|
|
exif_pixelxdimension = metadata['Exif.Photo.PixelXDimension']
|
|
- file.add_string_attribute('exif_pixeldimensions',str(exif_pixelydimension.raw_value)+'x'+str(exif_pixelxdimension.raw_value))
|
|
+ file.add_string_attribute('exif_pixeldimensions',str(exif_pixelydimension)+'x'+str(exif_pixelxdimension))
|
|
except:
|
|
file.add_string_attribute('exif_pixeldimensions',"")
|
|
try:
|
|
- exif_rating = metadata['Xmp.xmp.Rating']
|
|
- file.add_string_attribute('exif_rating',str(exif_rating.raw_value))
|
|
+ exif_rating = metadata['Rating']
|
|
+ file.add_string_attribute('exif_rating',str(exif_rating))
|
|
except:
|
|
file.add_string_attribute('exif_rating',"")
|
|
except:
|