Example #1
0
File: MediaDB.cs Project: XCVG/XSMP
        public IReadOnlyList <PublicModels.Song> GetAlbumSongs(string cname)
        {
            ThrowIfNotReady();

            var(artistCName, albumCName) = MediaUtils.SplitAlbumCName(cname);
            var rawSongs = from song in DBContext.Song
                           where song.AlbumArtistName == artistCName && song.AlbumName == albumCName
                           orderby song.Track ascending
                           select song;

            var songs = rawSongs.ToArray().Select(s => PublicModels.Song.FromDBObject(s, DBContext));

            return(songs.ToList());
        }
Example #2
0
File: MediaDB.cs Project: XCVG/XSMP
        public PublicModels.Album?GetAlbum(string cname)
        {
            ThrowIfNotReady();

            var(artistCName, albumCName) = MediaUtils.SplitAlbumCName(cname);
            var rawAlbums = from album in DBContext.Album
                            where album.ArtistName == artistCName && album.Name == albumCName
                            orderby album.Name ascending
                            select album;

            var rawAlbumArray = rawAlbums.ToArray();

            if (rawAlbumArray.Length > 0)
            {
                return(PublicModels.Album.FromDBObject(rawAlbumArray[0], DBContext));
            }

            return(null);
        }