34 lines
560 B
Python
34 lines
560 B
Python
|
"""FreeTube videos."""
|
||
|
|
||
|
from rwx import Object
|
||
|
|
||
|
|
||
|
class Video(Object):
|
||
|
"""FreeTube video."""
|
||
|
|
||
|
def __init__(self, uid: str, name: str) -> None:
|
||
|
"""Set id & name.
|
||
|
|
||
|
:param uid: identifier
|
||
|
:type uid: str
|
||
|
:param name: label
|
||
|
:type name: str
|
||
|
"""
|
||
|
self.uid = uid
|
||
|
self.name = name
|
||
|
|
||
|
def to_db(self) -> str:
|
||
|
"""Return identifier, zero length & title.
|
||
|
|
||
|
:rtype: str
|
||
|
"""
|
||
|
return f"""\
|
||
|
{{\
|
||
|
"videoId":"{self.uid}"\
|
||
|
,\
|
||
|
"lengthSeconds":0\
|
||
|
,\
|
||
|
"title":"{self.name}"\
|
||
|
}}\
|
||
|
"""
|