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

[PVR][Estuary] Guide window: Channel groups selector #13364

Merged
merged 2 commits into from Jan 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 17 additions & 5 deletions addons/resource.language.en_gb/resources/strings.po
Expand Up @@ -11074,16 +11074,16 @@ msgctxt "#19296"
msgid "No PVR add-on enabled"
msgstr ""

#. 'timeline' label used in pvr guide window
#. 'Viewtype' label for vertical channel layout, used in pvr guide window
#: addons/skin.estuary/xml/MyPVRGuide.xml
msgctxt "#19297"
msgid "Vertical"
msgid "Vertical channels"
msgstr ""

#. 'timeline' label used in pvr guide window
#. 'Viewtype' label for horizontal channel layout, used in pvr guide window
#: addons/skin.estuary/xml/MyPVRGuide.xml
msgctxt "#19298"
msgid "Horizontal"
msgid "Horizontal channels"
msgstr ""

#. generic "expiration" label used in different places
Expand All @@ -11093,7 +11093,19 @@ msgctxt "#19299"
msgid "Expires"
msgstr ""

#empty strings from id 19300 to 19498
#. 'Viewtype' label for vertical channel layout without channel group selctor, used in pvr guide window
#: addons/skin.estuary/xml/MyPVRGuide.xml
msgctxt "#19300"
msgid "Vertical channels, no group selector"
msgstr ""

#. 'Viewtype' label for horizontal channel layout without channel group selctor, used in pvr guide window
#: addons/skin.estuary/xml/MyPVRGuide.xml
msgctxt "#19301"
msgid "Horizontal channels, no group selector"
msgstr ""

#empty strings from id 19302 to 19498

