1111import xbmcplugin
1212
1313# Get the plugin url in plugin:// notation.
14- _url = sys .argv [0 ]
14+ _URL = sys .argv [0 ]
1515# Get the plugin handle as an integer number.
16- _handle = int (sys .argv [1 ])
16+ _HANDLE = int (sys .argv [1 ])
1717
1818# Free sample videos are provided by www.vidsplay.com
1919# Here we use a fixed set of properties simply for demonstrating purposes
@@ -68,7 +68,7 @@ def get_url(**kwargs):
6868 :return: plugin call URL
6969 :rtype: str
7070 """
71- return '{0 }?{1 }' .format (_url , urlencode (kwargs ))
71+ return '{}?{}' .format (_URL , urlencode (kwargs ))
7272
7373
7474def get_categories ():
@@ -112,10 +112,10 @@ def list_categories():
112112 """
113113 # Set plugin category. It is displayed in some skins as the name
114114 # of the current section.
115- xbmcplugin .setPluginCategory (_handle , 'My Video Collection' )
115+ xbmcplugin .setPluginCategory (_HANDLE , 'My Video Collection' )
116116 # Set plugin content. It allows Kodi to select appropriate views
117117 # for this type of content.
118- xbmcplugin .setContent (_handle , 'videos' )
118+ xbmcplugin .setContent (_HANDLE , 'videos' )
119119 # Get video categories
120120 categories = get_categories ()
121121 # Iterate through categories
@@ -143,11 +143,11 @@ def list_categories():
143143 # is_folder = True means that this item opens a sub-list of lower level items.
144144 is_folder = True
145145 # Add our item to the Kodi virtual folder listing.
146- xbmcplugin .addDirectoryItem (_handle , url , list_item , is_folder )
146+ xbmcplugin .addDirectoryItem (_HANDLE , url , list_item , is_folder )
147147 # Add a sort method for the virtual folder items (alphabetically, ignore articles)
148- xbmcplugin .addSortMethod (_handle , xbmcplugin .SORT_METHOD_LABEL_IGNORE_THE )
148+ xbmcplugin .addSortMethod (_HANDLE , xbmcplugin .SORT_METHOD_LABEL_IGNORE_THE )
149149 # Finish creating a virtual folder.
150- xbmcplugin .endOfDirectory (_handle )
150+ xbmcplugin .endOfDirectory (_HANDLE )
151151
152152
153153def list_videos (category ):
@@ -159,10 +159,10 @@ def list_videos(category):
159159 """
160160 # Set plugin category. It is displayed in some skins as the name
161161 # of the current section.
162- xbmcplugin .setPluginCategory (_handle , category )
162+ xbmcplugin .setPluginCategory (_HANDLE , category )
163163 # Set plugin content. It allows Kodi to select appropriate views
164164 # for this type of content.
165- xbmcplugin .setContent (_handle , 'videos' )
165+ xbmcplugin .setContent (_HANDLE , 'videos' )
166166 # Get the list of videos in the category.
167167 videos = get_videos (category )
168168 # Iterate through videos.
@@ -188,11 +188,11 @@ def list_videos(category):
188188 # is_folder = False means that this item won't open any sub-list.
189189 is_folder = False
190190 # Add our item to the Kodi virtual folder listing.
191- xbmcplugin .addDirectoryItem (_handle , url , list_item , is_folder )
191+ xbmcplugin .addDirectoryItem (_HANDLE , url , list_item , is_folder )
192192 # Add a sort method for the virtual folder items (alphabetically, ignore articles)
193- xbmcplugin .addSortMethod (_handle , xbmcplugin .SORT_METHOD_LABEL_IGNORE_THE )
193+ xbmcplugin .addSortMethod (_HANDLE , xbmcplugin .SORT_METHOD_LABEL_IGNORE_THE )
194194 # Finish creating a virtual folder.
195- xbmcplugin .endOfDirectory (_handle )
195+ xbmcplugin .endOfDirectory (_HANDLE )
196196
197197
198198def play_video (path ):
@@ -205,7 +205,7 @@ def play_video(path):
205205 # Create a playable item with a path to play.
206206 play_item = xbmcgui .ListItem (path = path )
207207 # Pass the item to the Kodi player.
208- xbmcplugin .setResolvedUrl (_handle , True , listitem = play_item )
208+ xbmcplugin .setResolvedUrl (_HANDLE , True , listitem = play_item )
209209
210210
211211def router (paramstring ):
@@ -231,7 +231,7 @@ def router(paramstring):
231231 # If the provided paramstring does not contain a supported action
232232 # we raise an exception. This helps to catch coding errors,
233233 # e.g. typos in action names.
234- raise ValueError ('Invalid paramstring: {0 }!' .format (paramstring ))
234+ raise ValueError ('Invalid paramstring: {}!' .format (paramstring ))
235235 else :
236236 # If the plugin is called from Kodi UI without any parameters,
237237 # display the list of video categories
0 commit comments