コード例 #1
0
        public AlbumListActivity(ISubsonicClient <TImageType> subsonicClient, AlbumListType albumListType, int?size = null, int?offset = null, int?fromYear = null, int?toYear = null, string genre = null, string musicFolderId = null)
        {
            var activityDelegate = new AlbumListActivityDelegate <TImageType>(albumListType, size, offset, fromYear, toYear, genre, musicFolderId);

            activityDelegate.Method = activityDelegate.CreateMethod(subsonicClient);
            ActivityDelegate        = activityDelegate;
        }
コード例 #2
0
        /// <summary>
        /// Gets list of band's albums simple list async
        /// </summary>
        public async Task <IEnumerable <AlbumBandResult> > GetAlbumsAsync(AlbumListType type)
        {
            WebDownloader wd      = new WebDownloader($@"https://www.metal-archives.com/band/discography/id/{Id}/tab/" + type.ToString().ToLower());
            string        content = await wd.DownloadDataAsync();

            return(WebContentParser.ParseList <AlbumBandResult>(content));
        }
コード例 #3
0
        private async Task<List<Models.AlbumModel>> GetAlbumList(AlbumListType albumListType, int size)
        {
            var subsonicClient = SettingsHelper.GetSubsonicClient();

            if (subsonicClient == null)
                return null;

            var albumList = await subsonicClient.GetAlbumListAsync(albumListType, size);

            var albumModels = new List<Models.AlbumModel>();

            foreach (var album in albumList.Albums)
            {
                var albumModel = new Models.AlbumModel
                {
                    Artist = album.Artist,
                    Child = album,
                    CoverArt = album.CoverArt,
                    Genre = album.Genre,
                    Id = album.Id,
                    Name = album.Title,
                    Parent = album.Parent,
                    Rating = album.UserRating,
                    Starred = album.Starred != default(DateTime),
                    Year = album.Year,
                    Image = await GetCoverArt(album.CoverArt ?? album.Id, 200)
                };

                albumModels.Add(albumModel);
            }

            return albumModels;
        }
コード例 #4
0
        public override int GetHashCode()
        {
            var hash       = 13;
            var hashFactor = 7;

            hash = hash * hashFactor + AlbumListType.GetHashCode();
            hash = hash * hashFactor + Current.GetHashCode();

            return(hash);
        }
コード例 #5
0
 public AlbumListActivityDelegate(AlbumListType albumListType, int?size = null, int?offset = null, int?fromYear = null, int?toYear = null, string genre = null, string musicFolderId = null)
 {
     AlbumListType = albumListType;
     Size          = size;
     Offset        = offset;
     FromYear      = fromYear;
     ToYear        = toYear;
     Genre         = genre;
     MusicFolderId = musicFolderId;
 }
コード例 #6
0
        public override int GetHashCode()
        {
            var hash = HashSeed;

            hash = hash * HashFactor + typeof(AlbumListActivityDelegate <TImageType>).GetHashCode();

            hash = hash * HashFactor + AlbumListType.GetHashCode();

            if (Size != null)
            {
                hash = hash * HashFactor + Size.GetHashCode();
            }

            if (Offset != null)
            {
                hash = hash * HashFactor + Offset.GetHashCode();
            }

            if (FromYear != null)
            {
                hash = hash * HashFactor + FromYear.GetHashCode();
            }

            if (ToYear != null)
            {
                hash = hash * HashFactor + ToYear.GetHashCode();
            }

            if (Genre != null)
            {
                hash = hash * HashFactor + Genre.GetHashCode();
            }

            if (MusicFolderId != null)
            {
                hash = hash * HashFactor + MusicFolderId.GetHashCode();
            }

            return(hash);
        }