#. label for epg genre value
#: xbmc/epg/Epg.cpp
Expand Down
6 changes: 3 additions & 3 deletions addons/skin.estuary/xml/Includes_PVR.xml
Expand Up @@ -257,7 +257,7 @@
<definition>
<control type="epggrid" id="$PARAM[control_id]">
<left>0</left>
<top>0</top>
<top>$PARAM[control_top]</top>
<right>20</right>
<bottom>340</bottom>
<orientation>$PARAM[control_orientation]</orientation>
Expand All @@ -267,8 +267,8 @@
<rulerunit>6</rulerunit>
<onleft>9000</onleft>
<onright>60</onright>
<onup>50</onup>
<ondown>50</ondown>
<onup>$PARAM[control_onup_id]</onup>
<ondown>$PARAM[control_id]</ondown>
<viewtype label="$PARAM[viewtype_label]">list</viewtype>
<progresstexture border="$PARAM[progress_texture_border]" colordiffuse="button_focus">$PARAM[progress_texture]</progresstexture>
<rulerdatelayout width="1700" height="45" condition="$PARAM[has_rulerdate_layout]">
Expand Down
137 changes: 111 additions & 26 deletions addons/skin.estuary/xml/MyPVRGuide.xml
Expand Up @@ -2,15 +2,15 @@
<window>
<defaultcontrol always="true">50</defaultcontrol>
<backgroundcolor>background</backgroundcolor>
<views>50,51</views>
<views>50,51,52,53</views>
<menucontrol>9000</menucontrol>
<controls>
<include>DefaultBackground</include>
<control type="group">
<animation effect="fade" start="100" end="0" time="200" tween="sine" condition="$EXP[infodialog_active]">Conditional</animation>
<control type="group">
<description>Guide Timeline</description>
<visible>Control.IsVisible(50) | Control.IsVisible(51)</visible>
<visible>Control.IsVisible(50) | Control.IsVisible(51) | Control.IsVisible(52) | Control.IsVisible(53)</visible>
<include>OpenClose_Right</include>
<include>Visible_Right</include>
<control type="group">
Expand All @@ -23,30 +23,115 @@
<bottom>336</bottom>
<texture colordiffuse="E6FFFFFF">dialogs/dialog-bg-nobo.png</texture>
</control>
<include content="EpgGrid">
<param name="control_id" value="50"/>
<param name="control_orientation" value="vertical"/>
<param name="viewtype_label" value="19297"/>
<param name="progress_texture_border" value="0,60,18,14"/>
<param name="progress_texture" value="windows/pvr/epg_progress_vertical.png"/>
<param name="has_rulerdate_layout" value="false"/>
<param name="ruler_width" value="1400"/>
<param name="ruler_label_width" value="365"/>
<param name="channel_width" value="350"/>
<param name="scrollbar_top" value="47"/>
</include>
<include content="EpgGrid">
<param name="control_id" value="51"/>
<param name="control_orientation" value="horizontal"/>
<param name="viewtype_label" value="19298"/>
<param name="progress_texture_border" value="5,10,5,10"/>
<param name="progress_texture" value="windows/pvr/epg_progress_horizontal.png"/>
<param name="has_rulerdate_layout" value="true"/>
<param name="ruler_width" value="150"/>
<param name="ruler_label_width" value="150"/>
<param name="channel_width" value="310"/>
<param name="scrollbar_top" value="105"/>
</include>
<control type="image">
<left>0</left>
<top>0</top>
<width>100%</width>
<height>44</height>
<texture colordiffuse="60FFFFFF">colors/white50.png</texture>
</control>
<control type="wraplist" id="11">
<top>0</top>
<left>0</left>
<width>100%</width>
<onup>63</onup>
<ondown>63</ondown>
<orientation>horizontal</orientation>
<scrolltime>200</scrolltime>
<focusposition>3</focusposition>
<visible>Control.IsVisible(50) | Control.IsVisible(51)</visible>
<itemlayout height="44" width="300">
<control type="label">
<left>-140</left>
<width>280</width>
<align>center</align>
<aligny>center</aligny>
<label>$INFO[ListItem.Label]</label>
<textcolor>grey</textcolor>
</control>
</itemlayout>
<focusedlayout height="44" width="300">
<control type="image">
<top>2</top>
<left>-148</left>
<width>296</width>
<height>42</height>
<texture colordiffuse="button_focus">lists/focus.png</texture>
<visible>Control.HasFocus(11)</visible>
</control>
<control type="image">
<left>-150</left>
<width>300</width>
<texture border="8" colordiffuse="button_focus">buttons/thumbnail_focused.png</texture>
</control>
<control type="label">
<left>-140</left>
<width>280</width>
<align>center</align>
<aligny>center</aligny>
<scroll>true</scroll>
<label>$INFO[ListItem.Label]</label>
</control>
</focusedlayout>
</control>
<control type="group" id="63">
<include content="EpgGrid">
<param name="control_id" value="50"/>
<param name="control_orientation" value="vertical"/>
<param name="control_top" value="55"/>
<param name="control_onup_id" value="11"/>
<param name="viewtype_label" value="19298"/>
<param name="progress_texture_border" value="0,60,18,14"/>
<param name="progress_texture" value="windows/pvr/epg_progress_vertical.png"/>
<param name="has_rulerdate_layout" value="false"/>
<param name="ruler_width" value="1400"/>
<param name="ruler_label_width" value="365"/>
<param name="channel_width" value="350"/>
<param name="scrollbar_top" value="47"/>
</include>
<include content="EpgGrid">
<param name="control_id" value="51"/>
<param name="control_orientation" value="horizontal"/>
<param name="control_top" value="55"/>
<param name="control_onup_id" value="11"/>
<param name="viewtype_label" value="19297"/>
<param name="progress_texture_border" value="5,10,5,10"/>
<param name="progress_texture" value="windows/pvr/epg_progress_horizontal.png"/>
<param name="has_rulerdate_layout" value="true"/>
<param name="ruler_width" value="150"/>
<param name="ruler_label_width" value="150"/>
<param name="channel_width" value="310"/>
<param name="scrollbar_top" value="105"/>
</include>
<include content="EpgGrid">
<param name="control_id" value="52"/>
<param name="control_orientation" value="vertical"/>
<param name="control_top" value="0"/>
<param name="control_onup_id" value="52"/>
<param name="viewtype_label" value="19301"/>
<param name="progress_texture_border" value="0,60,18,14"/>
<param name="progress_texture" value="windows/pvr/epg_progress_vertical.png"/>
<param name="has_rulerdate_layout" value="false"/>
<param name="ruler_width" value="1400"/>
<param name="ruler_label_width" value="365"/>
<param name="channel_width" value="350"/>
<param name="scrollbar_top" value="47"/>
</include>
<include content="EpgGrid">
<param name="control_id" value="53"/>
<param name="control_orientation" value="horizontal"/>
<param name="control_top" value="0"/>
<param name="control_onup_id" value="53"/>
<param name="viewtype_label" value="19300"/>
<param name="progress_texture_border" value="5,10,5,10"/>
<param name="progress_texture" value="windows/pvr/epg_progress_horizontal.png"/>
<param name="has_rulerdate_layout" value="true"/>
<param name="ruler_width" value="150"/>
<param name="ruler_label_width" value="150"/>
<param name="channel_width" value="310"/>
<param name="scrollbar_top" value="105"/>
</include>
</control>
</control>
<control type="group">
<bottom>0</bottom>
Expand Down
5 changes: 2 additions & 3 deletions xbmc/pvr/channels/PVRChannel.cpp
Expand Up @@ -407,9 +407,8 @@ void CPVRChannel::UpdatePath(CPVRChannelGroupInternal* group)

