// Catalog.GetString ("Music Library") public MusicLibrarySource() : base(Catalog.GetString("Music"), "Library", 40) { MediaTypes = TrackMediaAttributes.Music | TrackMediaAttributes.AudioStream; NotMediaTypes = TrackMediaAttributes.Podcast | TrackMediaAttributes.VideoStream | TrackMediaAttributes.AudioBook; Properties.SetStringList("Icon.Name", "audio-x-generic", "source-library"); Properties.Set <string> ("SearchEntryDescription", Catalog.GetString("Search your music")); // Migrate the old library-location schema, if necessary if (DatabaseConfigurationClient.Client.Get <int> ("MusicLibraryLocationMigrated", 0) != 1) { string old_location = OldLocationSchema.Get(); if (!String.IsNullOrEmpty(old_location)) { BaseDirectory = old_location; } DatabaseConfigurationClient.Client.Set <int> ("MusicLibraryLocationMigrated", 1); } SetFileNamePattern(MusicFileNamePattern); Section misc = PreferencesPage.Add(new Section("misc", Catalog.GetString("Miscellaneous"), 10)); misc.Add(new SchemaPreference <bool> (LibrarySchema.SortByAlbumYear, Catalog.GetString("_Sort an artist's albums by year, not title"), null, delegate { DatabaseTrackModel.Resort(); DatabaseTrackModel.Reload(); } )); }
public override void Deactivate() { DatabaseTrackModel.InvalidateCache(false); foreach (IFilterListModel filter in AvailableFilters) { filter.InvalidateCache(false); } }
protected void RateLimitedReload() { lock (track_model) { DatabaseTrackModel.Reload(); } OnUpdated(); Save(); }
protected override void AfterInitialized() { DatabaseTrackModel.JoinTable = TrackJoinTable; DatabaseTrackModel.JoinPrimaryKey = JoinPrimaryKey; DatabaseTrackModel.JoinColumn = "TrackID"; DatabaseTrackModel.CachesJoinTableEntries = CachesJoinTableEntries; DatabaseTrackModel.AddCondition(String.Format(TrackCondition, dbid)); base.AfterInitialized(); }
private void PrimarySourceInitialize() { // Scope the tracks to this primary source DatabaseTrackModel.AddCondition(String.Format("CoreTracks.PrimarySourceID = {0}", DbId)); primary_sources[DbId] = this; // If there was a crash, tracks can be left behind, for example in DaapSource. // Temporary playlists are cleaned up by the PlaylistSource.LoadAll call below if (IsTemporary && SavedCount > 0) { PurgeTracks(); } // Load our playlists and smart playlists foreach (PlaylistSource pl in PlaylistSource.LoadAll(this)) { AddChildSource(pl); } int sp_count = 0; foreach (SmartPlaylistSource pl in SmartPlaylistSource.LoadAll(this)) { AddChildSource(pl); sp_count++; } // Create default smart playlists if we haven't done it ever before, and if the // user has zero smart playlists. if (!HaveCreatedSmartPlaylists) { if (sp_count == 0) { foreach (SmartPlaylistDefinition def in DefaultSmartPlaylists) { SmartPlaylistSource pl = def.ToSmartPlaylistSource(this); pl.Save(); AddChildSource(pl); pl.RefreshAndReload(); sp_count++; } } // Only save it if we already had some smart playlists, or we actually created some (eg not // if we didn't have any and the list of default ones is empty atm). if (sp_count > 0) { HaveCreatedSmartPlaylists = true; } } expanded_schema = new SchemaEntry <bool> ( String.Format("sources.{0}", ParentConfigurationId), "expanded", true, "Is source expanded", "Is source expanded" ); }
protected override void AfterInitialized() { DatabaseTrackModel.JoinTable = TrackJoinTable; DatabaseTrackModel.JoinPrimaryKey = JoinPrimaryKey; DatabaseTrackModel.JoinColumn = "TrackID"; DatabaseTrackModel.CachesJoinTableEntries = CachesJoinTableEntries; DatabaseTrackModel.AddCondition(String.Format(TrackCondition, dbid)); Properties.Set <string> ("SearchEntryDescription", Catalog.GetString("Search this playlist")); base.AfterInitialized(); }
public void UpdateCounts() { DatabaseTrackModel.UpdateUnfilteredAggregates(); ever_counted = true; OnUpdated(); }
protected virtual void AfterInitialized() { DatabaseTrackModel.Initialize(TrackCache); OnSetupComplete(); }