From 46ec104b7571a8dd1de42a5044841aaa28305015 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 23 Sep 2024 14:35:32 +0200 Subject: [PATCH] freetube.videos --- rwx/sw/freetube/videos.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 rwx/sw/freetube/videos.py diff --git a/rwx/sw/freetube/videos.py b/rwx/sw/freetube/videos.py new file mode 100644 index 0000000..8a53713 --- /dev/null +++ b/rwx/sw/freetube/videos.py @@ -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}"\ +}}\ +"""