Skip to content
This repository was archived by the owner on Apr 9, 2021. It is now read-only.

Add minitutoruial + video titles to export #626

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public class PasteServiceConstants {
static final Pattern PASTEBIN_PATTERN = Pattern
.compile("^(?:(?:https?://)?(?:www\\.)?)?pastebin\\.com/(?:raw/)?(\\w+)(?:\\..+)?$");

static final String EXPORT_COMMENTS = "###.*";

static final Map<String, String> PASTE_SERVICE_URLS;

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ private List<String> loadAndParseTrackIds(String serviceName, String pasteId) {
"Couldn't load playlist. Either " + serviceName + " is down or the playlist does not exist.",
FriendlyException.Severity.FAULT, ex);
}

response = response.replaceAll(PasteServiceConstants.EXPORT_COMMENTS, "");

String[] unfiltered = response.split("\\s");
ArrayList<String> filtered = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ public void onInvoke(@Nonnull CommandContext context) {
throw new MessagingException(context.i18n("exportEmpty"));
}

String out = player.getRemainingTracks().stream()
.map(atc -> atc.getTrack().getInfo().uri)
String hint = "### " + context.i18n("exportPlaylistHint").replaceAll("\n", "\n### ");
String list = player.getRemainingTracks().stream()
.map(atc -> atc.getTrack().getInfo().uri + " ### " + atc.getTrack().getInfo().title)
.collect(Collectors.joining("\n"));

String out = hint + "\n" + list;

TextUtils.postToPasteService(out)
.thenApply(pasteUrl -> {
if (pasteUrl.isPresent()) {
Expand Down
1 change: 1 addition & 0 deletions FredBoat/src/main/resources/lang/en_US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ volumeSuccess=Changed volume from **{0}%** to **{1}%**.
exportEmpty=Nothing to export, the queue is empty.
exportPlaylistResulted=Exported playlist\: {0}\nYou can provide this URL to play the current playlist later.
exportPlaylistFail=Failed to upload playlist to paste services.
exportPlaylistHint=Use the play command with this link in order to queue the tracks below (;;play [link to this]).\nIf you wish to add songs manually, you may copy this and use pastebin/hastebin.com.\nKeep in mind that your song names have to be be prefixed with ###.
listShowShuffled=Showing shuffled playlist.
listShowRepeatSingle=Repeating current track.
listShowRepeatAll=Repeating current queue.
Expand Down