mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 09:21:18 +02:00
zapit/src/bouquets.cpp: change bouquets delete behavior after scan:
if box cable-only, remove all bouquets, else remove bouquets for scanned position only, do not remove bouquets after single transponder scan
This commit is contained in:
@@ -105,7 +105,7 @@ class CBouquetManager
|
||||
|
||||
void saveBouquets(void);
|
||||
void saveUBouquets(void);
|
||||
void saveBouquets(const CZapitClient::bouquetMode bouquetMode, const char * const providerName);
|
||||
void saveBouquets(const CZapitClient::bouquetMode bouquetMode, const char * const providerName, t_satellite_position satellitePosition = -1);
|
||||
void loadBouquets(bool ignoreBouquetFile = false);
|
||||
void renumServices();
|
||||
|
||||
@@ -118,6 +118,7 @@ class CBouquetManager
|
||||
bool existsChannelInBouquet(unsigned int bq_id, const t_channel_id channel_id);
|
||||
|
||||
void clearAll(bool user = true);
|
||||
void deletePosition(t_satellite_position satellitePosition);
|
||||
|
||||
void sortBouquets(void);
|
||||
};
|
||||
|
@@ -279,12 +279,16 @@ void CBouquetManager::saveUBouquets(void)
|
||||
chmod(UBOUQUETS_XML, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
}
|
||||
|
||||
void CBouquetManager::saveBouquets(const CZapitClient::bouquetMode bouquetMode, const char * const providerName)
|
||||
void CBouquetManager::saveBouquets(const CZapitClient::bouquetMode bouquetMode, const char * const providerName, t_satellite_position satellitePosition)
|
||||
{
|
||||
if (bouquetMode == CZapitClient::BM_DELETEBOUQUETS) {
|
||||
INFO("removing existing bouquets");
|
||||
//unlink(BOUQUETS_XML);
|
||||
g_bouquetManager->clearAll(false);
|
||||
if (satellitePosition > 0) {
|
||||
if (CFEManager::getInstance()->cableOnly())
|
||||
g_bouquetManager->clearAll(false);
|
||||
else
|
||||
g_bouquetManager->deletePosition(satellitePosition);
|
||||
}
|
||||
}
|
||||
if (bouquetMode == CZapitClient::BM_DONTTOUCHBOUQUETS)
|
||||
return;
|
||||
@@ -413,6 +417,14 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
|
||||
}
|
||||
|
||||
channel_node = channel_node->xmlNextNode;
|
||||
if(!bUser) {
|
||||
/* set satellite position for provider bouquets.
|
||||
reset position to 0, if position not match - means mixed bouquet */
|
||||
if (newBouquet->satellitePosition < 0)
|
||||
newBouquet->satellitePosition = satellitePosition;
|
||||
else if (newBouquet->satellitePosition != satellitePosition)
|
||||
newBouquet->satellitePosition = 0;
|
||||
}
|
||||
}
|
||||
if(!bUser)
|
||||
newBouquet->sortBouquet();
|
||||
@@ -503,6 +515,7 @@ CZapitBouquet* CBouquetManager::addBouquet(const std::string & name, bool ub, bo
|
||||
newBouquet->bUser = ub;
|
||||
newBouquet->bFav = myfav;
|
||||
newBouquet->bOther = false;
|
||||
newBouquet->satellitePosition = -1;
|
||||
|
||||
//printf("CBouquetManager::addBouquet: %s, user %s\n", name.c_str(), ub ? "YES" : "NO");
|
||||
if(ub) {
|
||||
@@ -651,7 +664,7 @@ void CBouquetManager::clearAll(bool user)
|
||||
{
|
||||
BouquetList tmplist;
|
||||
for (unsigned int i =0; i < Bouquets.size(); i++) {
|
||||
if (!user || !Bouquets[i]->bFav)
|
||||
if (user || !Bouquets[i]->bUser)
|
||||
delete Bouquets[i];
|
||||
else
|
||||
tmplist.push_back(Bouquets[i]);
|
||||
@@ -663,6 +676,19 @@ void CBouquetManager::clearAll(bool user)
|
||||
remainChannels = NULL;
|
||||
}
|
||||
|
||||
void CBouquetManager::deletePosition(t_satellite_position satellitePosition)
|
||||
{
|
||||
BouquetList tmplist;
|
||||
for (unsigned int i =0; i < Bouquets.size(); i++) {
|
||||
if (satellitePosition == Bouquets[i]->satellitePosition) {
|
||||
printf("CBouquetManager::deletePosition: delete [%s]\n", Bouquets[i]->Name.c_str());
|
||||
delete Bouquets[i];
|
||||
} else
|
||||
tmplist.push_back(Bouquets[i]);
|
||||
}
|
||||
Bouquets = tmplist;
|
||||
}
|
||||
|
||||
CBouquetManager::ChannelIterator::ChannelIterator(CBouquetManager* owner, const bool TV)
|
||||
{
|
||||
Owner = owner;
|
||||
|
@@ -544,7 +544,7 @@ bool CServiceScan::ScanProviders()
|
||||
}
|
||||
|
||||
if( !scanBouquetManager->Bouquets.empty() ) {
|
||||
scanBouquetManager->saveBouquets(bouquetMode, spI->second.c_str());
|
||||
scanBouquetManager->saveBouquets(bouquetMode, spI->second.c_str(), position);
|
||||
}
|
||||
scanBouquetManager->clearAll();
|
||||
}
|
||||
@@ -616,7 +616,7 @@ bool CServiceScan::ScanTransponder()
|
||||
found_channels = 0;
|
||||
|
||||
if(found_channels) {
|
||||
scanBouquetManager->saveBouquets(bouquetMode, providerName.c_str());
|
||||
scanBouquetManager->saveBouquets(bouquetMode, providerName.c_str(), scanedtransponders.size() > 1 ? satellitePosition : -1);
|
||||
SaveServices();
|
||||
Cleanup(true);
|
||||
CZapitClient myZapitClient;
|
||||
|
Reference in New Issue
Block a user