Add playlistTitle, bump yt-dlp-java version
This commit is contained in:
2
pom.xml
2
pom.xml
@ -35,7 +35,7 @@
|
||||
<apache-tika.version>3.2.3</apache-tika.version>
|
||||
<springdoc-openapi.version>2.8.5</springdoc-openapi.version>
|
||||
<jaffree.version>2024.08.29</jaffree.version>
|
||||
<yt-dlp-java.version>2.0.7</yt-dlp-java.version>
|
||||
<yt-dlp-java.version>2.0.8</yt-dlp-java.version>
|
||||
<record-builder.version>51</record-builder.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
|
||||
@ -31,7 +31,7 @@ public abstract class BaseTrackProgress {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getTimestamp() {
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
|
||||
@ -4,17 +4,19 @@ public class PlaylistProgress extends BaseTrackProgress {
|
||||
private String ytdlnStdout;
|
||||
private int overallProgress;
|
||||
private int trackCount;
|
||||
private String playlistTitle;
|
||||
private ProgressStatus status;
|
||||
|
||||
PlaylistProgress() {
|
||||
super(0, 0, 0);
|
||||
}
|
||||
|
||||
public PlaylistProgress(long playlistId, long trackSourceId, long userId, int trackCount) {
|
||||
public PlaylistProgress(long playlistId, long trackSourceId, long userId, int trackCount, String playlistTitle) {
|
||||
super(playlistId, trackSourceId, userId);
|
||||
this.setType(ProgressEntryType.PLAYLIST);
|
||||
this.status = ProgressStatus.LOADING;
|
||||
this.trackCount = trackCount;
|
||||
this.playlistTitle = playlistTitle;
|
||||
}
|
||||
|
||||
public String getYtdlnStdout() {
|
||||
@ -45,4 +47,8 @@ public class PlaylistProgress extends BaseTrackProgress {
|
||||
return trackCount;
|
||||
}
|
||||
|
||||
public String getPlaylistTitle() {
|
||||
return playlistTitle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Stream;
|
||||
@ -136,8 +137,14 @@ public class YoutubeTrackService {
|
||||
ytDlpRequest.setOption("audio-format", "best");
|
||||
ytDlpRequest.setOption("no-overwrites");
|
||||
|
||||
String playlistTitle = videoInfos.stream()
|
||||
.map(VideoInfo::getExtraProperties)
|
||||
.filter(Objects::nonNull)
|
||||
.map(v -> String.valueOf(v.getOrDefault("playlist_title", ""))).findFirst()
|
||||
.orElse("");
|
||||
|
||||
PlaylistProgress playlistProgress = new PlaylistProgress(playlistId, trackSource.getId(), userId,
|
||||
videoInfos.size());
|
||||
videoInfos.size(), playlistTitle);
|
||||
redisProgressService.saveProgress(playlistProgress);
|
||||
|
||||
var response = YtDlp.execute(ytDlpRequest, (downloadProgress, ignored) -> {
|
||||
@ -162,7 +169,7 @@ public class YoutubeTrackService {
|
||||
|
||||
try (Stream<Path> pathStream = Files.walk(temporaryFolder)) {
|
||||
List<Path> downloadedFiles = Files.walk(temporaryFolder).toList();
|
||||
logger.info("downloaded file count {}", downloadedFiles.size());
|
||||
logger.info("downloaded file count {}", downloadedFiles.size() - 2);
|
||||
|
||||
for (Path path : downloadedFiles) {
|
||||
if (Files.isDirectory(path))
|
||||
|
||||
Reference in New Issue
Block a user