Skip to content

Commit

Permalink
Merge pull request #14489 from DaVukovic/showplots
Browse files Browse the repository at this point in the history
Separate shown plots for unwatched items
  • Loading branch information
MartijnKaijser committed Nov 13, 2018
2 parents 7d498e9 + 9702661 commit fce4d88
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 15 deletions.
5 changes: 4 additions & 1 deletion addons/resource.language.en_gb/resources/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -12723,6 +12723,7 @@ msgstr ""
#: xbmc/media/MediaTypes.cpp
#: addons/skin.estuary/xml/Variables.xml
#: xbmc/view/GUIViewState.cpp
#: system/settings/settings.xml
msgctxt "#20342"
msgid "Movies"
msgstr ""
Expand All @@ -12734,6 +12735,7 @@ msgstr ""
#: addons/skin.estuary/xml/SkinSettings.xml
#: addons/skin.estuary/xml/Variables.xml
#: xbmc/view/GUIViewState.cpp
#: system/settings/settings.xml
msgctxt "#20343"
msgid "TV shows"
msgstr ""
Expand Down Expand Up @@ -18103,7 +18105,7 @@ msgstr ""
#. Description of setting with label #20369 "Show plot for unwatched items"
#: system/settings/settings.xml
msgctxt "#36141"
msgid "Show plot information for unwatched media in the video library."
msgid "Show plot information for unwatched media in the video library. The plot will be shown for the specific category you have selected. For example if 'Movies' is selected, the plot will be shown at the movie library, but will be hidden for TV shows and otherwise."
msgstr ""

#. Description of setting with label #14106 "Speed unit"
Expand Down Expand Up @@ -21575,3 +21577,4 @@ msgstr ""
msgctxt "#39113"
msgid "Center Mix Level in dB relative to metadata or default (-3 dB)"
msgstr ""

16 changes: 13 additions & 3 deletions system/settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -968,10 +968,20 @@
<default>true</default>
<control type="toggle" />
</setting>
<setting id="videolibrary.showunwatchedplots" type="boolean" label="20369" help="36141">
<setting id="videolibrary.showunwatchedplots" type="list[integer]" label="20369" help="36141">
<level>0</level>
<default>true</default>
<control type="toggle" />
<default>0,1</default> <!-- Show plot for both -->
<constraints>
<options>
<option label="20342">0</option> <!-- Show plot for unwatched movies only -->
<option label="20343">1</option> <!-- Show plot for unwatched tv show episodes only -->
</options>
<delimiter>,</delimiter>
</constraints>
<control type="list" format="string">
<multiselect>true</multiselect>
<hidevalue>false</hidevalue>
</control>
</setting>
<setting id="videolibrary.groupmoviesets" type="boolean" label="20458" help="36145">
<level>1</level>
Expand Down
30 changes: 20 additions & 10 deletions xbmc/guilib/guiinfo/VideoGUIInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "guilib/StereoscopicsManager.h"
#include "guilib/WindowIDs.h"
#include "settings/AdvancedSettings.h"
#include "settings/lib/Setting.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
#include "utils/StringUtils.h"
Expand Down Expand Up @@ -330,18 +331,27 @@ bool CVideoGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont
}
break;
case LISTITEM_PLOT:
if (tag->m_type != MediaTypeTvShow &&
tag->m_type != MediaTypeVideoCollection &&
tag->GetPlayCount() == 0 &&
!CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_VIDEOLIBRARY_SHOWUNWATCHEDPLOTS))
{
value = g_localizeStrings.Get(20370);
}
else
{
value = tag->m_strPlot;
std::shared_ptr<CSettingList> setting(std::dynamic_pointer_cast<CSettingList>(
CServiceBroker::GetSettingsComponent()->GetSettings()->GetSetting(CSettings::SETTING_VIDEOLIBRARY_SHOWUNWATCHEDPLOTS)));
if (tag->m_type != MediaTypeTvShow &&
tag->m_type != MediaTypeVideoCollection &&
tag->GetPlayCount() == 0 &&
setting &&
(
(tag->m_type == MediaTypeMovie && (!setting->FindIntInList(CSettings::VIDEOLIBRARY_PLOTS_SHOW_UNWATCHED_MOVIES))) ||
(tag->m_type == MediaTypeEpisode && (!setting->FindIntInList(CSettings::VIDEOLIBRARY_PLOTS_SHOW_UNWATCHED_TVSHOWEPISODES)))
)
)
{
value = g_localizeStrings.Get(20370);
}
else
{
value = tag->m_strPlot;
}
return true;
}
return true;
case LISTITEM_STATUS:
value = tag->m_strStatus;
return true;
Expand Down
3 changes: 3 additions & 0 deletions xbmc/settings/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ class CSettings : public CSettingsBase, public CSettingCreator, public CSettingC
static const std::string SETTING_SOURCE_VIDEOS;
static const std::string SETTING_SOURCE_MUSIC;
static const std::string SETTING_SOURCE_PICTURES;
// values for SETTING_VIDEOLIBRARY_SHOWUNWATCHEDPLOTS
static const int VIDEOLIBRARY_PLOTS_SHOW_UNWATCHED_MOVIES = 0;
static const int VIDEOLIBRARY_PLOTS_SHOW_UNWATCHED_TVSHOWEPISODES = 1;

/*!
\brief Creates a new settings wrapper around a new settings manager.
Expand Down
11 changes: 10 additions & 1 deletion xbmc/video/dialogs/GUIDialogVideoInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "storage/MediaManager.h"
#include "profiles/ProfileManager.h"
#include "settings/AdvancedSettings.h"
#include "settings/lib/Setting.h"
#include "settings/MediaSourceSettings.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
Expand Down Expand Up @@ -376,9 +377,17 @@ void CGUIDialogVideoInfo::SetMovie(const CFileItem *item)
void CGUIDialogVideoInfo::Update()
{
// setup plot text area
std::shared_ptr<CSettingList> setting(std::dynamic_pointer_cast<CSettingList>(
CServiceBroker::GetSettingsComponent()->GetSettings()->GetSetting(CSettings::SETTING_VIDEOLIBRARY_SHOWUNWATCHEDPLOTS)));
std::string strTmp = m_movieItem->GetVideoInfoTag()->m_strPlot;
if (m_movieItem->GetVideoInfoTag()->m_type != MediaTypeTvShow)
if (m_movieItem->GetVideoInfoTag()->GetPlayCount() == 0 && !CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_VIDEOLIBRARY_SHOWUNWATCHEDPLOTS))
if (m_movieItem->GetVideoInfoTag()->GetPlayCount() == 0 &&
setting &&
(
(m_movieItem->GetVideoInfoTag()->m_type == MediaTypeMovie && (!setting->FindIntInList(CSettings::VIDEOLIBRARY_PLOTS_SHOW_UNWATCHED_MOVIES))) ||
(m_movieItem->GetVideoInfoTag()->m_type == MediaTypeEpisode && (!setting->FindIntInList(CSettings::VIDEOLIBRARY_PLOTS_SHOW_UNWATCHED_TVSHOWEPISODES)))
)
)
strTmp = g_localizeStrings.Get(20370);

StringUtils::Trim(strTmp);
Expand Down

0 comments on commit fce4d88

Please sign in to comment.