当前位置: 首页>>代码示例>>Java>>正文


Java AudioTrack.getInfo方法代码示例

本文整理汇总了Java中com.sedmelluq.discord.lavaplayer.track.AudioTrack.getInfo方法的典型用法代码示例。如果您正苦于以下问题:Java AudioTrack.getInfo方法的具体用法?Java AudioTrack.getInfo怎么用?Java AudioTrack.getInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sedmelluq.discord.lavaplayer.track.AudioTrack的用法示例。


在下文中一共展示了AudioTrack.getInfo方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: update

import com.sedmelluq.discord.lavaplayer.track.AudioTrack; //导入方法依赖的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: canQueueTrack

import com.sedmelluq.discord.lavaplayer.track.AudioTrack; //导入方法依赖的package包/类
private boolean canQueueTrack(AudioTrack track, long requesterID) {
    final int trackLength = (int) Math.ceil(track.getDuration() / 1000);
    final int requesterTier = permissions.getTierLevel(requesterID);

    /* 7500 = ~ 2 hours
     * 18500 = ~ 5 hours
     */

    int maxTrackDuration = 7500;
    if (requesterTier == 1)
        maxTrackDuration = 18500;
    if (requesterTier >= 2)
        maxTrackDuration = Integer.MAX_VALUE;

    return !JukeBot.limitationsEnabled || (track.getInfo().isStream && requesterTier != 0) || trackLength <= maxTrackDuration;
}
 
开发者ID:Devoxin,项目名称:JukeBot,代码行数:17,代码来源:SongResultHandler.java

示例3: onTrackStart

import com.sedmelluq.discord.lavaplayer.track.AudioTrack; //导入方法依赖的package包/类
@Override
public void onTrackStart(AudioPlayer player, AudioTrack track) {
	TextChannel ch;
	if (GuildObject.guildMap.get(this.guildId).getSpecialChannels().getMusic().isEmpty()) {
		return;
	}
	if((ch = Bot.getInstance().shards
			.getTextChannelById(GuildObject.guildMap.get(this.guildId)
					.getSpecialChannels().getMusic())) != null) {
		if (!track.getInfo().isStream) {
			EmbedBuilder em = new EmbedBuilder();
			em.setTitle("New track: " + track.getInfo().title, track.getInfo().uri)
			.setColor(Color.MAGENTA)
			.setDescription(String.format("%s, **%s** is now playing\n"
					+ "%s", this.currentSong.getQueuer().getAsMention(),
					track.getInfo().title, track.getInfo().uri));
			ch.sendMessage(em.build()).queue();
		}
	}
}
 
开发者ID:paul-io,项目名称:momo-2,代码行数:21,代码来源:GuildTrackManager.java

示例4: compareTracks

import com.sedmelluq.discord.lavaplayer.track.AudioTrack; //导入方法依赖的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

示例5: getTrackName

import com.sedmelluq.discord.lavaplayer.track.AudioTrack; //导入方法依赖的package包/类
public static String getTrackName(AudioTrack track) {
	String sourceName = track.getSourceManager().getSourceName();
	if(sourceName.equals("local") || sourceName.equals("http")) {
		return track.getIdentifier();
	} else {
		return track.getInfo().title;
	}
}
 
开发者ID:Bleuzen,项目名称:Blizcord,代码行数:9,代码来源:Utils.java

示例6: handleTrackLoadedEvent

import com.sedmelluq.discord.lavaplayer.track.AudioTrack; //导入方法依赖的package包/类
private void handleTrackLoadedEvent(Message message, GuildTransformer guild, PlaylistTransformer playlist, AudioTrack track) {
    if (track.getInfo().isStream) {
        MessageFactory.makeWarning(message, "You can't add livestreams to a playlist!").queue();
        return;
    }

    playlist.addSong(
        track.getInfo().title,
        NumberUtil.formatTime(track.getDuration()),
        track.getInfo().uri
    );

    try {
        avaire.getDatabase().newQueryBuilder(Constants.MUSIC_PLAYLIST_TABLE_NAME)
            .where("id", playlist.getId()).andWhere("guild_id", message.getGuild().getId())
            .update(statement -> {
                statement.set("songs", AvaIre.GSON.toJson(playlist.getSongs()));
                statement.set("amount", playlist.getSongs().size());
            });

        avaire.getCache().getAdapter(CacheType.MEMORY)
            .forget(PlaylistController.getCacheString(message.getGuild()));

        MessageFactory.makeSuccess(message, ":user has added [:name](:url) to the `:playlist` playlist.\nThe `:playlist` playlist has `:slots` more song slots available.")
            .set("name", track.getInfo().title)
            .set("url", track.getInfo().uri)
            .set("playlist", playlist.getName())
            .set("slots", guild.getType().getLimits().getPlaylist().getSongs() - playlist.getSongs().size())
            .queue();
    } catch (SQLException e) {
        e.printStackTrace();

        MessageFactory.makeError(message, "Something went wrong while trying to save the playlist: " + e.getMessage()).queue();
    }
}
 
开发者ID:avaire,项目名称:avaire,代码行数:36,代码来源:AddSongToPlaylist.java

示例7: onQueue

import com.sedmelluq.discord.lavaplayer.track.AudioTrack; //导入方法依赖的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

示例8: getTextProgress

import com.sedmelluq.discord.lavaplayer.track.AudioTrack; //导入方法依赖的package包/类
private String getTextProgress(AudioTrack track) {
    StringBuilder builder = new StringBuilder(CommonUtils.formatDuration(track.getPosition()));
    if (!track.getInfo().isStream) {
        builder.append("/").append(CommonUtils.formatDuration(track.getDuration()));
    } else {
        builder.append(" (")
                .append(messageService.getMessage("discord.command.audio.panel.stream"))
                .append(")");
    }
    return builder.toString();
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:12,代码来源:AudioMessageManager.java

示例9: serialize

import com.sedmelluq.discord.lavaplayer.track.AudioTrack; //导入方法依赖的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

示例10: trackToJSON

import com.sedmelluq.discord.lavaplayer.track.AudioTrack; //导入方法依赖的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


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