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

Java AudioTrackInfo类代码示例

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

本文整理汇总了Java中com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo的典型用法代码示例。如果您正苦于以下问题:Java AudioTrackInfo类的具体用法?Java AudioTrackInfo怎么用?Java AudioTrackInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AudioTrackInfo类属于com.sedmelluq.discord.lavaplayer.track包,在下文中一共展示了AudioTrackInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: update

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
@Override
public void update() {
    if (MusicCommand.isIdle(guild) || !MusicCommand.existsTrackManager(trackManager)) {
        deleteThis();
        return;
    }
    final AudioTrack track = trackManager.getPlayer().getPlayingTrack();
    final AudioTrackInfo audioTrackInfo = track.getInfo();
    if (audioTrackInfo == null) {
        deleteThis();
        return;
    }
    final AudioQueue queue = trackManager.getAudioQueue();
    final AudioInfo next = queue.getNext();
    message.editMessage(Standard.getMessageEmbed(null, Standard.toBold("LIVE MUSIC INFO:"))
            .addField("Title", audioTrackInfo.title, false)
            .addField("Duration", String.format("`[%s / %s]`", MusicCommand.getTimestamp(track.getPosition()), MusicCommand.getTimestamp(track.getDuration())), false)
            .addField("Author", audioTrackInfo.author, false)
            .addField("Next Track", (next != null ? next.getTrack().getInfo().title : "None"), false)
            .addField("Volume", MusicCommand.getVolume(guild) + "%", false)
            .addField("Status", String.format("%s, %s", MusicCommand.isPaused(guild) ? "Paused" : "Playing", trackManager.getLoopType().getText()), false)
            .build()).queue();
}
 
开发者ID:Panzer1119,项目名称:Supreme-Bot,代码行数:24,代码来源:MusicMessageManager.java


示例2: formatTrackName

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
public static String formatTrackName(AudioTrackInfo info) {
	StringBuilder strBuilder = new StringBuilder();
	if("Unknown artist".equals(info.author)) {
		strBuilder.append(info.title);
	} else {
		strBuilder.append(info.author + " - " + info.title);
	}

	if(info.isStream) {
		strBuilder.append(" (Stream)");
	} else {
		strBuilder.append(" (" + FormatUtils.formatShortDuration(info.length) + ")");
	}

	return strBuilder.toString();
}
 
开发者ID:Shadorc,项目名称:Shadbot,代码行数:17,代码来源:FormatUtils.java


