Skip to content

Commit

Permalink
Change default ytdlp format to 1080
Browse files Browse the repository at this point in the history
  • Loading branch information
aNNiMON committed Dec 22, 2024
1 parent 3166e34 commit dd07d9f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2023 aNNiMON
Copyright (c) 2023-2025 aNNiMON

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void accept(@NotNull MessageContext ctx) {
<b>yt-dlp</b>
/dl link [format] — download a media using yt-dlp
<code>link</code> — a link to download (it must be supported by yt-dlp)
<code>format</code> — (optional) a download format. Can be: best, audio, 240, 360, 480, 720 or 1080. Default: best
<code>format</code> — (optional) a download format. Can be: best, audio, 240, 360, 480, 720 or 1080. Default: 1080
/clip link [duration] [format] — make a clip using yt-dlp (intended for streams)
<code>link</code> — yt-dlp supported link, livestreams intended such as twitch
<code>duration</code> — (optional) duration in seconds. Max: 199, min: 10, default: 20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

public class YtDlpCommandBundle implements CommandBundle<For> {

private static final String DEFAULT_FORMAT = "1080";

private final Sessions sessions;

public YtDlpCommandBundle(Sessions sessions) {
Expand Down Expand Up @@ -64,7 +66,7 @@ private void clip(@NotNull RegexMessageContext ctx) {
.orElse(20);
final String downloadOption = Optional.ofNullable(ctx.group(3))
.filter(Predicate.not(String::isBlank))
.orElse("best");
.orElse(DEFAULT_FORMAT);

final var session = createYtDlpSession(ctx.chatId(), url, downloadOption, duration);
session.setMessageId(ctx.messageId());
Expand All @@ -80,7 +82,7 @@ private void download(@NotNull RegexMessageContext ctx) {
final String url = ctx.group(1);
final String downloadOption = Optional.ofNullable(ctx.group(2))
.filter(Predicate.not(String::isBlank))
.orElse("best");
.orElse(DEFAULT_FORMAT);
final int maxDuration = 10 * 60 * 60;

final var session = createYtDlpSession(ctx.chatId(), url, downloadOption, maxDuration);
Expand Down

0 comments on commit dd07d9f

Please sign in to comment.