plexinc / plex-for-kodi

Offical Plex for Kodi add-on releases.
GNU General Public License v2.0
251 stars 124 forks source link

Chapter skipping #271

Open gbooker opened 5 years ago

gbooker commented 5 years ago

GHI (If applicable): #9

Description:

Up/Down buttons when OSD is not displayed will skip by chapter (if present).

Checklist:

pannal commented 5 years ago

Parameters should not be mutable. Fix:

IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- lib/player.py   (revision 807429622b4bc14a26360882cc8466b336b6c2fd)
+++ lib/player.py   (revision 4816fc5cf568914ee9a4d4da4f334d5fe90eb4c8)
@@ -155,7 +155,7 @@
         self.mode = self.MODE_RELATIVE
         self.ended = False

-    def setup(self, duration, offset, bif_url, title='', title2='', seeking=NO_SEEK, chapters=[]):
+    def setup(self, duration, offset, bif_url, title='', title2='', seeking=NO_SEEK, chapters=None):
         self.ended = False
         self.baseOffset = offset / 1000.0
         self.seeking = seeking
@@ -163,7 +163,7 @@
         self.bifURL = bif_url
         self.title = title
         self.title2 = title2
-        self.chapters = chapters
+        self.chapters = chapters or []
         self.getDialog(setup=True)
         self.dialog.setup(self.duration, int(self.baseOffset * 1000), self.bifURL, self.title, self.title2, chapters=self.chapters)

Index: lib/windows/seekdialog.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- lib/windows/seekdialog.py   (revision 807429622b4bc14a26360882cc8466b336b6c2fd)
+++ lib/windows/seekdialog.py   (revision 4816fc5cf568914ee9a4d4da4f334d5fe90eb4c8)
@@ -888,7 +888,7 @@
             self.updateProgress(set_to_current=False)
             self.setProperty('button.seek', '1')

-    def setup(self, duration, offset=0, bif_url=None, title='', title2='', chapters=[]):
+    def setup(self, duration, offset=0, bif_url=None, title='', title2='', chapters=None):
         self.title = title
         self.title2 = title2
         self.setProperty('video.title', title)
@@ -898,7 +898,7 @@
         self.baseOffset = offset
         self.offset = 0
         self._duration = duration
-        self.chapters = chapters
+        self.chapters = chapters or []
         self.bifURL = bif_url
         self.hasBif = bool(self.bifURL)
         if self.hasBif: