freetube.videos
This commit is contained in:
parent
6ece695be4
commit
46ec104b75
1 changed files with 33 additions and 0 deletions
33
rwx/sw/freetube/videos.py
Normal file
33
rwx/sw/freetube/videos.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
"""FreeTube videos."""
|
||||||
|
|
||||||
|
from rwx import Class
|
||||||
|
|
||||||
|
|
||||||
|
class Video(Class):
|
||||||
|
"""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}"\
|
||||||
|
}}\
|
||||||
|
"""
|
Loading…
Reference in a new issue