本文整理汇总了Java中de.umass.lastfm.Track类的典型用法代码示例。如果您正苦于以下问题:Java Track类的具体用法?Java Track怎么用?Java Track使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Track类属于de.umass.lastfm包,在下文中一共展示了Track类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: scrobble
import de.umass.lastfm.Track; //导入依赖的package包/类
public List<ScrobbleResult> scrobble(Session session) throws IOException {
File file = new File(cacheDir, SUBMISSIONS_FILE);
List<ScrobbleResult> result = new ArrayList<ScrobbleResult>();
if (file.exists()) {
BufferedReader r = new BufferedReader(new FileReader(file));
List<ScrobbleData> list = new ArrayList<ScrobbleData>(50);
String line;
while ((line = r.readLine()) != null) {
ScrobbleData d = decodeScrobbleData(line);
list.add(d);
if (list.size() == 50) {
result.addAll(Track.scrobble(list, session));
list.clear();
}
}
if (list.size() > 0)
result.addAll(Track.scrobble(list, session));
r.close();
FileWriter w = new FileWriter(file);
w.close();
}
return result;
}
开发者ID:kawaiiDango,项目名称:pScrobbler,代码行数:24,代码来源:FileSystemCache.java
示例2: scrobbleTracks
import de.umass.lastfm.Track; //导入依赖的package包/类
/**
* Submits the specified scrobbles to the Last.fm API for the current user.
*
* @param scrobbles the list of scrobbles to submit. Must be 50 or fewer items.
* @param callback the callback which will be invoked with the results of the submissions, with a
* list of {@link Result} as the message payload.
*/
public void scrobbleTracks(List<Scrobble> scrobbles, Handler.Callback callback) {
Preconditions.checkArgument(
scrobbles.size() <= 50, "Cannot submit more than 50 scrobbles at once");
final ScrobbleData[] scrobbleData = new ScrobbleData[scrobbles.size()];
for (int i = 0; i < scrobbles.size(); i++) {
Scrobble scrobble = scrobbles.get(i);
com.peterjosling.scroball.Track track = scrobble.track();
ScrobbleData data = new ScrobbleData(track.artist(), track.track(), scrobble.timestamp());
if (track.album().isPresent()) {
data.setAlbum(track.album().get());
}
if (track.albumArtist().isPresent()) {
data.setAlbumArtist(track.albumArtist().get());
}
if (track.duration().isPresent() && track.duration().get() > 0) {
data.setDuration((int) (track.duration().get() / 1000));
}
scrobbleData[i] = data;
}
new ScrobbleTracksTask(api, session, callback).execute(scrobbleData);
}
开发者ID:peterjosling,项目名称:scroball,代码行数:31,代码来源:LastfmClient.java
示例3: onPostExecute
import de.umass.lastfm.Track; //导入依赖的package包/类
@Override
protected void onPostExecute(Track updatedTrack) {
Message message = Message.obtain();
if (updatedTrack != null) {
com.peterjosling.scroball.Track.Builder builder =
com.peterjosling.scroball.Track.builder()
.artist(track.artist())
.track(track.track())
.duration(updatedTrack.getDuration() * 1000);
if (track.album().isPresent()) {
builder.album(track.album().get());
} else if (updatedTrack.getAlbum() != null) {
builder.album(updatedTrack.getAlbum());
}
message.obj = builder.build();
}
callback.handleMessage(message);
}
开发者ID:peterjosling,项目名称:scroball,代码行数:22,代码来源:LastfmClient.java
示例4: getTopSongs
import de.umass.lastfm.Track; //导入依赖的package包/类
/**
* Returns top songs for the given artist, using last.fm REST API.
*
* @param artistName The artist name.
* @param count Max number of songs to return.
* @param musicFolders Only return songs present in these folders.
* @return Top songs for artist.
*/
public List<MediaFile> getTopSongs(String artistName, int count, List<MusicFolder> musicFolders) {
try {
if (StringUtils.isBlank(artistName) || count <= 0) {
return Collections.emptyList();
}
List<MediaFile> result = new ArrayList<MediaFile>();
for (Track topTrack : Artist.getTopTracks(artistName, LAST_FM_KEY)) {
MediaFile song = mediaFileDao.getSongByArtistAndTitle(artistName, topTrack.getName(), musicFolders);
if (song != null) {
result.add(song);
if (result.size() == count) {
return result;
}
}
}
return result;
} catch (Throwable x) {
LOG.warn("Failed to find top songs for " + artistName, x);
return Collections.emptyList();
}
}
开发者ID:sindremehus,项目名称:subsonic,代码行数:31,代码来源:LastFmService.java
示例5: scrobble
import de.umass.lastfm.Track; //导入依赖的package包/类
public List<ScrobbleResult> scrobble(Session session) throws IOException {
File file = new File(cacheDir, SUBMISSIONS_FILE);
List<ScrobbleResult> result = new ArrayList<ScrobbleResult>();
if (file.exists()) {
BufferedReader r = new BufferedReader(new FileReader(file));
List<ScrobbleData> list = new ArrayList<ScrobbleData>(50);
String line;
while ((line = r.readLine()) != null) {
ScrobbleData d = decodeScrobbleData(line);
list.add(d);
if (list.size() == 50) {
result.addAll(Track.scrobble(list, session));
list.clear();
}
}
if (list.size() > 0)
result.addAll(Track.scrobble(list, session));
r.close();
FileWriter w = new FileWriter(file);
w.close();
}
return result;
}
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:24,代码来源:FileSystemCache.java
示例6: doInBackground
import de.umass.lastfm.Track; //导入依赖的package包/类
@Override
protected ScrobbleResult doInBackground(com.peterjosling.scroball.Track... params) {
com.peterjosling.scroball.Track track = params[0];
try {
return api.updateNowPlaying(track.artist(), track.track(), session);
} catch (CallException e) {
Log.d(TAG, "Failed to update now playing status", e);
}
return null;
}
开发者ID:peterjosling,项目名称:scroball,代码行数:11,代码来源:LastfmClient.java
示例7: getTrackInfo
import de.umass.lastfm.Track; //导入依赖的package包/类
public void getTrackInfo(com.peterjosling.scroball.Track track, Handler.Callback callback) {
new GetTrackInfoTask(session, callback).execute(track);
}
开发者ID:peterjosling,项目名称:scroball,代码行数:4,代码来源:LastfmClient.java
示例8: getTrackInfo
import de.umass.lastfm.Track; //导入依赖的package包/类
/**
* @see Track#getInfo(String, String, String)
*/
public Track getTrackInfo(String artist, String trackOrMbid, String apiKey) {
return Track.getInfo(artist, trackOrMbid, apiKey);
}
开发者ID:peterjosling,项目名称:scroball,代码行数:7,代码来源:LastfmApi.java
示例9: scrobble
import de.umass.lastfm.Track; //导入依赖的package包/类
/**
* @see Track#scrobble(List, Session)
*/
public List<ScrobbleResult> scrobble(List<ScrobbleData> scrobbleData, Session session) {
return Track.scrobble(scrobbleData, session);
}
开发者ID:peterjosling,项目名称:scroball,代码行数:7,代码来源:LastfmApi.java
示例10: updateNowPlaying
import de.umass.lastfm.Track; //导入依赖的package包/类
/**
* @see Track#updateNowPlaying(String, String, Session)
*/
public ScrobbleResult updateNowPlaying(String artistName, String trackName, Session session) {
return Track.updateNowPlaying(artistName, trackName, session);
}
开发者ID:peterjosling,项目名称:scroball,代码行数:7,代码来源:LastfmApi.java
示例11: scrobble
import de.umass.lastfm.Track; //导入依赖的package包/类
public ScrobbleResult scrobble(String artist, String title, int time, Session session) {
return Track.scrobble(artist, title, time, session);
}
开发者ID:josdem,项目名称:jmetadata,代码行数:4,代码来源:LastFMTrackHelper.java
示例12: updateNowPlaying
import de.umass.lastfm.Track; //导入依赖的package包/类
/**
* Updates the user's Now Playing status on the Last.fm API.
*
* @param track the track to take metadata from. Only track and artist will be used.
* @param callback the callback which will be invoked with the request result, with a {@link
* Result} as the message payload.
*/
public void updateNowPlaying(com.peterjosling.scroball.Track track, Handler.Callback callback) {
new UpdateNowPlayingTask(api, session, callback).execute(track);
}
开发者ID:peterjosling,项目名称:scroball,代码行数:11,代码来源:LastfmClient.java
注:本文中的de.umass.lastfm.Track类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论