Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filepath not passed to after_video event #5846

Closed
9 tasks done
sarmong opened this issue Dec 21, 2022 · 3 comments
Closed
9 tasks done

Filepath not passed to after_video event #5846

sarmong opened this issue Dec 21, 2022 · 3 comments
Assignees
Labels
docs/meta/cleanup related to docs, code cleanup, templates, devscripts etc question Question

Comments

@sarmong
Copy link

sarmong commented Dec 21, 2022

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

  • I understand that I will be blocked if I remove or skip any mandatory* field

Checklist

  • I'm reporting a bug unrelated to a specific site
  • I've verified that I'm running yt-dlp version 2022.11.11 (update instructions) or later (specify commit)
  • I've checked that all provided URLs are playable in a browser with the same IP and same login details
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar issues including closed ones. DO NOT post duplicates
  • I've read the guidelines for opening an issue

Provide a description that is worded well enough to be understood

When using --exec after_video:"notify-send 'Finished downloading'" , notify-send does not receive filepath as an argument. However, when using post_process, it does.

Provide verbose output that clearly demonstrates the problem

  • Run your yt-dlp command with -vU flag added (yt-dlp -vU <your command line>)
  • Copy the WHOLE output (starting with [debug] Command-line config) and insert it below

Complete Verbose Output

[debug] Command-line config: ['-vU', '--exec', "after_video:notify-send 'Finished downloading'", 'https://www.youtube.com/watch?v=7lmCu8wz8ro']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.11.11 [8b64402]
[debug] Python 3.10.8 (CPython x86_64 64bit) - Linux-5.15.82-1-lts-x86_64-with-glibc2.36 (OpenSSL 3.0.7 1 Nov 2022, glibc 2.36)
[debug] exe versions: ffmpeg 5.1.2 (setts), ffprobe 5.1.2
[debug] Optional libraries: certifi-2022.09.24, secretstorage-3.3.3, sqlite3-2.6.0
[debug] Proxy map: {}
[debug] Loaded 1723 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.11.11, Current version: 2022.11.11
yt-dlp is up to date (2022.11.11)
[debug] [youtube] Extracting URL: https://www.youtube.com/watch?v=7lmCu8wz8ro
[youtube] 7lmCu8wz8ro: Downloading webpage
[youtube] 7lmCu8wz8ro: Downloading android player API JSON
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, hasaud, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 7lmCu8wz8ro: Downloading 1 format(s): 248+251
[debug] Invoking http downloader on "https://rr3---sn-ugpva5o-3c2s.googlevideo.com/videoplayback?expire=1671633430&ei=tsWiY9P2MIKd8gPzwrigDw&ip=37.57.124.33&id=o-AEXK3c1Ht_i1CfJn1BKhiMjJ2k-XHvkvNNM74TL-FXoT&itag=248&source=youtube&requiressl=yes&mh=pG&mm=31%2C26&mn=sn-ugpva5o-3c2s%2Csn-4g5e6nsr&ms=au%2Conr&mv=m&mvi=3&pl=24&initcwndbps=1406250&spc=zIddbMUPF2PEibpfj3mcP9qeb0wZ5Ak&vprv=1&svpuc=1&mime=video%2Fwebm&gir=yes&clen=251475652&dur=6722.049&lmt=1545189620894973&mt=1671611328&fvip=3&keepalive=yes&fexp=24001373%2C24007246&c=ANDROID&txp=5535432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgLTYkILDOB1Q_wfWGsdnNxGqGVCIRSCIk876Tsgrdo6cCIQDO8Fz55Ddj0GlHpjLrnX4fbGjoxj8LPGyurqa_XROjCw%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgXzD8TvJwTw8PNjah8CjBFvtN5WoYsu3QqW3MsnGK_coCIQDviB8h6eL0ZjtshK7qEk__P3e4JlZ4sxZoSpVgWXDzyA%3D%3D"
[download] Destination: What Does It Take To Be An Expert At Python? [7lmCu8wz8ro].f248.webm
[download] 100% of  239.83MiB in 00:00:25 at 9.42MiB/s
[debug] Invoking http downloader on "https://rr3---sn-ugpva5o-3c2s.googlevideo.com/videoplayback?expire=1671633430&ei=tsWiY9P2MIKd8gPzwrigDw&ip=37.57.124.33&id=o-AEXK3c1Ht_i1CfJn1BKhiMjJ2k-XHvkvNNM74TL-FXoT&itag=251&source=youtube&requiressl=yes&mh=pG&mm=31%2C26&mn=sn-ugpva5o-3c2s%2Csn-4g5e6nsr&ms=au%2Conr&mv=m&mvi=3&pl=24&initcwndbps=1406250&spc=zIddbMUPF2PEibpfj3mcP9qeb0wZ5Ak&vprv=1&svpuc=1&mime=audio%2Fwebm&gir=yes&clen=91203988&dur=6722.081&lmt=1545376716775032&mt=1671611328&fvip=3&keepalive=yes&fexp=24001373%2C24007246&c=ANDROID&txp=5511222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgWJXZloUVLWR67W24Gv2psi8u3m8Ao5pmkd_5W3sR9rsCIDVHh3dV6gIqkXLxvlFrpsGODr2FPqu5ikYUvfXmahFt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgXzD8TvJwTw8PNjah8CjBFvtN5WoYsu3QqW3MsnGK_coCIQDviB8h6eL0ZjtshK7qEk__P3e4JlZ4sxZoSpVgWXDzyA%3D%3D"
[download] Destination: What Does It Take To Be An Expert At Python? [7lmCu8wz8ro].f251.webm
[download] 100% of   86.98MiB in 00:00:08 at 10.04MiB/s
[Merger] Merging formats into "What Does It Take To Be An Expert At Python? [7lmCu8wz8ro].webm"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:What Does It Take To Be An Expert At Python? [7lmCu8wz8ro].f248.webm' -i 'file:What Does It Take To Be An Expert At Python? [7lmCu8wz8ro].f251.webm' -c copy -map 0:v:0 -map 1:a:0 -movflags +faststart 'file:What Does It Take To Be An Expert At Python? [7lmCu8wz8ro].temp.webm'
Deleting original file What Does It Take To Be An Expert At Python? [7lmCu8wz8ro].f251.webm (pass -k to keep)
Deleting original file What Does It Take To Be An Expert At Python? [7lmCu8wz8ro].f248.webm (pass -k to keep)
[Exec] Executing command: notify-send 'Finished downloading'
@sarmong sarmong added bug Bug that is not site-specific triage Untriaged issue labels Dec 21, 2022
@pukkandan
Copy link
Member

