fix: format duration in rss feed

This commit is contained in:
Bnyro 2024-01-19 14:36:28 +01:00
parent 7b9e0ac432
commit 26844fcc1d

View File

@ -8,6 +8,7 @@ import me.kavin.piped.utils.obj.db.Channel;
import me.kavin.piped.utils.obj.db.Video;
import okhttp3.Request;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DurationFormatUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.hibernate.StatelessSession;
@ -86,7 +87,7 @@ public class ChannelHelpers {
entry.setTitle(video.getTitle());
entry.setPublishedDate(new Date(video.getUploaded()));
String contentText = String.format("Title: %s\nViews: %d\nId: %s\nDuration: %d\nIs YT Shorts: %b", video.getTitle(), video.getViews(), video.getId(), video.getDuration(), video.isShort());
String contentText = String.format("Title: %s\nViews: %d\nId: %s\nDuration: %s\nIs YT Shorts: %b", video.getTitle(), video.getViews(), video.getId(), DurationFormatUtils.formatDuration(video.getDuration() * 1000, "[HH]':'mm':'ss"), video.isShort());
content.setValue(contentText);
String thumbnailContent =