mirror of
https://github.com/openeggbert/youtubedl-frontend.git
synced 2025-03-26 09:39:23 +01:00
Formatting code
This commit is contained in:
parent
66c89e1c72
commit
712c876c71
@ -90,15 +90,18 @@ public class Main {
|
|||||||
StringBuilder oneChannelStringBuilder = createChannelHtml(null, channels, argsInstance, channelUrls, youtubeVideos, archiveBoxRootDirectory, videosDirectory, archiveBoxArchiveDirectory);
|
StringBuilder oneChannelStringBuilder = createChannelHtml(null, channels, argsInstance, channelUrls, youtubeVideos, archiveBoxRootDirectory, videosDirectory, archiveBoxArchiveDirectory);
|
||||||
Utils.writeTextToFile(oneChannelStringBuilder.toString(), videosHtmlFile);
|
Utils.writeTextToFile(oneChannelStringBuilder.toString(), videosHtmlFile);
|
||||||
|
|
||||||
|
|
||||||
System.out.println("[Warning] Snapshots without videos:");
|
System.out.println("[Warning] Snapshots without videos:");
|
||||||
YoutubeVideo.missingYoutubeVideos.forEach(s -> System.out.println(s));
|
YoutubeVideo.missingYoutubeVideos.forEach(s -> System.out.println(s));
|
||||||
System.out.println("Total duration: " + ((int) ((((double) YoutubeVideo.totalDurationInMilliseconds) / 1000d / 60d / 60d))) + " hours");
|
System.out.println("Total duration: " + ((int) ((((double) YoutubeVideo.totalDurationInMilliseconds) / 1000d / 60d / 60d))) + " hours");
|
||||||
youtubeVideos.stream().sorted((YoutubeVideo o1, YoutubeVideo o2) -> Long.valueOf(o1.getVideoDurationInMilliseconds()).compareTo(o2.getVideoDurationInMilliseconds()))
|
youtubeVideos.stream().sorted((YoutubeVideo o1, YoutubeVideo o2) -> Long.valueOf(o1.getVideoDurationInMilliseconds()).compareTo(o2.getVideoDurationInMilliseconds()))
|
||||||
.forEach(y-> {System.out.println(y.getVideoDurationInMinutes() + " = minutes \t" + "https://youtube.com/watch?v=" + y.getId() + "\t" + y.getTitle());});
|
.forEach(y -> {
|
||||||
|
System.out.println(y.getVideoDurationInMinutes() + " = minutes \t" + "https://youtube.com/watch?v=" + y.getId() + "\t" + y.getTitle());
|
||||||
|
});
|
||||||
System.out.println("\n\n\n\n");
|
System.out.println("\n\n\n\n");
|
||||||
youtubeVideos.stream().sorted((YoutubeVideo o1, YoutubeVideo o2) -> Long.valueOf(o1.getVideoFileSizeInBytes()).compareTo(o2.getVideoFileSizeInBytes()))
|
youtubeVideos.stream().sorted((YoutubeVideo o1, YoutubeVideo o2) -> Long.valueOf(o1.getVideoFileSizeInBytes()).compareTo(o2.getVideoFileSizeInBytes()))
|
||||||
.forEach(y-> {System.out.println(y.getVideoFileSizeInMegaBytes()+ " MB \t" + "https://youtube.com/watch?v=" + y.getId() + "\t" + y.getTitle());});
|
.forEach(y -> {
|
||||||
|
System.out.println(y.getVideoFileSizeInMegaBytes() + " MB \t" + "https://youtube.com/watch?v=" + y.getId() + "\t" + y.getTitle());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static StringBuilder createChannelHtml(String wantedChannelName, List<String> channels, Args argsInstance, Map<String, String> channelUrls, List<YoutubeVideo> youtubeVideos, File archiveBoxRootDirectory, File videosDirectory, File archiveBoxArchiveDirectory) {
|
private static StringBuilder createChannelHtml(String wantedChannelName, List<String> channels, Args argsInstance, Map<String, String> channelUrls, List<YoutubeVideo> youtubeVideos, File archiveBoxRootDirectory, File videosDirectory, File archiveBoxArchiveDirectory) {
|
||||||
|
@ -51,6 +51,7 @@ public class Utils {
|
|||||||
|
|
||||||
public static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
public static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||||
public static final NumberFormat TWO_DECIMAL_POINTS_FORMATTER = new DecimalFormat("#0.00");
|
public static final NumberFormat TWO_DECIMAL_POINTS_FORMATTER = new DecimalFormat("#0.00");
|
||||||
|
|
||||||
private Utils() {
|
private Utils() {
|
||||||
//Not meant to be instantiated.
|
//Not meant to be instantiated.
|
||||||
}
|
}
|
||||||
|
@ -328,6 +328,7 @@ public class YoutubeVideo implements Comparable<YoutubeVideo> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static long totalDurationInMilliseconds = 0l;
|
public static long totalDurationInMilliseconds = 0l;
|
||||||
|
|
||||||
public static List<YoutubeVideo> loadYoutubeVideos(File archiveBoxArchiveDirectory, Args argsInstance) throws IOException, InterruptedException {
|
public static List<YoutubeVideo> loadYoutubeVideos(File archiveBoxArchiveDirectory, Args argsInstance) throws IOException, InterruptedException {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
List<YoutubeVideo> youtubeVideos = new ArrayList<>();
|
List<YoutubeVideo> youtubeVideos = new ArrayList<>();
|
||||||
@ -394,6 +395,7 @@ public class YoutubeVideo implements Comparable<YoutubeVideo> {
|
|||||||
}
|
}
|
||||||
return youtubeVideos;
|
return youtubeVideos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getVideoDurationInMilliseconds() {
|
public long getVideoDurationInMilliseconds() {
|
||||||
String duration = videoDuration;
|
String duration = videoDuration;
|
||||||
String[] array = duration.split(":");
|
String[] array = duration.split(":");
|
||||||
|
@ -110,7 +110,6 @@ public class YoutubeVideoHtml {
|
|||||||
|
|
||||||
videoHtml.append("<button ").append(backEnabled ? "" : "disabled").append(" style=\"").append(backEnabled ? "" : "visibility:hidden;").append("font-size:200%;\" onclick=\"window.location ='").append("./").append(youtubeVideo.getPreviousVideoId()).append(".html'\">");
|
videoHtml.append("<button ").append(backEnabled ? "" : "disabled").append(" style=\"").append(backEnabled ? "" : "visibility:hidden;").append("font-size:200%;\" onclick=\"window.location ='").append("./").append(youtubeVideo.getPreviousVideoId()).append(".html'\">");
|
||||||
|
|
||||||
|
|
||||||
videoHtml.append("Back");
|
videoHtml.append("Back");
|
||||||
videoHtml.append("</button>");
|
videoHtml.append("</button>");
|
||||||
}
|
}
|
||||||
@ -177,6 +176,7 @@ videoHtml.append("</div>");
|
|||||||
singleVideo = videoHtml.toString();
|
singleVideo = videoHtml.toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.singleVideo;
|
return this.singleVideo;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user