The branch, frodo has been updated
       via  822c9bd0fc38741895ad09b50c2ca3e4df0c4f18 (commit)
       via  8d2e1604592f77bb549f56a27edf9c27ba6c5f8a (commit)
      from  ff5fb007c2a6c148e8abde6df7bef98c78f1e1f3 (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=822c9bd0fc38741895ad09b50c2ca3e4df0c4f18

commit 822c9bd0fc38741895ad09b50c2ca3e4df0c4f18
Author: beenje <[email protected]>
Date:   Tue Feb 5 22:23:08 2013 +0100

    [plugin.video.eyetv.parser] updated to version 2.2.1

diff --git a/plugin.video.eyetv.parser/addon.py 
b/plugin.video.eyetv.parser/addon.py
index cfb7154..f7db8a1 100755
--- a/plugin.video.eyetv.parser/addon.py
+++ b/plugin.video.eyetv.parser/addon.py
@@ -18,7 +18,7 @@
 
 from xbmcswift import xbmcgui, xbmc
 from resources.lib.eyetv_parser import Eyetv
-from resources.lib.eyetv_live import EyetvLive
+from resources.lib.eyetv_live import EyetvLive, EyetvLiveError
 from config import plugin
 
 
@@ -65,8 +65,11 @@ def show_homepage():
 @plugin.route('/live/')
 def live_tv():
     """Display the channels available for live TV"""
-    live = create_eyetv_live()
-    channels = live.get_channels()
+    try:
+        live = create_eyetv_live()
+        channels = live.get_channels()
+    except EyetvLiveError:
+        return show_homepage()
     items = [{
         'label': ' '.join((channel['displayNumber'], channel['name'])),
         'url': plugin.url_for('watch_channel', serviceid=channel['serviceID']),
@@ -79,8 +82,11 @@ def live_tv():
 @plugin.route('/watch/<serviceid>/')
 def watch_channel(serviceid):
     """Resolve and play the chosen channel"""
-    live = create_eyetv_live()
-    url = live.get_channel_url(serviceid)
+    try:
+        live = create_eyetv_live()
+        url = live.get_channel_url(serviceid)
+    except EyetvLiveError:
+        return None
     return plugin.set_resolved_url(url)
 
 
diff --git a/plugin.video.eyetv.parser/addon.xml 
b/plugin.video.eyetv.parser/addon.xml
index 496361e..71df6f9 100644
--- a/plugin.video.eyetv.parser/addon.xml
+++ b/plugin.video.eyetv.parser/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="plugin.video.eyetv.parser"
        name="EyeTV parser"
-       version="2.2.0"
+       version="2.2.1"
        provider-name="beenje">
   <requires>
     <import addon="xbmc.python" version="2.1.0"/>
diff --git a/plugin.video.eyetv.parser/changelog.txt 
b/plugin.video.eyetv.parser/changelog.txt
index fc7461b..bb257cb 100644
--- a/plugin.video.eyetv.parser/changelog.txt
+++ b/plugin.video.eyetv.parser/changelog.txt
@@ -1,3 +1,8 @@
+[B]Version 2.2.1[/B]
+
+- Exit gracefully in case of error
+(don't kill XBMC!)
+
 [B]Version 2.2.0[/B]
 
 - Do not pass icon and thumbnail due to crash with frodo
diff --git a/plugin.video.eyetv.parser/resources/lib/eyetv_live.py 
b/plugin.video.eyetv.parser/resources/lib/eyetv_live.py
index 132db1a..e59f05c 100644
--- a/plugin.video.eyetv.parser/resources/lib/eyetv_live.py
+++ b/plugin.video.eyetv.parser/resources/lib/eyetv_live.py
@@ -32,6 +32,10 @@ from config import plugin
 EYETVPORT = 2170
 
 
+class EyetvLiveError(Exception):
+    pass
+
+
 class EyetvLive:
     """Class to watch live TV using EyeTV iPhone access"""
 
@@ -44,11 +48,11 @@ class EyetvLive:
         if not self.is_up():
             xbmc.log('EyeTV is not running', xbmc.LOGERROR)
             xbmcgui.Dialog().ok(plugin.get_string(30110), 
plugin.get_string(30111))
-            exit(0)
+            raise EyetvLiveError
         if not self.wifi_access_is_on():
             xbmc.log('iPhone Access returned an error', xbmc.LOGERROR)
             xbmcgui.Dialog().ok(plugin.get_string(30110), 
plugin.get_string(30112))
-            exit(0)
+            raise EyetvLiveError
 
     def get_data(self, url):
         """Return the dictionary corresponding to the url request
@@ -71,11 +75,11 @@ class EyetvLive:
                 xbmcgui.Dialog().ok(plugin.get_string(30110), 
plugin.get_string(30115))
             else:
                 xbmcgui.Dialog().ok(plugin.get_string(30110), str(e))
-            exit(0)
+            raise EyetvLiveError
         except urllib2.URLError, e:
             xbmc.log('URLError: %s %s' % (full_url, str(e.reason)), 
xbmc.LOGERROR)
             xbmcgui.Dialog().ok(plugin.get_string(30110), 
plugin.get_string(30114))
-            exit(0)
+            raise EyetvLiveError
         if f.headers.get('Content-Encoding') == 'gzip':
             compresseddata = f.read()
             gzipper = gzip.GzipFile(fileobj=StringIO.StringIO(compresseddata))
@@ -124,7 +128,7 @@ class EyetvLive:
         if not data['success']:
             xbmc.log('live/tuneto error code: %d' % data['errorcode'], 
xbmc.LOGERROR)
             xbmcgui.Dialog().ok(plugin.get_string(30110), 
plugin.get_string(30113))
-            exit(0)
+            raise EyetvLiveError
         # Wait before checking if stream is ready
         # Otherwise we get the answer for the old stream when changing channel
         time.sleep(1)

http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=8d2e1604592f77bb549f56a27edf9c27ba6c5f8a

commit 8d2e1604592f77bb549f56a27edf9c27ba6c5f8a
Author: beenje <[email protected]>
Date:   Tue Feb 5 19:51:57 2013 +0100

    [plugin.video.synopsi] updated to version 1.0.3

diff --git a/plugin.video.synopsi/addon.xml b/plugin.video.synopsi/addon.xml
index 634042f..f691847 100644
--- a/plugin.video.synopsi/addon.xml
+++ b/plugin.video.synopsi/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="plugin.video.synopsi"
        name="SynopsiTV"
-       version="1.0.2"
+       version="1.0.3"
        provider-name="Synopsi.TV">
        <requires>
                <import addon="xbmc.python" version="2.1.0" />
diff --git a/plugin.video.synopsi/apiclient.py 
b/plugin.video.synopsi/apiclient.py
index d8fb692..26be6f3 100644
--- a/plugin.video.synopsi/apiclient.py
+++ b/plugin.video.synopsi/apiclient.py
@@ -52,7 +52,7 @@ class ApiClient(loggable.Loggable):
                self.username = username
                self.password = password
                self.accessToken = None
-               #~ self.refreshToken = None
+               self.refreshToken = None
                self.apiUrl = self.baseUrl + rel_api_url
                self.originReqHost = originReqHost
                self.authHeaders = None
@@ -187,10 +187,13 @@ class ApiClient(loggable.Loggable):
 
                self.updateAccessTokenTimeout()
                self.accessToken = response_json['access_token']
-               #~ self.refreshToken = response_json['refresh_token']
+               self.setRefreshToken(response_json['refresh_token'])
                self._log.debug('new access token: ' + self.accessToken)
                return True
 
+       def setRefreshToken(self, token):
+               self.refreshToken = token
+               
        def updateAccessTokenTimeout(self):
                self.accessTokenSessionStart = datetime.datetime.now()
 
diff --git a/plugin.video.synopsi/app_apiclient.py 
b/plugin.video.synopsi/app_apiclient.py
index 64902d4..aef8e50 100644
--- a/plugin.video.synopsi/app_apiclient.py
+++ b/plugin.video.synopsi/app_apiclient.py
@@ -98,6 +98,10 @@ class AppApiClient(ApiClient):
                self._lock_access_token.release()
                return res
 
+       def setRefreshToken(self, token):
+               ADDON = get_current_addon()
+               ADDON.setSetting('REFTOKEN', token)             
+
        # convienent functions
        def get_unwatched_episodes(self):
                episodes = self.unwatchedEpisodes()
@@ -222,3 +226,7 @@ class AppApiClient(ApiClient):
                data['file_name'] = rel_path(data['file_name'])
                return ApiClient.titleIdentify(self, props, **data)
 
+       def titleWatched(self, titleId, **data):
+               data['software_info'] = software_info()
+               return ApiClient.titleWatched(self, titleId, **data)
+
diff --git a/plugin.video.synopsi/cache.py b/plugin.video.synopsi/cache.py
index d913579..a275fd9 100644
--- a/plugin.video.synopsi/cache.py
+++ b/plugin.video.synopsi/cache.py
@@ -473,7 +473,10 @@ class AppStvList(OnlineStvList):
                return local_tvshows.values()
 
        def get_tvshow_local_seasons(self, stv_id):
-               tvshow = self.byType['tvshow'][stv_id]
+               tvshow = self.byType['tvshow'].get(stv_id)
+               if not tvshow:
+                       return []
+                       
                xbmc_id = tvshow['xbmc_id']
                                
                seasons = []            
diff --git a/plugin.video.synopsi/changelog.txt 
b/plugin.video.synopsi/changelog.txt
index 0618026..b91958d 100644
--- a/plugin.video.synopsi/changelog.txt
+++ b/plugin.video.synopsi/changelog.txt
@@ -1,3 +1,10 @@
+[B]Version 1.0.3[/B]
+
+- Added: send software info on checkin
+- Added: store refresh token for future token-auth
+- Added: login/settings info, where to sign-up
+- Fixed: sending wrong position
+
 [B]Version 1.0.2[/B]
 
 - Fixed: sending checkins wrong api usage
diff --git a/plugin.video.synopsi/dialog.py b/plugin.video.synopsi/dialog.py
index 836a34e..0e9974b 100644
--- a/plugin.video.synopsi/dialog.py
+++ b/plugin.video.synopsi/dialog.py
@@ -412,14 +412,11 @@ def show_video_dialog_data(stv_details, json_data={}, 
close=False):
                t1_similars = top.apiClient.titleSimilar(stv_details['id'])
                if t1_similars.has_key('titles'):
                        stv_details['similars'] = t1_similars['titles']
-       elif stv_details['type'] == 'tvshow':
+       elif stv_details['type'] == 'tvshow' and stv_details.has_key('seasons'):
                seasons = 
top.stvList.get_tvshow_local_seasons(stv_details['id'])
-               log('seasons on disk:' + str(seasons))
-               
-               # append seasons
-               if stv_details.has_key('seasons'):
-                       stv_details['similars'] = [ {'id': i['id'], 'name': 
'Season %d' % i['season_number'], 'cover_medium': i['cover_medium'], 'watched': 
i['episodes_count'] == i['watched_count'], 'file': i['season_number'] in 
seasons} for i in stv_details['seasons'] ]
-                       log(dump(stv_details['similars']))
+               log('seasons on disk:' + str(seasons))          
+               stv_details['similars'] = [ {'id': i['id'], 'name': 'Season %d' 
% i['season_number'], 'cover_medium': i['cover_medium'], 'watched': 
i['episodes_count'] == i['watched_count'], 'file': i['season_number'] in 
seasons} for i in stv_details['seasons'] ]
+
                                
 
        # similar overlays
diff --git a/plugin.video.synopsi/resources/language/English/strings.xml 
b/plugin.video.synopsi/resources/language/English/strings.xml
index 5c9f2ba..199589f 100644
--- a/plugin.video.synopsi/resources/language/English/strings.xml
+++ b/plugin.video.synopsi/resources/language/English/strings.xml
@@ -22,5 +22,6 @@
     <string id="69602">OK</string>
     <string id="69603">Terrible</string>
     <string id="69604">SynopsiTV Rating</string>
+    <string id="69700">To use our service, sign up at 
[B]www.synopsi.tv[/B].</string>
     
 </strings>
diff --git a/plugin.video.synopsi/resources/settings.xml 
b/plugin.video.synopsi/resources/settings.xml
index b18bb39..5803bc9 100644
--- a/plugin.video.synopsi/resources/settings.xml
+++ b/plugin.video.synopsi/resources/settings.xml
@@ -5,9 +5,12 @@
         <setting id="SETTINGS_VERSION" option="hidden" type="number" 
visible="false" default="1" />
 
         <!--Login-->
+        <setting label="69700" type="lsep" />
+               
         <setting id="USER" label="69503" type="text" default=""/>
        <setting id="PASS" label="69502" option="hidden" type="text" 
enable="!eq(-1,)" default=""/>
        
+       
        <!--TOKENS-->
         <setting id="BASE_URL" option="hidden" type="text" visible="false" 
default="https://api.synopsi.tv/"; />
         <setting id="REL_API_URL" option="hidden" type="text" visible="false" 
default="1.0/" />
diff --git a/plugin.video.synopsi/scrobbler.py 
b/plugin.video.synopsi/scrobbler.py
index 815e4e4..0d1cd2e 100644
--- a/plugin.video.synopsi/scrobbler.py
+++ b/plugin.video.synopsi/scrobbler.py
@@ -14,6 +14,7 @@ from utilities import *
 import top
 
 
+TIME_UNKNOWN = 65535
 CANCEL_DIALOG = (9, 10, 92, 216, 247, 257, 275, 61467, 61448, )
 # Default XBMC constant for hidden cancel button
 
@@ -62,6 +63,8 @@ class SynopsiPlayer(xbmc.Player):
                        event['position'] = position
                elif self.playing:
                        event['position'] = int(self.current_time)
+               else:
+                       event['position'] = TIME_UNKNOWN
 
                self.playerEvents.append(event)
 
@@ -120,10 +123,10 @@ class SynopsiPlayer(xbmc.Player):
                if self.playing:
                        self.resumed()
 
-       def get_time(self, default=None):
+       def get_time(self, default=TIME_UNKNOWN):
                try:
                        if self.isPlayingVideo():
-                               t = self.getTime()
+                               t = int(self.getTime())
                        else:
                                raise Exception('fix: xbmc missing exception')
                except:
@@ -151,10 +154,13 @@ class SynopsiPlayerDecor(SynopsiPlayer):
                        the current time, if get_time returns None, but the 
player is still playing a file
                        (acording to the self.playing variable). This indicates 
that the service thread update loop
                        tries to update time while we are in the 
onPlayBackStopped method and handlers """
+               
                t = self.get_time()
+                       
                if t or not self.playing:
                        self.current_time = t
-
+                       
+                       
                #~ self.get_media_info_tag()
 
        def started(self):
diff --git a/plugin.video.synopsi/service.py b/plugin.video.synopsi/service.py
index 653ae5c..5b7c419 100644
--- a/plugin.video.synopsi/service.py
+++ b/plugin.video.synopsi/service.py
@@ -30,7 +30,6 @@ __addon__.setSetting('ADDON_SERVICE_FIRSTRUN', "false")
 DEFAULT_SERVICE_PORT=int(__addon__.getSetting('ADDON_SERVICE_PORT'))
 
 def main():
-       log('SYNOPSI SERVICE START (Python %s)' % str(sys.version))
        apiclient1 = AppApiClient.getDefaultClient()
        top.apiClient = apiclient1
 
diff --git a/plugin.video.synopsi/tests/apiclient.unittest.py 
b/plugin.video.synopsi/tests/apiclient.unittest.py
index fe5c009..5ad2284 100644
--- a/plugin.video.synopsi/tests/apiclient.unittest.py
+++ b/plugin.video.synopsi/tests/apiclient.unittest.py
@@ -14,15 +14,36 @@ sys.path.insert(0, os.path.abspath('fakeenv'))
 from utilities import *
 from apiclient import *
 
-def pprint(data):
-       global logger
+# test data
+exampleEvents = [
+       {
+               "event": "start",
+               "timestamp": '2012-10-08 16:54:34',
+               "position": 1222
+       },
+       {
+               "event": "pause",
+               "timestamp": '2012-10-08 16:54:40',
+               "position": 1359
+       },
+       {
+               "event": "resume",
+               "timestamp": '2012-10-08 16:55:10',
+               "position": 1359
+       },
+       {
+               "event": "pause",
+               "timestamp": '2012-10-08 16:55:10',
+               "position": 65535
+       },
+       {
+               "event": "stop",
+               "timestamp": '2012-10-08 16:55:15',
+               "position": 1460
+       },
+]
 
-       if data is dict and data.has_key('_db_queries'):
-               del data['_db_queries']
 
-       msg = dump(data)
-       # print msg
-       logger.debug(msg)
 
 
 class ApiTest(TestCase):
@@ -88,29 +109,6 @@ class ApiTest(TestCase):
 
                data = client.libraryTitleAdd(stv_title_id)
 
-               exampleEvents = [
-                       {
-                           "event": "start",
-                           "timestamp": '2012-10-08 16:54:34',
-                           "position": 1222
-                       },
-                       {
-                           "event": "pause",
-                           "timestamp": '2012-10-08 16:54:40',
-                           "position": 1359
-                       },
-                       {
-                           "event": "resume",
-                           "timestamp": '2012-10-08 16:55:10',
-                           "position": 1359
-                       },
-                       {
-                           "event": "stop",
-                           "timestamp": '2012-10-08 16:55:15',
-                           "position": 1460
-                       },
-               ]
-
                #exampleEvents = []
 
                watched_data = {
@@ -122,6 +120,18 @@ class ApiTest(TestCase):
 
                data = client.libraryTitleRemove(stv_title_id)
 
+       def test_titleWatched(self):
+               client.getAccessToken()
+               stv_title_id = 145948
+               watched_data = {
+                       'rating': 1,
+                       'player_events': json.dumps(exampleEvents),
+                       'software_info': 'Test bullshit'
+               }
+
+               data = client.titleWatched(stv_title_id, **watched_data)
+               
+
        def test_profile_recco(self):
 
 
diff --git a/plugin.video.synopsi/tests/cache.unittest.py 
b/plugin.video.synopsi/tests/cache.unittest.py
index 26e11d5..cb64e06 100644
--- a/plugin.video.synopsi/tests/cache.unittest.py
+++ b/plugin.video.synopsi/tests/cache.unittest.py
@@ -15,15 +15,6 @@ from utilities import *
 from apiclient import *
 from cache import OfflineStvList, DuplicateStvIdException
 
-def pprint(data):
-       global logger
-
-       if data is dict and data.has_key('_db_queries'):
-               del data['_db_queries']
-       msg = dump(data)
-       # print msg
-       logger.debug(msg)
-
 
 class CacheTest(TestCase):
        def setUp(self):
diff --git a/plugin.video.synopsi/tests/common.py 
b/plugin.video.synopsi/tests/common.py
index 60d8342..14cc560 100644
--- a/plugin.video.synopsi/tests/common.py
+++ b/plugin.video.synopsi/tests/common.py
@@ -1,11 +1,12 @@
+import local_settings
 
 live_conn = {
        'base_url': 'https://api.synopsi.tv/',
        'key': '59c53964b1013defcff0155f6e4d54a4',
        'secret': 
'487615d20b22cdce510fd3476ed84d924e2b0c45ce7c49dc621764e05fae0904',
        'rel_api_url': '1.0/',
-       'username': '',
-       'password': '',
+       'username': local_settings.username,
+       'password': local_settings.password,
        'device_id': 'd2a8e78f-408a-11e2-9b7d-9927c8ae50bb',
 }
 
diff --git a/plugin.video.synopsi/tests/onlinecache.unittest.py 
b/plugin.video.synopsi/tests/onlinecache.unittest.py
index 6d8970c..d952f5e 100644
--- a/plugin.video.synopsi/tests/onlinecache.unittest.py
+++ b/plugin.video.synopsi/tests/onlinecache.unittest.py
@@ -18,16 +18,6 @@ from utilities import *
 from apiclient import *
 from cache import OnlineStvList, DuplicateStvIdException
 
-def pprint(data):
-       global logger
-
-       if data is dict and data.has_key('_db_queries'):
-               del data['_db_queries']
-       msg = dump(data)
-       # print msg
-       logger.debug(msg)
-
-
 class OnlineCacheTest(TestCase):
        def setUp(self):
                print '=' * 50
diff --git a/plugin.video.synopsi/utilities.py 
b/plugin.video.synopsi/utilities.py
index 18cd901..d6d2b7d 100644
--- a/plugin.video.synopsi/utilities.py
+++ b/plugin.video.synopsi/utilities.py
@@ -21,6 +21,7 @@ import xml.etree.ElementTree as ET
 import time
 import sys
 import xml.etree.ElementTree as et
+import platform
 
 common = CommonFunctions
 common.plugin = "SynopsiTV"
@@ -115,6 +116,31 @@ class ListEmptyException(BaseException):
        pass
 
 
+def player_info():
+       try:
+               info = {
+                       'player_name': 
xbmc.getInfoLabel('System.FriendlyName'), 
+                       'build_version': 
xbmc.getInfoLabel('System.BuildVersion')
+               }
+       except:
+               info = {'player_name': 'N/A'}
+               
+       return info
+
+def os_info():
+       try:
+               info = list(os.uname())
+               del info[1]
+       except:
+               info = 'N/A'
+       
+       return info
+
+def software_info():
+       i = { 'os_info': os_info() }
+       i.update(player_info())
+       return i 
+
 def dump(var):
        return json.dumps(var, indent=4)
 

-----------------------------------------------------------------------

Summary of changes:
 plugin.video.eyetv.parser/addon.py                 |   16 +++--
 plugin.video.eyetv.parser/addon.xml                |    2 +-
 plugin.video.eyetv.parser/changelog.txt            |    5 ++
 .../resources/lib/eyetv_live.py                    |   14 +++--
 plugin.video.synopsi/_src/TODO                     |   14 ----
 plugin.video.synopsi/addon.xml                     |    2 +-
 plugin.video.synopsi/apiclient.py                  |    7 ++-
 plugin.video.synopsi/app_apiclient.py              |    8 ++
 plugin.video.synopsi/cache.py                      |    5 +-
 plugin.video.synopsi/changelog.txt                 |    7 ++
 plugin.video.synopsi/dialog.py                     |   11 +--
 .../resources/language/English/strings.xml         |    1 +
 plugin.video.synopsi/resources/settings.xml        |    3 +
 plugin.video.synopsi/scrobbler.py                  |   12 +++-
 plugin.video.synopsi/service.py                    |    1 -
 plugin.video.synopsi/tests/apiclient.unittest.py   |   70 +++++++++++--------
 plugin.video.synopsi/tests/cache.unittest.py       |    9 ---
 plugin.video.synopsi/tests/common.py               |    5 +-
 plugin.video.synopsi/tests/onlinecache.unittest.py |   10 ---
 plugin.video.synopsi/utilities.py                  |   26 +++++++
 20 files changed, 137 insertions(+), 91 deletions(-)
 delete mode 100644 plugin.video.synopsi/_src/TODO


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to