File tree Expand file tree Collapse file tree 3 files changed +20
-14
lines changed
Expand file tree Collapse file tree 3 files changed +20
-14
lines changed Original file line number Diff line number Diff line change @@ -541,6 +541,22 @@ def stop(self, reason=''):
541541 key = '/status/sessions/terminate?sessionId=%s&reason=%s' % (self .session [0 ].id , quote_plus (reason ))
542542 return self ._server .query (key )
543543
544+ def updateProgress (self , time , state = 'stopped' ):
545+ """ Set the watched progress for this video.
546+
547+ Note that setting the time to 0 will not work.
548+ Use `markWatched` or `markUnwatched` to achieve
549+ that goal.
550+
551+ Parameters:
552+ time (int): milliseconds watched
553+ state (string): state of the video, default 'stopped'
554+ """
555+ key = '/:/progress?key=%s&identifier=com.plexapp.plugins.library&time=%d&state=%s' % (self .ratingKey ,
556+ time , state )
557+ self ._server .query (key )
558+ self .reload ()
559+
544560
545561@utils .registerPlexObject
546562class Release (PlexObject ):
Original file line number Diff line number Diff line change @@ -77,20 +77,6 @@ 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 ()
9480
9581
9682@utils .registerPlexObject
Original file line number Diff line number Diff line change @@ -281,6 +281,10 @@ def test_video_Episode_unmatch(episode, patched_http_call):
281281 episode .unmatch ()
282282
283283
284+ def test_video_Episode_updateProgress (episode , patched_http_call ):
285+ episode .updateProgress (10 * 60 * 1000 ) # 10 minutes.
286+
287+
284288def test_video_Episode_stop (episode , mocker , patched_http_call ):
285289 mocker .patch .object (episode , 'session' , return_value = list (mocker .MagicMock (id = 'hello' )))
286290 episode .stop (reason = "It's past bedtime!" )
You can’t perform that action at this time.
0 commit comments