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

hook called several times if file already exists #12279

Closed
LegITdevel opened this issue Feb 26, 2017 · 1 comment
Closed

hook called several times if file already exists #12279

LegITdevel opened this issue Feb 26, 2017 · 1 comment

Comments

@LegITdevel
Copy link

@LegITdevel LegITdevel commented Feb 26, 2017

def my_hook(d):
    if d['status'] == 'finished':
        print('Done downloading, now converting ...')


ydl_opts = {
    'format': 'bestaudio/best',
    'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '192',
    }],
    'logger': MyLogger(),
    'progress_hooks': [my_hook],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download(['http://www.youtube.com/watch?v=BaW_jenozKc'])

if the file already exists, the hook function is called several times for unknown reason

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Feb 26, 2017

The hook is called arbitrary number of times when downloading to report progress. It does not matter whether mp3 already exists or not since it does not download mp3.

@dstftw dstftw closed this Feb 26, 2017
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.