From dcc35109de1b7fe0393113f8c72044ee117d13d1 Mon Sep 17 00:00:00 2001 From: "Serge A. Levin" Date: Sun, 22 Jun 2025 19:28:36 +0300 Subject: [PATCH 1/3] + Sort order for the scenes --- resources/lib/listing/listing.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/resources/lib/listing/listing.py b/resources/lib/listing/listing.py index a93d503..9c9199b 100644 --- a/resources/lib/listing/listing.py +++ b/resources/lib/listing/listing.py @@ -10,6 +10,12 @@ from resources.lib.navigation import NavigationItem +def to_ddmmyyy(yyyymmdd: str): + if yyyymmdd is None: + return None + return yyyymmdd[8:] + "-" + yyyymmdd[5:7] + "-" + yyyymmdd[:4] + + class Listing(ABC): handle: int @@ -32,7 +38,8 @@ def list_items(self, params: dict): for (item, url) in self._create_items(criterion, sort_field, sort_dir, params): xbmcplugin.addDirectoryItem(self.handle, url, item, False) - xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_NONE) + xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE) + xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_DATE) xbmcplugin.endOfDirectory(self.handle) def get_root_item(self, override_title: str = "") -> (xbmcgui.ListItem, str): @@ -90,6 +97,7 @@ def _create_item(self, scene: dict, **kwargs): 'studio': scene['studio']['name'] if scene['studio'] is not None else None, 'userrating': rating, 'premiered': scene['date'], + 'date': to_ddmmyyy(scene['date']), 'tag': list(map(lambda t: t['name'], scene['tags'])), 'dateadded': scene['created_at'], 'lastplayed': scene["last_played_at"] From 2b091d90def1ca3b5395891f473c830a062fae17 Mon Sep 17 00:00:00 2001 From: "Serge A. Levin" Date: Sun, 22 Jun 2025 19:36:00 +0300 Subject: [PATCH 2/3] Updated artifacts actions to v4 --- .github/workflows/build-release.yaml | 4 ++-- .github/workflows/build.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 8e5c8ac..ef4a378 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -19,7 +19,7 @@ jobs: cd /tmp/ zip -r plugin.video.stash.zip plugin.video.stash/ - name: Upload - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: plugin.video.stash.zip path: /tmp/plugin.video.stash.zip @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest needs: ['build'] steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: plugin.video.stash.zip - uses: marvinpinto/action-automatic-releases@v1.2.1 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index eee8065..43568fe 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: cd /tmp/ zip -r plugin.video.stash.zip plugin.video.stash/ - name: Upload - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: plugin.video.stash.zip path: /tmp/plugin.video.stash.zip From 56d0f83c65b5cb001f73af4986c0600e923bff0b Mon Sep 17 00:00:00 2001 From: "Serge A. Levin" Date: Sat, 12 Jul 2025 23:09:52 +0300 Subject: [PATCH 3/3] Improve saved filters functionality Correct processing for phash_distance criterion Using basename as scene title if scene is not matched --- resources/lib/criterion_parser.py | 3 +++ resources/lib/listing/listing.py | 2 ++ resources/lib/stash_interface.py | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/resources/lib/criterion_parser.py b/resources/lib/criterion_parser.py index c49826f..260086b 100644 --- a/resources/lib/criterion_parser.py +++ b/resources/lib/criterion_parser.py @@ -60,6 +60,9 @@ def parse_criterion(criterion, value_transformer): elif isinstance(value, dict) and not value.keys() - ['endpoint', 'stashID']: filter['endpoint'] = value.get('endpoint') filter['stash_id'] = value.get('stashID') + elif isinstance(value, dict) and not value.keys() - ['value', 'distance']: + filter['value'] = value['value'] + filter['distance'] = value['distance'] else: filter['value'] = value_transformer(value) diff --git a/resources/lib/listing/listing.py b/resources/lib/listing/listing.py index 9c9199b..f84cd9a 100644 --- a/resources/lib/listing/listing.py +++ b/resources/lib/listing/listing.py @@ -84,6 +84,8 @@ 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'] file = scene['files'][0] + if not title and file is not None: + title = file['basename'] # / 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']) diff --git a/resources/lib/stash_interface.py b/resources/lib/stash_interface.py index c28a177..297ad48 100644 --- a/resources/lib/stash_interface.py +++ b/resources/lib/stash_interface.py @@ -61,6 +61,7 @@ def find_scenes(self, scene_filter=None, sort_field='title', sort_dir='asc'): screenshot } files { + basename duration video_codec audio_codec @@ -119,6 +120,7 @@ def find_scene(self, id): screenshot } files { + basename duration video_codec audio_codec @@ -150,6 +152,7 @@ def find_scene(self, id): screenshot } files { + basename duration video_codec audio_codec @@ -300,6 +303,7 @@ def find_scene_markers(self, markers_filter=None, sort_field='title', sort_dir=0 screenshot } files { + basename duration video_codec audio_codec