• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Track类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BridgeEventType类代码示例发布时间:2022-05-22
下一篇:
Java RoundUtils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap