Пример #1
0
 private String addDiscAndTrackNumber(String title, final Music track) {
   final int tracknum = track.getTrack();
   final int discnum = track.getDisc();
   if (tracknum > -1) {
     title = tracknum + "] " + title;
     if (discnum > -1) {
       title = discnum + ":" + title;
     }
     title = "[" + title;
   }
   return title;
 }
Пример #2
0
    /**
     * If not a stream, this sets up the mArtistName based on artist and album information.
     *
     * @param currentTrack The current playing {@link Music} item.
     */
    private void setArtist(final Music currentTrack) {
      final boolean showAlbumArtist = mSettings.getBoolean("showAlbumArtist", true);
      final String albumArtist = currentTrack.getAlbumArtistName();

      mArtistName = currentTrack.getArtistName();
      if (mArtistName == null || mArtistName.isEmpty()) {
        mArtistName = albumArtist;
      } else if (showAlbumArtist
          && albumArtist != null
          && !mArtistName.toLowerCase().contains(albumArtist.toLowerCase())) {
        mArtistName = albumArtist + " / " + mArtistName;
      }
    }
Пример #3
0
    /**
     * Gather and parse all song track information necessary after change.
     *
     * @param params A {@code MPDStatus} object array.
     * @return A null {@code Void} object, ignore it.
     */
    @Override
    protected final Music doInBackground(final Void... params) {
      try {
        mMPDStatus.waitForValidity();
        mApp.getMPD().getPlaylist().waitForValidity();
      } catch (final InterruptedException ignored) {
      }

      final Music currentTrack = mApp.getMPD().getCurrentTrack();

      if (currentTrack != null) {
        if (currentTrack.isStream()) {
          final String title = currentTrack.getTitle();

          if (title != null && !title.isEmpty()) {
            mAlbumName = currentTrack.getName();
            mTitle = currentTrack.getTitle();
          } else {
            mTitle = currentTrack.getName();
          }

          mArtistName = currentTrack.getArtistName();
          mAlbumInfo = new AlbumInfo(mArtistName, mAlbumName);
        } else {
          mAlbumName = currentTrack.getAlbumName();

          mDate = Long.toString(currentTrack.getDate());
          if (mDate.isEmpty() || mDate.charAt(0) == '-') {
            mDate = "";
          } else {
            mDate = " - " + mDate;
          }

          mTitle = currentTrack.getTitle();
          mTitle = addDiscAndTrackNumber(mTitle, currentTrack);
          setArtist(currentTrack);
          mAlbumInfo = new AlbumInfo(currentTrack);
        }
        mHasCoverChanged = hasCoverChanged();
        mTrackRating = getTrackRating(currentTrack);

        if (DEBUG) {
          Log.i(TAG, toString());
        }
      }

      mLastAlbum = mAlbumName;
      mLastArtist = mArtistName;

      return currentTrack;
    }