mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Added IPTV information menu and SVDRP INFO command.
This commit is contained in:
parent
3e553d5324
commit
d857378616
31
device.c
31
device.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: device.c,v 1.51 2007/10/06 00:02:50 rahrenbe Exp $
|
||||
* $Id: device.c,v 1.52 2007/10/06 20:57:53 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
#define IPTV_MAX_DEVICES 8
|
||||
|
||||
cIptvDevice * IptvDevices[IPTV_MAX_DEVICES];
|
||||
cIptvDevice * IptvDevices[IPTV_MAX_DEVICES] = { NULL };
|
||||
|
||||
unsigned int cIptvDevice::deviceCount = 0;
|
||||
|
||||
@ -63,11 +63,13 @@ cIptvDevice::~cIptvDevice()
|
||||
|
||||
bool cIptvDevice::Initialize(unsigned int DeviceCount)
|
||||
{
|
||||
debug("cIptvDevice::Initialize()\n");
|
||||
debug("cIptvDevice::Initialize(): DeviceCount=%d\n", DeviceCount);
|
||||
if (DeviceCount > IPTV_MAX_DEVICES)
|
||||
DeviceCount = IPTV_MAX_DEVICES;
|
||||
for (unsigned int i = 0; i < DeviceCount; ++i)
|
||||
IptvDevices[i] = new cIptvDevice(i);
|
||||
for (unsigned int i = DeviceCount; i < IPTV_MAX_DEVICES; ++i)
|
||||
IptvDevices[i] = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -76,20 +78,33 @@ unsigned int cIptvDevice::Count(void)
|
||||
unsigned int count = 0;
|
||||
debug("cIptvDevice::Count()\n");
|
||||
for (unsigned int i = 0; i < IPTV_MAX_DEVICES; ++i) {
|
||||
if (IptvDevices[i])
|
||||
if (IptvDevices[i] != NULL)
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
cIptvDevice *cIptvDevice::Get(unsigned int DeviceIndex)
|
||||
cIptvDevice *cIptvDevice::GetIptvDevice(int CardIndex)
|
||||
{
|
||||
debug("cIptvDevice::Get()\n");
|
||||
if ((DeviceIndex > 0) && (DeviceIndex <= IPTV_MAX_DEVICES))
|
||||
return IptvDevices[DeviceIndex - 1];
|
||||
//debug("cIptvDevice::GetIptvDevice(%d)\n", CardIndex);
|
||||
for (unsigned int i = 0; i < IPTV_MAX_DEVICES; ++i) {
|
||||
if ((IptvDevices[i] != NULL) && (IptvDevices[i]->CardIndex() == CardIndex)) {
|
||||
//debug("cIptvDevice::GetIptvDevice(%d): FOUND!\n", CardIndex);
|
||||
return IptvDevices[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cString cIptvDevice::GetInformation(void)
|
||||
{
|
||||
char Text[25];
|
||||
struct tm tm_r;
|
||||
time_t t = time(NULL);
|
||||
strftime(Text, sizeof(Text), "%T", localtime_r(&t, &tm_r));
|
||||
return cString::sprintf("IPTV device: %d\nTime: %s\n", deviceIndex, Text);
|
||||
}
|
||||
|
||||
cString cIptvDevice::GetChannelSettings(const char *Param, int *IpPort, cIptvProtocolIf* *Protocol)
|
||||
{
|
||||
debug("cIptvDevice::GetChannelSettings(%d)\n", deviceIndex);
|
||||
|
5
device.h
5
device.h
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: device.h,v 1.24 2007/10/05 19:00:44 ajhseppa Exp $
|
||||
* $Id: device.h,v 1.25 2007/10/06 20:57:53 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_DEVICE_H
|
||||
@ -24,7 +24,7 @@ public:
|
||||
static unsigned int deviceCount;
|
||||
static bool Initialize(unsigned int DeviceCount);
|
||||
static unsigned int Count(void);
|
||||
static cIptvDevice *Get(unsigned int DeviceIndex);
|
||||
static cIptvDevice *GetIptvDevice(int CardIndex);
|
||||
|
||||
// private parts
|
||||
private:
|
||||
@ -48,6 +48,7 @@ private:
|
||||
public:
|
||||
cIptvDevice(unsigned int DeviceIndex);
|
||||
virtual ~cIptvDevice();
|
||||
cString GetInformation(void);
|
||||
|
||||
// for channel parsing & buffering
|
||||
private:
|
||||
|
16
iptv.c
16
iptv.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: iptv.c,v 1.10 2007/10/06 00:02:50 rahrenbe Exp $
|
||||
* $Id: iptv.c,v 1.11 2007/10/06 20:57:53 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <getopt.h>
|
||||
@ -158,7 +158,7 @@ int cPluginIptv::ParseFilters(const char *Value, int *Filters)
|
||||
while (Value && *Value && (n < SECTION_FILTER_TABLE_SIZE)) {
|
||||
strn0cpy(buffer, Value, sizeof(buffer));
|
||||
int i = atoi(buffer);
|
||||
debug("cPluginIptv::ParseFilters(): Filters[%d]=%d\n", n, i);
|
||||
//debug("cPluginIptv::ParseFilters(): Filters[%d]=%d\n", n, i);
|
||||
if (i >= 0)
|
||||
Filters[n++] = i;
|
||||
if ((Value = strchr(Value, ' ')) != NULL)
|
||||
@ -206,8 +206,16 @@ const char **cPluginIptv::SVDRPHelpPages(void)
|
||||
|
||||
cString cPluginIptv::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode)
|
||||
{
|
||||
//debug("cPluginIptv::SVDRPCommand()\n");
|
||||
// Process SVDRP commands this plugin implements
|
||||
debug("cPluginIptv::SVDRPCommand(): Command=%s Option=%s\n", Command, Option);
|
||||
if (strcasecmp(Command, "INFO") == 0) {
|
||||
cIptvDevice *device = cIptvDevice::GetIptvDevice(cDevice::ActualDevice()->CardIndex());
|
||||
if (device)
|
||||
return device->GetInformation();
|
||||
else {
|
||||
ReplyCode = 550; // Requested action not taken
|
||||
return cString("IPTV information not available!");
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
42
po/fi_FI.po
42
po/fi_FI.po
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: VDR 1.5.7\n"
|
||||
"Report-Msgid-Bugs-To: Rolf Ahrenberg\n"
|
||||
"POT-Creation-Date: 2007-10-06 02:54+0300\n"
|
||||
"POT-Creation-Date: 2007-10-06 23:51+0300\n"
|
||||
"PO-Revision-Date: 2007-08-12 23:22+0300\n"
|
||||
"Last-Translator: Rolf Ahrenberg\n"
|
||||
"Language-Team: <vdr@linuxtv.org>\n"
|
||||
@ -47,67 +47,75 @@ msgstr "TDT (0x70)"
|
||||
msgid "Experiment the IPTV"
|
||||
msgstr "Koe IPTV:n ihmeellinen maailma"
|
||||
|
||||
#: setup.c:53
|
||||
#: setup.c:55
|
||||
msgid "UDP"
|
||||
msgstr "UDP"
|
||||
|
||||
#: setup.c:54
|
||||
#: setup.c:56
|
||||
msgid "HTTP"
|
||||
msgstr "HTTP"
|
||||
|
||||
#: setup.c:55
|
||||
#: setup.c:57
|
||||
msgid "FILE"
|
||||
msgstr "FILE"
|
||||
|
||||
#: setup.c:170
|
||||
#: setup.c:172
|
||||
msgid "Protocol"
|
||||
msgstr "Protokolla"
|
||||
|
||||
#: setup.c:174
|
||||
#: setup.c:176
|
||||
msgid "Delay (ms)"
|
||||
msgstr "Viive (ms)"
|
||||
|
||||
#: setup.c:179
|
||||
#: setup.c:181
|
||||
msgid "Address"
|
||||
msgstr "Osoite"
|
||||
|
||||
#: setup.c:180
|
||||
#: setup.c:182
|
||||
msgid "Port"
|
||||
msgstr "Portti"
|
||||
|
||||
#: setup.c:195
|
||||
#: setup.c:197
|
||||
msgid "Rid"
|
||||
msgstr "Radio-ID"
|
||||
|
||||
#: setup.c:267
|
||||
#: setup.c:269
|
||||
msgid "Cannot find unique channel settings!"
|
||||
msgstr "Yksilöllisiä kanava-asetuksia ei löydetä!"
|
||||
|
||||
#: setup.c:341
|
||||
#: setup.c:343
|
||||
msgid "IPTV Channels"
|
||||
msgstr "IPTV-kanavat"
|
||||
|
||||
#: setup.c:494
|
||||
#: setup.c:492
|
||||
msgid "IPTV Information"
|
||||
msgstr "IPTV-tiedot"
|
||||
|
||||
#: setup.c:509
|
||||
msgid "IPTV information not available!"
|
||||
msgstr "IPTV-tietoja ei saatavilla!"
|
||||
|
||||
#: setup.c:578
|
||||
msgid "TS buffer size [MB]"
|
||||
msgstr "TS-puskurin koko [MB]"
|
||||
|
||||
#: setup.c:495
|
||||
#: setup.c:579
|
||||
msgid "TS buffer prefill ratio [%]"
|
||||
msgstr "TS-puskurin esitäyttöaste [%]"
|
||||
|
||||
#: setup.c:496
|
||||
#: setup.c:580
|
||||
msgid "Use section filtering"
|
||||
msgstr "Käytä sektioiden suodatusta"
|
||||
|
||||
#: setup.c:498
|
||||
#: setup.c:582
|
||||
msgid "Scan Sid automatically"
|
||||
msgstr "Etsi palvelu-ID automaattisesti"
|
||||
|
||||
#: setup.c:499
|
||||
#: setup.c:583
|
||||
msgid "Disable filters"
|
||||
msgstr "Poista suodattimia käytöstä"
|
||||
|
||||
#. TRANSLATORS: note the singular!
|
||||
#: setup.c:502
|
||||
#: setup.c:586
|
||||
msgid "Disable filter"
|
||||
msgstr "Poista suodatin käytöstä"
|
||||
|
101
setup.c
101
setup.c
@ -3,16 +3,18 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: setup.c,v 1.20 2007/10/06 00:02:50 rahrenbe Exp $
|
||||
* $Id: setup.c,v 1.21 2007/10/06 20:57:53 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <vdr/device.h>
|
||||
#include <vdr/interface.h>
|
||||
#include <vdr/status.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "config.h"
|
||||
#include "device.h"
|
||||
#include "setup.h"
|
||||
|
||||
#ifndef trVDR
|
||||
@ -467,6 +469,88 @@ eOSState cIptvMenuChannels::ProcessKey(eKeys Key)
|
||||
return state;
|
||||
}
|
||||
|
||||
// --- cIptvMenuInfo ---------------------------------------------------------
|
||||
|
||||
class cIptvMenuInfo : public cOsdMenu
|
||||
{
|
||||
private:
|
||||
enum {
|
||||
INFO_TIMEOUT = 2000
|
||||
};
|
||||
char *text;
|
||||
cTimeMs timeout;
|
||||
void UpdateInfo();
|
||||
|
||||
public:
|
||||
cIptvMenuInfo();
|
||||
virtual ~cIptvMenuInfo();
|
||||
virtual void Display(void);
|
||||
virtual eOSState ProcessKey(eKeys Key);
|
||||
};
|
||||
|
||||
cIptvMenuInfo::cIptvMenuInfo()
|
||||
:cOsdMenu(tr("IPTV Information")), text(NULL), timeout(INFO_TIMEOUT)
|
||||
{
|
||||
UpdateInfo();
|
||||
}
|
||||
|
||||
cIptvMenuInfo::~cIptvMenuInfo()
|
||||
{
|
||||
free(text);
|
||||
}
|
||||
|
||||
void cIptvMenuInfo::UpdateInfo(void)
|
||||
{
|
||||
cIptvDevice *device = cIptvDevice::GetIptvDevice(cDevice::ActualDevice()->CardIndex());
|
||||
char Text[64];
|
||||
if (device)
|
||||
snprintf(Text, sizeof(Text), "%s", *device->GetInformation());
|
||||
else
|
||||
snprintf(Text, sizeof(Text), "%s", tr("IPTV information not available!"));
|
||||
free(text);
|
||||
text = Text ? strdup(Text) : NULL;
|
||||
Display();
|
||||
timeout.Set(INFO_TIMEOUT);
|
||||
}
|
||||
|
||||
void cIptvMenuInfo::Display(void)
|
||||
{
|
||||
cOsdMenu::Display();
|
||||
DisplayMenu()->SetText(text, true);
|
||||
if (text)
|
||||
cStatus::MsgOsdTextItem(text);
|
||||
}
|
||||
|
||||
eOSState cIptvMenuInfo::ProcessKey(eKeys Key)
|
||||
{
|
||||
switch (Key) {
|
||||
case kUp|k_Repeat:
|
||||
case kUp:
|
||||
case kDown|k_Repeat:
|
||||
case kDown:
|
||||
case kLeft|k_Repeat:
|
||||
case kLeft:
|
||||
case kRight|k_Repeat:
|
||||
case kRight:
|
||||
DisplayMenu()->Scroll(NORMALKEY(Key) == kUp || NORMALKEY(Key) == kLeft, NORMALKEY(Key) == kLeft || NORMALKEY(Key) == kRight);
|
||||
cStatus::MsgOsdTextItem(NULL, NORMALKEY(Key) == kUp || NORMALKEY(Key) == kLeft);
|
||||
return osContinue;
|
||||
default: break;
|
||||
}
|
||||
|
||||
eOSState state = cOsdMenu::ProcessKey(Key);
|
||||
|
||||
if (state == osUnknown) {
|
||||
switch (Key) {
|
||||
case kOk: return osBack;
|
||||
default: if (timeout.TimedOut())
|
||||
UpdateInfo();
|
||||
return osContinue;
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
// --- cIptvPluginSetup ------------------------------------------------------
|
||||
|
||||
cIptvPluginSetup::cIptvPluginSetup()
|
||||
@ -484,7 +568,7 @@ cIptvPluginSetup::cIptvPluginSetup()
|
||||
disabledFilterNames[i] = tr(section_filter_table[i].description);
|
||||
}
|
||||
Setup();
|
||||
SetHelp(trVDR("Channels"), NULL, NULL, NULL);
|
||||
SetHelp(trVDR("Channels"), NULL, NULL, trVDR("Button$Info"));
|
||||
}
|
||||
|
||||
void cIptvPluginSetup::Setup(void)
|
||||
@ -514,6 +598,14 @@ eOSState cIptvPluginSetup::EditChannel(void)
|
||||
return AddSubMenu(new cIptvMenuChannels());
|
||||
}
|
||||
|
||||
eOSState cIptvPluginSetup::ShowInfo(void)
|
||||
{
|
||||
debug("cIptvPluginSetup::ShowInfo()\n");
|
||||
if (HasSubMenu())
|
||||
return osContinue;
|
||||
return AddSubMenu(new cIptvMenuInfo());
|
||||
}
|
||||
|
||||
eOSState cIptvPluginSetup::ProcessKey(eKeys Key)
|
||||
{
|
||||
int oldsectionFiltering = sectionFiltering;
|
||||
@ -521,8 +613,9 @@ eOSState cIptvPluginSetup::ProcessKey(eKeys Key)
|
||||
eOSState state = cMenuSetupPage::ProcessKey(Key);
|
||||
if (state == osUnknown) {
|
||||
switch (Key) {
|
||||
case kRed: return EditChannel();
|
||||
default: break;
|
||||
case kRed: return EditChannel();
|
||||
case kBlue: return ShowInfo();
|
||||
default: state = osContinue;
|
||||
}
|
||||
}
|
||||
if ((Key != kNone) && ((numDisabledFilters != oldNumDisabledFilters) || (sectionFiltering != oldsectionFiltering))) {
|
||||
|
3
setup.h
3
setup.h
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: setup.h,v 1.10 2007/10/06 00:02:50 rahrenbe Exp $
|
||||
* $Id: setup.h,v 1.11 2007/10/06 20:57:53 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_SETUP_H
|
||||
@ -24,6 +24,7 @@ private:
|
||||
const char *disabledFilterNames[SECTION_FILTER_TABLE_SIZE];
|
||||
|
||||
eOSState EditChannel(void);
|
||||
eOSState ShowInfo(void);
|
||||
virtual void Setup(void);
|
||||
void StoreFilters(const char *Name, int *Values);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user