{"action":"created","comment":{"url":"https://api.github.com/repos/xbmc/repo-scripts/pulls/comments/58317300","id":58317300,"diff_hunk":"@@ -0,0 +1,243 @@\n+\"\"\"\n+This file contains additional utility functions\n+\"\"\"\n+import xbmc, xbmcgui, xbmcvfs, xbmcaddon\n+import os\n+import time\n+import sys\n+import buggalo\n+import re\n+import random\n+\n+__addon_id__= u'service.watchedlist'\n+__Addon = xbmcaddon.Addon(__addon_id__)\n+\n+# XBMC-JSON\n+if sys.version_info < (2, 7):\n+    import simplejson\n+else:\n+    import json as simplejson\n+\n+\n+def data_dir():\n+    \"\"\"\"get user data directory of this addon. \n+    according to http://wiki.xbmc.org/index.php?title=Add-on_Rules#Requirements_for_scripts_and_plugins\n+    \"\"\"\n+    __datapath__ = xbmc.translatePath( __Addon.getAddonInfo('profile') ).decode('utf-8')\n+    if not xbmcvfs.exists(__datapath__):\n+        xbmcvfs.mkdir(__datapath__)\n+    return __datapath__\n+\n+def addon_dir():\n+    \"\"\"\"get source directory of this addon.\n+    according to http://wiki.xbmc.org/index.php?title=Add-on_Rules#Requirements_for_scripts_and_plugins\n+    \"\"\"\n+    return __Addon.getAddonInfo('path').decode('utf-8')\n+\n+def log(message,loglevel=xbmc.LOGNOTICE):\n+    \"\"\"\"save message to xbmc.log.\n+    \n+    Args:\n+        message: has to be unicode, http://wiki.xbmc.org/index.php?title=Add-on_unicode_paths#Logging\n+        loglevel: xbmc.LOGDEBUG, xbmc.LOGINFO, xbmc.LOGNOTICE, xbmc.LOGWARNING, xbmc.LOGERROR, xbmc.LOGFATAL\n+    \"\"\"\n+    xbmc.log(encode(__addon_id__ + u\": \" + message), level=loglevel)\n+\n+\n+def showNotification(title,message, time=4000):\n+    \"\"\"Show Notification\n+\n+    Args: \n+        title: has to be unicode\n+        message: has to be unicode\n+        time: Time that the message is beeing displayed\n+    \"\"\"\n+    __addoniconpath__ = os.path.join(addon_dir(),\"icon.png\")\n+    log(u'Notification. %s: %s' % (title, message) )\n+    if xbmc.Player().isPlaying() == False: # do not show the notification, if a video is being played.\n+        xbmc.executebuiltin(encode('Notification(\"' + title + '\",\"' + message + '\",'+(str(time)).decode('utf-8')+',\"' + __addoniconpath__ + '\")'))","path":"service.watchedlist/resources/lib/utils.py","position":58,"original_position":58,"commit_id":"6e1cd8d5cb5913a07bb79f37c0cebba156ef623a","original_commit_id":"6e1cd8d5cb5913a07bb79f37c0cebba156ef623a","user":{"login":"phil65","id":110931,"avatar_url":"https://avatars.githubusercontent.com/u/110931?v=3","gravatar_id":"","url":"https://api.github.com/users/phil65","html_url":"https://github.com/phil65","followers_url":"https://api.github.com/users/phil65/followers","following_url":"https://api.github.com/users/phil65/following{/other_user}","gists_url":"https://api.github.com/users/phil65/gists{/gist_id}","starred_url":"https://api.github.com/users/phil65/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phil65/subscriptions","organizations_url":"https://api.github.com/users/phil65/orgs","repos_url":"https://api.github.com/users/phil65/repos","events_url":"https://api.github.com/users/phil65/events{/privacy}","received_events_url":"https://api.github.com/users/phil65/received_events","type":"User","site_admin":false},"body":"is is preferred to use xbmcgui.Dialog().Notification() instead of calling a builtin.","created_at":"2016-04-03T20:47:19Z","updated_at":"2016-04-03T20:47:19Z","html_url":"https://github.com/xbmc/repo-scripts/pull/81#discussion_r58317300","pull_request_url":"https://api.github.com/repos/xbmc/repo-scripts/pulls/81","_links":{"self":{"href":"https://api.github.com/repos/xbmc/repo-scripts/pulls/comments/58317300"},"html":{"href":"https://github.com/xbmc/repo-scripts/pull/81#discussion_r58317300"},"pull_request":{"href":"https://api.github.com/repos/xbmc/repo-scripts/pulls/81"}}},"pull_request":{"url":"https://api.github.com/repos/xbmc/repo-scripts/pulls/81","id":65033979,"html_url":"https://github.com/xbmc/repo-scripts/pull/81","diff_url":"https://github.com/xbmc/repo-scripts/pull/81.diff","patch_url":"https://github.com/xbmc/repo-scripts/pull/81.patch","issue_url":"https://api.github.com/repos/xbmc/repo-scripts/issues/81","number":81,"state":"open","locked":false,"title":"[service.watchedlist] 1.1.0","user":{"login":"SchapplM","id":2719430,"avatar_url":"https://avatars.githubusercontent.com/u/2719430?v=3","gravatar_id":"","url":"https://api.github.com/users/SchapplM","html_url":"https://github.com/SchapplM","followers_url":"https://api.github.com/users/SchapplM/followers","following_url":"https://api.github.com/users/SchapplM/following{/other_user}","gists_url":"https://api.github.com/users/SchapplM/gists{/gist_id}","starred_url":"https://api.github.com/users/SchapplM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchapplM/subscriptions","organizations_url":"https://api.github.com/users/SchapplM/orgs","repos_url":"https://api.github.com/users/SchapplM/repos","events_url":"https://api.github.com/users/SchapplM/events{/privacy}","received_events_url":"https://api.github.com/users/SchapplM/received_events","type":"User","site_admin":false},"body":"Please merge my update of the addon service.watchedlist. It was previously in repository helix with version 1.0.4.","created_at":"2016-04-02T10:06:26Z","updated_at":"2016-04-03T20:47:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76757ecc9d04c13ebaab50418fe3bb535a20f1ed","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/xbmc/repo-scripts/pulls/81/commits","review_comments_url":"https://api.github.com/repos/xbmc/repo-scripts/pulls/81/comments","review_comment_url":"https://api.github.com/repos/xbmc/repo-scripts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xbmc/repo-scripts/issues/81/comments","statuses_url":"https://api.github.com/repos/xbmc/repo-scripts/statuses/6e1cd8d5cb5913a07bb79f37c0cebba156ef623a","head":{"label":"SchapplM:isengard","ref":"isengard","sha":"6e1cd8d5cb5913a07bb79f37c0cebba156ef623a","user":{"login":"SchapplM","id":2719430,"avatar_url":"https://avatars.githubusercontent.com/u/2719430?v=3","gravatar_id":"","url":"https://api.github.com/users/SchapplM","html_url":"https://github.com/SchapplM","followers_url":"https://api.github.com/users/SchapplM/followers","following_url":"https://api.github.com/users/SchapplM/following{/other_user}","gists_url":"https://api.github.com/users/SchapplM/gists{/gist_id}","starred_url":"https://api.github.com/users/SchapplM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchapplM/subscriptions","organizations_url":"https://api.github.com/users/SchapplM/orgs","repos_url":"https://api.github.com/users/SchapplM/repos","events_url":"https://api.github.com/users/SchapplM/events{/privacy}","received_events_url":"https://api.github.com/users/SchapplM/received_events","type":"User","site_admin":false},"repo":{"id":55288322,"name":"repo-scripts","full_name":"SchapplM/repo-scripts","owner":{"login":"SchapplM","id":2719430,"avatar_url":"https://avatars.githubusercontent.com/u/2719430?v=3","gravatar_id":"","url":"https://api.github.com/users/SchapplM","html_url":"https://github.com/SchapplM","followers_url":"https://api.github.com/users/SchapplM/followers","following_url":"https://api.github.com/users/SchapplM/following{/other_user}","gists_url":"https://api.github.com/users/SchapplM/gists{/gist_id}","starred_url":"https://api.github.com/users/SchapplM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchapplM/subscriptions","organizations_url":"https://api.github.com/users/SchapplM/orgs","repos_url":"https://api.github.com/users/SchapplM/repos","events_url":"https://api.github.com/users/SchapplM/events{/privacy}","received_events_url":"https://api.github.com/users/SchapplM/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SchapplM/repo-scripts","description":"Official source repository for Kodi script add-ons","fork":true,"url":"https://api.github.com/repos/SchapplM/repo-scripts","forks_url":"https://api.github.com/repos/SchapplM/repo-scripts/forks","keys_url":"https://api.github.com/repos/SchapplM/repo-scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SchapplM/repo-scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SchapplM/repo-scripts/teams","hooks_url":"https://api.github.com/repos/SchapplM/repo-scripts/hooks","issue_events_url":"https://api.github.com/repos/SchapplM/repo-scripts/issues/events{/number}","events_url":"https://api.github.com/repos/SchapplM/repo-scripts/events","assignees_url":"https://api.github.com/repos/SchapplM/repo-scripts/assignees{/user}","branches_url":"https://api.github.com/repos/SchapplM/repo-scripts/branches{/branch}","tags_url":"https://api.github.com/repos/SchapplM/repo-scripts/tags","blobs_url":"https://api.github.com/repos/SchapplM/repo-scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SchapplM/repo-scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SchapplM/repo-scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/SchapplM/repo-scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SchapplM/repo-scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/SchapplM/repo-scripts/languages","stargazers_url":"https://api.github.com/repos/SchapplM/repo-scripts/stargazers","contributors_url":"https://api.github.com/repos/SchapplM/repo-scripts/contributors","subscribers_url":"https://api.github.com/repos/SchapplM/repo-scripts/subscribers","subscription_url":"https://api.github.com/repos/SchapplM/repo-scripts/subscription","commits_url":"https://api.github.com/repos/SchapplM/repo-scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/SchapplM/repo-scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/SchapplM/repo-scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/SchapplM/repo-scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/SchapplM/repo-scripts/contents/{+path}","compare_url":"https://api.github.com/repos/SchapplM/repo-scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SchapplM/repo-scripts/merges","archive_url":"https://api.github.com/repos/SchapplM/repo-scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SchapplM/repo-scripts/downloads","issues_url":"https://api.github.com/repos/SchapplM/repo-scripts/issues{/number}","pulls_url":"https://api.github.com/repos/SchapplM/repo-scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/SchapplM/repo-scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/SchapplM/repo-scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SchapplM/repo-scripts/labels{/name}","releases_url":"https://api.github.com/repos/SchapplM/repo-scripts/releases{/id}","deployments_url":"https://api.github.com/repos/SchapplM/repo-scripts/deployments","created_at":"2016-04-02T10:01:09Z","updated_at":"2016-03-20T15:06:13Z","pushed_at":"2016-04-02T10:04:57Z","git_url":"git://github.com/SchapplM/repo-scripts.git","ssh_url":"git@github.com:SchapplM/repo-scripts.git","clone_url":"https://github.com/SchapplM/repo-scripts.git","svn_url":"https://github.com/SchapplM/repo-scripts","homepage":"","size":180854,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"xbmc:isengard","ref":"isengard","sha":"6107b6079db6045bd9fdee41505d7511f385a7f7","user":{"login":"xbmc","id":199122,"avatar_url":"https://avatars.githubusercontent.com/u/199122?v=3","gravatar_id":"","url":"https://api.github.com/users/xbmc","html_url":"https://github.com/xbmc","followers_url":"https://api.github.com/users/xbmc/followers","following_url":"https://api.github.com/users/xbmc/following{/other_user}","gists_url":"https://api.github.com/users/xbmc/gists{/gist_id}","starred_url":"https://api.github.com/users/xbmc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xbmc/subscriptions","organizations_url":"https://api.github.com/users/xbmc/orgs","repos_url":"https://api.github.com/users/xbmc/repos","events_url":"https://api.github.com/users/xbmc/events{/privacy}","received_events_url":"https://api.github.com/users/xbmc/received_events","type":"Organization","site_admin":false},"repo":{"id":25119390,"name":"repo-scripts","full_name":"xbmc/repo-scripts","owner":{"login":"xbmc","id":199122,"avatar_url":"https://avatars.githubusercontent.com/u/199122?v=3","gravatar_id":"","url":"https://api.github.com/users/xbmc","html_url":"https://github.com/xbmc","followers_url":"https://api.github.com/users/xbmc/followers","following_url":"https://api.github.com/users/xbmc/following{/other_user}","gists_url":"https://api.github.com/users/xbmc/gists{/gist_id}","starred_url":"https://api.github.com/users/xbmc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xbmc/subscriptions","organizations_url":"https://api.github.com/users/xbmc/orgs","repos_url":"https://api.github.com/users/xbmc/repos","events_url":"https://api.github.com/users/xbmc/events{/privacy}","received_events_url":"https://api.github.com/users/xbmc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xbmc/repo-scripts","description":"Official source repository for Kodi script add-ons","fork":false,"url":"https://api.github.com/repos/xbmc/repo-scripts","forks_url":"https://api.github.com/repos/xbmc/repo-scripts/forks","keys_url":"https://api.github.com/repos/xbmc/repo-scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xbmc/repo-scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xbmc/repo-scripts/teams","hooks_url":"https://api.github.com/repos/xbmc/repo-scripts/hooks","issue_events_url":"https://api.github.com/repos/xbmc/repo-scripts/issues/events{/number}","events_url":"https://api.github.com/repos/xbmc/repo-scripts/events","assignees_url":"https://api.github.com/repos/xbmc/repo-scripts/assignees{/user}","branches_url":"https://api.github.com/repos/xbmc/repo-scripts/branches{/branch}","tags_url":"https://api.github.com/repos/xbmc/repo-scripts/tags","blobs_url":"https://api.github.com/repos/xbmc/repo-scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xbmc/repo-scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xbmc/repo-scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/xbmc/repo-scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xbmc/repo-scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/xbmc/repo-scripts/languages","stargazers_url":"https://api.github.com/repos/xbmc/repo-scripts/stargazers","contributors_url":"https://api.github.com/repos/xbmc/repo-scripts/contributors","subscribers_url":"https://api.github.com/repos/xbmc/repo-scripts/subscribers","subscription_url":"https://api.github.com/repos/xbmc/repo-scripts/subscription","commits_url":"https://api.github.com/repos/xbmc/repo-scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/xbmc/repo-scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/xbmc/repo-scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/xbmc/repo-scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/xbmc/repo-scripts/contents/{+path}","compare_url":"https://api.github.com/repos/xbmc/repo-scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xbmc/repo-scripts/merges","archive_url":"https://api.github.com/repos/xbmc/repo-scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xbmc/repo-scripts/downloads","issues_url":"https://api.github.com/repos/xbmc/repo-scripts/issues{/number}","pulls_url":"https://api.github.com/repos/xbmc/repo-scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/xbmc/repo-scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/xbmc/repo-scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xbmc/repo-scripts/labels{/name}","releases_url":"https://api.github.com/repos/xbmc/repo-scripts/releases{/id}","deployments_url":"https://api.github.com/repos/xbmc/repo-scripts/deployments","created_at":"2014-10-12T12:57:15Z","updated_at":"2016-03-20T15:06:13Z","pushed_at":"2016-04-03T19:42:09Z","git_url":"git://github.com/xbmc/repo-scripts.git","ssh_url":"git@github.com:xbmc/repo-scripts.git","clone_url":"https://github.com/xbmc/repo-scripts.git","svn_url":"https://github.com/xbmc/repo-scripts","homepage":"","size":184369,"stargazers_count":8,"watchers_count":8,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":51,"mirror_url":null,"open_issues_count":6,"forks":51,"open_issues":6,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xbmc/repo-scripts/pulls/81"},"html":{"href":"https://github.com/xbmc/repo-scripts/pull/81"},"issue":{"href":"https://api.github.com/repos/xbmc/repo-scripts/issues/81"},"comments":{"href":"https://api.github.com/repos/xbmc/repo-scripts/issues/81/comments"},"review_comments":{"href":"https://api.github.com/repos/xbmc/repo-scripts/pulls/81/comments"},"review_comment":{"href":"https://api.github.com/repos/xbmc/repo-scripts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xbmc/repo-scripts/pulls/81/commits"},"statuses":{"href":"https://api.github.com/repos/xbmc/repo-scripts/statuses/6e1cd8d5cb5913a07bb79f37c0cebba156ef623a"}}}}