001/*
002 * Copyright (c) 2012, the Last.fm Java Project and Committers
003 * All rights reserved.
004 *
005 * Redistribution and use of this software in source and binary forms, with or without modification, are
006 * permitted provided that the following conditions are met:
007 *
008 * - Redistributions of source code must retain the above
009 *   copyright notice, this list of conditions and the
010 *   following disclaimer.
011 *
012 * - Redistributions in binary form must reproduce the above
013 *   copyright notice, this list of conditions and the
014 *   following disclaimer in the documentation and/or other
015 *   materials provided with the distribution.
016 *
017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
018 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
019 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
020 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
021 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
022 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
023 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
024 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
025 */
026
027package de.umass.lastfm.scrobble;
028
029/**
030 * Class that holds all available fields for scrobble (and now playing) requests.
031 *
032 * @author Adrian Woodhead
033 */
034public class ScrobbleData {
035
036  /**
037   * The artist name. Required for scrobbling and now playing.
038   */
039  private String artist;
040
041  /**
042   * The track name. Required for scrobbling and now playing.
043   */
044  private String track;
045
046  /**
047   * The time the track started playing, in UNIX timestamp format (integer number of seconds since 00:00:00, January 1st 1970 UTC). This must
048   * be in the UTC time zone. Required for scrobbling only.
049   */
050  private int timestamp = -1;
051
052  /**
053   * The length of the track in seconds. Optional.
054   */
055  private int duration = -1;
056
057  /**
058   * The album name. Optional.
059   */
060  private String album;
061
062  /**
063   * The album artist, if this differs from the track artist. Optional.
064   */
065  private String albumArtist;
066
067  /**
068   * The MusicBrainz track id. Optional.
069   */
070  private String musicBrainzId;
071
072  /**
073   * The position of the track on the album. Optional.
074   */
075  private int trackNumber = -1;
076
077  /**
078   * The stream id for this track if received from the radio.getPlaylist service. Optional.
079   */
080  private String streamId;
081
082  /**
083   * Set to true if the user chose this song, or false if the song was chosen by someone else (such as a radio station or recommendation
084   * service). Optional.
085   */
086  private boolean chosenByUser = true;
087
088  public ScrobbleData() {
089  }
090
091  public ScrobbleData(String artist, String track, int timestamp) {
092    this.artist = artist;
093    this.track = track;
094    this.timestamp = timestamp;
095  }
096
097  public ScrobbleData(String artist, String album, String track, int timestamp) {
098    this.artist = artist;
099    this.album = album;
100    this.track = track;
101    this.timestamp = timestamp;
102  }
103
104  public ScrobbleData(String artist, String track, int timestamp, int duration, String album, String albumArtist, String musicBrainzId,
105            int trackNumber, String streamId) {
106    this.artist = artist;
107    this.track = track;
108    this.timestamp = timestamp;
109    this.duration = duration;
110    this.album = album;
111    this.albumArtist = albumArtist;
112    this.musicBrainzId = musicBrainzId;
113    this.trackNumber = trackNumber;
114    this.streamId = streamId;
115  }
116
117  public ScrobbleData(String artist, String track, int timestamp, int duration, String album, String albumArtist, String musicBrainzId,
118      int trackNumber, String streamId, boolean chosenByUser) {
119    this.artist = artist;
120    this.track = track;
121    this.timestamp = timestamp;
122    this.duration = duration;
123    this.album = album;
124    this.albumArtist = albumArtist;
125    this.musicBrainzId = musicBrainzId;
126    this.trackNumber = trackNumber;
127    this.streamId = streamId;
128    this.chosenByUser = chosenByUser;
129  }
130
131  public String getArtist() {
132    return artist;
133  }
134
135  public void setArtist(String artist) {
136    this.artist = artist;
137  }
138
139  public String getTrack() {
140    return track;
141  }
142
143  public void setTrack(String track) {
144    this.track = track;
145  }
146
147  public int getTimestamp() {
148    return timestamp;
149  }
150
151  public void setTimestamp(int timestamp) {
152    this.timestamp = timestamp;
153  }
154
155  public int getDuration() {
156    return duration;
157  }
158
159  public void setDuration(int duration) {
160    this.duration = duration;
161  }
162
163  public String getAlbum() {
164    return album;
165  }
166
167  public void setAlbum(String album) {
168    this.album = album;
169  }
170
171  public String getAlbumArtist() {
172    return albumArtist;
173  }
174
175  public void setAlbumArtist(String albumArtist) {
176    this.albumArtist = albumArtist;
177  }
178
179  public String getMusicBrainzId() {
180    return musicBrainzId;
181  }
182
183  public void setMusicBrainzId(String musicBrainzId) {
184    this.musicBrainzId = musicBrainzId;
185  }
186
187  public int getTrackNumber() {
188    return trackNumber;
189  }
190
191  public void setTrackNumber(int trackNumber) {
192    this.trackNumber = trackNumber;
193  }
194
195  public String getStreamId() {
196    return streamId;
197  }
198
199  public void setStreamId(String streamId) {
200    this.streamId = streamId;
201  }
202
203  public boolean isChosenByUser() {
204    return chosenByUser;
205  }
206
207  public void setChosenByUser(boolean chosenByUser) {
208    this.chosenByUser = chosenByUser;
209  }
210
211  /*
212   * (non-Javadoc)
213   *
214   * @see java.lang.Object#toString()
215   */
216  @Override
217  public String toString() {
218    return "ScrobbleData [track=" + track + ", artist=" + artist + ", album=" + album + ", albumArtist=" + albumArtist + ", duration="
219        + duration + ", musicBrainzId=" + musicBrainzId + ", timestamp=" + timestamp + ", trackNumber=" + trackNumber
220        + ", streamId=" + streamId + ", chosenByUser=" + chosenByUser + "]";
221  }
222
223}