PVR_ERROR CPVRClients::DeleteAllRecordingsFromTrash() { PVR_ERROR error(PVR_ERROR_NO_ERROR); PVR_CLIENTMAP clients; GetConnectedClients(clients); std::vector<PVR_CLIENT> suppClients; for (PVR_CLIENTMAP_CITR itrClients = clients.begin(); itrClients != clients.end(); ++itrClients) { if (itrClients->second->SupportsRecordingsUndelete() && itrClients->second->GetRecordingsAmount(true) > 0) suppClients.push_back(itrClients->second); } int selection = 0; if (suppClients.size() > 1) { // have user select client CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); pDialog->Reset(); pDialog->SetHeading(CVariant{19292}); //Delete all permanently pDialog->Add(g_localizeStrings.Get(24032)); // All Add-ons PVR_CLIENTMAP_CITR itrClients; for (itrClients = clients.begin(); itrClients != clients.end(); ++itrClients) { if (itrClients->second->SupportsRecordingsUndelete() && itrClients->second->GetRecordingsAmount(true) > 0) pDialog->Add(itrClients->second->GetBackendName()); } pDialog->Open(); selection = pDialog->GetSelectedItem(); } if (selection == 0) { typedef std::vector<PVR_CLIENT>::const_iterator suppClientsCITR; for (suppClientsCITR itrSuppClients = suppClients.begin(); itrSuppClients != suppClients.end(); ++itrSuppClients) { PVR_ERROR currentError = (*itrSuppClients)->DeleteAllRecordingsFromTrash(); if (currentError != PVR_ERROR_NO_ERROR) { CLog::Log(LOGERROR, "PVR - %s - cannot delete all recordings from client '%d': %s",__FUNCTION__, (*itrSuppClients)->GetID(), CPVRClient::ToString(currentError)); error = currentError; } } } else if (selection >= 1 && selection <= (int)suppClients.size()) { PVR_ERROR currentError = suppClients[selection-1]->DeleteAllRecordingsFromTrash(); if (currentError != PVR_ERROR_NO_ERROR) { CLog::Log(LOGERROR, "PVR - %s - cannot delete all recordings from client '%d': %s",__FUNCTION__, suppClients[selection-1]->GetID(), CPVRClient::ToString(currentError)); error = currentError; } } return error; }
void CPVRClients::ProcessMenuHooks(int iClientID, PVR_MENUHOOK_CAT cat) { PVR_MENUHOOKS *hooks = NULL; // get client id if (iClientID < 0 && cat == PVR_MENUHOOK_SETTING) { PVR_CLIENTMAP clients; GetConnectedClients(clients); if (clients.size() == 1) { iClientID = clients.begin()->first; } else if (clients.size() > 1) { // have user select client CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); pDialog->Reset(); pDialog->SetHeading(19196); PVR_CLIENTMAP_ITR itrClients; for (itrClients = clients.begin(); itrClients != clients.end(); itrClients++) { pDialog->Add(itrClients->second->GetBackendName()); } pDialog->DoModal(); int selection = pDialog->GetSelectedLabel(); if (selection >= 0) { itrClients = clients.begin(); for (int i = 0; i < selection; i++) itrClients++; iClientID = itrClients->first; } } } if (iClientID < 0) iClientID = GetPlayingClientID(); PVR_CLIENT client; if (GetConnectedClient(iClientID, client) && client->HaveMenuHooks(cat)) { hooks = client->GetMenuHooks(); std::vector<int> hookIDs; CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); pDialog->Reset(); pDialog->SetHeading(19196); for (unsigned int i = 0; i < hooks->size(); i++) pDialog->Add(client->GetString(hooks->at(i).iLocalizedStringId)); pDialog->DoModal(); int selection = pDialog->GetSelectedLabel(); if (selection >= 0) client->CallMenuHook(hooks->at(selection)); } }
PVR_ERROR CPVRClients::GetChannelGroups(CPVRChannelGroups *groups) { PVR_ERROR error(PVR_ERROR_NO_ERROR); PVR_CLIENTMAP clients; GetConnectedClients(clients); for (PVR_CLIENTMAP_ITR itrClients = clients.begin(); itrClients != clients.end(); itrClients++) { PVR_ERROR currentError = (*itrClients).second->GetChannelGroups(groups); if (currentError != PVR_ERROR_NOT_IMPLEMENTED && currentError != PVR_ERROR_NO_ERROR) { error = currentError; CLog::Log(LOGERROR, "PVR - %s - cannot get groups from client '%d': %s",__FUNCTION__, (*itrClients).first, CPVRClient::ToString(error)); } } return error; }
PVR_ERROR CPVRClients::GetRecordings(CPVRRecordings *recordings, bool deleted) { PVR_ERROR error(PVR_ERROR_NO_ERROR); PVR_CLIENTMAP clients; GetConnectedClients(clients); for (PVR_CLIENTMAP_CITR itrClients = clients.begin(); itrClients != clients.end(); itrClients++) { PVR_ERROR currentError = (*itrClients).second->GetRecordings(recordings, deleted); if (currentError != PVR_ERROR_NOT_IMPLEMENTED && currentError != PVR_ERROR_NO_ERROR) { CLog::Log(LOGERROR, "PVR - %s - cannot get recordings from client '%d': %s",__FUNCTION__, (*itrClients).first, CPVRClient::ToString(currentError)); error = currentError; } } return error; }
PVR_ERROR CPVRClients::GetChannels(CPVRChannelGroupInternal *group) { PVR_ERROR error(PVR_ERROR_NO_ERROR); PVR_CLIENTMAP clients; GetConnectedClients(clients); /* get the channel list from each client */ for (PVR_CLIENTMAP_ITR itrClients = clients.begin(); itrClients != clients.end(); itrClients++) { PVR_ERROR currentError = (*itrClients).second->GetChannels(*group, group->IsRadio()); if (currentError != PVR_ERROR_NOT_IMPLEMENTED && currentError != PVR_ERROR_NO_ERROR) { error = currentError; CLog::Log(LOGERROR, "PVR - %s - cannot get channels from client '%d': %s",__FUNCTION__, (*itrClients).first, CPVRClient::ToString(error)); } } return error; }
PVR_ERROR CPVRClients::GetTimers(CPVRTimers *timers) { PVR_ERROR error(PVR_ERROR_NO_ERROR); PVR_CLIENTMAP clients; GetConnectedClients(clients); /* get the timer list from each client */ for (PVR_CLIENTMAP_ITR itrClients = clients.begin(); itrClients != clients.end(); itrClients++) { PVR_ERROR currentError = (*itrClients).second->GetTimers(timers); if (currentError != PVR_ERROR_NOT_IMPLEMENTED && currentError != PVR_ERROR_NO_ERROR) { CLog::Log(LOGERROR, "PVR - %s - cannot get timers from client '%d': %s",__FUNCTION__, (*itrClients).first, CPVRClient::ToString(currentError)); error = currentError; } } return error; }
bool CGUIDialogPVRChannelManager::OnClickButtonNewChannel(CGUIMessage &message) { std::vector<long> clients; CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); if (!pDlgSelect) return false; pDlgSelect->SetHeading(19213); // Select Client pDlgSelect->Add(g_localizeStrings.Get(19209)); clients.push_back(PVR_VIRTUAL_CLIENT_ID); PVR_CLIENTMAP clientMap; if (g_PVRClients->GetConnectedClients(clientMap) > 0) { PVR_CLIENTMAP_ITR itr; for (itr = clientMap.begin() ; itr != clientMap.end(); itr++) { clients.push_back((*itr).first); pDlgSelect->Add((*itr).second->Name()); } } pDlgSelect->DoModal(); int selection = pDlgSelect->GetSelectedLabel(); if (selection >= 0 && selection <= (int) clients.size()) { int clientID = clients[selection]; if (clientID == PVR_VIRTUAL_CLIENT_ID) { CStdString strURL = ""; if (CGUIKeyboardFactory::ShowAndGetInput(strURL, g_localizeStrings.Get(19214), false)) { if (!strURL.empty()) { CPVRChannel *newchannel = new CPVRChannel(m_bIsRadio); newchannel->SetChannelName(g_localizeStrings.Get(19204)); newchannel->SetEPGEnabled(false); newchannel->SetVirtual(true); newchannel->SetStreamURL(strURL); newchannel->SetClientID(PVR_VIRTUAL_CLIENT_ID); if (g_PVRChannelGroups->CreateChannel(*newchannel)) g_PVRChannelGroups->GetGroupAll(m_bIsRadio)->Persist(); CFileItemPtr channel(new CFileItem(*newchannel)); if (channel) { channel->SetProperty("ActiveChannel", true); channel->SetProperty("Name", g_localizeStrings.Get(19204)); channel->SetProperty("UseEPG", false); channel->SetProperty("Icon", newchannel->IconPath()); channel->SetProperty("EPGSource", (int)0); channel->SetProperty("ClientName", g_localizeStrings.Get(19209)); channel->SetProperty("ParentalLocked", false); m_channelItems->AddFront(channel, m_iSelected); m_viewControl.SetItems(*m_channelItems); Renumber(); } } } } else { CGUIDialogOK::ShowAndGetInput(19033,19038,0,0); } } return true; }
void CPVRClients::ProcessMenuHooks(int iClientID, PVR_MENUHOOK_CAT cat, const CFileItem *item) { // get client id if (iClientID < 0 && cat == PVR_MENUHOOK_SETTING) { PVR_CLIENTMAP clients; GetConnectedClients(clients); if (clients.size() == 1) { iClientID = clients.begin()->first; } else if (clients.size() > 1) { // have user select client CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); pDialog->Reset(); pDialog->SetHeading(CVariant{19196}); PVR_CLIENTMAP_CITR itrClients; for (itrClients = clients.begin(); itrClients != clients.end(); itrClients++) { pDialog->Add(itrClients->second->GetBackendName()); } pDialog->Open(); int selection = pDialog->GetSelectedItem(); if (selection >= 0) { itrClients = clients.begin(); for (int i = 0; i < selection; i++) itrClients++; iClientID = itrClients->first; } } } if (iClientID < 0) iClientID = GetPlayingClientID(); PVR_CLIENT client; if (GetConnectedClient(iClientID, client) && client->HaveMenuHooks(cat)) { PVR_MENUHOOKS *hooks = client->GetMenuHooks(); std::vector<int> hookIDs; int selection = 0; CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); pDialog->Reset(); pDialog->SetHeading(CVariant{19196}); for (unsigned int i = 0; i < hooks->size(); i++) if (hooks->at(i).category == cat || hooks->at(i).category == PVR_MENUHOOK_ALL) { pDialog->Add(g_localizeStrings.GetAddonString(client->ID(), hooks->at(i).iLocalizedStringId)); hookIDs.push_back(i); } if (hookIDs.size() > 1) { pDialog->Open(); selection = pDialog->GetSelectedItem(); } if (selection >= 0) client->CallMenuHook(hooks->at(hookIDs.at(selection)), item); } }