File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,12 @@ Usage Examples
131131 print (playlist.title)
132132
133133
134+ .. code-block :: python
135+
136+ # Example 10: Rate Mr. Robot four stars.
137+ plex.library.section(' TV Shows' ).get(' Mr. Robot' ).rate(8.0 )
138+
139+
134140 Running tests over PlexAPI
135141--------------------------
136142
Original file line number Diff line number Diff line change @@ -78,6 +78,13 @@ def markUnwatched(self):
7878 self ._server .query (key )
7979 self .reload ()
8080
81+ def rate (self , rate ):
82+ """ Rate video. """
83+ key = '/:/rate?key=%s&identifier=com.plexapp.plugins.library&rating=%s' % (self .ratingKey , rate )
84+
85+ self ._server .query (key )
86+ self .reload ()
87+
8188 def _defaultSyncTitle (self ):
8289 """ Returns str, default title for a new syncItem. """
8390 return self .title
Original file line number Diff line number Diff line change @@ -19,3 +19,10 @@ def test_refresh_section(tvshows):
1919
2020def test_refresh_video (movie ):
2121 movie .refresh ()
22+
23+
24+ def test_rate_movie (movie ):
25+ oldrate = movie .userRating
26+ movie .rate (10.0 )
27+ assert movie .userRating == 10.0 , 'User rating 10.0 after rating five stars.'
28+ movie .rate (oldrate )
You can’t perform that action at this time.
0 commit comments