Add jsonify.py.
This commit is contained in:
		
							parent
							
								
									21af1576c2
								
							
						
					
					
						commit
						5c4b2e9d21
					
				
					 2 changed files with 30 additions and 0 deletions
				
			
		|  | @ -1,4 +1,5 @@ | ||||||
| from . import exceptions | from . import exceptions | ||||||
| from . import helpers | from . import helpers | ||||||
|  | from . import jsonify | ||||||
| from . import ycdldb | from . import ycdldb | ||||||
| from . import ytapi | from . import ytapi | ||||||
|  |  | ||||||
							
								
								
									
										29
									
								
								ycdl/jsonify.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								ycdl/jsonify.py
									
									
									
									
									
										Normal 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 | ||||||
		Loading…
	
		Reference in a new issue