Add jsonify.py.

master
voussoir 2020-05-21 20:28:45 -07:00
parent 21af1576c2
commit 5c4b2e9d21
2 changed files with 30 additions and 0 deletions

View File

@ -1,4 +1,5 @@
from . import exceptions
from . import helpers
from . import jsonify
from . import ycdldb
from . import ytapi

29
ycdl/jsonify.py Normal file
View File

@ -0,0 +1,29 @@
def channel(c):
j = {
'id': c.id,
'name': c.name,
'automark': c.automark,
}
return j
def exception(e):
j = {
'type': 'error',
'error_type': e.error_type,
'error_message': e.error_message,
}
return j
def video(v):
j = {
'id': v.id,
'published': v.published,
'author_id': v.author_id,
'title': v.title,
'description': v.description,
'duration': v.duration,
'views': v.views,
'thumbnail': v.thumbnail,
'download': v.download,
}
return j