Compare commits
5 Commits
main
...
5b6862f678
| Author | SHA1 | Date | |
|---|---|---|---|
|
5b6862f678
|
|||
|
aef8980786
|
|||
|
2baa79c3a9
|
|||
|
95ca3d1a65
|
|||
|
973e588947
|
@ -1,5 +1,5 @@
|
||||
services:
|
||||
composer_backend:
|
||||
hls-proxy:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.dev
|
||||
|
||||
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.8</yt-dlp-java.version>
|
||||
<yt-dlp-java.version>2.0.7</yt-dlp-java.version>
|
||||
<record-builder.version>51</record-builder.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
|
||||
@ -38,7 +38,6 @@ public class TrackController {
|
||||
@ModelAttribute AddLocalTrackRequest request) throws ImportTrackException {
|
||||
var params = AddLocalTrackParamsBuilder.builder()
|
||||
.blob(new MultipartBlob(request.source()))
|
||||
.includeProgressHistory(true)
|
||||
.build();
|
||||
TrackResponse response = trackService.addLocalTrack(user, playlistId, params);
|
||||
return ResponseEntity.ok(response);
|
||||
|
||||
@ -31,7 +31,7 @@ public abstract class BaseTrackProgress {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
public Long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
|
||||
@ -4,19 +4,17 @@ 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, String playlistTitle) {
|
||||
public PlaylistProgress(long playlistId, long trackSourceId, long userId, int trackCount) {
|
||||
super(playlistId, trackSourceId, userId);
|
||||
this.setType(ProgressEntryType.PLAYLIST);
|
||||
this.status = ProgressStatus.LOADING;
|
||||
this.trackCount = trackCount;
|
||||
this.playlistTitle = playlistTitle;
|
||||
}
|
||||
|
||||
public String getYtdlnStdout() {
|
||||
@ -47,8 +45,4 @@ public class PlaylistProgress extends BaseTrackProgress {
|
||||
return trackCount;
|
||||
}
|
||||
|
||||
public String getPlaylistTitle() {
|
||||
return playlistTitle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ 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;
|
||||
@ -137,14 +136,8 @@ 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(), playlistTitle);
|
||||
videoInfos.size());
|
||||
redisProgressService.saveProgress(playlistProgress);
|
||||
|
||||
var response = YtDlp.execute(ytDlpRequest, (downloadProgress, ignored) -> {
|
||||
@ -156,8 +149,7 @@ public class YoutubeTrackService {
|
||||
}, stdoutLine -> {
|
||||
redisProgressService.<PlaylistProgress>updateTrackProgressField(playlistId, trackSource.getId(), userId,
|
||||
progress -> {
|
||||
String previousStdout = progress.getYtdlnStdout() == null ? "" : progress.getYtdlnStdout();
|
||||
progress.setYtdlnStdout(previousStdout + stdoutLine);
|
||||
progress.setYtdlnStdout(String.join("\n", progress.getYtdlnStdout(), stdoutLine));
|
||||
});
|
||||
}, null);
|
||||
redisProgressService.<PlaylistProgress>updateTrackProgressField(playlistId, trackSource.getId(), userId,
|
||||
@ -169,7 +161,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() - 2);
|
||||
logger.info("downloaded file count {}", downloadedFiles.size());
|
||||
|
||||
for (Path path : downloadedFiles) {
|
||||
if (Files.isDirectory(path))
|
||||
|
||||
Reference in New Issue
Block a user