コード例 #1
0
        public static string SearchAlbum(string name)
        {
            IEnumerable <Album> l    = lib.album_list.Where(a => a.name.ToLower().Contains(name.ToString().ToLower()));
            List <strAlbum>     list = new List <strAlbum>();

            foreach (Album alb in l)
            {
                //if (alb.name.ToLower().Contains(name.ToString().ToLower()))
                //{
                Artist   art = Artist.get(lib.artist_list, alb.artist_id);
                strAlbum a   = new strAlbum();
                a.id     = alb.id;
                a.name   = alb.name;
                a.artist = art.name;
                a.cover  = string.Format(lib.configuration.AlbumCoverImageFileURLFormat, art.url_name, alb.url_name);
                list.Add(a);
                //}
            }
            return(Newtonsoft.Json.JsonConvert.SerializeObject(list.ToArray <strAlbum>()));
        }
コード例 #2
0
        public static string GetAlbum(string id)
        {
            List <strAlbum> album  = new List <strAlbum>();
            Artist          artist = Artist.get(lib.artist_list, Convert.ToInt32(Convert.ToInt32(id)));

            if (artist != null)
            {
                List <string> albumimg  = new List <string>();
                List <string> albumname = new List <string>();
                foreach (Album a in lib.album_list)
                {
                    if (a.artist_id == artist.id)
                    {
                        strAlbum s = new strAlbum();
                        s.id     = a.id;
                        s.name   = a.name;
                        s.artist = artist.name;
                        s.cover  = string.Format(lib.configuration.AlbumCoverImageFileURLFormat, artist.url_name, a.url_name);
                        album.Add(s);
                    }
                }
            }
            return(Newtonsoft.Json.JsonConvert.SerializeObject(album));
        }