Skip to content

Commit f5af5d0

Browse files
committed
Add updateProgress function to Video
1 parent c3dc913 commit f5af5d0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

plexapi/video.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,21 @@ def markUnwatched(self):
7777
self._server.query(key)
7878
self.reload()
7979

80+
def updateProgress(self, time, state='stopped'):
81+
""" Set the watched progress for this video.
82+
83+
Note that setting the time to 0 will not work.
84+
Use `markWatched` or `markUnwatched` to achieve
85+
that goal.
86+
87+
Parameters:
88+
time (int): milliseconds watched
89+
state (string): state of the video, default 'stopped'
90+
"""
91+
key = '/:/progress?key=%s&identifier=com.plexapp.plugins.library&time=%d&state=%s' % (self.ratingKey, time, state)
92+
self._server.query(key)
93+
self.reload()
94+
8095

8196
@utils.registerPlexObject
8297
class Movie(Video, Playable):

0 commit comments

Comments
 (0)