Exemplo n.º 1
0
    private void AddItemToFacadeControl(Song aSong)
    {
      GUIListItem item = new GUIListItem(aSong.ToShortString());
      item.Label = aSong.Artist + " - " + aSong.Title;

      string iconThumb = InfoScrobbler.GetSongAlbumImage(aSong);
      item.ThumbnailImage = item.IconImage = item.IconImageBig = iconThumb;
      item.MusicTag = aSong.ToMusicTag();

      facadeRadioPlaylist.Add(item);
    }
    /// <summary>
    /// Push the given song on the queue.
    /// </summary>
    /// <param name="song_">The song to be enqueued.</param>
    public static void pushQueue(Song song_)
    {
      string logmessage = "Adding to queue: " + song_.ToShortString();
      if (_useDebugLog)
      {
        Log.Debug("AudioscrobblerBase: {0}", logmessage);
      }

      // Enqueue the song
      lock (queueLock)
      {
        queue.Add(song_);
      }

      if (submitThread != null)
      {
        if (submitThread.IsAlive)
        {
          try
          {
            Log.Debug("AudioscrobblerBase: trying to kill submit thread (no longer needed)");
            StopSubmitQueueThread();
          }
          catch (Exception ex)
          {
            Log.Warn("AudioscrobblerBase: Result of pre-submit thread abort - {0}", ex.Message);
          }
        }
      }

      // Try to submit immediately.
      StartSubmitQueueThread();
    }
 private static bool IsSongBelowMinPercentage(Song aSong)
 {
   try
   {
     if ((Convert.ToDouble(aSong.LastFMMatch, NumberFormatInfo.InvariantInfo) * 100) < _minimumArtistMatchPercent)
     {
       return true;
     }
     else
     {
       return false;
     }
   }
   catch (Exception ex)
   {
     Log.Warn("AudioscrobblerUtils: Could not check percentage match for Song: {0} - {1}", aSong.ToShortString(),
              ex.Message);
     return false;
   }
 }