protected override void AfterInitialized()
 {
     DatabaseTrackModel.JoinTable              = TrackJoinTable;
     DatabaseTrackModel.JoinPrimaryKey         = JoinPrimaryKey;
     DatabaseTrackModel.JoinColumn             = "TrackID";
     DatabaseTrackModel.CachesJoinTableEntries = CachesJoinTableEntries;
     DatabaseTrackModel.AddCondition(String.Format(TrackCondition, dbid));
     base.AfterInitialized();
 }
Exemple #2
0
        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"
                );
        }
Exemple #3
0
 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();
 }