Example #1
0
        public void DeleteAllTracks (AbstractPlaylistSource source)
        {
            if (source.PrimarySource != this) {
                Log.WarningFormat ("Cannot delete all tracks from {0} via primary source {1}", source, this);
                return;
            }

            if (source.Count < 1)
                return;

            var list = CachedList<DatabaseTrackInfo>.CreateFromModel (source.DatabaseTrackModel);
            ThreadAssist.SpawnFromMain (delegate {
                DeleteTrackList (list);
            });
        }
Example #2
0
        private Playlist BuildPlaylistFromSource (AbstractPlaylistSource source)
        {
            var mpris_playlist = new Playlist ();
            mpris_playlist.Name = source.Name;
            mpris_playlist.Id = MakeObjectPath (source);
            mpris_playlist.Icon = GetIconPath (source);

            return mpris_playlist;
        }
Example #3
0
 public void HandlePlaylistChange (AbstractPlaylistSource source)
 {
     PlaylistChangedHandler playlist_handler = playlist_changed;
     if (playlist_handler != null) {
         try {
             playlist_handler (BuildPlaylistFromSource (source));
         } catch (Exception e) {
             Log.Exception (e);
         }
     }
 }
Example #4
0
        private ObjectPath MakeObjectPath (AbstractPlaylistSource playlist)
        {
            StringBuilder object_path_builder = new StringBuilder ();

            object_path_builder.Append (DBusServiceManager.ObjectRoot);
            if (playlist.Parent != null) {
                object_path_builder.AppendFormat ("/{0}", DBusServiceManager.MakeDBusSafeString (playlist.Parent.TypeName));
            }
            object_path_builder.Append ("/Playlists/");

            object_path_builder.Append (DBusServiceManager.MakeDBusSafeString (playlist.UniqueId));

            string object_path = object_path_builder.ToString ();
            playlist_sources[object_path] = playlist;

            return new ObjectPath (object_path);
        }