std::string strFileNameAndPath;
CSingleLock lock(m_critSection);
strFileNameAndPath = StringUtils::Format("pvr://channels/%s/%s/%s_%d.pvr",
(m_bIsRadio ? "radio" : "tv"),
group->GroupName().c_str(),
strFileNameAndPath = StringUtils::Format("%s%s_%d.pvr",
group->GetPath(),
CServiceBroker::GetPVRManager().Clients()->GetClientAddonId(m_iClientId).c_str(),
m_iUniqueId);
if (m_strFileNameAndPath != strFileNameAndPath)
Expand Down
5 changes: 5 additions & 0 deletions xbmc/pvr/channels/PVRChannelGroup.cpp
Expand Up @@ -204,6 +204,11 @@ bool CPVRChannelGroup::Update(void)
return UpdateGroupEntries(PVRChannels_tmp);
}

std::string CPVRChannelGroup::GetPath() const
{
return StringUtils::Format("pvr://channels/%s/%s/", m_bRadio ? "radio" : "tv", GroupName().c_str());
}

bool CPVRChannelGroup::SetChannelNumber(const CPVRChannelPtr &channel, const CPVRChannelNumber &channelNumber)
{
bool bReturn(false);
Expand Down
6 changes: 6 additions & 0 deletions xbmc/pvr/channels/PVRChannelGroup.h
Expand Up @@ -117,6 +117,12 @@ namespace PVR
*/
virtual bool Update(void);

/*!
* @brief Get the path of this group.
* @return the path.
*/
std::string GetPath() const;

/*!
* @brief Change the channelnumber of a group. Used by CGUIDialogPVRChannelManager. Call SortByChannelNumber() and Renumber() after all changes are done.
* @param channel The channel to change the channel number for.
Expand Down
27 changes: 11 additions & 16 deletions xbmc/pvr/channels/PVRChannelGroups.cpp
Expand Up @@ -133,34 +133,31 @@ void CPVRChannelGroups::SortGroups()
}
}

CFileItemPtr CPVRChannelGroups::GetByPath(const std::string &strPath) const
CFileItemPtr CPVRChannelGroups::GetByPath(const std::string &strInPath) const
{
// get the filename from curl
CURL url(strPath);
std::string strFileName = url.GetFileName();
URIUtils::RemoveSlashAtEnd(strFileName);
std::string strPath = strInPath;
URIUtils::RemoveSlashAtEnd(strPath);

std::string strCheckPath;
for (std::vector<CPVRChannelGroupPtr>::const_iterator it = m_groups.begin(); it != m_groups.end(); ++it)
for (const auto& group: m_groups)
{
// check if the path matches
strCheckPath = StringUtils::Format("channels/%s/%s/", (*it)->IsRadio() ? "radio" : "tv", (*it)->GroupName().c_str());
if (URIUtils::PathHasParent(strFileName, strCheckPath))
strCheckPath = group->GetPath();
if (URIUtils::PathHasParent(strPath, strCheckPath))
{
strFileName.erase(0, strCheckPath.length());
std::vector<std::string> split(StringUtils::Split(strFileName, '_', 2));
strPath.erase(0, strCheckPath.size());
std::vector<std::string> split(StringUtils::Split(strPath, '_', 2));
if (split.size() == 2)
{
CPVRChannelPtr channel((*it)->GetByUniqueID(atoi(split[1].c_str()), CServiceBroker::GetPVRManager().Clients()->GetClientId(split[0])));
const CPVRChannelPtr channel = group->GetByUniqueID(atoi(split[1].c_str()), CServiceBroker::GetPVRManager().Clients()->GetClientId(split[0]));
if (channel)
return CFileItemPtr(new CFileItem(channel));
}
}
}

// no match
CFileItemPtr retVal(new CFileItem);
return retVal;
return CFileItemPtr(new CFileItem());
}

CPVRChannelGroupPtr CPVRChannelGroups::GetById(int iGroupId) const
Expand Down Expand Up @@ -392,15 +389,13 @@ int CPVRChannelGroups::GetGroupList(CFileItemList* results, bool bExcludeHidden
int iReturn(0);
CSingleLock lock(m_critSection);

std::string strPath;
for (std::vector<CPVRChannelGroupPtr>::const_iterator it = m_groups.begin(); it != m_groups.end(); ++it)
{
// exclude hidden groups if desired
if (bExcludeHidden && (*it)->IsHidden())
continue;

strPath = StringUtils::Format("pvr://channels/%s/%s/", m_bRadio ? "radio" : "tv", (*it)->GroupName().c_str());
CFileItemPtr group(new CFileItem(strPath, true));
CFileItemPtr group(new CFileItem((*it)->GetPath(), true));
group->m_strTitle = (*it)->GroupName();
group->SetLabel((*it)->GroupName());
results->Add(group);
Expand Down