Skip to content
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

[scraper] Pass JSON serialized path settings to python scrapers #17063

Merged
merged 2 commits into from
Jan 1, 2020

Conversation

Montellese
Copy link
Member

Description

This is an alternative approach to #16964 and uses the newly introduce ISettingsValueSerializerInterface from #17062. It converts the scraper path settings to flat JSON like e.g.

{
  "RatingS": 1,
  "absolutenumber": false,
  "dvdorder": false,
  "language": "en",
  "token": ""
}

and passes them to the python based scrapers.

This will need to be backported to Leia together with the following commit from #17062: 7fbb037

Motivation and Context

See #16964. I prefer to use a clean approach / solution.

How Has This Been Tested?

Manually.

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • None of the above (please explain below)

Checklist:

  • My code follows the Code Guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the Contributing document
  • I have added tests to cover my change
  • All new and existing tests passed

@Montellese Montellese added Type: Fix non-breaking change which fixes an issue Type: Improvement non-breaking change which improves existing functionality Backport: Needed Component: Settings Component: Add-ons v19 Matrix labels Dec 21, 2019
@Montellese Montellese added this to the Matrix 19.0-alpha 1 milestone Dec 21, 2019
@Montellese Montellese added this to In progress in General (roadmap) via automation Dec 21, 2019
@ronie
Copy link
Member

ronie commented Dec 21, 2019

Thx, tested & works great.

@rmrector
Copy link
Contributor

Thanks. Can you return an empty object/dictionary, {}, in the failure conditions rather than an empty string? This way it will always deserialize to a dictionary in Python.

@Montellese Montellese closed this Dec 21, 2019
@Montellese Montellese deleted the feature/settings_json_serializer branch December 21, 2019 23:38
General (roadmap) automation moved this from In progress to Done Dec 21, 2019
@Montellese Montellese moved this from Done to In progress in General (roadmap) Dec 21, 2019
@Montellese Montellese restored the feature/settings_json_serializer branch December 21, 2019 23:44
@Montellese
Copy link
Member Author

I added handling for empty serializations in CScraper::GetPathSettingsAsJSON().
I accidentally deleted the branch of this PR so it was automatically closed. I'll try to re-open it.

@Montellese Montellese reopened this Dec 21, 2019
@Montellese Montellese force-pushed the feature/settings_json_serializer branch 3 times, most recently from 7b5b6b8 to 2812ce4 Compare December 21, 2019 23:53
Copy link
Contributor

@rmrector rmrector left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I runtime tested it and it works well. The new interface looks great. Thanks.

Copy link
Member

@Rechi Rechi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the current code guidelines.

xbmc/settings/lib/ISettingsValueSerializer.h Outdated Show resolved Hide resolved
xbmc/settings/SettingsValueXmlSerializer.cpp Outdated Show resolved Hide resolved
xbmc/settings/SettingsValueXmlSerializer.cpp Outdated Show resolved Hide resolved
xbmc/settings/SettingsValueXmlSerializer.cpp Outdated Show resolved Hide resolved
xbmc/settings/SettingsValueXmlSerializer.cpp Outdated Show resolved Hide resolved
xbmc/settings/SettingsValueFlatJsonSerializer.cpp Outdated Show resolved Hide resolved
xbmc/settings/SettingsValueFlatJsonSerializer.cpp Outdated Show resolved Hide resolved
xbmc/settings/SettingsValueFlatJsonSerializer.cpp Outdated Show resolved Hide resolved
xbmc/settings/SettingsValueFlatJsonSerializer.cpp Outdated Show resolved Hide resolved
@@ -800,10 +819,12 @@ static bool PythonDetails(const std::string &ID,
const std::string &key,
const std::string &url,
const std::string &action,
const std::string &pathSettings,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really the intention to use a different formatting style on the newly added parameter than for all the other parameters?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also adjust the style of the already existing parameters to match the current code guidelines.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which has absolutely nothing to do with this PR.

@Montellese Montellese force-pushed the feature/settings_json_serializer branch from 2812ce4 to 13d7a51 Compare December 23, 2019 23:13
@Montellese
Copy link
Member Author

Addressed almost all style issues.

Copy link
Member

@garbear garbear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON implementation looks good

General (roadmap) automation moved this from In progress to Reviewer approved Dec 24, 2019
@Montellese Montellese force-pushed the feature/settings_json_serializer branch from 13d7a51 to d9d0bea Compare December 25, 2019 09:21
@Montellese
Copy link
Member Author

@ronie @romanvm @rmrector are you ok with the current implementation?

@romanvm
Copy link
Contributor

romanvm commented Dec 25, 2019

@Montellese Sorry I had no time to check or test your code but from a cursory glance it looks better than my amateur approach. I guess I'll close my PR.

Copy link
Member

@ronie ronie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested again with the latest cosmetic changes and it still work ok.
cheers!

Copy link
Contributor

@romanvm romanvm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I have limited understanding of Kodi settings internals, but the scraper part looks good.

@Montellese Montellese force-pushed the feature/settings_json_serializer branch from d9d0bea to 47d015e Compare December 31, 2019 23:53
@Montellese
Copy link
Member Author

Rebased after merging #17062 and waiting for Jenkins results before merging.

@rmrector
Copy link
Contributor

rmrector commented Jan 1, 2020

jenkins build this please

@Montellese Montellese merged commit bcd4533 into xbmc:master Jan 1, 2020
General (roadmap) automation moved this from Reviewer approved to Done Jan 1, 2020
@Montellese Montellese deleted the feature/settings_json_serializer branch January 1, 2020 18:00
@Montellese
Copy link
Member Author

See #17112 for the backport for Leia.

Maven85 pushed a commit to Maven85/kodi that referenced this pull request Jan 21, 2020
…erializer

[scraper] Pass JSON serialized path settings to python scrapers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport: Done Component: Add-ons Component: Settings Type: Fix non-breaking change which fixes an issue Type: Improvement non-breaking change which improves existing functionality v19 Matrix Wiki: Needed
Projects
Development

Successfully merging this pull request may close these issues.

None yet

6 participants