Phase 1: quick flow fixes

- One message per job: the status message is deleted once the file is
  sent, or shortened to "Sent." when Telegram keeps it.
- No reply quotes in private chats; groups keep them.
- Queue status only mentions the position when the wait is above
  QUEUE_NOTICE_THRESHOLD_SECONDS or somebody is ahead. Status edits are
  throttled to one per 2.5 s per message; a state that arrives too soon
  is shown later instead of dropped. The wait estimate is 0 with a free
  slot.
- Caption with title (uploader and date when generic), uploader,
  duration, a short source link without tracking parameters and an
  optional "via @bot" line (CAPTION_ATTRIBUTION). Uploaded videos get a
  320 px JPEG thumbnail; merged MP4s are written with faststart.
- Buttons under the result: Audio (MP3), Other quality, Thumbnail,
  Delete. Requester only in groups.
- Language resolved once per update and passed in the context. A
  fallback to English is logged as a bug; a test walks every screen in
  Spanish and Dutch. Language picker on the first /start.
- Sizes without a zero decimal ("50 MB").
- First link of a new user shows the card once and sets the default to
  "best that fits my limit".
- Errors offer the next step (Try again, Smaller quality, Upgrade, Open
  app); passing lookup failures are retried once.
- Up to MULTI_LINK_MAX links per message; a link sent a moment ago gets
  "already sent" with a Send again button.
- Mini App menu button, labelled per private chat in the user's
  language.
- Personal /settings in private chats with an "Add me to a group"
  button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Michilis
2026-11-18 20:08:58 +00:00
co-authored by Claude Opus 5.5
parent 3c153af97f
commit 6843053582
52 changed files with 3369 additions and 271 deletions
+5 -1
View File
@@ -153,7 +153,11 @@ func profileArgs(p media.Profile) []string {
if h := p.Height(); h > 0 {
sort = "vcodec:h264,res:" + strconv.Itoa(h) + ",acodec:m4a"
}
return []string{"-S", sort, "-f", "bv*+ba/b", "--merge-output-format", "mp4/mkv"}
return []string{"-S", sort, "-f", "bv*+ba/b", "--merge-output-format", "mp4/mkv",
// Put the index at the start of the MP4, so Telegram can play it
// while it is still loading.
"--postprocessor-args", "Merger+ffmpeg_o:-movflags +faststart",
"--postprocessor-args", "FixupM3u8+ffmpeg_o:-movflags +faststart"}
}
// DownloadArgs builds the full argument list for a download. It is exported
+3 -2
View File
@@ -168,6 +168,7 @@ func TestExecDownload(t *testing.T) {
mustHave("--match-filters", "!is_live & duration<=?600")
mustHave("-S", "vcodec:h264,res:720,acodec:m4a")
mustHave("--merge-output-format", "mp4/mkv")
mustHave("--postprocessor-args", "Merger+ffmpeg_o:-movflags +faststart")
mustHave("-P", dir)
if args[len(args)-2] != "--" || args[len(args)-1] != "https://example.com/watch?v=abc" {
t.Errorf("the URL must come last after --, got %v", args[len(args)-2:])
@@ -247,8 +248,8 @@ func TestExecDownloadCancel(t *testing.T) {
func TestProfileArgs(t *testing.T) {
join := func(p media.Profile) string { return strings.Join(profileArgs(p), " ") }
tests := map[media.Profile]string{
media.Best: "-S vcodec:h264,res,acodec:m4a -f bv*+ba/b --merge-output-format mp4/mkv",
media.P480: "-S vcodec:h264,res:480,acodec:m4a -f bv*+ba/b --merge-output-format mp4/mkv",
media.Best: "-S vcodec:h264,res,acodec:m4a -f bv*+ba/b --merge-output-format mp4/mkv --postprocessor-args Merger+ffmpeg_o:-movflags +faststart --postprocessor-args FixupM3u8+ffmpeg_o:-movflags +faststart",
media.P480: "-S vcodec:h264,res:480,acodec:m4a -f bv*+ba/b --merge-output-format mp4/mkv --postprocessor-args Merger+ffmpeg_o:-movflags +faststart --postprocessor-args FixupM3u8+ffmpeg_o:-movflags +faststart",
media.MP3: "-f ba/b -x --audio-format mp3 --audio-quality 192K",
media.M4A: "-f ba[ext=m4a]/ba/b -x --audio-format m4a",
media.Thumb: "--skip-download --write-thumbnail --convert-thumbnails jpg",
+2
View File
@@ -40,6 +40,8 @@ type Info struct {
IsLive bool `json:"is_live"`
LiveStatus string `json:"live_status"`
Availability string `json:"availability"`
// UploadDate is YYYYMMDD, when the site says.
UploadDate string `json:"upload_date"`
Formats []Format `json:"formats"`
Subtitles map[string][]SubTrack `json:"subtitles"`