public DaapPlaylistSource(DAAP.Playlist playlist, DaapSource parent) : base(playlist.Name, parent) { 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(); }); }
private void OnServiceFound(object o, ServiceArgs args) { ThreadAssist.ProxyToMain(delegate { DaapSource source = new DaapSource(args.Service); string key = String.Format("{0}:{1}", args.Service.Name, args.Service.Port); if (source_map.Count == 0) { ServiceManager.SourceManager.AddSource(container); } if (source_map.ContainsKey(key)) { // Received new connection info for service container.RemoveChildSource(source_map [key]); source_map [key] = source; } else { // New service information source_map.Add(key, source); } container.AddChildSource(source); // Don't flash shares we find on startup (well, within 5s of startup) if ((DateTime.Now - locator_started).TotalSeconds > 5) { source.NotifyUser(); } }); }
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 (); }); }
public DaapTrackInfo(Track track, DaapSource source) : base() { TrackTitle = track.Title; AlbumTitle = track.Album; ArtistName = track.Artist; DateAdded = track.DateAdded; DateUpdated = track.DateModified; Genre = track.Genre; FileSize = track.Size; TrackCount = track.TrackCount; TrackNumber = track.TrackNumber; DiscNumber = track.DiscNumber; DiscCount = track.DiscCount; Year = track.Year; Duration = track.Duration; MimeType = track.Format; BitRate = (int)track.BitRate; ExternalId = track.Id; PrimarySource = source; Uri = new SafeUri(String.Format( "{0}{1}/{2}", DaapService.ProxyServer.HttpBaseAddress, source.Database.GetHashCode(), track.Id )); //this.IsLive = false; //this.CanSaveToDatabase = false; }
public DaapTrackInfo(Track track, DaapSource source) : base() { TrackTitle = track.Title; AlbumTitle = track.Album; ArtistName = track.Artist; DateAdded = track.DateAdded; DateUpdated = track.DateModified; Genre = track.Genre; FileSize = track.Size; TrackCount = track.TrackCount; TrackNumber = track.TrackNumber; DiscNumber = track.DiscNumber; DiscCount = track.DiscCount; Year = track.Year; Duration = track.Duration; MimeType = track.Format; BitRate = (int)track.BitRate; ExternalId = track.Id; PrimarySource = source; Uri = new SafeUri (String.Format ( "{0}{1}/{2}", DaapService.ProxyServer.HttpBaseAddress, source.Database.GetHashCode (), track.Id )); //this.IsLive = false; //this.CanSaveToDatabase = false; }
private void OnServiceRemoved(object o, ServiceArgs args) { ThreadAssist.ProxyToMain(delegate { string key = String.Format("{0}:{1}", args.Service.Name, args.Service.Port); DaapSource source = source_map [key]; source.Disconnect(true); container.RemoveChildSource(source); source_map.Remove(key); if (source_map.Count == 0) { ServiceManager.SourceManager.RemoveSource(container); } }); }
public DaapErrorView (DaapSource source, DaapErrorType failure) : base() { //AppPaintable = true; //BorderWidth = 10; this.source = source; this.failure = failure; pane = new MessagePane(); pane.HeaderIcon = IconThemeUtils.LoadIcon(48, "face-surprise", Stock.DialogError); pane.ArrowIcon = IconThemeUtils.LoadIcon(24, "go-next", Stock.GoForward); pane.HeaderMarkup = String.Format("<big><b>{0}</b></big>", GLib.Markup.EscapeText((failure == DaapErrorType.UserDisconnect ? Catalog.GetString("Disconnected from music share") : Catalog.GetString("Unable to connect to music share")))); AddPaneItems(); pane.Show(); Add(pane); }
public DaapErrorView(DaapSource source, DaapErrorType failure) : base() { //AppPaintable = true; //BorderWidth = 10; this.source = source; this.failure = failure; pane = new MessagePane(); pane.HeaderIcon = IconThemeUtils.LoadIcon(48, "face-surprise", Stock.DialogError); pane.ArrowIcon = IconThemeUtils.LoadIcon(24, "go-next", Stock.GoForward); pane.HeaderMarkup = String.Format("<big><b>{0}</b></big>", GLib.Markup.EscapeText((failure == DaapErrorType.UserDisconnect ? Catalog.GetString("Disconnected from music share") : Catalog.GetString("Unable to connect to music share")))); AddPaneItems(); pane.Show(); Add(pane); }
private void AddDaapServer (Service service) { ThreadAssist.ProxyToMain (delegate { DaapSource source = new DaapSource (service); string key = String.Format ("{0}:{1}", service.Name, service.Port); if (source_map.Count == 0) { ServiceManager.SourceManager.AddSource (container); } if (source_map.ContainsKey (key)) { // Received new connection info for service container.RemoveChildSource (source_map [key]); source_map [key] = source; } else { // New service information source_map.Add (key, source); } container.AddChildSource (source); // Don't flash shares we find on startup (well, within 5s of startup) if ((DateTime.Now - locator_started).TotalSeconds > 5) { source.NotifyUser (); } }); }