Android Open Source - kure-music-player Song






From Project

Back to project page kure-music-player.

License

The source code is released under:

GNU General Public License

If you think the Android project kure-music-player listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.kure.musicplayer.model;
/*from w ww .j a v a  2s .  c  o m*/

/**
 * Represents a single audio file on the Android system.
 *
 * It's a simple data container, filled with setters/getters.
 *
 * Only mandatory fields are:
 * - id (which is a unique Android identified for a media file
 *       anywhere on the system)
 * - filePath (full path for the file on the filesystem).
 */
public class Song {

  private long id;
  private String filePath;

  /**
   * Creates a new Song, with specified `songID` and `filePath`.
   *
   * @note It's a unique Android identifier for a media file
   *       anywhere on the system.
   */
  public Song(long id, String filePath) {
    this.id        = id;
    this.filePath  = filePath;
  }

  /**
   * Identifier for the song on the Android system.
   * (so we can locate the file anywhere)
   */
  public long getId() {
    return id;
  }

  /**
   * Full path for the music file within the filesystem.
   */
  public String getFilePath() {
    return filePath;
  }

  // optional metadata

  private String title       = "";
  private String artist      = "";
  private String album       = "";
  private int    year        = -1;
  private String genre       = "";
  private int    track_no    = -1;
  private long   duration_ms = -1;


  public String getTitle() {
    return title;
  }
  public void setTitle(String title) {
    this.title = title;
  }


  public String getArtist() {
    return artist;
  }
  public void setArtist(String artist) {
    this.artist = artist;
  }


  public String getAlbum() {
    return album;
  }
  public void setAlbum(String album) {
    this.album = album;
  }


  public int getYear() {
    return year;
  }
  public void setYear(int year) {
    this.year = year;
  }


  public String getGenre() {
    return genre;
  }
  public void setGenre(String genre) {
    this.genre = genre;
  }


  public int getTrackNumber() {
    return track_no;
  }
  public void setTrackNumber(int track_no) {
    this.track_no = track_no;
  }

  /**
   * Sets the duration of the song, in miliseconds.
   */
  public void setDuration(long duration_ms) {
    this.duration_ms = duration_ms;
  }
  /**
   * Returns the duration of the song, in miliseconds.
   */
  public long getDuration() {
    return duration_ms;
  }
  public long getDurationSeconds() {
    return getDuration() / 1000;
  }
  public long getDurationMinutes() {
    return getDurationSeconds() / 60;
  }
}




Java Source Code List

com.kure.musicplayer.MusicController.java
com.kure.musicplayer.NotificationMusic.java
com.kure.musicplayer.NotificationSimple.java
com.kure.musicplayer.Settings.java
com.kure.musicplayer.activities.ActivityListAlbums.java
com.kure.musicplayer.activities.ActivityListSongs.java
com.kure.musicplayer.activities.ActivityMaster.java
com.kure.musicplayer.activities.ActivityMenuAlbum.java
com.kure.musicplayer.activities.ActivityMenuArtist.java
com.kure.musicplayer.activities.ActivityMenuGenre.java
com.kure.musicplayer.activities.ActivityMenuMain.java
com.kure.musicplayer.activities.ActivityMenuMusic.java
com.kure.musicplayer.activities.ActivityMenuPlaylist.java
com.kure.musicplayer.activities.ActivityMenuSettings.java
com.kure.musicplayer.activities.ActivityMenuYear.java
com.kure.musicplayer.activities.ActivityNowPlaying.java
com.kure.musicplayer.activities.ActivityQuit.java
com.kure.musicplayer.activities.XXX.java
com.kure.musicplayer.adapters.AdapterSong.java
com.kure.musicplayer.external.RemoteControlClientCompat.java
com.kure.musicplayer.external.RemoteControlHelper.java
com.kure.musicplayer.helpers.SingleToast.java
com.kure.musicplayer.model.Playlist.java
com.kure.musicplayer.model.SongList.java
com.kure.musicplayer.model.Song.java
com.kure.musicplayer.services.ServicePlayMusic.java
com.kure.musicplayer.services.ServiceScrobbleMusic.java
com.kure.musicplayer.kMP.java