Add some additional exif picture metadata to listitems. But Kodi skins do not seem to be using that info, unfortunately
This commit is contained in:
parent
dd70170caa
commit
0e6ca0d290
2 changed files with 95 additions and 66 deletions
|
@ -89,6 +89,25 @@ class Media(object):
|
|||
'gain': cast(float, self._from_stream_or_part('gain'))
|
||||
}
|
||||
|
||||
def picture_codec(self):
|
||||
"""
|
||||
Returns the exif metadata of pictures. This does NOT seem to be used
|
||||
reliably by Kodi skins! (e.g. not at all)
|
||||
"""
|
||||
return {
|
||||
'exif:CameraMake': self.xml[0].get('make'), # e.g. 'Canon'
|
||||
'exif:CameraModel': self.xml[0].get('model'), # e.g. 'Canon XYZ'
|
||||
'exif:DateTime': self.xml.get('originallyAvailableAt', '').replace('-', ':') or None, # e.g. '2017-11-05'
|
||||
'exif:Height': self.xml[0].get('height'), # e.g. '2160'
|
||||
'exif:Width': self.xml[0].get('width'), # e.g. '3240'
|
||||
'exif:Orientation': self.xml[0][self.part].get('orientation'), # e.g. '1'
|
||||
'exif:FocalLength': self.xml[0].get('focalLength'), # TO BE VALIDATED
|
||||
'exif:ExposureTime': self.xml[0].get('exposure'), # e.g. '1/1000'
|
||||
'exif:ApertureFNumber': self.xml[0].get('aperture'), # e.g. 'f/5.0'
|
||||
'exif:ISOequivalent': self.xml[0].get('iso'), # e.g. '1600'
|
||||
# missing on Kodi side: lens, e.g. "EF50mm f/1.8 II"
|
||||
}
|
||||
|
||||
def mediastreams(self):
|
||||
"""
|
||||
Returns the media streams for metadata purposes
|
||||
|
|
|
@ -133,6 +133,17 @@ def _generate_content(api):
|
|||
# other fields - let's use the PMS answer to be safe
|
||||
# See https://github.com/croneter/PlexKodiConnect/issues/1129
|
||||
if not api.kodi_id or 'title' not in item:
|
||||
if api.plex_type == v.PLEX_TYPE_PHOTO:
|
||||
item = {
|
||||
'title': api.title(),
|
||||
'label': api.title(),
|
||||
'type': api.kodi_type,
|
||||
'dateadded': api.date_created(), # e.g '2019-01-03 19:40:59'
|
||||
'lastplayed': api.lastplayed(), # e.g. '2019-01-04 16:05:03'
|
||||
'playcount': api.viewcount(),
|
||||
}
|
||||
item.update(api.picture_codec())
|
||||
else:
|
||||
cast = [{
|
||||
'name': x[0],
|
||||
'thumbnail': x[1],
|
||||
|
@ -177,13 +188,6 @@ def _generate_content(api):
|
|||
'writer': api.writers(), # list of [str]
|
||||
'year': api.year(), # [int]
|
||||
}
|
||||
|
||||
if plex_type in (v.PLEX_TYPE_EPISODE, v.PLEX_TYPE_SEASON, v.PLEX_TYPE_SHOW):
|
||||
leaves = api.leave_count()
|
||||
if leaves:
|
||||
item['extraproperties'] = leaves
|
||||
# Add all the artwork we can
|
||||
item['art'] = api.artwork(full_artwork=True)
|
||||
# Add all info for e.g. video and audio streams
|
||||
item['streamdetails'] = api.mediastreams()
|
||||
# Cleanup required due to the way metadatautils works
|
||||
|
@ -201,6 +205,12 @@ def _generate_content(api):
|
|||
'position': resume,
|
||||
'total': api.runtime()
|
||||
}
|
||||
if plex_type in (v.PLEX_TYPE_EPISODE, v.PLEX_TYPE_SEASON, v.PLEX_TYPE_SHOW):
|
||||
leaves = api.leave_count()
|
||||
if leaves:
|
||||
item['extraproperties'] = leaves
|
||||
# Add all the artwork we can
|
||||
item['art'] = api.artwork(full_artwork=True)
|
||||
|
||||
item['icon'] = v.ICON_FROM_PLEXTYPE[plex_type]
|
||||
# Some customization
|
||||
|
|
Loading…
Reference in a new issue