diff options
author | methodus <methodus@web.de> | 2012-11-04 21:01:08 +0100 |
---|---|---|
committer | methodus <methodus@web.de> | 2012-11-04 21:01:08 +0100 |
commit | 2b3819970e8a5691991aee907d4533711efbbcae (patch) | |
tree | 8e6bab836d947a8d5bd8b8a1283d3756b0990850 /plugins/profiler/vdrDVBProfiler | |
parent | fb93bd2ba0cb90af39d174fa0e95f8f79eb600e9 (diff) | |
download | vdr-plugin-upnp-2b3819970e8a5691991aee907d4533711efbbcae.tar.gz vdr-plugin-upnp-2b3819970e8a5691991aee907d4533711efbbcae.tar.bz2 |
Added an option for leading zeros.
Diffstat (limited to 'plugins/profiler/vdrDVBProfiler')
-rw-r--r-- | plugins/profiler/vdrDVBProfiler/channelTitle.conf | 2 | ||||
-rw-r--r-- | plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp | 17 |
2 files changed, 14 insertions, 5 deletions
diff --git a/plugins/profiler/vdrDVBProfiler/channelTitle.conf b/plugins/profiler/vdrDVBProfiler/channelTitle.conf index 598c667..b8daa5d 100644 --- a/plugins/profiler/vdrDVBProfiler/channelTitle.conf +++ b/plugins/profiler/vdrDVBProfiler/channelTitle.conf @@ -24,4 +24,4 @@ # # Thank you. -%no% %chan% %- |title%
\ No newline at end of file +%no;3% %chan% %- |title%
\ No newline at end of file diff --git a/plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp b/plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp index 333f773..c21275c 100644 --- a/plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp +++ b/plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp @@ -59,8 +59,8 @@ public: string ToString(){ stringstream output; - size_t startPos = 0, endPos = 0, delim = 0; - string delimiter, var; + size_t startPos = 0, endPos = 0, delim = 0, opt = 0; + string delimiter, options, var; while((startPos = pattern.find_first_of('%', startPos)) != string::npos){ // Copy the content from endPos to startPos output << pattern.substr(endPos + 1, startPos - endPos - (endPos > 0 ? 1 : 0 )); @@ -69,9 +69,18 @@ public: delimiter = pattern.substr(startPos + 1, delim - startPos - 1); startPos = delim; } - var = pattern.substr(startPos + 1, endPos - startPos - 1); + if((opt = pattern.find_first_of(';', startPos+1)) != string::npos && opt < endPos){ + options = pattern.substr(opt + 1, endPos - opt - 1); + } else { + opt = endPos; + } + var = pattern.substr(startPos + 1, opt - startPos - 1); if (var.compare("no") == 0 && channelNo > 0){ - output << delimiter << channelNo; + int width = atoi(options.c_str()); + output << delimiter; + if(width > 0) + output << setfill('0') << setw(width); + output << channelNo; } else if(var.compare("chan") == 0 && !channelName.empty()){ output << delimiter << channelName; } else if(var.compare("title") == 0 && !title.empty()){ |