{"action":"created","comment":{"url":"https://api.github.com/repos/kodi-pvr/pvr.hts/pulls/comments/42324574","id":42324574,"diff_hunk":"@@ -0,0 +1,187 @@\n+/*\n+ *      Copyright (C) 2005-2011 Team XBMC\n+ *      http://www.xbmc.org\n+ *\n+ *  This Program is free software; you can redistribute it and/or modify\n+ *  it under the terms of the GNU General Public License as published by\n+ *  the Free Software Foundation; either version 2, or (at your option)\n+ *  any later version.\n+ *\n+ *  This Program is distributed in the hope that it will be useful,\n+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+ *  GNU General Public License for more details.\n+ *\n+ *  You should have received a copy of the GNU General Public License\n+ *  along with XBMC; see the file COPYING.  If not, write to\n+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\n+ *  http://www.gnu.org/copyleft/gpl.html\n+ *\n+ */\n+\n+#include \"../Tvheadend.h\"\n+\n+#include \"Settings.h\"\n+\n+namespace tvheadend {\n+\n+const std::string Settings::DEFAULT_HOST                = \"127.0.0.1\";\n+const int         Settings::DEFAULT_HTTP_PORT           = 9981;\n+const int         Settings::DEFAULT_HTSP_PORT           = 9982;\n+const std::string Settings::DEFAULT_USERNAME            = \"\";\n+const std::string Settings::DEFAULT_PASSWORD            = \"\";\n+const int         Settings::DEFAULT_CONNECT_TIMEOUT     = 10000; // millisecs\n+const int         Settings::DEFAULT_RESPONSE_TIMEOUT    = 5000;  // millisecs\n+const bool        Settings::DEFAULT_TRACE_DEBUG         = false;\n+const bool        Settings::DEFAULT_ASYNC_EPG           = false;\n+const int         Settings::DEFAULT_TOTAL_TUNERS        = 1;  // total tuners > 1 => predictive tuning active\n+const int         Settings::DEFAULT_PRETUNER_CLOSEDELAY = 10; // secs\n+const int         Settings::DEFAULT_AUTOREC_MAXDIFF     = 15; // mins. Maximum difference between real and approximate start time for auto recordings\n+const int         Settings::DEFAULT_APPROX_TIME         = 0;  // mins\n+\n+std::string Settings::ReadStringSetting(const std::string &key, const std::string &def)\n+{\n+  char value[1024];\n+  if (XBMC->GetSetting(key.c_str(), value))\n+    return value;\n+\n+  return def;\n+}\n+\n+int Settings::ReadIntSetting(const std::string &key, int def)\n+{\n+  int value;\n+  if (XBMC->GetSetting(key.c_str(), &value))\n+    return value;\n+\n+  return def;\n+}\n+\n+bool Settings::ReadBoolSetting(const std::string &key, bool def)\n+{\n+  bool value;\n+  if (XBMC->GetSetting(key.c_str(), &value))\n+    return value;\n+\n+  return def;\n+}\n+\n+void Settings::ReadSettings()\n+{\n+  /* Connection */\n+  SetHostname(ReadStringSetting(\"host\", DEFAULT_HOST));\n+  SetPortHTSP(ReadIntSetting(\"htsp_port\", DEFAULT_HTSP_PORT));\n+  SetPortHTTP(ReadIntSetting(\"http_port\", DEFAULT_HTTP_PORT));\n+  SetUsername(ReadStringSetting(\"user\", DEFAULT_USERNAME));\n+  SetPassword(ReadStringSetting(\"pass\", DEFAULT_PASSWORD));\n+\n+  /* Note: Timeouts in settings UI are defined in seconds but we expect them to be in milliseconds. */\n+  SetConnectTimeout(ReadIntSetting(\"connect_timeout\", DEFAULT_CONNECT_TIMEOUT / 1000) * 1000);\n+  SetResponseTimeout(ReadIntSetting(\"response_timeout\", DEFAULT_RESPONSE_TIMEOUT / 1000) * 1000);\n+\n+  /* Debug */\n+  SetTraceDebug(ReadBoolSetting(\"trace_debug\", DEFAULT_TRACE_DEBUG));\n+\n+  /* Data Transfer */\n+  SetTraceDebug(ReadBoolSetting(\"epg_async\", DEFAULT_ASYNC_EPG));\n+\n+  /* Predictive Tuning */\n+  bool bPretunerEnabled = ReadBoolSetting(\"pretuner_enabled\", false);\n+  SetTotalTuners(bPretunerEnabled ? ReadIntSetting(\"total_tuners\", DEFAULT_TOTAL_TUNERS) : 1);\n+  SetPreTunerCloseDelay(bPretunerEnabled ? ReadIntSetting(\"pretuner_closedelay\", DEFAULT_PRETUNER_CLOSEDELAY) : 0);\n+\n+  /* Auto recordings */\n+  SetAutorecApproxTime(ReadIntSetting(\"autorec_approxtime\", DEFAULT_APPROX_TIME));\n+  SetAutorecMaxDiff(ReadIntSetting(\"autorec_maxdiff\", DEFAULT_AUTOREC_MAXDIFF));\n+}\n+\n+ADDON_STATUS Settings::SetStringSetting(const std::string &oldValue, const void *newValue)\n+{\n+  if (oldValue == std::string(reinterpret_cast<const char *>(newValue)))\n+  {\n+    // value not changed.","path":"src/tvheadend/Settings.cpp","position":102,"original_position":102,"commit_id":"063c4cd333a74de088ac4889d436cf3de4c2eb85","original_commit_id":"063c4cd333a74de088ac4889d436cf3de4c2eb85","user":{"login":"Jalle19","id":1106133,"avatar_url":"https://avatars.githubusercontent.com/u/1106133?v=3","gravatar_id":"","url":"https://api.github.com/users/Jalle19","html_url":"https://github.com/Jalle19","followers_url":"https://api.github.com/users/Jalle19/followers","following_url":"https://api.github.com/users/Jalle19/following{/other_user}","gists_url":"https://api.github.com/users/Jalle19/gists{/gist_id}","starred_url":"https://api.github.com/users/Jalle19/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jalle19/subscriptions","organizations_url":"https://api.github.com/users/Jalle19/orgs","repos_url":"https://api.github.com/users/Jalle19/repos","events_url":"https://api.github.com/users/Jalle19/events{/privacy}","received_events_url":"https://api.github.com/users/Jalle19/received_events","type":"User","site_admin":false},"body":"Minor thing, but if you'd add these comments in the method documentation in the header file then this method and the two below it could be shortened to 4 lines each instead of the current 10.","created_at":"2015-10-18T18:47:08Z","updated_at":"2015-10-18T18:47:08Z","html_url":"https://github.com/kodi-pvr/pvr.hts/pull/116#discussion_r42324574","pull_request_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/pulls/116","_links":{"self":{"href":"https://api.github.com/repos/kodi-pvr/pvr.hts/pulls/comments/42324574"},"html":{"href":"https://github.com/kodi-pvr/pvr.hts/pull/116#discussion_r42324574"},"pull_request":{"href":"https://api.github.com/repos/kodi-pvr/pvr.hts/pulls/116"}}},"pull_request":{"url":"https://api.github.com/repos/kodi-pvr/pvr.hts/pulls/116","id":47801348,"html_url":"https://github.com/kodi-pvr/pvr.hts/pull/116","diff_url":"https://github.com/kodi-pvr/pvr.hts/pull/116.diff","patch_url":"https://github.com/kodi-pvr/pvr.hts/pull/116.patch","issue_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/issues/116","number":116,"state":"open","locked":false,"title":"Refactor class Settings, step 2","user":{"login":"ksooo","id":3226626,"avatar_url":"https://avatars.githubusercontent.com/u/3226626?v=3","gravatar_id":"","url":"https://api.github.com/users/ksooo","html_url":"https://github.com/ksooo","followers_url":"https://api.github.com/users/ksooo/followers","following_url":"https://api.github.com/users/ksooo/following{/other_user}","gists_url":"https://api.github.com/users/ksooo/gists{/gist_id}","starred_url":"https://api.github.com/users/ksooo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksooo/subscriptions","organizations_url":"https://api.github.com/users/ksooo/orgs","repos_url":"https://api.github.com/users/ksooo/repos","events_url":"https://api.github.com/users/ksooo/events{/privacy}","received_events_url":"https://api.github.com/users/ksooo/received_events","type":"User","site_admin":false},"body":"Fixes Coverity complaints after https://github.com/kodi-pvr/pvr.hts/commit/f013946b78e5b4770316883edfdf8028140d7d0a @Jalle19 mind taking a look.\r\n\r\nBTW: I overlooked the public members in class Settings you've just introduced. I do not like that, tbh and would have bugged you with that if I had seen this before the merge. ;-)","created_at":"2015-10-15T15:23:00Z","updated_at":"2015-10-18T18:47:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f6ae3e19757cf094edc930d8003f40f2be737a60","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/pulls/116/commits","review_comments_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/pulls/116/comments","review_comment_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/issues/116/comments","statuses_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/statuses/063c4cd333a74de088ac4889d436cf3de4c2eb85","head":{"label":"ksooo:coverity-oct-2015","ref":"coverity-oct-2015","sha":"063c4cd333a74de088ac4889d436cf3de4c2eb85","user":{"login":"ksooo","id":3226626,"avatar_url":"https://avatars.githubusercontent.com/u/3226626?v=3","gravatar_id":"","url":"https://api.github.com/users/ksooo","html_url":"https://github.com/ksooo","followers_url":"https://api.github.com/users/ksooo/followers","following_url":"https://api.github.com/users/ksooo/following{/other_user}","gists_url":"https://api.github.com/users/ksooo/gists{/gist_id}","starred_url":"https://api.github.com/users/ksooo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksooo/subscriptions","organizations_url":"https://api.github.com/users/ksooo/orgs","repos_url":"https://api.github.com/users/ksooo/repos","events_url":"https://api.github.com/users/ksooo/events{/privacy}","received_events_url":"https://api.github.com/users/ksooo/received_events","type":"User","site_admin":false},"repo":{"id":31843279,"name":"pvr.hts","full_name":"ksooo/pvr.hts","owner":{"login":"ksooo","id":3226626,"avatar_url":"https://avatars.githubusercontent.com/u/3226626?v=3","gravatar_id":"","url":"https://api.github.com/users/ksooo","html_url":"https://github.com/ksooo","followers_url":"https://api.github.com/users/ksooo/followers","following_url":"https://api.github.com/users/ksooo/following{/other_user}","gists_url":"https://api.github.com/users/ksooo/gists{/gist_id}","starred_url":"https://api.github.com/users/ksooo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksooo/subscriptions","organizations_url":"https://api.github.com/users/ksooo/orgs","repos_url":"https://api.github.com/users/ksooo/repos","events_url":"https://api.github.com/users/ksooo/events{/privacy}","received_events_url":"https://api.github.com/users/ksooo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ksooo/pvr.hts","description":"Kodi's Tvheadend HTSP client addon","fork":true,"url":"https://api.github.com/repos/ksooo/pvr.hts","forks_url":"https://api.github.com/repos/ksooo/pvr.hts/forks","keys_url":"https://api.github.com/repos/ksooo/pvr.hts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ksooo/pvr.hts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ksooo/pvr.hts/teams","hooks_url":"https://api.github.com/repos/ksooo/pvr.hts/hooks","issue_events_url":"https://api.github.com/repos/ksooo/pvr.hts/issues/events{/number}","events_url":"https://api.github.com/repos/ksooo/pvr.hts/events","assignees_url":"https://api.github.com/repos/ksooo/pvr.hts/assignees{/user}","branches_url":"https://api.github.com/repos/ksooo/pvr.hts/branches{/branch}","tags_url":"https://api.github.com/repos/ksooo/pvr.hts/tags","blobs_url":"https://api.github.com/repos/ksooo/pvr.hts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ksooo/pvr.hts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ksooo/pvr.hts/git/refs{/sha}","trees_url":"https://api.github.com/repos/ksooo/pvr.hts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ksooo/pvr.hts/statuses/{sha}","languages_url":"https://api.github.com/repos/ksooo/pvr.hts/languages","stargazers_url":"https://api.github.com/repos/ksooo/pvr.hts/stargazers","contributors_url":"https://api.github.com/repos/ksooo/pvr.hts/contributors","subscribers_url":"https://api.github.com/repos/ksooo/pvr.hts/subscribers","subscription_url":"https://api.github.com/repos/ksooo/pvr.hts/subscription","commits_url":"https://api.github.com/repos/ksooo/pvr.hts/commits{/sha}","git_commits_url":"https://api.github.com/repos/ksooo/pvr.hts/git/commits{/sha}","comments_url":"https://api.github.com/repos/ksooo/pvr.hts/comments{/number}","issue_comment_url":"https://api.github.com/repos/ksooo/pvr.hts/issues/comments{/number}","contents_url":"https://api.github.com/repos/ksooo/pvr.hts/contents/{+path}","compare_url":"https://api.github.com/repos/ksooo/pvr.hts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ksooo/pvr.hts/merges","archive_url":"https://api.github.com/repos/ksooo/pvr.hts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ksooo/pvr.hts/downloads","issues_url":"https://api.github.com/repos/ksooo/pvr.hts/issues{/number}","pulls_url":"https://api.github.com/repos/ksooo/pvr.hts/pulls{/number}","milestones_url":"https://api.github.com/repos/ksooo/pvr.hts/milestones{/number}","notifications_url":"https://api.github.com/repos/ksooo/pvr.hts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ksooo/pvr.hts/labels{/name}","releases_url":"https://api.github.com/repos/ksooo/pvr.hts/releases{/id}","created_at":"2015-03-08T08:31:54Z","updated_at":"2015-05-05T19:41:17Z","pushed_at":"2015-10-18T17:12:05Z","git_url":"git://github.com/ksooo/pvr.hts.git","ssh_url":"git@github.com:ksooo/pvr.hts.git","clone_url":"https://github.com/ksooo/pvr.hts.git","svn_url":"https://github.com/ksooo/pvr.hts","homepage":null,"size":1110,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"kodi-pvr:master","ref":"master","sha":"5fad199e1089f1dcb44ec737219d7bc176cea84a","user":{"login":"kodi-pvr","id":11259403,"avatar_url":"https://avatars.githubusercontent.com/u/11259403?v=3","gravatar_id":"","url":"https://api.github.com/users/kodi-pvr","html_url":"https://github.com/kodi-pvr","followers_url":"https://api.github.com/users/kodi-pvr/followers","following_url":"https://api.github.com/users/kodi-pvr/following{/other_user}","gists_url":"https://api.github.com/users/kodi-pvr/gists{/gist_id}","starred_url":"https://api.github.com/users/kodi-pvr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kodi-pvr/subscriptions","organizations_url":"https://api.github.com/users/kodi-pvr/orgs","repos_url":"https://api.github.com/users/kodi-pvr/repos","events_url":"https://api.github.com/users/kodi-pvr/events{/privacy}","received_events_url":"https://api.github.com/users/kodi-pvr/received_events","type":"Organization","site_admin":false},"repo":{"id":31268331,"name":"pvr.hts","full_name":"kodi-pvr/pvr.hts","owner":{"login":"kodi-pvr","id":11259403,"avatar_url":"https://avatars.githubusercontent.com/u/11259403?v=3","gravatar_id":"","url":"https://api.github.com/users/kodi-pvr","html_url":"https://github.com/kodi-pvr","followers_url":"https://api.github.com/users/kodi-pvr/followers","following_url":"https://api.github.com/users/kodi-pvr/following{/other_user}","gists_url":"https://api.github.com/users/kodi-pvr/gists{/gist_id}","starred_url":"https://api.github.com/users/kodi-pvr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kodi-pvr/subscriptions","organizations_url":"https://api.github.com/users/kodi-pvr/orgs","repos_url":"https://api.github.com/users/kodi-pvr/repos","events_url":"https://api.github.com/users/kodi-pvr/events{/privacy}","received_events_url":"https://api.github.com/users/kodi-pvr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kodi-pvr/pvr.hts","description":"Kodi's Tvheadend HTSP client addon","fork":false,"url":"https://api.github.com/repos/kodi-pvr/pvr.hts","forks_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/forks","keys_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/teams","hooks_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/hooks","issue_events_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/issues/events{/number}","events_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/events","assignees_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/assignees{/user}","branches_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/branches{/branch}","tags_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/tags","blobs_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/git/refs{/sha}","trees_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/statuses/{sha}","languages_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/languages","stargazers_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/stargazers","contributors_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/contributors","subscribers_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/subscribers","subscription_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/subscription","commits_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/commits{/sha}","git_commits_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/git/commits{/sha}","comments_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/comments{/number}","issue_comment_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/issues/comments{/number}","contents_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/contents/{+path}","compare_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/merges","archive_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/downloads","issues_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/issues{/number}","pulls_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/pulls{/number}","milestones_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/milestones{/number}","notifications_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/labels{/name}","releases_url":"https://api.github.com/repos/kodi-pvr/pvr.hts/releases{/id}","created_at":"2015-02-24T16:07:43Z","updated_at":"2015-10-14T17:25:33Z","pushed_at":"2015-10-18T18:38:18Z","git_url":"git://github.com/kodi-pvr/pvr.hts.git","ssh_url":"git@github.com:kodi-pvr/pvr.hts.git","clone_url":"https://github.com/kodi-pvr/pvr.hts.git","svn_url":"https://github.com/kodi-pvr/pvr.hts","homepage":null,"size":1815,"stargazers_count":22,"watchers_count":22,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":14,"forks":24,"open_issues":14,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kodi-pvr/pvr.hts/pulls/116"},"html":{"href":"https://github.com/kodi-pvr/pvr.hts/pull/116"},"issue":{"href":"https://api.github.com/repos/kodi-pvr/pvr.hts/issues/116"},"comments":{"href":"https://api.github.com/repos/kodi-pvr/pvr.hts/issues/116/comments"},"review_comments":{"href":"https://api.github.com/repos/kodi-pvr/pvr.hts/pulls/116/comments"},"review_comment":{"href":"https://api.github.com/repos/kodi-pvr/pvr.hts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kodi-pvr/pvr.hts/pulls/116/commits"},"statuses":{"href":"https://api.github.com/repos/kodi-pvr/pvr.hts/statuses/063c4cd333a74de088ac4889d436cf3de4c2eb85"}}}}