Пример #1
0
        public DaapPlaylistSource(DAAP.Playlist playlist, DaapSource parent)
            : base(playlist.Name, parent)
        {
            IsTemporary = true;
            this.parent = parent;
            Save ();

            int count = 0;
            if (playlist.Tracks.Count > 0) {
                //IList<DAAP.Track> tracks = playlist.Tracks;
                int [] external_ids = new int [playlist.Tracks.Count];
                int i = 0;
                foreach (DAAP.Track track in playlist.Tracks) {
                    external_ids[i++] = track == null ? -1 : track.Id;
                    if (track != null) {
                        count++;
                    }
                }

                if (count > 0) {
                    ServiceManager.DbConnection.Execute (insert_track_command, DbId, parent.DbId, external_ids);
                }
            }
            SavedCount = count;

            ThreadAssist.ProxyToMain (delegate {
                OnUpdated ();
            });
        }
Пример #2
0
        public DaapSource (DAAP.Service service) : base (Catalog.GetString ("Music Share"), service.Name,
                                                    (service.Address.ToString () + service.Port).Replace (":", "").Replace (".", ""), 300, true)
        {
            this.service = service;
            Properties.SetString ("UnmapSourceActionLabel", Catalog.GetString ("Disconnect"));
            Properties.SetString ("UnmapSourceActionIconName", "gtk-disconnect");

            SupportsPlaylists = false;
            SavedCount = 0;
            UpdateIcon ();

            AfterInitialized ();
        }
Пример #3
0
 public void UnregisterDatabase(DAAP.Database database)
 {
     databases.Remove(database);
 }
Пример #4
0
 public void RegisterDatabase(DAAP.Database database)
 {
     databases.Add(database);
 }
Пример #5
0
 protected virtual void StreamTrack(Socket client, DAAP.Database database, DAAP.Track song, long offset)
 {
     long length;
     Stream stream = database.StreamTrack(song, offset, out length);
     WriteResponseStream(client, stream, length, song.FileName, offset < 0 ? 0 : offset);
     stream.Close();
     client.Close();
 }
Пример #6
0
 protected void StreamTrack(Socket client, DAAP.Database database, DAAP.Track song)
 {
     StreamTrack (client, database, song, -1);
 }
Пример #7
0
 public void OnDatabaseTrackRemoved(object o, DAAP.TrackArgs args)
 {
     //RemoveTrack (
 }
Пример #8
0
 public void OnDatabaseTrackAdded(object o, DAAP.TrackArgs args)
 {
     DaapTrackInfo track = new DaapTrackInfo (args.Track, this);
     track.Save ();
 }