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

Get output name when using external downloader #25250

Closed
NightMachinary opened this issue May 12, 2020 · 1 comment
Closed

Get output name when using external downloader #25250

NightMachinary opened this issue May 12, 2020 · 1 comment
Labels

Comments

@NightMachinary
Copy link

@NightMachinary NightMachinary commented May 12, 2020

Checklist

  • I'm asking a question
  • I've looked through the README and FAQ for similar questions
  • I've searched the bugtracker for similar questions including closed ones

Question

By searching through the issues, I have found this script for streaming videos, and I have tried adapting it to use aria2c:

#!/usr/bin/env python3
import subprocess, sys
import youtube_dl


player_run = False
p = None


def hook(status):
    global player_run, p

    if not player_run:
        print(f"Running mpv for {status['filename']} ...")
        player_run = True
        p = subprocess.Popen(['mpv', status['filename']])


opts = {
    'format': 'best',
    'nopart': True,
    'progress_hooks': [hook],
    # 'verbose': True,
    # 'external_downloader': 'aria2c',
    'noplaylist': True,
    'writesubtitles': True,
}

with youtube_dl.YoutubeDL(opts) as ydl:
    ydl.download([sys.argv[1]])

p.wait()

The problem is that when using an external downloader, the progress hook won't get called. How can I work around this?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented May 12, 2020

You can't, progress reporting does not work with external downloaders.

@dstftw dstftw closed this May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.