mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-03 10:51:05 +02:00
zapit/src/bouquets.cpp: dont clear user-bouquets in 'erase' mode;
add helpers to get filtered channel lists;
add channels not present in services.xml with NOT_FOUND flag
Origin commit data
------------------
Commit: a4005bc75c
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-01-28 (Mon, 28 Jan 2013)
This commit is contained in:
@@ -57,6 +57,8 @@ class CZapitBouquet
|
|||||||
CZapitChannel* getChannelByChannelID(const t_channel_id channel_id, const unsigned char serviceType = ST_RESERVED);
|
CZapitChannel* getChannelByChannelID(const t_channel_id channel_id, const unsigned char serviceType = ST_RESERVED);
|
||||||
void sortBouquet(void);
|
void sortBouquet(void);
|
||||||
void sortBouquetByNumber(void);
|
void sortBouquetByNumber(void);
|
||||||
|
bool getTvChannels(ZapitChannelList &list, int flags = CZapitChannel::PRESENT);
|
||||||
|
bool getRadioChannels(ZapitChannelList &list, int flags = CZapitChannel::PRESENT);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef vector<CZapitBouquet *> BouquetList;
|
typedef vector<CZapitBouquet *> BouquetList;
|
||||||
@@ -115,7 +117,7 @@ class CBouquetManager
|
|||||||
void moveBouquet(const unsigned int oldId, const unsigned int newId);
|
void moveBouquet(const unsigned int oldId, const unsigned int newId);
|
||||||
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();
|
void clearAll(bool user = true);
|
||||||
|
|
||||||
void sortBouquets(void);
|
void sortBouquets(void);
|
||||||
};
|
};
|
||||||
|
@@ -157,6 +157,26 @@ void CZapitBouquet::moveService(const unsigned int oldPosition, const unsigned i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CZapitBouquet::getTvChannels(ZapitChannelList &list, int flags)
|
||||||
|
{
|
||||||
|
list.clear();
|
||||||
|
for (ZapitChannelList::iterator it = tvChannels.begin(); it != tvChannels.end(); ++it) {
|
||||||
|
if ((*it)->flags & flags)
|
||||||
|
list.push_back(*it);
|
||||||
|
}
|
||||||
|
return (!list.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CZapitBouquet::getRadioChannels(ZapitChannelList &list, int flags)
|
||||||
|
{
|
||||||
|
list.clear();
|
||||||
|
for (ZapitChannelList::iterator it = tvChannels.begin(); it != tvChannels.end(); ++it) {
|
||||||
|
if ((*it)->flags & flags)
|
||||||
|
list.push_back(*it);
|
||||||
|
}
|
||||||
|
return (!list.empty());
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
size_t CZapitBouquet::recModeRadioSize(const transponder_id_t transponder_id)
|
size_t CZapitBouquet::recModeRadioSize(const transponder_id_t transponder_id)
|
||||||
{
|
{
|
||||||
@@ -262,7 +282,7 @@ void CBouquetManager::saveBouquets(const CZapitClient::bouquetMode bouquetMode,
|
|||||||
if (bouquetMode == CZapitClient::BM_DELETEBOUQUETS) {
|
if (bouquetMode == CZapitClient::BM_DELETEBOUQUETS) {
|
||||||
INFO("removing existing bouquets");
|
INFO("removing existing bouquets");
|
||||||
//unlink(BOUQUETS_XML);
|
//unlink(BOUQUETS_XML);
|
||||||
g_bouquetManager->clearAll();
|
g_bouquetManager->clearAll(false);
|
||||||
}
|
}
|
||||||
if (bouquetMode == CZapitClient::BM_DONTTOUCHBOUQUETS)
|
if (bouquetMode == CZapitClient::BM_DONTTOUCHBOUQUETS)
|
||||||
return;
|
return;
|
||||||
@@ -279,7 +299,7 @@ void CBouquetManager::saveBouquets(const CZapitClient::bouquetMode bouquetMode,
|
|||||||
Bouquets[0]->Name = providerName;
|
Bouquets[0]->Name = providerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bouquetMode == CZapitClient::BM_UPDATEBOUQUETS) || (bouquetMode == CZapitClient::BM_CREATESATELLITEBOUQUET)) {
|
if ((bouquetMode == CZapitClient::BM_UPDATEBOUQUETS) || (bouquetMode == CZapitClient::BM_DELETEBOUQUETS)) {
|
||||||
while (!(Bouquets.empty())) {
|
while (!(Bouquets.empty())) {
|
||||||
CZapitBouquet* bouquet;
|
CZapitBouquet* bouquet;
|
||||||
int dest = g_bouquetManager->existsBouquet(Bouquets[0]->Name.c_str());
|
int dest = g_bouquetManager->existsBouquet(Bouquets[0]->Name.c_str());
|
||||||
@@ -378,6 +398,13 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
|
|||||||
|
|
||||||
chan->bAlwaysLocked = newBouquet->bLocked;
|
chan->bAlwaysLocked = newBouquet->bLocked;
|
||||||
newBouquet->addService(chan);
|
newBouquet->addService(chan);
|
||||||
|
} else if (bUser) {
|
||||||
|
chan = new CZapitChannel(name2, CREATE_CHANNEL_ID64, 1 /*service_type*/,
|
||||||
|
satellitePosition, freq);
|
||||||
|
CServiceManager::getInstance()->AddChannel(chan);
|
||||||
|
chan->flags = CZapitChannel::NOT_FOUND;
|
||||||
|
chan->bAlwaysLocked = newBouquet->bLocked;
|
||||||
|
newBouquet->addService(chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
channel_node = channel_node->xmlNextNode;
|
channel_node = channel_node->xmlNextNode;
|
||||||
@@ -616,12 +643,19 @@ void CBouquetManager::moveBouquet(const unsigned int oldId, const unsigned int n
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBouquetManager::clearAll()
|
void CBouquetManager::clearAll(bool user)
|
||||||
{
|
{
|
||||||
for (unsigned int i =0; i < Bouquets.size(); i++)
|
BouquetList tmplist;
|
||||||
|
for (unsigned int i =0; i < Bouquets.size(); i++) {
|
||||||
|
if (!user || !Bouquets[i]->bFav)
|
||||||
delete Bouquets[i];
|
delete Bouquets[i];
|
||||||
|
else
|
||||||
|
tmplist.push_back(Bouquets[i]);
|
||||||
|
}
|
||||||
|
|
||||||
Bouquets.clear();
|
Bouquets.clear();
|
||||||
|
if (!user)
|
||||||
|
Bouquets = tmplist;
|
||||||
remainChannels = NULL;
|
remainChannels = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user