diff options
author | lado <herrlado@gmail.com> | 2013-04-01 00:10:39 +0200 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2013-04-01 00:10:39 +0200 |
commit | da671823efe4d9202b2df74d12b7b69d0bea56c0 (patch) | |
tree | 6fda962ebb2c4e0fa62309e3a1cdeb47780c8aa6 | |
parent | 3b02fe45b221ae9017daafb63bfbc8e5405006ac (diff) | |
download | vdr-manager-da671823efe4d9202b2df74d12b7b69d0bea56c0.tar.gz vdr-manager-da671823efe4d9202b2df74d12b7b69d0bea56c0.tar.bz2 |
Feature #790 Feature #1319
-rw-r--r-- | vdr-vdrmanager/helpers.cpp | 84 |
1 files changed, 4 insertions, 80 deletions
diff --git a/vdr-vdrmanager/helpers.cpp b/vdr-vdrmanager/helpers.cpp index 80721f3..7dcef54 100644 --- a/vdr-vdrmanager/helpers.cpp +++ b/vdr-vdrmanager/helpers.cpp @@ -709,6 +709,10 @@ string cHelpers::ToText(cRecording * recording) { } } + result += ":"; + //Feature #1319 + result += recording->Name(); + result += "\r\n"; return result; } @@ -1066,86 +1070,6 @@ int cHelpers::RecordingLengthInSeconds(cRecording* recording) { return Duration(recording) * 60; } -/** Compress a STL string using zlib with given compression level and return - * the binary data. */ -string cHelpers::compress_string(const string& str, int compressionlevel) { - z_stream zs; // z_stream is zlib's control structure - memset(&zs, 0, sizeof(zs)); - - if (deflateInit(&zs, compressionlevel) != Z_OK) - throw(runtime_error("deflateInit failed while compressing.")); - - zs.next_in = (Bytef*) str.data(); - zs.avail_in = str.size(); // set the z_stream's input - - int ret; - char outbuffer[32768]; - string outstring; - -// retrieve the compressed bytes blockwise - do { - zs.next_out = reinterpret_cast<Bytef*>(outbuffer); - zs.avail_out = sizeof(outbuffer); - - ret = deflate(&zs, Z_FINISH); - - if (outstring.size() < zs.total_out) { - // append the block to the output string - outstring.append(outbuffer, zs.total_out - outstring.size()); - } - } while (ret == Z_OK); - - deflateEnd(&zs); - - if (ret != Z_STREAM_END) { // an error occurred that was not EOF - ostringstream oss; - oss << "Exception during zlib compression: (" << ret << ") " << zs.msg; - throw(runtime_error(oss.str())); - } - - return outstring; -} - -/** Decompress an STL string using zlib and return the original data. */ -string cHelpers::decompress_string(const string& str) { - z_stream zs; // z_stream is zlib's control structure - memset(&zs, 0, sizeof(zs)); - - if (inflateInit(&zs) != Z_OK) - throw(runtime_error("inflateInit failed while decompressing.")); - - zs.next_in = (Bytef*) str.data(); - zs.avail_in = str.size(); - - int ret; - char outbuffer[32768]; - string outstring; - -// get the decompressed bytes blockwise using repeated calls to inflate - do { - zs.next_out = reinterpret_cast<Bytef*>(outbuffer); - zs.avail_out = sizeof(outbuffer); - - ret = inflate(&zs, 0); - - if (outstring.size() < zs.total_out) { - outstring.append(outbuffer, zs.total_out - outstring.size()); - } - - } while (ret == Z_OK); - - inflateEnd(&zs); - - if (ret != Z_STREAM_END) { // an error occurred that was not EOF - ostringstream oss; - oss << "Exception during zlib decompression: (" << ret << ") " - << zs.msg; - throw(runtime_error(oss.str())); - } - - return outstring; -} - //These three methodes were stolen from vdr-restfulapi project. Thanks! std::queue<int> cHelpers::ConvertToBinary(int v) { int b; |