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

[video] Adjust the validations and messages in add version/extra #24477

Merged
merged 8 commits into from
Jan 11, 2024

Conversation

CrystalP
Copy link
Contributor

@CrystalP CrystalP commented Jan 10, 2024

Description

Reviewed, refactored, added messages. clarified messages related to the addition of a version or extra from library or files.
Both Manage versions > Add and the popup for similar movie found on scan are taken care of.
Manage versions > Add can add from library, relatively straightforward, but can also add any video file, which can be in many situations and require lots of validations and cases (videos is unknown, video is in library and is an extra, video is in library and is a version - could be default version or secondary version of a movie with only one version or multiple).

The design would need to change with the addition of a new dialog to clarify what's happening in some of the situations and avoid some overly long and not so clear messages. Only so much can be done with the available dialogs and space available in a popup yesno / OK dialog.

Messages changes:

  • reviewed and tried to simplify some
  • duplicated and specialized some messages because the same actions can be done to add an extra or a version and the message needs to reflect it.

Addressed functionality gaps:

  • adding movies of the library as new version or extra was silently losing the extras and non-default versions of the movie being added
  • through Browse files, a version can be turned into an extra and vice-versa. It has its uses but warrants a warning.
  • selecting the default version of a movie already in library in browse files removed the library entry and made the default version a version of the new movie, but any extras were silently discarded.

Future todo: the code for versions and extras was made very similar on purpose, it will be possible to group them in one function.

Motivation and context

Noticed some misleading messages and that code had to be reviewed.

How has this been tested?

all combinations of adding version or extra from:

  • library
  • files: unscanned/unknown video
  • files: video that's already an extra of a movie
  • files: video that's already an version of a movie
  • files: video that's a single version movie
  • files: video that's a the default version of a movie with multiple versions

What is the effect on users?

Better messages, error checking and handling of the addition.

Screenshots (if appropriate):

upcoming

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)
  • Student submission (PR was done for educational purposes and will be treated as such)
  • 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

@CrystalP CrystalP added Type: Fix non-breaking change which fixes an issue Type: Improvement non-breaking change which improves existing functionality Component: Video Component: Database v21 Omega Feature: Video Versions/Extras labels Jan 10, 2024
@CrystalP CrystalP added this to the Omega 21.0 Beta 3 milestone Jan 10, 2024
Copy link
Member

@ksooo ksooo left a comment

Choose a reason for hiding this comment

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

Nothing serious.
I spotted some code fragments that look very similar. Maybe here is some potential to factor out something to get rid of duplicate code?

xbmc/video/VideoDatabase.cpp Outdated Show resolved Hide resolved
xbmc/video/VideoDatabase.cpp Outdated Show resolved Hide resolved
Comment on lines 12308 to 12311
int CVideoDatabase::GetVideoVersionInfo(const std::string& fileNameAndPath,
int& idFile,
std::string& typeVideoVersion,
int& idMedia,
MediaType& mediaType,
VideoAssetType& videoAssetType)
CVideoAssetInfo CVideoDatabase::GetVideoVersionInfo(const std::string& filenameAndPath)
Copy link
Member

Choose a reason for hiding this comment

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

Thanks you so much for this interface change.

Comment on lines 39 to 44
public:
int m_idFile{-1};
int m_assetTypeId{-1};
std::string m_assetTypeName;
int m_idMedia{-1};
MediaType m_mediaType{MediaTypeNone};
VideoAssetType m_assetType{VideoAssetType::UNKNOWN};
Copy link
Member

Choose a reason for hiding this comment

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

I consider a class with all members being public not a good design. Either you make the new type a struct(and name it SVideoAssetInfo and remove m_ prefix from the members) or you provide proper getters and setters and make the members private.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes good idea. the code guidelines don't require the S prefix for the struct name, but still want the m_ prefix for the members...

Copy link
Member

Choose a reason for hiding this comment

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

Okay, we ofc should follow the code guidelines.

xbmc/video/dialogs/GUIDialogVideoManagerExtras.cpp Outdated Show resolved Hide resolved
xbmc/video/dialogs/GUIDialogVideoManagerExtras.cpp Outdated Show resolved Hide resolved
xbmc/video/dialogs/GUIDialogVideoManagerVersions.cpp Outdated Show resolved Hide resolved
@CrystalP
Copy link
Contributor Author

I spotted some code fragments that look very similar. Maybe here is some potential to factor out something to get rid of duplicate code?

Yes that is intentional to facilitate a refactoring. Only few details vary. I may even add a commit to this PR for it.

@jenkins4kodi jenkins4kodi added the Rebase needed PR that does not apply/merge cleanly to current base branch label Jan 11, 2024
@jenkins4kodi jenkins4kodi removed the Rebase needed PR that does not apply/merge cleanly to current base branch label Jan 11, 2024
@CrystalP
Copy link
Contributor Author

Suggestions applied, rebased + final commit to avoid losing extras when moving a movie into another one through Add > Browse files. Left the code merge between versions and extra dialogs for future PR, I need to recharge a bit, this was pretty complicated.
However for the user it is relatively simple (except a couple messages for weird situations) and the former silent loss of some video assets is avoided.
The design must change in v22.

@@ -55,7 +55,6 @@ bool CGUIDialogVideoManagerExtras::OnMessage(CGUIMessage& message)
{
AddVideoExtra();
}
break;
Copy link
Member

Choose a reason for hiding this comment

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

I would keep this break;, although not having it does not cause any problems atm. But if another case gets added in the future, one can easily forget to reintroduce the break here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok I didn't mean to remove it.

xbmc/video/dialogs/GUIDialogVideoManagerExtras.cpp Outdated Show resolved Hide resolved
xbmc/video/dialogs/GUIDialogVideoManagerVersions.cpp Outdated Show resolved Hide resolved
@CrystalP
Copy link
Contributor Author

comments + formatting applied.

@CrystalP CrystalP changed the title [video] Review/adjust the validations and messages in add version/extra [video] Adjust the validations and messages in add version/extra Jan 11, 2024
@CrystalP
Copy link
Contributor Author

Added todo for future merge of add version and add extras logic

@CrystalP CrystalP merged commit 39d7860 into xbmc:master Jan 11, 2024
2 checks passed
@CrystalP CrystalP deleted the add-extra-validations branch January 11, 2024 23:24
CrystalP added a commit to CrystalP/xbmc that referenced this pull request Mar 5, 2024
Stopped being used after PR xbmc#24477
@CrystalP CrystalP mentioned this pull request Mar 5, 2024
14 tasks
popcornmix pushed a commit to popcornmix/xbmc that referenced this pull request Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Database Component: Video Feature: Video Versions/Extras Type: Fix non-breaking change which fixes an issue Type: Improvement non-breaking change which improves existing functionality v21 Omega
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants