bool CPVRDatabase::Persist(CPVRChannel &channel, bool bQueueWrite /* = false */) { bool bReturn(false); /* invalid channel */ if (channel.UniqueID() <= 0) { CLog::Log(LOGERROR, "PVR - %s - invalid channel uid: %d", __FUNCTION__, channel.UniqueID()); return bReturn; } CStdString strQuery; if (channel.ChannelID() <= 0) { /* new channel */ strQuery = PrepareSQL("INSERT INTO channels (" "iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsLocked, " "sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, " "iClientChannelNumber, sInputFormat, sStreamURL, iEncryptionSystem, idEpg) " "VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, '%s', '%s', %i, %i)", channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsLocked() ? 1 : 0), channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(), channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(), channel.EpgID()); } else { /* update channel */ strQuery = PrepareSQL("REPLACE INTO channels (" "iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsLocked, " "sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, " "iClientChannelNumber, sInputFormat, sStreamURL, iEncryptionSystem, idChannel, idEpg) " "VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, '%s', '%s', %i, %i, %i)", channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsLocked() ? 1 : 0), channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(), channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(), channel.ChannelID(), channel.EpgID()); } if (bQueueWrite) { QueueInsertQuery(strQuery); bReturn = true; } else if (ExecuteQuery(strQuery)) { CSingleLock lock(channel.m_critSection); if (channel.m_iChannelId <= 0) channel.m_iChannelId = (int)m_pDS->lastinsertid(); bReturn = true; } return bReturn; }
int CPVRDatabase::Persist(const CPVRChannel &channel, bool bQueueWrite /* = false */) { int iReturn = -1; /* invalid channel */ if (channel.UniqueID() <= 0) { CLog::Log(LOGERROR, "PVRDB - %s - invalid channel uid: %d", __FUNCTION__, channel.UniqueID()); return iReturn; } CStdString strQuery; if (channel.ChannelID() <= 0) { /* new channel */ strQuery = FormatSQL("INSERT INTO channels (" "iUniqueId, bIsRadio, bIsHidden, " "sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, " "iClientChannelNumber, sInputFormat, sStreamURL, iEncryptionSystem, idEpg) " "VALUES (%i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, '%s', '%s', %i, %i);", channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(), channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(), channel.EpgID()); } else { /* update channel */ strQuery = FormatSQL("REPLACE INTO channels (" "iUniqueId, bIsRadio, bIsHidden, " "sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, " "iClientChannelNumber, sInputFormat, sStreamURL, iEncryptionSystem, idChannel, idEpg) " "VALUES (%i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, '%s', '%s', %i, %i, %i);", channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(), channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(), channel.ChannelID(), channel.EpgID()); } if (bQueueWrite) { QueueInsertQuery(strQuery); iReturn = 0; } else if (ExecuteQuery(strQuery)) { iReturn = (channel.ChannelID() <= 0) ? (int) m_pDS->lastinsertid() : channel.ChannelID(); } return iReturn; }
bool CPVRDatabase::Persist(CPVRChannel &channel, bool bCommit) { bool bReturn(false); /* invalid channel */ if (channel.UniqueID() <= 0) { CLog::LogF(LOGERROR, "Invalid channel uid: %d", channel.UniqueID()); return bReturn; } CSingleLock lock(m_critSection); // Note: Do not use channel.ChannelID value to check presence of channel in channels table. It might not yet be set correctly. std::string strQuery = PrepareSQL("iUniqueId = %u AND iClientId = %u", channel.UniqueID(), channel.ClientID()); const std::string strValue = GetSingleValue("channels", "idChannel", strQuery); if (strValue.empty()) { /* new channel */ strQuery = PrepareSQL("INSERT INTO channels (" "iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsUserSetName, bIsLocked, " "sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, " "idEpg) " "VALUES (%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i)", channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsUserSetName() ? 1 : 0), (channel.IsLocked() ? 1 : 0), channel.IconPath().c_str(), channel.ChannelName().c_str(), 0, (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), static_cast<unsigned int>(channel.LastWatched()), channel.ClientID(), channel.EpgID()); } else { /* update channel */ strQuery = PrepareSQL("REPLACE INTO channels (" "iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsUserSetName, bIsLocked, " "sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, " "idChannel, idEpg) " "VALUES (%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %s, %i)", channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsUserSetName() ? 1 : 0), (channel.IsLocked() ? 1 : 0), channel.IconPath().c_str(), channel.ChannelName().c_str(), 0, (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), static_cast<unsigned int>(channel.LastWatched()), channel.ClientID(), strValue.c_str(), channel.EpgID()); } if (QueueInsertQuery(strQuery)) { bReturn = true; if (bCommit) bReturn = CommitInsertQueries(); } return bReturn; }
long CPVRDatabase::UpdateChannel(const CPVRChannel &channel, bool bQueueWrite /* = false */) { long iReturn = -1; /* invalid channel */ if (channel.UniqueID() <= 0) { CLog::Log(LOGERROR, "PVRDB - %s - invalid channel uid: %d", __FUNCTION__, channel.UniqueID()); return iReturn; } CStdString strQuery; if (channel.ChannelID() <= 0) { /* new channel */ strQuery = FormatSQL("INSERT INTO Channels (" "UniqueId, ChannelNumber, GroupId, IsRadio, IsHidden, " "IconPath, ChannelName, IsVirtual, EPGEnabled, EPGScraper, ClientId, " "ClientChannelNumber, InputFormat, StreamURL, EncryptionSystem) " "VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %i, %i, '%s', '%s', %i)\n", channel.UniqueID(), channel.ChannelNumber(), channel.GroupID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.ClientID(), channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem()); } else { /* update channel */ strQuery = FormatSQL("REPLACE INTO Channels (" "UniqueId, ChannelNumber, GroupId, IsRadio, IsHidden, " "IconPath, ChannelName, IsVirtual, EPGEnabled, EPGScraper, ClientId, " "ClientChannelNumber, InputFormat, StreamURL, EncryptionSystem, ChannelId) " "VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %i, %i, '%s', '%s', %i, %i)\n", channel.UniqueID(), channel.ChannelNumber(), channel.GroupID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.ClientID(), channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(), channel.ChannelID()); } if (bQueueWrite) { QueueInsertQuery(strQuery); iReturn = 0; } else if (ExecuteQuery(strQuery)) { iReturn = (channel.ChannelID() <= 0) ? (long) m_pDS->lastinsertid() : channel.ChannelID(); } return iReturn; }
bool CPVRDatabase::Persist(CPVRChannel &channel) { bool bReturn(false); /* invalid channel */ if (channel.UniqueID() <= 0) { CLog::Log(LOGERROR, "PVR - %s - invalid channel uid: %d", __FUNCTION__, channel.UniqueID()); return bReturn; } std::string strQuery; if (channel.ChannelID() <= 0) { /* new channel */ strQuery = PrepareSQL("INSERT INTO channels (" "iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsUserSetName, bIsLocked, " "sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, " "idEpg) " "VALUES (%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i)", channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsUserSetName() ? 1 : 0), (channel.IsLocked() ? 1 : 0), channel.IconPath().c_str(), channel.ChannelName().c_str(), 0, (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(), channel.EpgID()); } else { /* update channel */ strQuery = PrepareSQL("REPLACE INTO channels (" "iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsUserSetName, bIsLocked, " "sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, " "idChannel, idEpg) " "VALUES (%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, %i)", channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsUserSetName() ? 1 : 0), (channel.IsLocked() ? 1 : 0), channel.IconPath().c_str(), channel.ChannelName().c_str(), 0, (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(), channel.ChannelID(), channel.EpgID()); } if (QueueInsertQuery(strQuery)) { /* update the channel ID for new channels */ if (channel.ChannelID() <= 0) channel.SetChannelID((int)m_pDS->lastinsertid()); bReturn = true; } return bReturn; }
bool CPVRChannel::UpdateFromClient(const CPVRChannel &channel) { bool bChanged = false; bChanged = SetClientID(channel.ClientID()) || bChanged; bChanged = SetClientChannelNumber(channel.ClientChannelNumber()) || bChanged; bChanged = SetClientChannelName(channel.ClientChannelName()) || bChanged; bChanged = SetInputFormat(channel.InputFormat()) || bChanged; bChanged = SetStreamURL(channel.StreamURL()) || bChanged; bChanged = SetEncryptionSystem(channel.EncryptionSystem()) || bChanged; bChanged = SetRecording(channel.IsRecording()) || bChanged; if (m_strChannelName.IsEmpty()) { m_strChannelName = channel.ClientChannelName(); bChanged = true; } if (m_strIconPath.IsEmpty()) { m_strIconPath = channel.IconPath(); bChanged = true; } return bChanged; }
int CPVRChannelGroup::GetEPGNext(CFileItemList &results) { int iInitialSize = results.Size(); CSingleLock lock(m_critSection); for (unsigned int iChannelPtr = 0; iChannelPtr < size(); iChannelPtr++) { CPVRChannel *channel = at(iChannelPtr).channel; CEpg *epg = channel->GetEPG(); if (!epg || !epg->HasValidEntries() || at(iChannelPtr).channel->IsHidden()) continue; CEpgInfoTag epgNow; if (!epg->InfoTagNext(epgNow)) continue; CFileItemPtr entry(new CFileItem(epgNow)); entry->SetLabel2(epgNow.StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false)); entry->SetPath(channel->ChannelName()); entry->SetThumbnailImage(channel->IconPath()); results.Add(entry); } return results.Size() - iInitialSize; }
int CPVREpgContainer::GetEPGNext(CFileItemList* results, bool bRadio) { CPVRChannelGroup *channels = (CPVRChannelGroup *) CPVRManager::GetChannelGroups()->GetGroupAll(bRadio); CSingleLock lock(m_critSection); int iInitialSize = results->Size(); for (unsigned int iChannelPtr = 0; iChannelPtr < channels->Size(); iChannelPtr++) { CPVRChannel *channel = (CPVRChannel *) channels->GetByIndex(iChannelPtr); CPVREpg *epg = channel->GetEPG(); if (!epg->HasValidEntries()) continue; const CPVREpgInfoTag *epgNext = (CPVREpgInfoTag *) epg->InfoTagNext(); if (!epgNext) continue; CFileItemPtr entry(new CFileItem(*epgNext)); entry->SetLabel2(epgNext->Start().GetAsLocalizedTime("", false)); entry->m_strPath = channel->ChannelName(); entry->SetThumbnailImage(channel->IconPath()); results->Add(entry); } return results->Size() - iInitialSize; }
int CPVREpgs::GetEPGNext(CFileItemList* results, bool bRadio) { CPVRChannels *channels = bRadio ? &PVRChannelsRadio : &PVRChannelsTV; int iInitialSize = results->Size(); for (unsigned int iChannelPtr = 0; iChannelPtr < channels->size(); iChannelPtr++) { CPVRChannel *channel = channels->GetByIndex(iChannelPtr); CPVREpg *epg = channel->GetEPG(); if (!epg->HasValidEntries() || epg->IsUpdateRunning()) continue; const CPVREpgInfoTag *epgNext = epg->InfoTagNext(); if (!epgNext) { continue; } CFileItemPtr entry(new CFileItem(*epgNext)); entry->SetLabel2(epgNext->Start().GetAsLocalizedTime("", false)); entry->m_strPath = channel->ChannelName(); entry->SetThumbnailImage(channel->IconPath()); results->Add(entry); } return results->Size() - iInitialSize; }
bool CPVRChannel::UpdateFromClient(const CPVRChannel &channel) { SetClientID(channel.ClientID()); SetClientChannelNumber(channel.ClientChannelNumber()); SetInputFormat(channel.InputFormat()); SetStreamURL(channel.StreamURL()); SetEncryptionSystem(channel.EncryptionSystem()); SetClientChannelName(channel.ClientChannelName()); CSingleLock lock(m_critSection); if (m_strChannelName.IsEmpty()) SetChannelName(channel.ClientChannelName()); if (m_strIconPath.IsEmpty()||(!m_strIconPath.Equals(channel.IconPath()) && !IsUserSetIcon())) SetIconPath(channel.IconPath()); return m_bChanged; }
/*! * @brief Copy over channel info from xbmcChannel to addonClient. * @param xbmcChannel The channel on XBMC's side. * @param addonChannel The channel on the addon's side. */ inline void PVRWriteClientChannelInfo(const CPVRChannel &xbmcChannel, PVR_CHANNEL &addonChannel) { addonChannel.iUniqueId = xbmcChannel.UniqueID(); addonChannel.iChannelNumber = xbmcChannel.ClientChannelNumber(); addonChannel.strChannelName = xbmcChannel.ClientChannelName().c_str(); addonChannel.strIconPath = xbmcChannel.IconPath().c_str(); addonChannel.iEncryptionSystem = xbmcChannel.EncryptionSystem(); addonChannel.bIsRadio = xbmcChannel.IsRadio(); addonChannel.bIsHidden = xbmcChannel.IsHidden(); addonChannel.strInputFormat = xbmcChannel.InputFormat().c_str(); addonChannel.strStreamURL = xbmcChannel.StreamURL().c_str(); }
/*! * @brief Copy over channel info from xbmcChannel to addonClient. * @param xbmcChannel The channel on XBMC's side. * @param addonChannel The channel on the addon's side. */ void CPVRClient::WriteClientChannelInfo(const CPVRChannel &xbmcChannel, PVR_CHANNEL &addonChannel) { memset(&addonChannel, 0, sizeof(addonChannel)); addonChannel.iUniqueId = xbmcChannel.UniqueID(); addonChannel.iChannelNumber = xbmcChannel.ClientChannelNumber(); 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(); addonChannel.bIsRadio = xbmcChannel.IsRadio(); addonChannel.bIsHidden = xbmcChannel.IsHidden(); strncpy(addonChannel.strInputFormat, xbmcChannel.InputFormat().c_str(), sizeof(addonChannel.strInputFormat) - 1); strncpy(addonChannel.strStreamURL, xbmcChannel.StreamURL().c_str(), sizeof(addonChannel.strStreamURL) - 1); }
bool CPVRChannel::UpdateFromClient(const CPVRChannel &channel) { SetClientID(channel.ClientID()); SetClientChannelNumber(channel.ClientChannelNumber()); SetInputFormat(channel.InputFormat()); SetStreamURL(channel.StreamURL()); SetEncryptionSystem(channel.EncryptionSystem()); SetClientChannelName(channel.ClientChannelName()); CSingleLock lock(m_critSection); // only update the channel name and icon if the user hasn't changed them manually if (m_strChannelName.empty() || !IsUserSetName()) SetChannelName(channel.ClientChannelName()); if (m_strIconPath.empty() || !IsUserSetIcon()) SetIconPath(channel.IconPath()); return m_bChanged; }
void CPVRChannels::SearchAndSetChannelIcons(bool bUpdateDb /* = false */) { if (g_guiSettings.GetString("pvrmenu.iconpath") == "") return; CPVRDatabase *database = g_PVRManager.GetTVDatabase(); database->Open(); for (unsigned int ptr = 0; ptr < size(); ptr++) { CPVRChannel *channel = at(ptr); /* skip if an icon is already set */ if (channel->IconPath() != "") continue; CStdString strBasePath = g_guiSettings.GetString("pvrmenu.iconpath"); CStdString strIconPath = strBasePath + channel->ClientChannelName(); CStdString strIconPathLower = strBasePath + channel->ClientChannelName().ToLower(); CStdString strIconPathUid; strIconPathUid.Format("%s/%08d", strBasePath, channel->UniqueID()); channel->SetIconPath(strIconPath + ".tbn", bUpdateDb) || channel->SetIconPath(strIconPath + ".jpg", bUpdateDb) || channel->SetIconPath(strIconPath + ".png", bUpdateDb) || channel->SetIconPath(strIconPathLower + ".tbn", bUpdateDb) || channel->SetIconPath(strIconPathLower + ".jpg", bUpdateDb) || channel->SetIconPath(strIconPathLower + ".png", bUpdateDb) || channel->SetIconPath(strIconPathUid + ".tbn", bUpdateDb) || channel->SetIconPath(strIconPathUid + ".jpg", bUpdateDb) || channel->SetIconPath(strIconPathUid + ".png", bUpdateDb); /* TODO: start channel icon scraper here if nothing was found */ } database->Close(); }
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; }
bool CGUIWindowPVRChannels::OnContextButtonSetThumb(CFileItem *item, CONTEXT_BUTTON button) { bool bReturn = false; if (button == CONTEXT_BUTTON_SET_THUMB) { if (CProfilesManager::Get().GetCurrentProfile().canWriteSources() && !g_passwordManager.IsProfileLockUnlocked()) return bReturn; else if (!g_passwordManager.IsMasterLockUnlocked(true)) return bReturn; /* setup our thumb list */ CFileItemList items; CPVRChannel *channel = item->GetPVRChannelInfoTag(); if (!channel->IconPath().IsEmpty()) { /* add the current thumb, if available */ CFileItemPtr current(new CFileItem("thumb://Current", false)); current->SetArt("thumb", channel->IconPath()); current->SetLabel(g_localizeStrings.Get(20016)); items.Add(current); } else if (item->HasArt("thumb")) { /* already have a thumb that the share doesn't know about - must be a local one, so we may as well reuse it */ CFileItemPtr current(new CFileItem("thumb://Current", false)); current->SetArt("thumb", item->GetArt("thumb")); current->SetLabel(g_localizeStrings.Get(20016)); items.Add(current); } /* and add a "no thumb" entry as well */ CFileItemPtr nothumb(new CFileItem("thumb://None", false)); nothumb->SetIconImage(item->GetIconImage()); nothumb->SetLabel(g_localizeStrings.Get(20018)); items.Add(nothumb); CStdString strThumb; VECSOURCES shares; if (g_guiSettings.GetString("pvrmenu.iconpath") != "") { CMediaSource share1; share1.strPath = g_guiSettings.GetString("pvrmenu.iconpath"); share1.strName = g_localizeStrings.Get(19018); shares.push_back(share1); } g_mediaManager.GetLocalDrives(shares); if (!CGUIDialogFileBrowser::ShowAndGetImage(items, shares, g_localizeStrings.Get(1030), strThumb)) return bReturn; if (strThumb != "thumb://Current") { if (strThumb == "thumb://None") strThumb = ""; channel->SetIconPath(strThumb, true); channel->Persist(); UpdateData(); } bReturn = true; } return bReturn; }