def __init__(self):
     self.__settings = None
     self.__collection = plc.PlaylistCollection()
     self.__monitor = WidgetsMonitor(onNotificationCallback = self.__on_notification_cb, onSettingsChangedCallback = self.__on_settings_changed_cb)
     helper.set_property('service.skin.smartplaylist.widgets.ReloadSettings', 'false')
     self.__on_settings_changed_cb()        
     self.__daemon()
 def _set_one_item_properties(self, property, item):
     apl.AudioPlaylist._set_one_item_properties(self, property, item)
     if item:
         helper.set_property("%s.Artist"    % property, '%s' %item['artist'])
         helper.set_property("%s.Album"  % property, item['album'])
         helper.set_property("%s.Art(thumb)"   % property, item['thumbnail'])
         helper.set_property("%s.Art(fanart)"  % property, item['fanart'])
 def _set_one_item_properties(self, property, item):
     vpl.VideoPlaylist._set_one_item_properties(self, property, item)
     if item:
         helper.set_property("%s.EpisodeNo"    % property, "S%.2dE%.2d" %(float(item.get('season')), float(item.get('episode'))))
         helper.set_property("%s.TVshowTitle"  % property, item.get('showtitle'))
         helper.set_property("%s.Art(thumb)"   % property, item['art'].get('thumb',''))
         helper.set_property("%s.Art(fanart)"  % property, item['art'].get('tvshow.fanart',''))
 def _set_one_item_properties(self, property, item):
     if item:
         helper.set_property("%s.DBID"         % property, str(item.get('id')))
         helper.set_property("%s.File"         % property, item.get('file',''))
         helper.set_property("%s.Title"        % property, item.get('title'))            
     else:
         helper.set_property("%s.Title"        % property, '')
 def __daemon(self):
     home_update = False
     timer = 0
     while (not xbmc.abortRequested):
         xbmc.sleep(500)
         if helper.get_property('service.skin.smartplaylist.widgets.ReloadSettings') == 'true':
             helper.set_property('service.skin.smartplaylist.widgets.ReloadSettings', 'false')
             self.__on_settings_changed_cb()
         if int(self.__settings.getSetting("random_method")) == 0 :
             # convert time to seconds, times 2 for 0,5 second sleep compensation
             targetTimet = int(float(self.__settings.getSetting("random_timer"))) * 60 * 2
             timer += 1
             if timer == targetTimet:
                 self.__collection.update_all_playlists(['Random'])
                 timer = 0
         if int(self.__settings.getSetting("random_method")) == 2 :
             if  home_update and helper.is_home_screen():
                 self.__collection.update_all_playlists(['Random'])
                 home_update = False
             elif not home_update and not helper.is_home_screen():
                 home_update = True
 def _set_playlist_properties(self):
     vpl.VideoPlaylist._set_playlist_properties(self)
     helper.set_property("%s.Artists" %self._alias, str(self._getArtistsCount()))
 def _set_one_item_properties(self, property, item):
     vpl.VideoPlaylist._set_one_item_properties(self, property, item)
     if item:
         helper.set_property("%s.Artist"  % property, '%s' %item['artist'])
         helper.set_property("%s.Art(poster)"  % property, item.get('thumbnail',''))
         helper.set_property("%s.Art(fanart)"  % property, item.get('fanart',''))
 def _set_playlist_properties(self):
     vpl.VideoPlaylist._set_playlist_properties(self)
     helper.set_property("%s.TvShows" %self._alias, str(self._getTvShowCount()))
 def _set_one_item_properties(self, property, item):
     vpl.VideoPlaylist._set_one_item_properties(self, property, item)
     if item:
         helper.set_property("%s.SetTitle" % property, item.get("set"))
         helper.set_property("%s.Art(poster)" % property, item["art"].get("poster", ""))
         helper.set_property("%s.Art(fanart)" % property, item["art"].get("fanart", ""))
 def _set_playlist_properties(self):
     apl.AudioPlaylist._set_playlist_properties(self)
     helper.set_property("%s.Artists" %self._alias, str(self._getArtistsCount()))
     helper.set_property("%s.Albums" %self._alias, str(self._getAlbumsCount()))
 def _set_playlist_properties(self):
     helper.set_property("%s.Name"       %self._alias, self.playlistName)
     helper.set_property("%s.Type"       %self._alias, self.itemType )
     helper.set_property("%s.Count"      %self._alias, str(self.__get_item_count()))
     helper.set_property("%s.Watched"    %self._alias, str(self.__get_watched_item_count()))
     helper.set_property("%s.Unwatched"  %self._alias, str(self.__get_unwatched_item_count()))