示例3: compareTracks

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
private boolean compareTracks(AudioTrack track1, AudioTrack track2) {
    if (Objects.equals(track1, track2)) {
        return true;
    }
    AudioTrackInfo info1 = track1.getInfo();
    AudioTrackInfo info2 = track2.getInfo();
    if (info1 != null && info2 != null) {
        return Objects.equals(info1.uri, info2.uri)
                && Objects.equals(info1.uri, info2.uri)
                && Objects.equals(info1.title, info2.title)
                && Objects.equals(info1.author, info2.author)
                && Objects.equals(info1.identifier, info2.identifier)
                && Objects.equals(info1.length, info2.length)
                && Objects.equals(info1.isStream, info2.isStream);
    }
    return Objects.equals(info1, info1);
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:18,代码来源:ValidationService.java


示例4: encodeTrack

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
@Override
public void encodeTrack(MessageOutput stream, AudioTrack track) throws IOException {
  DataOutput output = stream.startMessage();
  output.write(TRACK_INFO_VERSION);

  AudioTrackInfo trackInfo = track.getInfo();
  output.writeUTF(trackInfo.title);
  output.writeUTF(trackInfo.author);
  output.writeLong(trackInfo.length);
  output.writeUTF(trackInfo.identifier);
  output.writeBoolean(trackInfo.isStream);
  DataFormatTools.writeNullableText(output, trackInfo.uri);

  encodeTrackDetails(track, output);
  output.writeLong(track.getPosition());

  stream.commitMessage(TRACK_INFO_VERSIONED);
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:19,代码来源:DefaultAudioPlayerManager.java


示例5: decodeTrack

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
@Override
public DecodedTrackHolder decodeTrack(MessageInput stream) throws IOException {
  DataInput input = stream.nextMessage();
  if (input == null) {
    return null;
  }

  int version = (stream.getMessageFlags() & TRACK_INFO_VERSIONED) != 0 ? (input.readByte() & 0xFF) : 1;

  AudioTrackInfo trackInfo = new AudioTrackInfo(input.readUTF(), input.readUTF(), input.readLong(), input.readUTF(),
      input.readBoolean(), version >= 2 ? DataFormatTools.readNullableText(input) : null);
  AudioTrack track = decodeTrackDetails(trackInfo, input);
  long position = input.readLong();

  if (track != null) {
    track.setPosition(position);
  }

  stream.skipRemainingBytes();

  return new DecodedTrackHolder(track);
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:23,代码来源:DefaultAudioPlayerManager.java


示例6: loadItem

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
@Override
public AudioItem loadItem(DefaultAudioPlayerManager manager, AudioReference reference) {
  String streamName = getChannelIdentifierFromUrl(reference.identifier);
  if (streamName == null) {
    return null;
  }

  JsonBrowser channelInfo = fetchStreamChannelInfo(streamName);

  if (channelInfo == null) {
    return AudioReference.NO_TRACK;
  } else {
    final String displayName = channelInfo.get("display_name").text();
    final String status = channelInfo.get("status").text();

    return new TwitchStreamAudioTrack(new AudioTrackInfo(
        status,
        displayName,
        Long.MAX_VALUE,
        reference.identifier,
        true,
        reference.identifier
    ), this);
  }
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:26,代码来源:TwitchStreamAudioSourceManager.java


示例7: loadTrackFromPageContent

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
private AudioTrack loadTrackFromPageContent(String trackUrl, String content) throws IOException {
  JsonBrowser config = loadConfigJsonFromPageContent(content);

  if (config == null) {
    throw new FriendlyException("Track information not found on the page.", SUSPICIOUS, null);
  }

  return new VimeoAudioTrack(new AudioTrackInfo(
      config.get("clip").get("title").text(),
      config.get("owner").get("display_name").text(),
      (long) (config.get("clip").get("duration").get("raw").as(Double.class) * 1000.0),
      trackUrl,
      false,
      trackUrl
  ), this);
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:17,代码来源:VimeoAudioSourceManager.java


示例8: probe

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
@Override
public MediaContainerDetectionResult probe(AudioReference reference, SeekableInputStream inputStream) throws IOException {
  if (!checkNextBytes(inputStream, WAV_RIFF_HEADER)) {
    return null;
  }

  log.debug("Track {} is a WAV file.", reference.identifier);

  WavFileInfo fileInfo = new WavFileLoader(inputStream).parseHeaders();

  return new MediaContainerDetectionResult(this, new AudioTrackInfo(
      defaultOnNull(reference.title, UNKNOWN_TITLE),
      UNKNOWN_ARTIST,
      fileInfo.getDuration(),
      reference.identifier,
      false,
      reference.identifier
  ));
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:20,代码来源:WavContainerProbe.java


示例9: probe

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
@Override
public MediaContainerDetectionResult probe(AudioReference reference, SeekableInputStream stream) throws IOException {
  if (!checkNextBytes(stream, OGG_PAGE_HEADER)) {
    return null;
  }

  log.debug("Track {} is an OGG stream.", reference.identifier);

  return new MediaContainerDetectionResult(this, new AudioTrackInfo(
      reference.title != null ? reference.title : UNKNOWN_TITLE,
      UNKNOWN_ARTIST,
      Long.MAX_VALUE,
      reference.identifier,
      true,
      reference.identifier
  ));
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:18,代码来源:OggContainerProbe.java


示例10: probe

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
@Override
public MediaContainerDetectionResult probe(AudioReference reference, SeekableInputStream inputStream) throws IOException {
  if (!checkNextBytes(inputStream, EBML_TAG)) {
    return null;
  }

  log.debug("Track {} is a matroska file.", reference.identifier);

  MatroskaStreamingFile file = new MatroskaStreamingFile(inputStream);
  file.readFile();

  if (!hasSupportedAudioTrack(file)) {
    return new MediaContainerDetectionResult(this, "No supported audio tracks present in the file.");
  }

  return new MediaContainerDetectionResult(this, new AudioTrackInfo(UNKNOWN_TITLE, UNKNOWN_ARTIST,
      (long) file.getDuration(), reference.identifier, false, reference.identifier));
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:19,代码来源:MatroskaContainerProbe.java


示例11: probe

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
@Override
public MediaContainerDetectionResult probe(AudioReference reference, SeekableInputStream inputStream) throws IOException {
  AdtsStreamReader reader = new AdtsStreamReader(inputStream);

  if (reader.findPacketHeader(MediaContainerDetection.STREAM_SCAN_DISTANCE) == null) {
    return null;
  }

  log.debug("Track {} is an ADTS stream.", reference.identifier);

  return new MediaContainerDetectionResult(this, new AudioTrackInfo(
      reference.title != null ? reference.title : MediaContainerDetection.UNKNOWN_TITLE,
      MediaContainerDetection.UNKNOWN_ARTIST,
      Long.MAX_VALUE,
      reference.identifier,
      true,
      reference.identifier
  ));
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:20,代码来源:AdtsContainerProbe.java


示例12: probe

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
@Override
public MediaContainerDetectionResult probe(AudioReference reference, SeekableInputStream inputStream) throws IOException {
  if (!checkNextBytes(inputStream, FlacFileLoader.FLAC_CC)) {
    return null;
  }

  log.debug("Track {} is a FLAC file.", reference.identifier);

  FlacTrackInfo trackInfo = new FlacFileLoader(inputStream).parseHeaders();

  return new MediaContainerDetectionResult(this, new AudioTrackInfo(
      defaultOnNull(trackInfo.tags.get(TITLE_TAG), UNKNOWN_TITLE),
      defaultOnNull(trackInfo.tags.get(ARTIST_TAG), UNKNOWN_ARTIST),
      trackInfo.duration,
      reference.identifier,
      false,
      reference.identifier
  ));
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:20,代码来源:FlacContainerProbe.java


示例13: onQueue

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
public void onQueue(MessageChannel sourceChannel, BotContext context, List<TrackRequest> requests, int pageNum) {
    initLocale(sourceChannel);
    final int pageSize = 25;
    List<List<TrackRequest>> parts = Lists.partition(requests, pageSize);
    final int totalPages = parts.size();
    final int offset = (pageNum - 1) * pageSize + 1;

    final long totalDuration = requests.stream()
            .filter(Objects::nonNull)
            .map(TrackRequest::getTrack)
            .filter(Objects::nonNull)
            .mapToLong(AudioTrack::getDuration).sum();

    if (pageNum > totalPages) {
        onQueueError(sourceChannel, "discord.command.audio.queue.list.totalPages", parts.size());
        return;
    }
    List<TrackRequest> pageRequests = parts.get(pageNum - 1);

    EmbedBuilder builder = getQueueMessage();
    for (int i = 0; i < pageRequests.size(); i++) {
        TrackRequest request = pageRequests.get(i);
        AudioTrack track = request.getTrack();
        AudioTrackInfo info = track.getInfo();

        int rowNum = i + offset;
        String title = messageService.getMessage("discord.command.audio.queue.list.entry", rowNum,
                CommonUtils.formatDuration(track.getDuration()), rowNum == 1 ? ":musical_note: " : "",
                getTitle(info), info.uri, request.getMember().getEffectiveName());
        builder.addField(EmbedBuilder.ZERO_WIDTH_SPACE, title, false);
    }
    builder.setFooter(totalPages > 1
            ? messageService.getMessage("discord.command.audio.queue.list.pageFooter",
            pageNum, totalPages, requests.size(), CommonUtils.formatDuration(totalDuration),
            context.getConfig().getPrefix())
            : messageService.getMessage("discord.command.audio.queue.list.footer",
            requests.size(), CommonUtils.formatDuration(totalDuration)), null);
    messageService.sendMessageSilent(sourceChannel::sendMessage, builder.build());
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:40,代码来源:AudioMessageManager.java


示例14: getBasicMessage

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
private EmbedBuilder getBasicMessage(TrackRequest request) {
    AudioTrackInfo info = request.getTrack().getInfo();
    String thumbUrl = getThumbnail(info);

    EmbedBuilder builder = messageService.getBaseEmbed();
    builder.setTitle(getTitle(info), info.uri);
    builder.setAuthor(getArtist(info), info.uri, thumbUrl);
    builder.setThumbnail(thumbUrl);
    builder.setDescription(messageService.getMessage("discord.command.audio.queue.add"));
    return builder;
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:12,代码来源:AudioMessageManager.java


示例15: getThumbnail

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
private String getThumbnail(AudioTrackInfo info) {
    try {
        URI uri = new URI(info.uri);
        if (uri.getHost().contains("youtube.com") || uri.getHost().contains("youtu.be")) {
            return String.format("https://img.youtube.com/vi/%s/0.jpg", info.identifier);
        }
    } catch (URISyntaxException e) {
        // fall down
    }
    return null;
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:12,代码来源:AudioMessageManager.java


示例16: serialize

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
@Override
public JsonElement serialize(AudioTrack src, Type typeOfSrc, JsonSerializationContext context) {
    AudioTrackInfo info = src.getInfo();

    // Get meta data
    AudioTrackMetaData metaData = (AudioTrackMetaData) src.getUserData();

    // Parse votes to json array
    JsonArray votes = new JsonArray();
    for (Map.Entry<Integer, Byte> entry : metaData.getVotes().entrySet()) {
        JsonObject vote = new JsonObject();
        vote.addProperty(entry.getKey().toString(), entry.getValue());
        votes.add(vote);
    }

    JsonObject jsonTrack = new JsonObject();
    jsonTrack.addProperty("id", metaData.getTrackID());
    jsonTrack.addProperty("uri", info.uri);
    jsonTrack.addProperty("userID", metaData.getUserID());
    jsonTrack.addProperty("userName", metaData.getUserName());
    jsonTrack.addProperty("title", info.title);
    jsonTrack.add("voters", votes);
    jsonTrack.addProperty("votes", metaData.getVoteCount());
    jsonTrack.addProperty("length", info.length);
    jsonTrack.addProperty("position", src.getPosition());

    return jsonTrack;
}
 
开发者ID:VSETH-GECO,项目名称:BASS,代码行数:29,代码来源:AudioTrackSerializer.java


示例17: trackToJSON

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
private JSONObject trackToJSON(AudioTrack audioTrack) {
    AudioTrackInfo trackInfo = audioTrack.getInfo();

    return new JSONObject()
            .put("title", trackInfo.title)
            .put("author", trackInfo.author)
            .put("length", trackInfo.length)
            .put("identifier", trackInfo.identifier)
            .put("uri", trackInfo.uri)
            .put("isStream", trackInfo.isStream)
            .put("isSeekable", audioTrack.isSeekable())
            .put("position", audioTrack.getPosition());
}
 
开发者ID:Frederikam,项目名称:Lavalink,代码行数:14,代码来源:AudioLoaderRestHandler.java


示例18: decodeTrackDetails

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
/**
 * Decodes an audio track from a byte array.
 * @param trackInfo Track info for the track to decode
 * @param buffer Byte array containing the encoded track
 * @return Decoded audio track
 */
public AudioTrack decodeTrackDetails(AudioTrackInfo trackInfo, byte[] buffer) {
  try {
    DataInput input = new DataInputStream(new ByteArrayInputStream(buffer));
    return decodeTrackDetails(trackInfo, input);
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:15,代码来源:DefaultAudioPlayerManager.java


示例19: LocalAudioTrack

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
/**
 * @param trackInfo Track info
 * @param probe Probe for the media container of this track
 * @param sourceManager Source manager used to load this track
 */
public LocalAudioTrack(AudioTrackInfo trackInfo, MediaContainerProbe probe, LocalAudioSourceManager sourceManager) {
  super(trackInfo);

  this.file = new File(trackInfo.identifier);
  this.probe = probe;
  this.sourceManager = sourceManager;
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:13,代码来源:LocalAudioTrack.java


示例20: decodeTrack

import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; //导入依赖的package包/类
@Override
public AudioTrack decodeTrack(AudioTrackInfo trackInfo, DataInput input) throws IOException {
  String probeName = input.readUTF();

  for (MediaContainer container : MediaContainer.class.getEnumConstants()) {
    if (container.probe.getName().equals(probeName)) {
      return new LocalAudioTrack(trackInfo, container.probe, this);
    }
  }

  return null;
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:13,代码来源:LocalAudioSourceManager.java



注:本文中的com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java CancelDelegationTokenResponseProto类代码示例发布时间:2022-05-22
下一篇:
Java ViewHolder类代码示例发布时间: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