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

Return more values to the hook #2363

Open
yasoob opened this issue Feb 10, 2014 · 2 comments
Open

Return more values to the hook #2363

yasoob opened this issue Feb 10, 2014 · 2 comments
Labels

Comments

@yasoob
Copy link
Contributor

@yasoob yasoob commented Feb 10, 2014

Currently the hook looks like this

def add_progress_hook(self, ph):
        """ ph gets called on download progress, with a dictionary with the entries
        * filename: The final filename
        * status: One of "downloading" and "finished"

        It can also have some of the following entries:

        * downloaded_bytes: Bytes on disks
        * total_bytes: Total bytes, None if unknown
        * tmpfilename: The filename we're currently writing to
        * eta: The estimated time in seconds, None if unknown
        * speed: The download speed in bytes/second, None if unknown

        Hooks are guaranteed to be called at least once (with status "finished")
        if the download is successful.
        """
        self._progress_hooks.append(ph)

This is the downloader > common.py file.

What I would like is that the hook should return more values like the thumbnail url and the title ( more specifically the values returned by the extractor ). Is it possible to implement this feature. What I am doing is that I am making a GUI for youtube-dl in PyQt and want to access these values in a single run. Another way could be to first run youtube-dl with -g and other switches and then download the file in another run but I want to run youtube-dl only one time. If there is another way then do tell me.

The GUI is under heavy development and is available at https://github.com/yasoob/youtube-dl-GUI

@jaimeMF jaimeMF added the request label Feb 10, 2014
@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Feb 10, 2014

Instead of sending this info each time, I would send it just once in YoutubeDL.process_info before it starts writing things to disk and downloading the video.

You can read the info by using the info.json file, since you know the video filename, you can easily load the information.

@yasoob
Copy link
Contributor Author

@yasoob yasoob commented Feb 10, 2014

can you give a simple example?

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.