当前位置: 首页>>代码示例>>C#>>正文


C# Artist.GetImageURL方法代码示例

本文整理汇总了C#中Artist.GetImageURL方法的典型用法代码示例。如果您正苦于以下问题:C# Artist.GetImageURL方法的具体用法?C# Artist.GetImageURL怎么用?C# Artist.GetImageURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Artist的用法示例。


在下文中一共展示了Artist.GetImageURL方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetArtistImageURL

        public static async Task<string> GetArtistImageURL(string artistname)
        {
            Artist artist = new Artist(artistname, GetSession());
            string url = string.Empty;
            try
            {
                url = await Task.Run(() => artist.GetImageURL(ImageSize.Large));
            }
            catch (Exception ex)
            {
                Console.WriteLine("lastfm: couldn't fetch large image: " + ex.StackTrace);
            }

            if (string.IsNullOrEmpty(url))
            {
                try
                {
                    url = await Task.Run(() => artist.GetImageURL(ImageSize.Medium));
                }
                catch (Exception ex)
                {
                    Console.WriteLine("lastfm: couldn't fetch medium image: " + ex.StackTrace);
                }
            }

            if (string.IsNullOrEmpty(url))
            {
                try
                {
                    url = await Task.Run(() => artist.GetImageURL(ImageSize.Small));
                }
                catch (Exception ex)
                {
                    Console.WriteLine("lastfm: couldn't fetch small image: " + ex.StackTrace);
                }
            }
            return url;
            
        }
开发者ID:devalacarte,项目名称:mediaplayer,代码行数:39,代码来源:LastFM.cs

示例2: GetArtist

        private async void GetArtist()
        {
            Artist artist = new Artist(ArtistName, session);
            ArtistImage = string.Empty;
            try
            {
                ArtistImage = await Task.Run(() => artist.GetImageURL(ImageSize.Large));
            }
            catch (Exception ex)
            {
                Console.WriteLine("lastfm: couldn't fetch large image: " + ex.StackTrace);
            }

            if (string.IsNullOrEmpty(ArtistImage))
            {
                try
                {
                    ArtistImage = await Task.Run(() => artist.GetImageURL(ImageSize.Medium));
                }
                catch (Exception ex)
                {
                    Console.WriteLine("lastfm: couldn't fetch medium image: " + ex.StackTrace);
                }
            }

            if (string.IsNullOrEmpty(ArtistImage))
            {
                try
                {
                    ArtistImage = await Task.Run(() => artist.GetImageURL(ImageSize.Small));
                }
                catch (Exception ex)
                {
                    Console.WriteLine("lastfm: couldn't fetch small image: " + ex.StackTrace);
                }
            }
            
        }
开发者ID:devalacarte,项目名称:mediaplayer,代码行数:38,代码来源:PageOneVM.cs

示例3: button2_Click

        private void button2_Click(object sender, EventArgs e)
        {
            string API_KEY = "60d35bf7777d870ec958a21872bacb24";
              string API_SECRET = "099158e5216ad77239be5e0a2228cf04";
              Session session = new Session(API_KEY, API_SECRET);
              ArtistManager.Instance.InitDatabase();
              List<ArtistItem> arts = ArtistManager.Instance.GetArtists();
              int i = 0;
              foreach (ArtistItem artistItem in arts)
              {

            i++;
            if (string.IsNullOrEmpty(artistItem.Img_url))
            {
              try
              {
            Artist artist = new Artist(artistItem.Name, session);
            artistItem.Img_url = artist.GetImageURL(ImageSize.Huge);
            ArtistManager.Instance.Save(artistItem);
            ArtistManager.Instance.Grabber.GetSimilarArtists(artistItem.Id);

              }
              catch (Exception)
              {

              }
              label1.Text = i.ToString();
              Application.DoEvents();
              //Thread.Sleep(200);
            }
              }
        }
开发者ID:andrewjswan,项目名称:youtube-fm-for-mediaportal,代码行数:32,代码来源:Form1.cs


注:本文中的Artist.GetImageURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。