- controlapi: add logolist command to allow easy channellogo management

This commit is contained in:
svenhoefer
2015-04-21 14:31:00 +02:00
parent 2c9d0674cd
commit c4c358720b
3 changed files with 66 additions and 0 deletions

View File

@@ -251,6 +251,11 @@
<td><a href="http://box_ip/control/build_live_url">
http://box_ip/control/build_live_url</a></td>
</tr>
<tr>
<td>54. <a href="#logolist"></a>Listet Senderlogos</td>
<td><a href="http://box_ip/control/logolist">
http://box_ip/control/logolist</a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
@@ -2181,6 +2186,29 @@ Beispiel:<br>
http://box_ip:31339/id=bae8000600850083<br>
&nbsp;</div>
<!-- ----------------------------------------------------------- -->
<div class="title1"><a name="logolist"></a><b>54. Listet Senderlogos</b></div>
<div class="URL">Handler: http://box_ip/control/logolist</div>
<br>
<b>Parameter:</b> keine oder files
<br><br>
<b>R&uuml;ckgabe:</b> ChannelID;Channelname;Logoname ohne Erweiterung[;benutztes Logo[;Ziel des Symlinks]]
<br><br>
Liste aller Kan&auml;le incl. Logonamen<br>
Wird der Parameter <i>files</i> angegeben, wird - sofern vorhanden - der Dateiname des benutzen<br>
Senderlogos angehangen.<br>
Ist diese Datei ein symbolischer Link, wird noch zus&auml;tzlich das Ziel diesen Links angehangen.
<br>
<div class="example">
Beispiel:<br>
<br>
&gt;&gt;&gt;http://box_ip/control/logolist?files<br>
4c9d044d00016dca;Das Erste;44d00016dca;/share/logo/44d00016dca.png<br>
66dd03fb0001283d;Das Erste HD;3fb0001283d;/share/logo/3fb0001283d.png;/share/logo/3f300012b5c.png<br>
5b9d045900013355;BTV;45900013355<br>
519d0007008532da;Folx TV;7008532da<br>
&nbsp;</div>
&nbsp;&nbsp;</p>

View File

@@ -39,6 +39,8 @@
#include <driver/screenshot.h>
#include <gui/rc_lock.h>
#include <rcsim.h>
#include <driver/pictureviewer/pictureviewer.h>
extern CPictureViewer *g_PicViewer;
// yhttpd
#include <yhttpd.h>
@@ -155,6 +157,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]=
{"getservicesxml", &CControlAPI::GetServicesxmlCGI,""},
{"getbouquetsxml", &CControlAPI::GetBouquetsxmlCGI,""},
{"channellist", &CControlAPI::ChannellistCGI, "text/plain"},
{"logolist", &CControlAPI::LogolistCGI, "text/plain"},
{"getbouquet", &CControlAPI::GetBouquetCGI, "+xml"},
{"getbouquets", &CControlAPI::GetBouquetsCGI, "+xml"},
{"getmode", &CControlAPI::GetModeCGI, "text/plain"},
@@ -830,6 +833,40 @@ void CControlAPI::ChannellistCGI(CyhookHandler *hh)
SendChannelList(hh);
}
void CControlAPI::LogolistCGI(CyhookHandler *hh)
{
std::string result = "";
int mode = NeutrinoAPI->Zapit->getMode();
CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin();
for (; !(cit.EndOfChannels()); cit++)
{
std::vector<t_channel_id> v;
CZapitChannel * channel = *cit;
size_t pos = std::find(v.begin(), v.end(), channel->getChannelID()) - v.begin();
if (pos < v.size())
continue;
v.push_back(channel->getChannelID());
result += string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS";%s;"PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS"", channel->getChannelID(), channel->getName().c_str(), (channel->getChannelID() & 0xFFFFFFFFFFFFULL));
if (hh->ParamList["1"].compare("files") == 0)
{
std::string logoFile = "";
std::string logoLink = "";
char link[PATH_MAX + 1] = {0};
if (g_PicViewer->GetLogoName(channel->getChannelID(), NeutrinoAPI->GetServiceName(channel->getChannelID()), logoFile, NULL, NULL))
{
result += string_printf(";%s", logoFile.c_str());
realpath(logoFile.c_str(), link);
logoLink = string(link);
if (strcmp(logoFile.c_str(), logoLink.c_str()) != 0)
result += string_printf(";%s", logoLink.c_str());
}
}
result += "\n";
}
hh->WriteLn(result);
}
//-----------------------------------------------------------------------------
// get actual and next event data for given channel
//-----------------------------------------------------------------------------

View File

@@ -78,6 +78,7 @@ private:
void ShutdownCGI(CyhookHandler *hh);
void VolumeCGI(CyhookHandler *hh);
void ChannellistCGI(CyhookHandler *hh);
void LogolistCGI(CyhookHandler *hh);
void GetBouquetCGI(CyhookHandler *hh);
void GetBouquetsCGI(CyhookHandler *hh);
void EpgCGI(CyhookHandler *hh);