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

Database support #793

Open
glisignoli opened this issue Apr 18, 2013 · 0 comments
Open

Database support #793

glisignoli opened this issue Apr 18, 2013 · 0 comments

Comments

@glisignoli
Copy link
Contributor

@glisignoli glisignoli commented Apr 18, 2013

Related to: #152

So in efforts to allow php applications to start downloads, report on download status I've been thinking of added database support to youtube-dl. The reason for doing this is that a php application can call youtube-dl, and then forget about it. It can then read the contents of a database to report on the video status.

I'm no expert on this, so feel free to give me any better ideas

The plan (unless anyone has any better ideas) is to create a new fuction called to_output that will ether send output to the screen or to a database. Any existing calls to to_screen(message) will need to be changed to to_output(message, messagetype).

The extra input (message type) will be used to determine what type of message is being received. Errors, DownloadPercentage, FileSize, etc. Then the value can be stored in message.

to_screen would then be used to displaying that information in a useful way to the screen. So instead of using

self._downloader.to_screen(u'[plus.google] Title: %s' % video_title)

You would use:

self._downloader.to_output(video_title, "VIDEOTITLE")

to_output would then contain a lot of code to ether pass the information to to_database, or transform the text into something useful to to_screen:

if messagetype == "VIDEOTITLE":
    print "Title: " + message

This is quite a lot of work, it means all the non-data infromation will be stored in to_screen, but it then allows other output methods to be added later using just the data.

The other method is just to just write to a database and leave the existing to_screen code alone. No messing around with the existing to_screen code, but then I'll need to create a log_to_database call after every to_screen call. Which I feel is just wrong.

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
1 participant
You can’t perform that action at this time.