Exemple #1
0
 /// <summary>
 /// Get the Playback object from storage
 /// </summary>
 /// <returns></returns>
 public static async Task GetDataAsync()
 {
     if (PlaybackInstance == null)
     {
         PlaybackInstance = (await DbAccess.LoadAsync <Playback>())[0];
     }
 }
Exemple #2
0
 /// <summary>
 /// Get the TaggedAlbum collection from storage
 /// </summary>
 /// <returns></returns>
 public static async Task GetDataAsync()
 {
     if (TaggedAlbumCollection == null)
     {
         // Get the current set of albums and form the lookup tables
         TaggedAlbumCollection = await DbAccess.LoadAsync <TaggedAlbum>();
     }
 }
Exemple #3
0
 /// <summary>
 /// Get the Albums collection from storage
 /// </summary>
 /// <returns></returns>
 public static async Task GetDataAsync()
 {
     if (GenrePopulationCollection == null)
     {
         // Get the current set of GenrePopulation
         GenrePopulationCollection = await DbAccess.LoadAsync <GenrePopulation>();
     }
 }
Exemple #4
0
 /// <summary>
 /// Get the Autoplay collection from storage
 /// </summary>
 /// <returns></returns>
 public static async Task GetDataAsync()
 {
     if (AutoplayCollection == null)
     {
         // Get the current set of autoplays
         AutoplayCollection = await DbAccess.LoadAsync <Autoplay>();
     }
 }
Exemple #5
0
        /// <summary>
        /// Get the Library collection from storage
        /// </summary>
        /// <returns></returns>
        public static async Task GetDataAsync()
        {
            if (LibraryCollection == null)
            {
                // Get the current set of libraries
                LibraryCollection = await DbAccess.LoadAsync <Library>();

                LibraryNames = LibraryCollection.Select(lib => lib.Name).ToList();
            }
        }
Exemple #6
0
        /// <summary>
        /// Get the Albums collection from storage
        /// </summary>
        /// <returns></returns>
        public static async Task GetDataAsync()
        {
            if (AlbumCollection == null)
            {
                // Get the current set of albums and form the lookup tables
                AlbumCollection = await DbAccess.LoadAsync <Album>();

                IdLookup = AlbumCollection.ToDictionary(alb => alb.Id);
            }
        }
Exemple #7
0
        /// <summary>
        /// Get the Artists collection from storage
        /// </summary>
        /// <returns></returns>
        public static async Task GetDataAsync()
        {
            if (ArtistCollection == null)
            {
                // Get the current set of artists and form the lookup tables
                ArtistCollection = await DbAccess.LoadAsync <Artist>();

                IdLookup = ArtistCollection.ToDictionary(art => art.Id);
            }
        }
Exemple #8
0
        /// <summary>
        /// Get the Tags collection from storage
        /// </summary>
        /// <returns></returns>
        public static async Task GetDataAsync()
        {
            if (TagsCollection == null)
            {
                // Get the current set of tags and form the lookup tables
                TagsCollection = await DbAccess.LoadAsync <Tag>();

                NameLookup      = TagsCollection.ToDictionary(tag => tag.Name);
                ShortNameLookup = TagsCollection.ToDictionary(tag => tag.ShortName);
            }
        }
Exemple #9
0
        /// <summary>
        /// Get the Sources collection from storage
        /// </summary>
        /// <returns></returns>
        public static async Task GetDataAsync()
        {
            if (SourceCollection == null)
            {
                // Get the current set of sources
                SourceCollection = await DbAccess.LoadAsync <Source>();

                // Set the ScanSource, ScanType, LocalAccess and RemoteAccess fields.
                SourceCollection.ForEach(source => source.InitialiseAccess());
            }
        }
Exemple #10
0
        /// <summary>
        /// Get the Songs collection from storage
        /// </summary>
        /// <returns></returns>
        public static async Task GetDataAsync()
        {
            // Get the current set of songs
            SongCollection = await DbAccess.LoadAsync <Song>();

            // Form the lookups
            foreach (Song song in SongCollection)
            {
                IdLookup[song.Id] = song;
                artistAlbumLookup.AddValue(song.ArtistAlbumId, song);
                albumLookup.AddValue(song.AlbumId, song);
            }
        }
Exemple #11
0
        /// <summary>
        /// Get the Playlists collection from storage
        /// </summary>
        /// <returns></returns>
        public static async Task GetDataAsync()
        {
            if (PlaylistCollection == null)
            {
                PlaylistCollection = new List <Playlist>();

                // Get the current set of SongPlaylists
                List <SongPlaylist> songPlaylists = await DbAccess.LoadAsync <SongPlaylist>();

                // Get all the SongPlaylistItems
                List <SongPlaylistItem> songPlaylistItems = await DbAccess.LoadAsync <SongPlaylistItem>();

                // Make sure all these items are linked to songs. Remove any that aren't
                List <SongPlaylistItem> orphanItems = songPlaylistItems.Where(item => Songs.GetSongById(item.SongId) == null).ToList();

                // Remove any orphaned items
                orphanItems.ForEach(item => songPlaylistItems.Remove(item));
                DbAccess.DeleteItemsAsync(orphanItems);

                // Link the playlists with their playlistitems
                songPlaylists.ForEach(playlist => playlist.GetContents(songPlaylistItems));

                // Add these to the main collection
                PlaylistCollection.AddRange(songPlaylists);

                // Now do the same for the AlbumPlaylists
                List <AlbumPlaylist> albumPlaylists = await DbAccess.LoadAsync <AlbumPlaylist>();

                // Get all the PlaylistItems
                List <AlbumPlaylistItem> albumPlaylistItems = await DbAccess.LoadAsync <AlbumPlaylistItem>();

                // Link the album playlist items to thier playlists
                albumPlaylists.ForEach(playlist => playlist.GetContents(albumPlaylistItems));

                PlaylistCollection.AddRange(albumPlaylists);
            }
        }