-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolution filter fix #20
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b6bdd79
streaming - added a option to allow the user to set a maximum resilut…
miawgogo 7524bf0
streaming - made original the default
miawgogo b352964
chore - cleaning up
miawgogo 0303eba
some fixes and some additions
miawgogo c15b978
changes in response to review
miawgogo 83ff01c
Correction to settings string
miawgogo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
__pycache__ | ||
venv/ | ||
plugin.video.stash.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
import json | ||
from resources.lib.utils.resolutions import Resolution_map | ||
|
||
""" elif "resolution" == criterion: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented code, so can be removed |
||
val = criterion["resolution"]["modifier"]["value"] | ||
criterion["resolution"]["modifier"]["value"] = Resolution_map[val] """ | ||
|
||
|
||
def parse(criterions): | ||
|
@@ -8,9 +13,15 @@ def parse(criterions): | |
if criterion in ('sceneIsMissing', 'imageIsMissing', 'performerIsMissing', 'galleryIsMissing', 'tagIsMissing', 'studioIsMissing', 'studioIsMissing'): | ||
filter['is_missing'] = criterion['value'] | ||
else: | ||
is_timestamp_field = criterion 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) | ||
if "resolution" == criterion: | ||
val = criterions[criterion]["value"] | ||
criterions[criterion]["value"] = Resolution_map[val] | ||
is_timestamp_field = criterion 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) | ||
|
||
return filter | ||
|
||
|
@@ -21,12 +32,14 @@ def parse_criterion(criterion, value_transformer): | |
filter['modifier'] = criterion['modifier'] | ||
|
||
value = criterion.get('value', '') | ||
|
||
if isinstance(value, dict) and not value.keys() - ['items', 'excluded', 'depth']: | ||
if value.get('items') is not None: | ||
filter['value'] = list(map(lambda v: v['id'], value['items'])) | ||
|
||
if value.get('excluded') is not None: | ||
filter['excludes'] = list(map(lambda v: v['id'], value['excluded'])) | ||
filter['excludes'] = list( | ||
map(lambda v: v['id'], value['excluded'])) | ||
|
||
if value.get('depth') is not None: | ||
filter['depth'] = value['depth'] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think neither of these are required? The plugin doesn't require a separate venv (it's running in Kodi anyway), and there is no need to build a ZIP (see below as well).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is so i could install the kodi stubs to get some code completion from VS Code relating to the Kodi functions.
I prefer to use a venv to do this rather than installing it locally/globally to avoid polluting my users python libaries with development libaries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to keep them locally, and ignored. You can add it to
.git/info/exclude
. Git also reads that file as a.gitignore
but it will be local only / not part of the repository.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That explains all the (re)formatting of further unchanged code. PyCharm doesn't do that (automatically), which I prefer.