diff --git a/resources/lib/criterion_parser.py b/resources/lib/criterion_parser.py index d2a9992..514b260 100644 --- a/resources/lib/criterion_parser.py +++ b/resources/lib/criterion_parser.py @@ -4,13 +4,15 @@ def parse(criterions): filter = {} - for criterion in criterions: - if criterion in ('sceneIsMissing', 'imageIsMissing', 'performerIsMissing', 'galleryIsMissing', 'tagIsMissing', 'studioIsMissing', 'studioIsMissing'): - filter['is_missing'] = criterion['value'] + for name, criterion in criterions.items(): + if name in ('is_missing', 'has_markers'): + filter[name] = criterion['value'] + elif name in ('organized', 'performer_favorite', 'interactive'): + filter[name] = criterion['value'] == 'true' else: - is_timestamp_field = criterion in ('created_at', 'updated_at', 'scene_created_at', 'scene_updated_at') + is_timestamp_field = name in ('created_at', 'updated_at', 'scene_created_at', 'scene_updated_at') value_transformer = (lambda v: v.replace(' ', 'T') if isinstance(v, str) else v) if is_timestamp_field else lambda v: v - filter[criterion] = parse_criterion(criterions[criterion], value_transformer) + filter[name] = parse_criterion(criterion, value_transformer) return filter diff --git a/resources/lib/listing/listing.py b/resources/lib/listing/listing.py index 27cc192..22ce8ef 100644 --- a/resources/lib/listing/listing.py +++ b/resources/lib/listing/listing.py @@ -76,9 +76,10 @@ def _create_items(self, criterion: dict, sort_field: str, sort_dir: int, params: def _create_item(self, scene: dict, **kwargs): title = kwargs['title'] if 'title' in kwargs else scene['title'] screenshot = kwargs['screenshot'] if 'screenshot' in kwargs else scene['paths']['screenshot'] - # * 2 because rating is 1 to 5 and Kodi uses 1 to 10 - rating = scene['rating'] * 2 if 'rating' in scene and scene['rating'] is not None else 0 - duration = int(scene['file']['duration']) + file = scene['files'][0] + # / 10 because rating is 1 to 100 and Kodi uses 1 to 10 + rating = round(scene['rating100'] / 10 if 'rating100' in scene and scene['rating100'] is not None else 0) + duration = int(file['duration']) item = xbmcgui.ListItem(label=title) item.setInfo('video', {'title': title, 'mediatype': 'video', @@ -92,12 +93,12 @@ def _create_item(self, scene: dict, **kwargs): 'dateadded': scene['created_at'] }) - item.addStreamInfo('video', {'codec': scene['file']['video_codec'], - 'width': scene['file']['width'], - 'height': scene['file']['height'], + item.addStreamInfo('video', {'codec': file['video_codec'], + 'width': file['width'], + 'height': file['height'], 'duration': duration}) - item.addStreamInfo('audio', {'codec': scene['file']['audio_codec']}) + item.addStreamInfo('audio', {'codec': file['audio_codec']}) screenshot = self._client.add_api_key(screenshot) item.setArt({'thumb': screenshot, 'fanart': screenshot}) diff --git a/resources/lib/listing/scene_marker_listing.py b/resources/lib/listing/scene_marker_listing.py index 8bea8a6..b2b88d1 100644 --- a/resources/lib/listing/scene_marker_listing.py +++ b/resources/lib/listing/scene_marker_listing.py @@ -41,7 +41,7 @@ def _create_items(self, criterion: dict, sort_field: str, sort_dir: int, params: item = self._create_item(marker['scene'], title=title, screenshot=marker['screenshot']) url = self._create_play_url(marker['scene']['id']) - duration = marker['scene']['file']['duration'] + duration = marker['scene']['files'][0]['duration'] item.setProperty('StartPercent', str(round(marker['seconds'] / duration * 100, 2))) items.append((item, url)) diff --git a/resources/lib/stash_interface.py b/resources/lib/stash_interface.py index 12e855e..0bbe31e 100644 --- a/resources/lib/stash_interface.py +++ b/resources/lib/stash_interface.py @@ -51,13 +51,13 @@ def find_scenes(self, scene_filter=None, sort_field='title', sort_dir='asc'): id title details - rating + rating100 date created_at paths { screenshot } - file { + files { duration video_codec audio_codec @@ -101,14 +101,14 @@ def find_scene(self, id): id title details - rating + rating100 date created_at paths { stream screenshot } - file { + files { duration video_codec audio_codec @@ -133,13 +133,13 @@ def find_scene(self, id): id title details - rating + rating100 date created_at paths { screenshot } - file { + files { duration video_codec audio_codec @@ -283,13 +283,13 @@ def find_scene_markers(self, markers_filter=None, sort_field='title', sort_dir=0 id title details - rating + rating100 date created_at paths { screenshot } - file { + files { duration video_codec audio_codec