Skip to content

Commit

Permalink
Version 0.1.0 (#121)
Browse files Browse the repository at this point in the history
Improved hub vertical scrolling animation
Fix issue causing error when marking devices as refreshed
Improved exception handling for some errors
Fix (#87): Switching between managed users causes Kodi to crashing
Fix (#119): Occasional crashes when exiting the add-on
  • Loading branch information
ruuk committed Aug 28, 2017
1 parent bee72b0 commit 819229c
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 51 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.plex"
name="Plex"
version="0.0.102"
version="0.1.0"
provider-name="Plex">
<requires>
<import addon="xbmc.python" version="2.24.0"/>
Expand Down
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[- 0.1.0 -]

Improved hub vertical scrolling animation
Fix (#87): Switching between managed users causes Kodi to crashing
Fix (#119): Occasional crashes when exiting the add-on

[- 0.0.102 -]

Handle connection errors on link screen polling
Expand Down
14 changes: 9 additions & 5 deletions lib/_included_packages/plexnet/plexserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,15 @@ def query(self, path, method=None, **kwargs):
method = method or self.session.get
url = self.buildUrl(path, includeToken=True)
util.LOG('{0} {1}'.format(method.__name__.upper(), re.sub('X-Plex-Token=[^&]+', 'X-Plex-Token=****', url)))
response = method(url, **kwargs)
if response.status_code not in (200, 201):
codename = http.status_codes.get(response.status_code, ['Unknown'])[0]
raise exceptions.BadRequest('({0}) {1}'.format(response.status_code, codename))
data = response.text.encode('utf8')
try:
response = method(url, **kwargs)
if response.status_code not in (200, 201):
codename = http.status_codes.get(response.status_code, ['Unknown'])[0]
raise exceptions.BadRequest('({0}) {1}'.format(response.status_code, codename))
data = response.text.encode('utf8')
except http.requests.ConnectionError:
util.ERROR()
return None

return ElementTree.fromstring(data) if data else None

Expand Down
2 changes: 1 addition & 1 deletion lib/_included_packages/plexnet/plexservermanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def updateFromDiscovery(self, server):
pass

def markDevicesAsRefreshing(self):
for uuid in self.serversByUuid:
for uuid in self.serversByUuid.keys():
self.serversByUuid[uuid].markAsRefreshing()

def mergeServer(self, server):
Expand Down
8 changes: 6 additions & 2 deletions lib/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,14 @@ def _main():
if not windowutils.HOME.closeOption:
return

if windowutils.HOME.closeOption == 'signout':
closeOption = windowutils.HOME.closeOption

windowutils.shutdownHome()

if closeOption == 'signout':
signout()
break
elif windowutils.HOME.closeOption == 'switch':
elif closeOption == 'switch':
plexapp.ACCOUNT.isAuthenticated = False
finally:
windowutils.shutdownHome()
Expand Down
29 changes: 15 additions & 14 deletions lib/plex.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,21 +302,22 @@ def init():


def requirePlexPass():
if not plexapp.ACCOUNT.hasPlexPass():
from windows import signin, background
background.setSplash(False)
w = signin.SignInPlexPass.open()
retry = w.retry
del w
util.DEBUG_LOG('PlexPass required. Signing out...')
plexapp.ACCOUNT.signOut()
plexapp.SERVERMANAGER.clearState()
if retry:
return 'RETRY'
else:
return False

return True
# if not plexapp.ACCOUNT.hasPlexPass():
# from windows import signin, background
# background.setSplash(False)
# w = signin.SignInPlexPass.open()
# retry = w.retry
# del w
# util.DEBUG_LOG('PlexPass required. Signing out...')
# plexapp.ACCOUNT.signOut()
# plexapp.SERVERMANAGER.clearState()
# if retry:
# return 'RETRY'
# else:
# return False

# return True


def authorize():
Expand Down
8 changes: 7 additions & 1 deletion lib/windows/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ def tick(self):
self.showHubs(self.lastSection, update=True)

def shutdown(self):
self.serverList.reset()
self.unhookSignals()

def onAction(self, action):
Expand Down Expand Up @@ -643,7 +644,12 @@ def showSections(self):
plli.setProperty('item', '1')
items.append(plli)

sections = plexapp.SERVERMANAGER.selectedServer.library.sections()
try:
sections = plexapp.SERVERMANAGER.selectedServer.library.sections()
except plexnet.exceptions.BadRequest:
self.setFocusId(self.SERVER_BUTTON_ID)
util.messageDialog("Error", "Bad request")
return

if plexapp.SERVERMANAGER.selectedServer.hasHubs():
self.tasks = [SectionHubsTask().setup(s, self.sectionHubsCallback) for s in [HomeSection, PlaylistsSection] + sections]
Expand Down
54 changes: 27 additions & 27 deletions resources/skins/Main/1080i/script-plex-home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,121 +26,121 @@
</control>

<control type="grouplist" id="50">
<animation effect="slide" end="0,-135" time="200" tween="quadratic" easing="out" condition="!IsEmpty(Window.Property(off.sections))">Conditional</animation>
<animation effect="slide" end="0,-135" time="200" tween="sine" easing="inout" condition="!IsEmpty(Window.Property(off.sections))">Conditional</animation>

<!-- 501 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),0) + Control.IsVisible(500)" reversible="true">
<effect type="slide" end="0,-345" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-345" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 502 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),1) + Control.IsVisible(501)" reversible="true">
<effect type="slide" end="0,-540" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-540" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 503 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),2) + Control.IsVisible(502)" reversible="true">
<effect type="slide" end="0,-540" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-540" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 504 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),3) + Control.IsVisible(503)" reversible="true">
<effect type="slide" end="0,-540" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-540" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 505 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),4) + Control.IsVisible(504)" reversible="true">
<effect type="slide" end="0,-540" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-540" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 506 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),5) + Control.IsVisible(505)" reversible="true">
<effect type="slide" end="0,-400" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-400" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 507 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),6) + Control.IsVisible(506)" reversible="true">
<effect type="slide" end="0,-440" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-440" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 508 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),7) + Control.IsVisible(507)" reversible="true">
<effect type="slide" end="0,-540" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-540" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 509 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),8) + Control.IsVisible(508)" reversible="true">
<effect type="slide" end="0,-540" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-540" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 510 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),9) + Control.IsVisible(509)" reversible="true">
<effect type="slide" end="0,-400" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-400" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 511 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),10) + Control.IsVisible(510)" reversible="true">
<effect type="slide" end="0,-400" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-400" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 512 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),11) + Control.IsVisible(511)" reversible="true">
<effect type="slide" end="0,-400" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-400" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 520 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),12) + Control.IsVisible(512)" reversible="true">
<effect type="slide" end="0,-400" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-400" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 521 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),13) + Control.IsVisible(520)" reversible="true">
<effect type="slide" end="0,-400" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-400" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 522 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),14) + Control.IsVisible(521)" reversible="true">
<effect type="slide" end="0,-400" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-400" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 513 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),15) + Control.IsVisible(522)" reversible="true">
<effect type="slide" end="0,-400" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-400" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 514 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),16) + Control.IsVisible(513)" reversible="true">
<effect type="slide" end="0,-540" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-540" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 515 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),17) + Control.IsVisible(514)" reversible="true">
<effect type="slide" end="0,-540" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-540" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 516 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),18) + Control.IsVisible(515)" reversible="true">
<effect type="slide" end="0,-540" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-540" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 517 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),19) + Control.IsVisible(516)" reversible="true">
<effect type="slide" end="0,-540" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-540" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 518 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),20) + Control.IsVisible(517)" reversible="true">
<effect type="slide" end="0,-540" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-540" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 519 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),21) + Control.IsVisible(518)" reversible="true">
<effect type="slide" end="0,-540" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-540" time="200" tween="sine" easing="inout"/>
</animation>

<!-- 523 Focus animation -->
<animation type="Conditional" condition="IntegerGreaterThan(Window.Property(hub.focus),22) + Control.IsVisible(519)" reversible="true">
<effect type="slide" end="0,-540" time="200" tween="quadratic" easing="out"/>
<effect type="slide" end="0,-540" time="200" tween="sine" easing="inout"/>
</animation>


Expand All @@ -157,8 +157,8 @@
<width>2130</width>
<height>200</height>
<control type="fixedlist" id="101">
<animation effect="slide" end="-110,0" time="200" tween="quadratic" easing="out" condition="IntegerGreaterThan(Container(101).Position,3)">Conditional</animation>
<animation effect="slide" end="-110,0" time="200" tween="quadratic" easing="out" condition="IntegerGreaterThan(Container(101).Position,4)">Conditional</animation>
<animation effect="slide" end="-110,0" time="200" tween="sine" easing="inout" condition="IntegerGreaterThan(Container(101).Position,3)">Conditional</animation>
<animation effect="slide" end="-110,0" time="200" tween="sine" easing="inout" condition="IntegerGreaterThan(Container(101).Position,4)">Conditional</animation>
<posx>-300</posx>
<posy>0</posy>
<width>2430</width>
Expand Down Expand Up @@ -7769,7 +7769,7 @@


<control type="group" id="200">
<animation effect="slide" end="0,-135" time="200" tween="quadratic" easing="out" condition="!IsEmpty(Window.Property(off.sections)) + !ControlGroup(200).HasFocus(0)">Conditional</animation>
<animation effect="slide" end="0,-135" time="200" tween="sine" easing="inout" condition="!IsEmpty(Window.Property(off.sections)) + !ControlGroup(200).HasFocus(0)">Conditional</animation>
<defaultcontrol always="true">201</defaultcontrol>
<posx>0</posx>
<posy>0</posy>
Expand Down

0 comments on commit 819229c

Please sign in to comment.