mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
added extented recording information
This commit is contained in:
parent
49c6ef552c
commit
2c17177f2f
1
HISTORY
1
HISTORY
@ -27,3 +27,4 @@ Version 0.0.2
|
|||||||
- fixed bug that new skin was not properly loaded sometimes when skin was changed in OSD Setup menu
|
- fixed bug that new skin was not properly loaded sometimes when skin was changed in OSD Setup menu
|
||||||
- fixed bug that new font was displayed first after VDR restart when font was changed in OSD Setup menu
|
- fixed bug that new font was displayed first after VDR restart when font was changed in OSD Setup menu
|
||||||
- display always newest recording of folders in recordings list, thanks@ Lars Hanisch for providing the patch
|
- display always newest recording of folders in recordings list, thanks@ Lars Hanisch for providing the patch
|
||||||
|
- added extented recording information
|
||||||
|
1
Makefile
1
Makefile
@ -76,6 +76,7 @@ OBJS = $(PLUGIN).o \
|
|||||||
libcore/helpers.o \
|
libcore/helpers.o \
|
||||||
libcore/imageloader.o \
|
libcore/imageloader.o \
|
||||||
libcore/recfolderinfo.o \
|
libcore/recfolderinfo.o \
|
||||||
|
libcore/extrecinfo.o \
|
||||||
libcore/timers.o \
|
libcore/timers.o \
|
||||||
libtemplate/globals.o \
|
libtemplate/globals.o \
|
||||||
libtemplate/parameter.o \
|
libtemplate/parameter.o \
|
||||||
|
4
extrecinfo/template.txt
Normal file
4
extrecinfo/template.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
General;<mediainfo>
|
||||||
|
Video;<res_width>%Width%</res_width><res_height>%Height%</res_height><aspectratio>%DisplayAspectRatio/String%</aspectratio><codec>%Codec%</codec><format>%Format_Commercial%</format><framerate>%FrameRate%</framerate><interlace>%Interlacement%</interlace>
|
||||||
|
Audio;<track><codec>%Format_Commercial%</codec><bitrate>%BitRate%</bitrate><language>%Language%</language></track>
|
||||||
|
File_End;</mediainfo>
|
96
libcore/extrecinfo.c
Normal file
96
libcore/extrecinfo.c
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
#include "../config.h"
|
||||||
|
#include "helpers.h"
|
||||||
|
#include "extrecinfo.h"
|
||||||
|
|
||||||
|
cExtRecInfo::cExtRecInfo(const char *xml) {
|
||||||
|
this->xml = xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
cExtRecInfo::~cExtRecInfo(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cExtRecInfo::Parse(void) {
|
||||||
|
//read media info
|
||||||
|
string mediaInfoXml;
|
||||||
|
StripXmlTag(xml, mediaInfoXml, "mediainfo");
|
||||||
|
if (mediaInfoXml.size() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
StripXmlTag(mediaInfoXml, resWidth, "res_width");
|
||||||
|
StripXmlTag(mediaInfoXml, resHeight, "res_height");
|
||||||
|
resString = GetScreenResolutionString(resWidth, resHeight, &isHD);
|
||||||
|
StripXmlTag(mediaInfoXml, aspectratio, "aspectratio");
|
||||||
|
isWideScreen = !aspectratio.compare("16:9");
|
||||||
|
StripXmlTag(mediaInfoXml, codec, "codec");
|
||||||
|
StripXmlTag(mediaInfoXml, format, "format");
|
||||||
|
StripXmlTag(mediaInfoXml, framerate, "framerate");
|
||||||
|
StripXmlTag(mediaInfoXml, interlace, "interlace");
|
||||||
|
|
||||||
|
size_t found = 0;
|
||||||
|
isDolby = false;
|
||||||
|
do {
|
||||||
|
string track;
|
||||||
|
found = StripXmlTag(mediaInfoXml, track, "track", found);
|
||||||
|
if (found == string::npos)
|
||||||
|
break;
|
||||||
|
tAudioTrack sTrack;
|
||||||
|
StripXmlTag(track, sTrack.codec, "codec");
|
||||||
|
StripXmlTag(track, sTrack.bitrate, "bitrate");
|
||||||
|
StripXmlTag(track, sTrack.language, "language");
|
||||||
|
if (!sTrack.codec.compare("AC-3"))
|
||||||
|
isDolby = true;
|
||||||
|
tracks.push_back(sTrack);
|
||||||
|
} while (found != string::npos);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//get content of <tag> ... </tag> inside xml
|
||||||
|
size_t cExtRecInfo::StripXmlTag(string &xmlstring, string &content, const char *tag, int start) {
|
||||||
|
// set the search strings
|
||||||
|
stringstream strStart, strStop;
|
||||||
|
strStart << "<" << tag << ">";
|
||||||
|
strStop << "</" << tag << ">";
|
||||||
|
// find the strings
|
||||||
|
size_t locStart = xmlstring.find(strStart.str(), start);
|
||||||
|
size_t locStop = xmlstring.find(strStop.str(), start);
|
||||||
|
if (locStart == string::npos || locStop == string::npos)
|
||||||
|
return string::npos;
|
||||||
|
// extract relevant text
|
||||||
|
int pos = locStart + strStart.str().size();
|
||||||
|
int len = locStop - pos;
|
||||||
|
|
||||||
|
content = (len < 0) ? "" : xmlstring.substr(pos, len);
|
||||||
|
return locStop + strStop.str().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t cExtRecInfo::StripXmlTag(string &xmlstring, int &content, const char *tag, int start) {
|
||||||
|
// set the search strings
|
||||||
|
stringstream strStart, strStop;
|
||||||
|
strStart << "<" << tag << ">";
|
||||||
|
strStop << "</" << tag << ">";
|
||||||
|
// find the strings
|
||||||
|
size_t locStart = xmlstring.find(strStart.str(), start);
|
||||||
|
size_t locStop = xmlstring.find(strStop.str(), start);
|
||||||
|
if (locStart == string::npos || locStop == string::npos)
|
||||||
|
return string::npos;
|
||||||
|
// extract relevant text
|
||||||
|
int pos = locStart + strStart.str().size();
|
||||||
|
int len = locStop - pos;
|
||||||
|
|
||||||
|
string value = (len < 0) ? "" : xmlstring.substr(pos, len);
|
||||||
|
content = atoi(value.c_str());
|
||||||
|
return locStop + strStop.str().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cExtRecInfo::Debug(void) {
|
||||||
|
dsyslog("skindesigner: extRecInfo xml: %s", xml.c_str());
|
||||||
|
dsyslog("skindesigner: : res_width %d, res_height %d, res %s, aspectratio %s, codec %s, format %s, framerate %s, interlace %s, hd %s, widescreen %s",
|
||||||
|
resWidth, resHeight, resString.c_str(), aspectratio.c_str(), codec.c_str(), format.c_str(), framerate.c_str(), interlace.c_str(),
|
||||||
|
isHD ? "true": "false", isWideScreen ? "true" : "false");
|
||||||
|
int numTrack = 1;
|
||||||
|
for (vector<tAudioTrack>::iterator it = tracks.begin(); it != tracks.end(); it++) {
|
||||||
|
dsyslog("skindesigner: audio track %d, codec %s, bitrate %s, language: %s", numTrack++, (*it).codec.c_str(), (*it).bitrate.c_str(), (*it).language.c_str());
|
||||||
|
}
|
||||||
|
}
|
36
libcore/extrecinfo.h
Normal file
36
libcore/extrecinfo.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#ifndef __EXTRECINFO_H
|
||||||
|
#define __EXTRECINFO_H
|
||||||
|
|
||||||
|
#include <vdr/recording.h>
|
||||||
|
|
||||||
|
struct tAudioTrack {
|
||||||
|
string codec;
|
||||||
|
string bitrate;
|
||||||
|
string language;
|
||||||
|
};
|
||||||
|
|
||||||
|
class cExtRecInfo {
|
||||||
|
private:
|
||||||
|
string xml;
|
||||||
|
size_t StripXmlTag(string &xmlstring, string &content, const char *tag, int start = 0);
|
||||||
|
size_t StripXmlTag(string &xmlstring, int &content, const char *tag, int start = 0);
|
||||||
|
public:
|
||||||
|
cExtRecInfo(const char *xml);
|
||||||
|
~cExtRecInfo(void);
|
||||||
|
bool Parse(void);
|
||||||
|
void Debug(void);
|
||||||
|
int resWidth;
|
||||||
|
int resHeight;
|
||||||
|
string resString;
|
||||||
|
bool isHD;
|
||||||
|
string aspectratio;
|
||||||
|
bool isWideScreen;
|
||||||
|
string codec;
|
||||||
|
string format;
|
||||||
|
string framerate;
|
||||||
|
string interlace;
|
||||||
|
bool isDolby;
|
||||||
|
vector< tAudioTrack > tracks;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __EXTRECINFO_H
|
@ -175,3 +175,46 @@ void cStopWatch::Report(const char* message) {
|
|||||||
void cStopWatch::Stop(const char* message) {
|
void cStopWatch::Stop(const char* message) {
|
||||||
dsyslog("skindesigner: %s - needed %d ms", message, (int)(cTimeMs::Now() - start));
|
dsyslog("skindesigner: %s - needed %d ms", message, (int)(cTimeMs::Now() - start));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//View Helpers
|
||||||
|
string GetScreenResolutionString(int width, int height, bool *isHD) {
|
||||||
|
string name = "";
|
||||||
|
switch (width) {
|
||||||
|
case 1920:
|
||||||
|
case 1440:
|
||||||
|
name = "hd1080i";
|
||||||
|
*isHD = true;
|
||||||
|
break;
|
||||||
|
case 1280:
|
||||||
|
if (height == 720)
|
||||||
|
name = "hd720p";
|
||||||
|
else
|
||||||
|
name = "hd1080i";
|
||||||
|
*isHD = true;
|
||||||
|
break;
|
||||||
|
case 720:
|
||||||
|
name = "sd576i";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
name = "sd576i";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
string GetScreenAspectString(double aspect, bool *isWideScreen) {
|
||||||
|
string name = "";
|
||||||
|
*isWideScreen = false;
|
||||||
|
if (aspect == 4.0/3.0) {
|
||||||
|
name = "4:3";
|
||||||
|
*isWideScreen = false;
|
||||||
|
} else if (aspect == 16.0/9.0) {
|
||||||
|
name = "16:9";
|
||||||
|
*isWideScreen = true;
|
||||||
|
} else if (aspect == 2.21) {
|
||||||
|
name = "21:9";
|
||||||
|
*isWideScreen = true;
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -37,4 +37,8 @@ public:
|
|||||||
void Report(const char* message);
|
void Report(const char* message);
|
||||||
void Stop(const char* message);
|
void Stop(const char* message);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
string GetScreenResolutionString(int width, int height, bool *isHD);
|
||||||
|
string GetScreenAspectString(double aspect, bool *isWideScreen);
|
||||||
|
|
||||||
#endif // __HELPERS_H
|
#endif // __HELPERS_H
|
||||||
|
@ -309,47 +309,6 @@ void cDisplayChannelView::ClearScreenResolution(void) {
|
|||||||
lastScreenHeight = 0;
|
lastScreenHeight = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
string cDisplayChannelView::GetScreenResolutionString(int width, int height, bool *isHD) {
|
|
||||||
string name = "";
|
|
||||||
switch (width) {
|
|
||||||
case 1920:
|
|
||||||
case 1440:
|
|
||||||
name = "hd1080i";
|
|
||||||
*isHD = true;
|
|
||||||
break;
|
|
||||||
case 1280:
|
|
||||||
if (height == 720)
|
|
||||||
name = "hd720p";
|
|
||||||
else
|
|
||||||
name = "hd1080i";
|
|
||||||
*isHD = true;
|
|
||||||
break;
|
|
||||||
case 720:
|
|
||||||
name = "sd576i";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
name = "sd576i";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
string cDisplayChannelView::GetScreenAspectString(double aspect, bool *isWideScreen) {
|
|
||||||
string name = "";
|
|
||||||
*isWideScreen = false;
|
|
||||||
if (aspect == 4.0/3.0) {
|
|
||||||
name = "4:3";
|
|
||||||
*isWideScreen = false;
|
|
||||||
} else if (aspect == 16.0/9.0) {
|
|
||||||
name = "16:9";
|
|
||||||
*isWideScreen = true;
|
|
||||||
} else if (aspect == 2.21) {
|
|
||||||
name = "21:9";
|
|
||||||
*isWideScreen = true;
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cDisplayChannelView::DrawScraperContent(const cEvent *event) {
|
void cDisplayChannelView::DrawScraperContent(const cEvent *event) {
|
||||||
if (!event)
|
if (!event)
|
||||||
return;
|
return;
|
||||||
|
@ -16,8 +16,6 @@ private:
|
|||||||
int lastAudioChannel;
|
int lastAudioChannel;
|
||||||
string lastTracDesc;
|
string lastTracDesc;
|
||||||
string lastTrackLang;
|
string lastTrackLang;
|
||||||
string GetScreenResolutionString(int width, int height, bool *isHD);
|
|
||||||
string GetScreenAspectString(double aspect, bool *isWideScreen);
|
|
||||||
string GetChannelSep(const cChannel *channel, bool prev);
|
string GetChannelSep(const cChannel *channel, bool prev);
|
||||||
virtual void Action(void);
|
virtual void Action(void);
|
||||||
public:
|
public:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "../services/scraper2vdr.h"
|
#include "../services/scraper2vdr.h"
|
||||||
#include "../libcore/helpers.h"
|
#include "../libcore/helpers.h"
|
||||||
#include "../libcore/recfolderinfo.h"
|
#include "../libcore/recfolderinfo.h"
|
||||||
|
#include "../libcore/extrecinfo.h"
|
||||||
#include "displaymenuitemcurrentview.h"
|
#include "displaymenuitemcurrentview.h"
|
||||||
|
|
||||||
|
|
||||||
@ -504,6 +505,8 @@ void cDisplayMenuItemCurrentRecordingView::Prepare(void) {
|
|||||||
void cDisplayMenuItemCurrentRecordingView::Render(void) {
|
void cDisplayMenuItemCurrentRecordingView::Render(void) {
|
||||||
if (!recording)
|
if (!recording)
|
||||||
return;
|
return;
|
||||||
|
map < string, vector< map< string, string > > > loopTokens;
|
||||||
|
|
||||||
bool isFolder = (total > 0) ? true : false;
|
bool isFolder = (total > 0) ? true : false;
|
||||||
intTokens.insert(pair<string,int>("folder", isFolder));
|
intTokens.insert(pair<string,int>("folder", isFolder));
|
||||||
|
|
||||||
@ -553,9 +556,44 @@ void cDisplayMenuItemCurrentRecordingView::Render(void) {
|
|||||||
|
|
||||||
SetScraperPoster(NULL, usedRecording);
|
SetScraperPoster(NULL, usedRecording);
|
||||||
|
|
||||||
|
|
||||||
const cRecordingInfo *info = usedRecording->Info();
|
const cRecordingInfo *info = usedRecording->Info();
|
||||||
if (!info) return;
|
if (!info) return;
|
||||||
|
|
||||||
|
bool extRecinfoAvailable = false;
|
||||||
|
if (info->Aux()) {
|
||||||
|
cExtRecInfo extRecInfo(info->Aux());
|
||||||
|
if (extRecInfo.Parse()) {
|
||||||
|
extRecinfoAvailable = true;
|
||||||
|
intTokens.insert(pair<string,int>("screenwidth", extRecInfo.resWidth));
|
||||||
|
intTokens.insert(pair<string,int>("screenheight", extRecInfo.resHeight));
|
||||||
|
intTokens.insert(pair<string,int>("isHD", extRecInfo.isHD));
|
||||||
|
intTokens.insert(pair<string,int>("isWideScreen", extRecInfo.isWideScreen));
|
||||||
|
intTokens.insert(pair<string,int>("isDolby", extRecInfo.isDolby));
|
||||||
|
stringTokens.insert(pair<string,string>("resolution", extRecInfo.resString));
|
||||||
|
stringTokens.insert(pair<string,string>("aspect", extRecInfo.aspectratio));
|
||||||
|
stringTokens.insert(pair<string,string>("codec", extRecInfo.codec));
|
||||||
|
stringTokens.insert(pair<string,string>("format", extRecInfo.format));
|
||||||
|
stringTokens.insert(pair<string,string>("framerate", extRecInfo.framerate));
|
||||||
|
stringTokens.insert(pair<string,string>("interlace", extRecInfo.interlace));
|
||||||
|
intTokens.insert(pair<string,int>("numtracks", extRecInfo.tracks.size()));
|
||||||
|
vector< map<string,string> > trackTokens;
|
||||||
|
int trackNumber = 1;
|
||||||
|
for (vector<tAudioTrack>::iterator track = extRecInfo.tracks.begin(); track != extRecInfo.tracks.end(); track++) {
|
||||||
|
map<string,string> element;
|
||||||
|
stringstream trackNum;
|
||||||
|
trackNum << trackNumber++;
|
||||||
|
element.insert(pair<string,string>("track[num]", trackNum.str()));
|
||||||
|
element.insert(pair<string,string>("track[codec]", (*track).codec));
|
||||||
|
element.insert(pair<string,string>("track[bitrate]", (*track).bitrate));
|
||||||
|
element.insert(pair<string,string>("track[language]", (*track).language));
|
||||||
|
trackTokens.push_back(element);
|
||||||
|
}
|
||||||
|
loopTokens.insert(pair<string, vector< map< string, string > > >("track", trackTokens));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intTokens.insert(pair<string,int>("extrecinfoavailable", extRecinfoAvailable));
|
||||||
|
|
||||||
stringTokens.insert(pair<string,string>("shorttext", info->ShortText() ? info->ShortText() : ""));
|
stringTokens.insert(pair<string,string>("shorttext", info->ShortText() ? info->ShortText() : ""));
|
||||||
stringTokens.insert(pair<string,string>("description", info->Description() ? info->Description() : ""));
|
stringTokens.insert(pair<string,string>("description", info->Description() ? info->Description() : ""));
|
||||||
|
|
||||||
@ -588,7 +626,7 @@ void cDisplayMenuItemCurrentRecordingView::Render(void) {
|
|||||||
intTokens.insert(pair<string,int>("durationeventhours", duration / 60));
|
intTokens.insert(pair<string,int>("durationeventhours", duration / 60));
|
||||||
stringTokens.insert(pair<string,string>("durationeventminutes", *cString::sprintf("%.2d", duration%60)));
|
stringTokens.insert(pair<string,string>("durationeventminutes", *cString::sprintf("%.2d", duration%60)));
|
||||||
SetTokensPosMenuItem();
|
SetTokensPosMenuItem();
|
||||||
DrawViewElement(veMenuCurrentItemDetail, &stringTokens, &intTokens);
|
DrawViewElement(veMenuCurrentItemDetail, &stringTokens, &intTokens, &loopTokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cDisplayMenuItemCurrentRecordingView::Clear(void) {
|
void cDisplayMenuItemCurrentRecordingView::Clear(void) {
|
||||||
|
@ -333,44 +333,3 @@ void cDisplayReplayView::Action(void) {
|
|||||||
DoFlush();
|
DoFlush();
|
||||||
cView::Action();
|
cView::Action();
|
||||||
}
|
}
|
||||||
|
|
||||||
string cDisplayReplayView::GetScreenResolutionString(int width, int height, bool *isHD) {
|
|
||||||
string name = "";
|
|
||||||
switch (width) {
|
|
||||||
case 1920:
|
|
||||||
case 1440:
|
|
||||||
name = "hd1080i";
|
|
||||||
*isHD = true;
|
|
||||||
break;
|
|
||||||
case 1280:
|
|
||||||
if (height == 720)
|
|
||||||
name = "hd720p";
|
|
||||||
else
|
|
||||||
name = "hd1080i";
|
|
||||||
*isHD = true;
|
|
||||||
break;
|
|
||||||
case 720:
|
|
||||||
name = "sd576i";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
name = "sd576i";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
string cDisplayReplayView::GetScreenAspectString(double aspect, bool *isWideScreen) {
|
|
||||||
string name = "";
|
|
||||||
*isWideScreen = false;
|
|
||||||
if (aspect == 4.0/3.0) {
|
|
||||||
name = "4:3";
|
|
||||||
*isWideScreen = false;
|
|
||||||
} else if (aspect == 16.0/9.0) {
|
|
||||||
name = "16:9";
|
|
||||||
*isWideScreen = true;
|
|
||||||
} else if (aspect == 2.21) {
|
|
||||||
name = "21:9";
|
|
||||||
*isWideScreen = true;
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
|
@ -7,8 +7,6 @@
|
|||||||
class cDisplayReplayView : public cView {
|
class cDisplayReplayView : public cView {
|
||||||
private:
|
private:
|
||||||
cString lastDate;
|
cString lastDate;
|
||||||
string GetScreenResolutionString(int width, int height, bool *isHD);
|
|
||||||
string GetScreenAspectString(double aspect, bool *isWideScreen);
|
|
||||||
virtual void Action(void);
|
virtual void Action(void);
|
||||||
public:
|
public:
|
||||||
cDisplayReplayView(cTemplateView *tmplView);
|
cDisplayReplayView(cTemplateView *tmplView);
|
||||||
|
Loading…
Reference in New Issue
Block a user