diff --git a/FredBoat/src/main/java/fredboat/audio/source/PasteServiceConstants.java b/FredBoat/src/main/java/fredboat/audio/source/PasteServiceConstants.java index affcb6152..34361c2ca 100644 --- a/FredBoat/src/main/java/fredboat/audio/source/PasteServiceConstants.java +++ b/FredBoat/src/main/java/fredboat/audio/source/PasteServiceConstants.java @@ -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 PASTE_SERVICE_URLS; static { diff --git a/FredBoat/src/main/java/fredboat/audio/source/PlaylistImportSourceManager.java b/FredBoat/src/main/java/fredboat/audio/source/PlaylistImportSourceManager.java index cddbc768e..8dd172f85 100644 --- a/FredBoat/src/main/java/fredboat/audio/source/PlaylistImportSourceManager.java +++ b/FredBoat/src/main/java/fredboat/audio/source/PlaylistImportSourceManager.java @@ -161,6 +161,8 @@ private List 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 filtered = new ArrayList<>(); diff --git a/FredBoat/src/main/java/fredboat/command/music/info/ExportCommand.java b/FredBoat/src/main/java/fredboat/command/music/info/ExportCommand.java index ec9d1c4fd..7a5b55aad 100644 --- a/FredBoat/src/main/java/fredboat/command/music/info/ExportCommand.java +++ b/FredBoat/src/main/java/fredboat/command/music/info/ExportCommand.java @@ -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()) { diff --git a/FredBoat/src/main/resources/lang/en_US.properties b/FredBoat/src/main/resources/lang/en_US.properties index 83c55f948..4a30d7143 100644 --- a/FredBoat/src/main/resources/lang/en_US.properties +++ b/FredBoat/src/main/resources/lang/en_US.properties @@ -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.