X-Git-Url: https://git.pterodactylus.net/?p=sonitus.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsonitus%2Fdata%2FMetadata.java;h=91acad4c96e333340d845df1d7e3d38a2f92bf0f;hp=0903457a4333d3f27175445da40c3abfe5e56b37;hb=2daf7a2adb65ea869e85326cff512e0410e1a257;hpb=be40b55ee6886b1524e1a6b23fabfe6d03847f78 diff --git a/src/main/java/net/pterodactylus/sonitus/data/Metadata.java b/src/main/java/net/pterodactylus/sonitus/data/Metadata.java index 0903457..91acad4 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/Metadata.java +++ b/src/main/java/net/pterodactylus/sonitus/data/Metadata.java @@ -202,6 +202,37 @@ public class Metadata { return new Metadata(formatMetadata, contentMetadata.title(title)); } + /** + * Returns the comment of the content, if any. + * + * @return The comment of the content + */ + public Optional comment() { + return contentMetadata.comment(); + } + + /** + * Returns new metadata with the same attributes as this metadata but with the + * comment changed to the given comment. + * + * @param comment + * The new comment + * @return The new metadata + */ + public Metadata comment(String comment) { + return new Metadata(formatMetadata, contentMetadata.comment(comment)); + } + + /** + * Returns the title with the comment appended in parantheses, if a comment has + * been set. + * + * @return The title with the comment appended + */ + public String fullTitle() { + return String.format("%s%s", title(), comment().isPresent() ? String.format(" (%s)", comment().get()) : ""); + } + // // OBJECT METHODS //