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][keymaps][guiinfo] Fix / improve subchannel numbers support #13069

Merged
merged 10 commits into from
Nov 21, 2017
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/resource.language.en_gb/resources/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -9810,7 +9810,7 @@ msgstr ""
#. default for channels without a name. place holder will be filled with channel number.
#: xbmc/pvr/channels/PVRChannel.cpp
msgctxt "#19085"
msgid "Unknown channel {0:d}"
msgid "Unknown channel {0:s}"
msgstr ""

#. Label for "Instant recording action" setting
Expand Down
7 changes: 7 additions & 0 deletions system/keymaps/keyboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
<delete>Delete</delete>
<m mod="ctrl">Move</m>
<h>PreviousMenu</h>
<period mod="longpress">ChannelNumberSeparator</period>
</keyboard>
</TVChannels>
<TVRecordings>
Expand Down Expand Up @@ -249,13 +250,15 @@
<g>NextChannelGroup</g>
<backspace mod="longpress">Number0</backspace> <!-- 0 key goes to "now" on EPG timeline -->
<browser_back mod="longpress">Number0</browser_back> <!-- 0 key goes to "now" on EPG timeline -->
<period mod="longpress">ChannelNumberSeparator</period>
</keyboard>
</TVGuide>
<RadioChannels>
<keyboard>
<delete>Delete</delete>
<m mod="ctrl">Move</m>
<j>PreviousMenu</j>
<period mod="longpress">ChannelNumberSeparator</period>
</keyboard>
</RadioChannels>
<RadioRecordings>
Expand Down Expand Up @@ -294,6 +297,7 @@
<t>ShowTimerRule</t>
<backspace mod="longpress">Number0</backspace> <!-- 0 key goes to "now" on EPG timeline -->
<browser_back mod="longpress">Number0</browser_back> <!-- 0 key goes to "now" on EPG timeline -->
<period mod="longpress">ChannelNumberSeparator</period>
</keyboard>
</RadioGuide>
<FileManager>
Expand Down Expand Up @@ -672,6 +676,7 @@
<enter mod="longpress">ActivateWindow(PVROSDChannels)</enter>
<pageup>ChannelUp</pageup>
<pagedown>ChannelDown</pagedown>
<period mod="longpress">ChannelNumberSeparator</period>
</keyboard>
</FullscreenLiveTV>
<FullscreenRadio>
Expand All @@ -688,10 +693,12 @@
<enter mod="longpress">ActivateWindow(PVROSDChannels)</enter>
<pageup>ChannelUp</pageup>
<pagedown>ChannelDown</pagedown>
<period mod="longpress">ChannelNumberSeparator</period>
</keyboard>
</FullscreenRadio>
<PVROSDChannels>
<keyboard>
<period mod="longpress">ChannelNumberSeparator</period>
<backspace>Close</backspace>
<escape>Close</escape>
<browser_back>Close</browser_back>
Expand Down
93 changes: 6 additions & 87 deletions xbmc/GUIInfoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1708,16 +1708,6 @@ const infomap musicpartymode[] = {{ "enabled", MUSICPM_ENABLED },
/// _string_,
/// Channel name of the radio programme that's currently playing (PVR).
/// }
/// \table_row3{ <b>`MusicPlayer.ChannelNumber`</b>,
/// \anchor MusicPlayer_ChannelNumber
/// _string_,
/// Channel number of the radio programme that's currently playing (PVR).
/// }
/// \table_row3{ <b>`MusicPlayer.SubChannelNumber`</b>,
/// \anchor MusicPlayer_SubChannelNumber
/// _string_,
/// Subchannel number of the radio channel that's currently playing (PVR).
/// }
/// \table_row3{ <b>`MusicPlayer.ChannelNumberLabel`</b>,
/// \anchor MusicPlayer_ChannelNumberLabel
/// _string_,
Expand Down Expand Up @@ -1764,9 +1754,7 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE },
{ "playcount", MUSICPLAYER_PLAYCOUNT },
{ "lastplayed", MUSICPLAYER_LASTPLAYED },
{ "channelname", MUSICPLAYER_CHANNEL_NAME },
{ "channelnumber", MUSICPLAYER_CHANNEL_NUMBER },
{ "subchannelnumber", MUSICPLAYER_SUB_CHANNEL_NUMBER },
{ "channelnumberlabel", MUSICPLAYER_CHANNEL_NUMBER_LBL },
{ "channelnumberlabel", MUSICPLAYER_CHANNEL_NUMBER },
{ "channelgroup", MUSICPLAYER_CHANNEL_GROUP },
{ "dbid", MUSICPLAYER_DBID }
};
Expand Down Expand Up @@ -2106,16 +2094,6 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE },
/// _string_,
/// Name of the currently tuned channel (PVR).
/// }
/// \table_row3{ <b>`VideoPlayer.ChannelNumber`</b>,
/// \anchor VideoPlayer_ChannelNumber
/// _string_,
/// Number of the currently tuned channel (PVR).
/// }
/// \table_row3{ <b>`VideoPlayer.SubChannelNumber`</b>,
/// \anchor VideoPlayer_SubChannelNumber
/// _string_,
/// Subchannel number of the tv channel that's currently playing (PVR).
/// }
/// \table_row3{ <b>`VideoPlayer.ChannelNumberLabel`</b>,
/// \anchor VideoPlayer_ChannelNumberLabel
/// _string_,
Expand Down Expand Up @@ -2191,9 +2169,7 @@ const infomap videoplayer[] = {{ "title", VIDEOPLAYER_TITLE },
{ "nextendtime", VIDEOPLAYER_NEXT_ENDTIME },
{ "nextduration", VIDEOPLAYER_NEXT_DURATION },
{ "channelname", VIDEOPLAYER_CHANNEL_NAME },
{ "channelnumber", VIDEOPLAYER_CHANNEL_NUMBER },
{ "subchannelnumber", VIDEOPLAYER_SUB_CHANNEL_NUMBER },
{ "channelnumberlabel", VIDEOPLAYER_CHANNEL_NUMBER_LBL },
{ "channelnumberlabel", VIDEOPLAYER_CHANNEL_NUMBER },
{ "channelgroup", VIDEOPLAYER_CHANNEL_GROUP },
{ "hasepg", VIDEOPLAYER_HAS_EPG },
{ "parentalrating", VIDEOPLAYER_PARENTAL_RATING },
Expand Down Expand Up @@ -3468,11 +3444,6 @@ const infomap container_str[] = {{ "property", CONTAINER_PROPERTY },
/// _string_,
/// Playcount of Video in a container
/// }
/// \table_row3{ <b>`ListItem.ChannelNumber`</b>,
/// \anchor ListItem_ChannelNumber
/// _string_,
/// Number of current selected TV channel in a container
/// }
/// \table_row3{ <b>`ListItem.ChannelName`</b>,
/// \anchor ListItem_ChannelName
/// _string_,
Expand Down Expand Up @@ -3675,12 +3646,6 @@ const infomap container_str[] = {{ "property", CONTAINER_PROPERTY },
/// _string_,
/// Channel group of the selected item (PVR).
/// }
/// \table_row3{ <b>`ListItem.SubChannelNumber`</b>,
/// \anchor ListItem_SubChannelNumber
/// _string_,
/// Subchannel number of the currently selected channel that's currently
/// playing (PVR).
/// }
/// \table_row3{ <b>`ListItem.ChannelNumberLabel`</b>,
/// \anchor ListItem_ChannelNumberLabel
/// _string_,
Expand Down Expand Up @@ -3962,9 +3927,7 @@ const infomap listitem_labels[]= {{ "thumb", LISTITEM_THUMB },
{ "nextstartdate", LISTITEM_NEXT_STARTDATE },
{ "nextenddate", LISTITEM_NEXT_ENDDATE },
{ "channelname", LISTITEM_CHANNEL_NAME },
{ "channelnumber", LISTITEM_CHANNEL_NUMBER },
{ "subchannelnumber", LISTITEM_SUB_CHANNEL_NUMBER },
{ "channelnumberlabel", LISTITEM_CHANNEL_NUMBER_LBL },
{ "channelnumberlabel", LISTITEM_CHANNEL_NUMBER },
{ "channelgroup", LISTITEM_CHANNEL_GROUP },
{ "hasepg", LISTITEM_HAS_EPG },
{ "hastimer", LISTITEM_HASTIMER },
Expand Down Expand Up @@ -6211,8 +6174,6 @@ std::string CGUIInfoManager::GetLabel(int info, int contextWindow, std::string *
case MUSICPLAYER_LYRICS:
case MUSICPLAYER_CHANNEL_NAME:
case MUSICPLAYER_CHANNEL_NUMBER:
case MUSICPLAYER_SUB_CHANNEL_NUMBER:
case MUSICPLAYER_CHANNEL_NUMBER_LBL:
case MUSICPLAYER_CHANNEL_GROUP:
case MUSICPLAYER_PLAYCOUNT:
case MUSICPLAYER_LASTPLAYED:
Expand Down Expand Up @@ -6257,8 +6218,6 @@ std::string CGUIInfoManager::GetLabel(int info, int contextWindow, std::string *
case VIDEOPLAYER_NEXT_DURATION:
case VIDEOPLAYER_CHANNEL_NAME:
case VIDEOPLAYER_CHANNEL_NUMBER:
case VIDEOPLAYER_SUB_CHANNEL_NUMBER:
case VIDEOPLAYER_CHANNEL_NUMBER_LBL:
case VIDEOPLAYER_CHANNEL_GROUP:
case VIDEOPLAYER_PARENTAL_RATING:
case VIDEOPLAYER_PLAYCOUNT:
Expand Down Expand Up @@ -8802,19 +8761,7 @@ std::string CGUIInfoManager::GetMusicTagLabel(int info, const CFileItem *item)
case MUSICPLAYER_CHANNEL_NUMBER:
{
if (m_currentFile->HasPVRChannelInfoTag())
return StringUtils::Format("%i", m_currentFile->GetPVRChannelInfoTag()->ChannelNumber());
}
break;
case MUSICPLAYER_SUB_CHANNEL_NUMBER:
{
if (m_currentFile->HasPVRChannelInfoTag())
return StringUtils::Format("%i", m_currentFile->GetPVRChannelInfoTag()->SubChannelNumber());
}
break;
case MUSICPLAYER_CHANNEL_NUMBER_LBL:
{
if (m_currentFile->HasPVRChannelInfoTag())
return m_currentFile->GetPVRChannelInfoTag()->FormattedChannelNumber();
return m_currentFile->GetPVRChannelInfoTag()->ChannelNumber().FormattedChannelNumber();
}
break;
case MUSICPLAYER_CHANNEL_GROUP:
Expand Down Expand Up @@ -10265,32 +10212,6 @@ std::string CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, std::
return item->GetPVRRecordingInfoTag()->ExpirationTimeAsLocalTime().GetAsLocalizedTime("", false);;
break;
case LISTITEM_CHANNEL_NUMBER:
{
std::string number;
if (item->HasPVRChannelInfoTag())
number = StringUtils::Format("%i", item->GetPVRChannelInfoTag()->ChannelNumber());
if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->HasChannel())
number = StringUtils::Format("%i", item->GetEPGInfoTag()->ChannelNumber());
if (item->HasPVRTimerInfoTag())
number = StringUtils::Format("%i", item->GetPVRTimerInfoTag()->ChannelNumber());

return number;
}
break;
case LISTITEM_SUB_CHANNEL_NUMBER:
{
std::string number;
if (item->HasPVRChannelInfoTag())
number = StringUtils::Format("%i", item->GetPVRChannelInfoTag()->SubChannelNumber());
if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->HasChannel())
number = StringUtils::Format("%i", item->GetEPGInfoTag()->Channel()->SubChannelNumber());
if (item->HasPVRTimerInfoTag() && item->GetPVRTimerInfoTag()->HasChannel())
number = StringUtils::Format("%i", item->GetPVRTimerInfoTag()->Channel()->SubChannelNumber());

return number;
}
break;
case LISTITEM_CHANNEL_NUMBER_LBL:
{
CPVRChannelPtr channel;
if (item->HasPVRChannelInfoTag())
Expand All @@ -10300,16 +10221,14 @@ std::string CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, std::
else if (item->HasPVRTimerInfoTag())
channel = item->GetPVRTimerInfoTag()->Channel();

return channel ?
channel->FormattedChannelNumber() :
"";
return channel ? channel->ChannelNumber().FormattedChannelNumber() : "";
}
break;
case LISTITEM_CHANNEL_NAME:
if (item->HasPVRChannelInfoTag())
return item->GetPVRChannelInfoTag()->ChannelName();
if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->HasChannel())
return item->GetEPGInfoTag()->ChannelName();
return item->GetEPGInfoTag()->Channel()->ChannelName();
if (item->HasPVRRecordingInfoTag())
return item->GetPVRRecordingInfoTag()->m_strChannelName;
if (item->HasPVRTimerInfoTag())
Expand Down
8 changes: 4 additions & 4 deletions xbmc/addons/PVRClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,8 @@ void CPVRClient::WriteClientChannelInfo(const CPVRChannelPtr &xbmcChannel, PVR_C
{
addonChannel = {0};
addonChannel.iUniqueId = xbmcChannel->UniqueID();
addonChannel.iChannelNumber = xbmcChannel->ClientChannelNumber();
addonChannel.iSubChannelNumber = xbmcChannel->ClientSubChannelNumber();
addonChannel.iChannelNumber = xbmcChannel->ClientChannelNumber().GetChannelNumber();
addonChannel.iSubChannelNumber = xbmcChannel->ClientChannelNumber().GetSubChannelNumber();
strncpy(addonChannel.strChannelName, xbmcChannel->ClientChannelName().c_str(), sizeof(addonChannel.strChannelName) - 1);
strncpy(addonChannel.strIconPath, xbmcChannel->IconPath().c_str(), sizeof(addonChannel.strIconPath) - 1);
addonChannel.iEncryptionSystem = xbmcChannel->EncryptionSystem();
Expand Down Expand Up @@ -1710,7 +1710,7 @@ void CPVRClient::cb_transfer_channel_group_member(void *kodiInstance, const ADDO
else if (group->IsRadio() == channel->IsRadio())
{
/* transfer this entry to the group */
group->AddToGroup(channel, member->iChannelNumber);
group->AddToGroup(channel, CPVRChannelNumber(member->iChannelNumber, /*member->iSubChannelNumber*/ 0), true); // FIXME: Extend PVR API: Add PVR_CHANNEL_GROUP_MEMBER::iSubChannelNumber
}
}

Expand Down Expand Up @@ -1752,7 +1752,7 @@ void CPVRClient::cb_transfer_channel_entry(void *kodiInstance, const ADDON_HANDL

/* transfer this entry to the internal channels group */
CPVRChannelPtr transferChannel(new CPVRChannel(*channel, client->GetID()));
kodiChannels->UpdateFromClient(transferChannel);
kodiChannels->UpdateFromClient(transferChannel, CPVRChannelNumber());
}

void CPVRClient::cb_transfer_recording_entry(void *kodiInstance, const ADDON_HANDLE handle, const PVR_RECORDING *recording)
Expand Down
18 changes: 9 additions & 9 deletions xbmc/guiinfo/GUIInfoLabels.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@
#define MUSICPLAYER_PLAYCOUNT 227
#define MUSICPLAYER_LASTPLAYED 228
#define MUSICPLAYER_CHANNEL_NAME 229
#define MUSICPLAYER_CHANNEL_NUMBER 230
// unused 230
#define MUSICPLAYER_CHANNEL_GROUP 231
#define MUSICPLAYER_SUB_CHANNEL_NUMBER 232
#define MUSICPLAYER_CHANNEL_NUMBER_LBL 233
// unused 232
#define MUSICPLAYER_CHANNEL_NUMBER 233
#define MUSICPLAYER_CONTENT 234
#define MUSICPLAYER_USER_RATING 235
#define MUSICPLAYER_RATING_AND_VOTES 236
Expand Down Expand Up @@ -260,7 +260,7 @@
#define VIDEOPLAYER_NEXT_ENDTIME 302
#define VIDEOPLAYER_NEXT_DURATION 303
#define VIDEOPLAYER_CHANNEL_NAME 304
#define VIDEOPLAYER_CHANNEL_NUMBER 305
// unused 305
#define VIDEOPLAYER_CHANNEL_GROUP 306
#define VIDEOPLAYER_PARENTAL_RATING 307
#define VIDEOPLAYER_HAS_EPG 308
Expand All @@ -269,8 +269,8 @@
#define VIDEOPLAYER_STEREOSCOPIC_MODE 311
#define VIDEOPLAYER_SUBTITLES_LANG 312
#define VIDEOPLAYER_AUDIO_LANG 313
#define VIDEOPLAYER_SUB_CHANNEL_NUMBER 314
#define VIDEOPLAYER_CHANNEL_NUMBER_LBL 315
// unused 314
#define VIDEOPLAYER_CHANNEL_NUMBER 315
#define VIDEOPLAYER_CAN_RESUME_LIVE_TV 316
#define VIDEOPLAYER_IMDBNUMBER 317
#define VIDEOPLAYER_EPISODENAME 318
Expand Down Expand Up @@ -761,7 +761,7 @@
#define LISTITEM_NEXT_ENDDATE (LISTITEM_START + 128)
#define LISTITEM_NEXT_DURATION (LISTITEM_START + 129)
#define LISTITEM_CHANNEL_NAME (LISTITEM_START + 130)
#define LISTITEM_CHANNEL_NUMBER (LISTITEM_START + 131)
// unused (LISTITEM_START + 131)
#define LISTITEM_CHANNEL_GROUP (LISTITEM_START + 132)
#define LISTITEM_HASTIMER (LISTITEM_START + 133)
#define LISTITEM_ISRECORDING (LISTITEM_START + 134)
Expand All @@ -774,8 +774,8 @@
#define LISTITEM_IS_STEREOSCOPIC (LISTITEM_START + 141)
#define LISTITEM_INPROGRESS (LISTITEM_START + 142)
#define LISTITEM_HASRECORDING (LISTITEM_START + 143)
#define LISTITEM_SUB_CHANNEL_NUMBER (LISTITEM_START + 144)
#define LISTITEM_CHANNEL_NUMBER_LBL (LISTITEM_START + 145)
// unused (LISTITEM_START + 144)
#define LISTITEM_CHANNEL_NUMBER (LISTITEM_START + 145)
#define LISTITEM_IMDBNUMBER (LISTITEM_START + 146)
#define LISTITEM_EPISODENAME (LISTITEM_START + 147)
#define LISTITEM_IS_COLLECTION (LISTITEM_START + 148)
Expand Down
1 change: 1 addition & 0 deletions xbmc/input/ActionIDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
#define ACTION_PVR_PLAY_TV 189
#define ACTION_PVR_PLAY_RADIO 190
#define ACTION_PVR_SHOW_TIMER_RULE 191
#define ACTION_CHANNEL_NUMBER_SEP 192

#define ACTION_TOGGLE_FULLSCREEN 199 //!< switch 2 desktop resolution
#define ACTION_TOGGLE_WATCHED 200 //!< Toggle watched status (videos)
Expand Down
1 change: 1 addition & 0 deletions xbmc/input/ActionTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ static const std::map<ActionName, ActionID> ActionMappings =
{ "record" , ACTION_RECORD },
{ "togglecommskip" , ACTION_TOGGLE_COMMSKIP },
{ "showtimerrule" , ACTION_PVR_SHOW_TIMER_RULE },
{ "channelnumberseparator" , ACTION_CHANNEL_NUMBER_SEP },

// Mouse actions
{ "leftclick" , ACTION_MOUSE_LEFT_CLICK },
Expand Down
27 changes: 20 additions & 7 deletions xbmc/pvr/PVRActionListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ bool CPVRActionListener::OnAction(const CAction &action)
case REMOTE_7:
case REMOTE_8:
case REMOTE_9:
case ACTION_CHANNEL_NUMBER_SEP:
{
if (!bIsPlayingPVR)
return false;
Expand All @@ -131,12 +132,22 @@ bool CPVRActionListener::OnAction(const CAction &action)
if (g_windowManager.IsPythonWindow(g_windowManager.GetTopMostModalDialogID()))
return false;

int iRemote = bIsJumpSMS ? action.GetID() - (ACTION_JUMP_SMS2 - REMOTE_2) : action.GetID();
CServiceBroker::GetPVRManager().GUIActions()->GetChannelNumberInputHandler().AppendChannelNumberDigit(iRemote - REMOTE_0);
char cCharacter;
if (action.GetID() == ACTION_CHANNEL_NUMBER_SEP)
{
cCharacter = CPVRChannelNumber::SEPARATOR;
}
else
{
int iRemote = bIsJumpSMS ? action.GetID() - (ACTION_JUMP_SMS2 - REMOTE_2) : action.GetID();
cCharacter = (iRemote - REMOTE_0) + '0';
}
CServiceBroker::GetPVRManager().GUIActions()->GetChannelNumberInputHandler().AppendChannelNumberCharacter(cCharacter);
return true;
}
return false;
}

case ACTION_SHOW_INFO:
{
if (!bIsPlayingPVR)
Expand Down Expand Up @@ -173,12 +184,14 @@ bool CPVRActionListener::OnAction(const CAction &action)
if (!bIsPlayingPVR)
return false;

// Offset from key codes back to button number
int iChannelNumber = static_cast<int>(action.GetAmount());
const CPVRChannelPtr currentChannel(CServiceBroker::GetPVRManager().GetCurrentChannel());
const CFileItemPtr item(CServiceBroker::GetPVRManager().ChannelGroups()->Get(currentChannel->IsRadio())->GetSelectedGroup()->GetByChannelNumber(iChannelNumber));
CServiceBroker::GetPVRManager().GUIActions()->SwitchToChannel(item, false);
int iChannelNumber = static_cast<int>(action.GetAmount(0));
int iSubChannelNumber = static_cast<int>(action.GetAmount(1));

const CPVRChannelPtr currentChannel = CServiceBroker::GetPVRManager().GetCurrentChannel();
const CPVRChannelGroupPtr selectedGroup = CServiceBroker::GetPVRManager().ChannelGroups()->Get(currentChannel->IsRadio())->GetSelectedGroup();
const CFileItemPtr item(selectedGroup->GetByChannelNumber(CPVRChannelNumber(iChannelNumber, iSubChannelNumber)));

CServiceBroker::GetPVRManager().GUIActions()->SwitchToChannel(item, false);
return true;
}
}
Expand Down
Loading