mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-03 10:51:12 +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 saveBouquets(void);
|
||||||
void saveUBouquets(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 loadBouquets(bool ignoreBouquetFile = false);
|
||||||
void renumServices();
|
void renumServices();
|
||||||
|
|
||||||
@@ -118,6 +118,7 @@ class CBouquetManager
|
|||||||
bool existsChannelInBouquet(unsigned int bq_id, const t_channel_id channel_id);
|
bool existsChannelInBouquet(unsigned int bq_id, const t_channel_id channel_id);
|
||||||
|
|
||||||
void clearAll(bool user = true);
|
void clearAll(bool user = true);
|
||||||
|
void deletePosition(t_satellite_position satellitePosition);
|
||||||
|
|
||||||
void sortBouquets(void);
|
void sortBouquets(void);
|
||||||
};
|
};
|
||||||
|
@@ -279,12 +279,16 @@ void CBouquetManager::saveUBouquets(void)
|
|||||||
chmod(UBOUQUETS_XML, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
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) {
|
if (bouquetMode == CZapitClient::BM_DELETEBOUQUETS) {
|
||||||
INFO("removing existing bouquets");
|
INFO("removing existing bouquets");
|
||||||
//unlink(BOUQUETS_XML);
|
if (satellitePosition > 0) {
|
||||||
g_bouquetManager->clearAll(false);
|
if (CFEManager::getInstance()->cableOnly())
|
||||||
|
g_bouquetManager->clearAll(false);
|
||||||
|
else
|
||||||
|
g_bouquetManager->deletePosition(satellitePosition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (bouquetMode == CZapitClient::BM_DONTTOUCHBOUQUETS)
|
if (bouquetMode == CZapitClient::BM_DONTTOUCHBOUQUETS)
|
||||||
return;
|
return;
|
||||||
@@ -413,6 +417,14 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
|
|||||||
}
|
}
|
||||||
|
|
||||||
channel_node = channel_node->xmlNextNode;
|
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)
|
if(!bUser)
|
||||||
newBouquet->sortBouquet();
|
newBouquet->sortBouquet();
|
||||||
@@ -503,6 +515,7 @@ CZapitBouquet* CBouquetManager::addBouquet(const std::string & name, bool ub, bo
|
|||||||
newBouquet->bUser = ub;
|
newBouquet->bUser = ub;
|
||||||
newBouquet->bFav = myfav;
|
newBouquet->bFav = myfav;
|
||||||
newBouquet->bOther = false;
|
newBouquet->bOther = false;
|
||||||
|
newBouquet->satellitePosition = -1;
|
||||||
|
|
||||||
//printf("CBouquetManager::addBouquet: %s, user %s\n", name.c_str(), ub ? "YES" : "NO");
|
//printf("CBouquetManager::addBouquet: %s, user %s\n", name.c_str(), ub ? "YES" : "NO");
|
||||||
if(ub) {
|
if(ub) {
|
||||||
@@ -651,7 +664,7 @@ void CBouquetManager::clearAll(bool user)
|
|||||||
{
|
{
|
||||||
BouquetList tmplist;
|
BouquetList tmplist;
|
||||||
for (unsigned int i =0; i < Bouquets.size(); i++) {
|
for (unsigned int i =0; i < Bouquets.size(); i++) {
|
||||||
if (!user || !Bouquets[i]->bFav)
|
if (user || !Bouquets[i]->bUser)
|
||||||
delete Bouquets[i];
|
delete Bouquets[i];
|
||||||
else
|
else
|
||||||
tmplist.push_back(Bouquets[i]);
|
tmplist.push_back(Bouquets[i]);
|
||||||
@@ -663,6 +676,19 @@ void CBouquetManager::clearAll(bool user)
|
|||||||
remainChannels = NULL;
|
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)
|
CBouquetManager::ChannelIterator::ChannelIterator(CBouquetManager* owner, const bool TV)
|
||||||
{
|
{
|
||||||
Owner = owner;
|
Owner = owner;
|
||||||
|
@@ -544,7 +544,7 @@ bool CServiceScan::ScanProviders()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( !scanBouquetManager->Bouquets.empty() ) {
|
if( !scanBouquetManager->Bouquets.empty() ) {
|
||||||
scanBouquetManager->saveBouquets(bouquetMode, spI->second.c_str());
|
scanBouquetManager->saveBouquets(bouquetMode, spI->second.c_str(), position);
|
||||||
}
|
}
|
||||||
scanBouquetManager->clearAll();
|
scanBouquetManager->clearAll();
|
||||||
}
|
}
|
||||||
@@ -616,7 +616,7 @@ bool CServiceScan::ScanTransponder()
|
|||||||
found_channels = 0;
|
found_channels = 0;
|
||||||
|
|
||||||
if(found_channels) {
|
if(found_channels) {
|
||||||
scanBouquetManager->saveBouquets(bouquetMode, providerName.c_str());
|
scanBouquetManager->saveBouquets(bouquetMode, providerName.c_str(), scanedtransponders.size() > 1 ? satellitePosition : -1);
|
||||||
SaveServices();
|
SaveServices();
|
||||||
Cleanup(true);
|
Cleanup(true);
|
||||||
CZapitClient myZapitClient;
|
CZapitClient myZapitClient;
|
||||||
|
Reference in New Issue
Block a user