{"action":"created","comment":{"url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/pulls/comments/92332636","pull_request_review_id":12845060,"id":92332636,"diff_hunk":"@@ -590,66 +580,95 @@ const std::string &Dvb::GetLiveStreamURL(const PVR_CHANNEL &channelinfo)\n   return m_channels[channelinfo.iUniqueId - 1]->streamURL;\n }\n \n-\n void *Dvb::Process()\n {\n   XBMC->Log(LOG_DEBUG, \"%s: Running...\", __FUNCTION__);\n   int update = 0;\n   int interval = (!g_lowPerformance) ? 60 : 300;\n \n+  // set PVR_CONNECTION_STATE_CONNECTING only once!\n+  SetConnectionState(PVR_CONNECTION_STATE_CONNECTING);\n+\n   while (!IsStopped())\n   {\n-    Sleep(1000);\n-    ++update;\n-\n-    CLockObject lock(m_mutex);\n-    if (m_updateEPG)\n+    if (!IsConnected())\n     {\n-      m_updateEPG = false;\n-      m_mutex.Unlock();\n-      Sleep(8000); /* Sleep enough time to let the recording service grab the EPG data */\n-      m_mutex.Lock();\n-      XBMC->Log(LOG_INFO, \"Performing forced EPG update!\");\n-      PVR->TriggerEpgUpdate(m_currentChannel);\n-    }\n+      XBMC->Log(LOG_INFO, \"Trying to connect to the backend service...\");\n+\n+      if (CheckBackendVersion() && UpdateBackendStatus(true) && LoadChannels())\n+      {\n+        XBMC->Log(LOG_INFO, \"Connection to the backend service successful.\");\n+        SetConnectionState(PVR_CONNECTION_STATE_CONNECTED);\n \n-    if (m_updateTimers)\n+        TimerUpdates();\n+        // force recording sync as Kodi won't update recordings on PVR restart\n+        PVR->TriggerRecordingUpdate();\n+      }\n+      else\n+      {\n+        XBMC->Log(LOG_INFO, \"Connection to the backend service failed.\"\n+          \" Retrying in 10 seconds...\");\n+        Sleep(10000);\n+      }\n+    }\n+    else\n     {\n-      m_updateTimers = false;\n-      m_mutex.Unlock();\n       Sleep(1000);\n-      m_mutex.Lock();\n-      XBMC->Log(LOG_INFO, \"Performing forced timer updates!\");\n-      TimerUpdates();\n-      update = 0;\n-    }\n+      ++update;\n \n-    if (update >= interval)\n-    {\n-      update = 0;\n-      XBMC->Log(LOG_INFO, \"Performing timer/recording updates!\");\n-      TimerUpdates();\n-      PVR->TriggerRecordingUpdate();\n+      CLockObject lock(m_mutex);\n+      if (m_updateEPG)\n+      {\n+        m_updateEPG = false;\n+        m_mutex.Unlock();\n+        Sleep(8000); /* Sleep enough time to let the recording service grab the EPG data */\n+        m_mutex.Lock();\n+        XBMC->Log(LOG_INFO, \"Performing forced EPG update!\");\n+        PVR->TriggerEpgUpdate(m_currentChannel);\n+      }\n+\n+      if (m_updateTimers)","path":"src/DvbData.cpp","position":181,"original_position":181,"commit_id":"e0662933bc4c65b54bc818c99e21449f789d3927","original_commit_id":"19105b63861d0c7d6e8964b4da4898758879eafe","user":{"login":"CiNcH83","id":24539361,"avatar_url":"https://avatars.githubusercontent.com/u/24539361?v=3","gravatar_id":"","url":"https://api.github.com/users/CiNcH83","html_url":"https://github.com/CiNcH83","followers_url":"https://api.github.com/users/CiNcH83/followers","following_url":"https://api.github.com/users/CiNcH83/following{/other_user}","gists_url":"https://api.github.com/users/CiNcH83/gists{/gist_id}","starred_url":"https://api.github.com/users/CiNcH83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CiNcH83/subscriptions","organizations_url":"https://api.github.com/users/CiNcH83/orgs","repos_url":"https://api.github.com/users/CiNcH83/repos","events_url":"https://api.github.com/users/CiNcH83/events{/privacy}","received_events_url":"https://api.github.com/users/CiNcH83/received_events","type":"User","site_admin":false},"body":"Do we really have to update the timers every second?","created_at":"2016-12-14T07:11:39Z","updated_at":"2016-12-14T07:11:39Z","html_url":"https://github.com/kodi-pvr/pvr.dvbviewer/pull/46#discussion_r92332636","pull_request_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/pulls/comments/92332636"},"html":{"href":"https://github.com/kodi-pvr/pvr.dvbviewer/pull/46#discussion_r92332636"},"pull_request":{"href":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/pulls/46","id":97742890,"html_url":"https://github.com/kodi-pvr/pvr.dvbviewer/pull/46","diff_url":"https://github.com/kodi-pvr/pvr.dvbviewer/pull/46.diff","patch_url":"https://github.com/kodi-pvr/pvr.dvbviewer/pull/46.patch","issue_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/issues/46","number":46,"state":"open","locked":false,"title":"(Hot-)Fixes for Krypton","user":{"login":"manuelm","id":357694,"avatar_url":"https://avatars.githubusercontent.com/u/357694?v=3","gravatar_id":"","url":"https://api.github.com/users/manuelm","html_url":"https://github.com/manuelm","followers_url":"https://api.github.com/users/manuelm/followers","following_url":"https://api.github.com/users/manuelm/following{/other_user}","gists_url":"https://api.github.com/users/manuelm/gists{/gist_id}","starred_url":"https://api.github.com/users/manuelm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manuelm/subscriptions","organizations_url":"https://api.github.com/users/manuelm/orgs","repos_url":"https://api.github.com/users/manuelm/repos","events_url":"https://api.github.com/users/manuelm/events{/privacy}","received_events_url":"https://api.github.com/users/manuelm/received_events","type":"User","site_admin":false},"body":"Adds support for connection state change callback to fix connecting and reconnecting if the backend goes down. Plus removes RTSP, which isn't working anymore.\r\n\r\nEdit: Will upmerge this afterwards","created_at":"2016-12-13T12:37:29Z","updated_at":"2016-12-14T07:11:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3c0a6c2d0dc7d563a1089be453478f99e4a11874","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/pulls/46/commits","review_comments_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/pulls/46/comments","review_comment_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/issues/46/comments","statuses_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/statuses/e0662933bc4c65b54bc818c99e21449f789d3927","head":{"label":"manuelm:Krypton","ref":"Krypton","sha":"e0662933bc4c65b54bc818c99e21449f789d3927","user":{"login":"manuelm","id":357694,"avatar_url":"https://avatars.githubusercontent.com/u/357694?v=3","gravatar_id":"","url":"https://api.github.com/users/manuelm","html_url":"https://github.com/manuelm","followers_url":"https://api.github.com/users/manuelm/followers","following_url":"https://api.github.com/users/manuelm/following{/other_user}","gists_url":"https://api.github.com/users/manuelm/gists{/gist_id}","starred_url":"https://api.github.com/users/manuelm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manuelm/subscriptions","organizations_url":"https://api.github.com/users/manuelm/orgs","repos_url":"https://api.github.com/users/manuelm/repos","events_url":"https://api.github.com/users/manuelm/events{/privacy}","received_events_url":"https://api.github.com/users/manuelm/received_events","type":"User","site_admin":false},"repo":{"id":31600085,"name":"pvr.dvbviewer","full_name":"manuelm/pvr.dvbviewer","owner":{"login":"manuelm","id":357694,"avatar_url":"https://avatars.githubusercontent.com/u/357694?v=3","gravatar_id":"","url":"https://api.github.com/users/manuelm","html_url":"https://github.com/manuelm","followers_url":"https://api.github.com/users/manuelm/followers","following_url":"https://api.github.com/users/manuelm/following{/other_user}","gists_url":"https://api.github.com/users/manuelm/gists{/gist_id}","starred_url":"https://api.github.com/users/manuelm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manuelm/subscriptions","organizations_url":"https://api.github.com/users/manuelm/orgs","repos_url":"https://api.github.com/users/manuelm/repos","events_url":"https://api.github.com/users/manuelm/events{/privacy}","received_events_url":"https://api.github.com/users/manuelm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/manuelm/pvr.dvbviewer","description":"Kodi's DVBViewer client addon ","fork":true,"url":"https://api.github.com/repos/manuelm/pvr.dvbviewer","forks_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/forks","keys_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/teams","hooks_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/hooks","issue_events_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/issues/events{/number}","events_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/events","assignees_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/assignees{/user}","branches_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/branches{/branch}","tags_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/tags","blobs_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/git/refs{/sha}","trees_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/statuses/{sha}","languages_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/languages","stargazers_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/stargazers","contributors_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/contributors","subscribers_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/subscribers","subscription_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/subscription","commits_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/commits{/sha}","git_commits_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/git/commits{/sha}","comments_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/comments{/number}","issue_comment_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/issues/comments{/number}","contents_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/contents/{+path}","compare_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/merges","archive_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/downloads","issues_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/issues{/number}","pulls_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/pulls{/number}","milestones_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/milestones{/number}","notifications_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/labels{/name}","releases_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/releases{/id}","deployments_url":"https://api.github.com/repos/manuelm/pvr.dvbviewer/deployments","created_at":"2015-03-03T13:38:39Z","updated_at":"2016-11-24T23:50:03Z","pushed_at":"2016-12-13T16:13:59Z","git_url":"git://github.com/manuelm/pvr.dvbviewer.git","ssh_url":"git@github.com:manuelm/pvr.dvbviewer.git","clone_url":"https://github.com/manuelm/pvr.dvbviewer.git","svn_url":"https://github.com/manuelm/pvr.dvbviewer","homepage":null,"size":756,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"kodi-pvr:Krypton","ref":"Krypton","sha":"3aa4add117c80a807c0a5a1b1bacdd7b16ab9aa9","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":31507746,"name":"pvr.dvbviewer","full_name":"kodi-pvr/pvr.dvbviewer","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.dvbviewer","description":"Kodi's DVBViewer client addon ","fork":false,"url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer","forks_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/forks","keys_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/teams","hooks_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/hooks","issue_events_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/issues/events{/number}","events_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/events","assignees_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/assignees{/user}","branches_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/branches{/branch}","tags_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/tags","blobs_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/git/refs{/sha}","trees_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/statuses/{sha}","languages_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/languages","stargazers_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/stargazers","contributors_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/contributors","subscribers_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/subscribers","subscription_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/subscription","commits_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/commits{/sha}","git_commits_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/git/commits{/sha}","comments_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/comments{/number}","issue_comment_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/issues/comments{/number}","contents_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/contents/{+path}","compare_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/merges","archive_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/downloads","issues_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/issues{/number}","pulls_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/pulls{/number}","milestones_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/milestones{/number}","notifications_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/labels{/name}","releases_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/releases{/id}","deployments_url":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/deployments","created_at":"2015-03-01T19:27:00Z","updated_at":"2016-11-26T12:39:05Z","pushed_at":"2016-12-13T16:13:59Z","git_url":"git://github.com/kodi-pvr/pvr.dvbviewer.git","ssh_url":"git@github.com:kodi-pvr/pvr.dvbviewer.git","clone_url":"https://github.com/kodi-pvr/pvr.dvbviewer.git","svn_url":"https://github.com/kodi-pvr/pvr.dvbviewer","homepage":null,"size":794,"stargazers_count":3,"watchers_count":3,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":8,"forks":12,"open_issues":8,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/pulls/46"},"html":{"href":"https://github.com/kodi-pvr/pvr.dvbviewer/pull/46"},"issue":{"href":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/issues/46"},"comments":{"href":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/kodi-pvr/pvr.dvbviewer/statuses/e0662933bc4c65b54bc818c99e21449f789d3927"}}}}
{"actor":{"display_login":"CiNcH83"}}