Skip to content

Commit

Permalink
Merge pull request #149 from wushuo894/test
Browse files Browse the repository at this point in the history
1.1.222
  • Loading branch information
wushuo894 authored Jan 19, 2025
2 parents 7eb6599 + 35b7eb1 commit 6951036
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/main/java/ani/rss/util/TorrentUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,35 @@ public static void deleteBackRss(Ani ani, Item item) {

List<File> downloadPathList = getDownloadPath(ani);

List<TorrentsInfo> torrentsInfos = getTorrentsInfos();

for (File file : downloadPathList) {
String finalReName = reName;
TorrentsInfo backRSS = torrentsInfos
.stream()
.filter(torrentsInfo -> {
if (!torrentsInfo.getDownloadDir().equals(FileUtil.getAbsolutePath(file.toString()))) {
return false;
}
if (!ReUtil.contains(StringEnum.SEASON_REG, torrentsInfo.getName())) {
return false;
}
String s = ReUtil.get(StringEnum.SEASON_REG, torrentsInfo.getName(), 0);
return s.equals(finalReName);
})
.findFirst()
.orElse(null);
if (Objects.nonNull(backRSS)) {
TorrentUtil.delete(backRSS, true, true);
}
}

List<File> files = downloadPathList.stream()
.filter(File::exists)
.filter(File::isDirectory)
.flatMap(downloadPath -> Stream.of(ObjectUtil.defaultIfNull(downloadPath.listFiles(), new File[]{})))
.collect(Collectors.toList());

for (File file : files) {
String fileMainName = FileUtil.mainName(file);
if (StrUtil.isBlank(fileMainName)) {
Expand Down

0 comments on commit 6951036

Please sign in to comment.