pukkandan commented Dec 21, 2022

There is no single filename associated with the after_video stage - so nothing is appended to --exec (as opposed to NA in -o). I will correct the documentation to reflect this.

If you want all the filenames, use %(requested_downloads.:.filepath)#q. But since you are only downloading a single format per video, why not just run at after_move (default)?

@pukkandan pukkandan added docs/meta/cleanup related to docs, code cleanup, templates, devscripts etc question Question and removed bug Bug that is not site-specific triage Untriaged issue labels Dec 21, 2022
@sarmong
Copy link
Author

sarmong commented Dec 26, 2022

My idea was to run a command after yt-dlp is done with everything. And it seems like after_video is the last event that runs.

Maybe, because according to the doc, it runs 'after downloading and processing all formats of a video', it could receive the video name, just like the before_dl does? Since both are dealing with download.

@pukkandan
Copy link
Member

according to the doc, it runs 'after downloading and processing all formats of a video',
it could receive the video name, just like the before_dl does?

I believe you are misunderstanding what "all formats" mean. If you pass say, -f f1,f2, both formats will be downloaded into separate files. This stage runs only after both of them are downloaded and processed. Since the formats have different filenames, no single name can be passed to --exec.

Did you try using the default stage as I suggested?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs/meta/cleanup related to docs, code cleanup, templates, devscripts etc question Question
Projects
None yet
Development

No branches or pull requests

2 participants