From 0a5e98f4177384854fbd3153739293fbcb526fc0 Mon Sep 17 00:00:00 2001 From: fedir Date: Tue, 18 Feb 2025 18:03:34 +0100 Subject: [PATCH 1/3] Added a uml diagram. --- design/design.gaphor | 917 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 917 insertions(+) create mode 100644 design/design.gaphor diff --git a/design/design.gaphor b/design/design.gaphor new file mode 100644 index 0000000..a5a4465 --- /dev/null +++ b/design/design.gaphor @@ -0,0 +1,917 @@ + + + + + +diagram { + /* line-style: sloppy 0.3; */ +} + +controlflow { + dash-style: 0; +} + + + + + +Model Name Here + + + + + + + + + + + + + + + + + + + + +1. Use Cases + + + + + + + + + + + + + + + + +2. Domain Analysis + + + + + + + + + + + + + + + +3. Architectural Design + + + + + + + + + + + + + + + + + + + + + + + + + + +4. Detailed Design + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Use Cases + + + + + + + + + +Analyze functional requirements by +identifying user roles – actors – and +associating them to their use cases. + + + + + + + + + +(1.0, 0.0, 0.0, 1.0, 93.76953125, 79.1953125) + + +(0.0, 0.0) + + +258.0 + + +110.0 + + + + + + + + + + + + + +Use Case Scenarios + + + + + + + + + +Model abstract use case implementation by creating activity diagrams visualizing activity flows for primary and secondary use case scenarios. + + + + + + + + + +(1.0, 0.0, 0.0, 1.0, 58.0, 79.0) + + +(0.0, 0.0) + + +364.0 + + +95.0 + + + + + + + + + + + + + +Domain Entities + + + + + + + + + +Perform domain analysis by modeling domain entities and their relationships using simplified class diagram. This diagram will serve as a visual dictionary of concepts. It will also be a starting point for your design-level data model. + + + + + + + + + +(1.0, 0.0, 0.0, 1.0, 46.015625, 81.69921875) + + +(0.0, 0.0) + + +400.0 + + +100.0 + + + + + + + + + + + + + +Package Dependencies + + + + + + + + + + + + +Interactions + + + + + + + + + +Interaction + + + + + + + + + + +Prepare package dependencies diagram to group your implementation classes in appropriate way. This will help you maintain the code well structured and avoid design flaws such as cyclic dependencies or dependencies on unstable parts + + + + + + + + + +(1.0, 0.0, 0.0, 1.0, 106.71484375, 51.49999999999997) + + +(0.0, 0.0) + + +271.5703125 + + +144.0 + + + + + + + + + + +Model component interactions for use case scenarios in order to find out new methods in +existing classes or even new classes with specific responsibilities. + + + + + + + + + +(1.0, 0.0, 0.0, 1.0, 43.0, 73.0) + + +(0.0, 0.0) + + +322.0 + + +93.0 + + + + + + + + + + + + + +Detailed Class Design + + + + + + + + + + + + + + + + + +Create detailed class diagrams to capture your object-oriented data model. + + + + + + + + + +(1.0, 0.0, 0.0, 1.0, 133.29296875, 17.285152435302734) + + +(0.0, 0.0) + + +215.0 + + +76.0 + + + + + + + + + + + + + +Implementation Architecture + + + + + + + + + +Define the major artifacts that manifest implementation of your components. Indicate how they are deployed on hardware nodes, their inter-dependencies and communication protocols. + + + + + + + + + +(1.0, 0.0, 0.0, 1.0, -7.59375, 75.08984375) + + +(0.0, 0.0) + + +271.0 + + +129.0 + + + + + + + + + + +Recommender + + + + + + + + + + + + + + + + + + + + + + + + + + +(1.0, 0.0, 0.0, 1.0, 345.78324127197266, 680.6172180175781) + + +(0.0, 0.0) + + +632.0 + + +205.20700073242188 + + + + + + + + + + + + + +recommend + + + + + + + + + + + + ++ Recommender(history_file: string, cache_db_file: Optional(string) = None) + + + + +in + + +count + + + + + +int + + + + +1 + + +History + + + + + + + + + + + + + + + + + + + + + + + +(1.0, 0.0, 0.0, 1.0, 186.63282775878906, 443.60939025878906) + + +(0.0, 0.0) + + +318.3008270263672 + + +164.75778198242188 + + + + + +0 + + + + + + + + + + +1 + + +History + + + + + + + + + +in + + +filename + + + + + +string + + + + + + + +1 + + +__size__ + + + + + + + + + + +0 + + +0 + + + + + + + + +(1.0, 0.0, 0.0, 1.0, 427.53533935546875, 679.4648742675781) + + +[(0.0, 1.15234375), (0.0, -71.09770202636719)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 + + +1 + + + + +composite + + + + + + + + + + + +* + + +* + + + + +HistoryYouTube + + + + + + + + + + + + + + + +(1.0, 0.0, 0.0, 1.0, 91.67303721110027, 224.98699188232425) + + +(0.0, 44.798164367675795) + + +181.64712270100912 + + +58.35613250732423 + + + + + +0 + + +0 + + + + + + + +HistoryFreeTube + + + + + + + + + + + + + + + +(1.0, 0.0, 0.0, 1.0, 380.05679575602204, 226.81316375732428) + + +(0.0, 43.58071645100908) + + +249.7537180582683 + + +57.138684590657604 + + + + + +0 + + +0 + + + + + + + + + + +0 + + +0 + + +(1.0, 0.0, 0.0, 1.0, 223.12159220377606, 442.6041793823242) + + +[(0.0, 0.0), (6.154947234916875, -114.46289062499994)] + + + + + + + + + + +0 + + +0 + + +(1.0, 0.0, 0.0, 1.0, 438.54807535807294, 442.6823043823242) + + +[(0.0, 0.0), (0.3684514898106386, -115.14973958333326)] + + + + + + + + + + +1 + + ++ parse_history(filename: string) -> History + + + + +When parse_history() is called, it should identify and return the correct history type. It can leverage the is_this_type() function that the implementers of this interface should implement to identify whether it's the correct type. + + + + + + + + + +(1.0, 0.0, 0.0, 1.0, 532.4830907185875, 411.48828125) + + +(0.0, 0.0) + + +170.39703369140614 + + +229.0 + + + + + + + + + + + + + +1 + + +is_this_type + + + + + + + + + +in + + +filename + + + + + +string + + + + \ No newline at end of file -- 2.45.2 From 0279f667b32b38ac12e8e385afbd5c9f394da822 Mon Sep 17 00:00:00 2001 From: fedir Date: Tue, 18 Feb 2025 18:36:35 +0100 Subject: [PATCH 2/3] Added `Video` class to the diagram --- design/design.gaphor | 266 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 234 insertions(+), 32 deletions(-) diff --git a/design/design.gaphor b/design/design.gaphor index a5a4465..adc8560 100644 --- a/design/design.gaphor +++ b/design/design.gaphor @@ -111,6 +111,7 @@ controlflow { + @@ -126,6 +127,7 @@ controlflow { + @@ -373,6 +375,7 @@ existing classes or even new classes with specific responsibilities. + @@ -391,7 +394,7 @@ existing classes or even new classes with specific responsibilities. -(1.0, 0.0, 0.0, 1.0, 133.29296875, 17.285152435302734) +(1.0, 0.0, 0.0, 1.0, 126.22541649148083, -111.56346769146282) (0.0, 0.0) @@ -481,16 +484,16 @@ existing classes or even new classes with specific responsibilities. -(1.0, 0.0, 0.0, 1.0, 345.78324127197266, 680.6172180175781) +(1.0, 0.0, 0.0, 1.0, 59.49042039678521, 676.7889605442139) -(0.0, 0.0) +(-4.473890692342593, 0.0) -632.0 +581.5334231350598 -205.20700073242188 +103.7992092219963 @@ -541,12 +544,17 @@ existing classes or even new classes with specific responsibilities. History + + + - + + + @@ -563,7 +571,7 @@ existing classes or even new classes with specific responsibilities. -(1.0, 0.0, 0.0, 1.0, 186.63282775878906, 443.60939025878906) +(1.0, 0.0, 0.0, 1.0, 186.63282775878895, 443.60939025878906) (0.0, 0.0) @@ -614,17 +622,6 @@ existing classes or even new classes with specific responsibilities. string - - - - - -1 - - -__size__ - - @@ -645,10 +642,10 @@ existing classes or even new classes with specific responsibilities. -(1.0, 0.0, 0.0, 1.0, 427.53533935546875, 679.4648742675781) +(1.0, 0.0, 0.0, 1.0, 427.1573380812623, 679.4648742675781) -[(0.0, 1.15234375), (0.0, -71.09770202636719)] +[(0.37800127420644003, -2.6759137233642605), (0.37800127420644003, -71.09770202636719)] @@ -720,7 +717,7 @@ existing classes or even new classes with specific responsibilities. -HistoryYouTube +YouTubeHistory @@ -736,7 +733,7 @@ existing classes or even new classes with specific responsibilities. -(1.0, 0.0, 0.0, 1.0, 91.67303721110027, 224.98699188232425) +(1.0, 0.0, 0.0, 1.0, 86.18801116943362, 224.98699188232428) (0.0, 44.798164367675795) @@ -762,7 +759,7 @@ existing classes or even new classes with specific responsibilities. -HistoryFreeTube +FreeTubeHistory @@ -778,7 +775,7 @@ existing classes or even new classes with specific responsibilities. -(1.0, 0.0, 0.0, 1.0, 380.05679575602204, 226.81316375732428) +(1.0, 0.0, 0.0, 1.0, 380.05679575602204, 226.81316375732425) (0.0, 43.58071645100908) @@ -816,7 +813,7 @@ existing classes or even new classes with specific responsibilities. (1.0, 0.0, 0.0, 1.0, 223.12159220377606, 442.6041793823242) -[(0.0, 0.0), (6.154947234916875, -114.46289062499994)] +[(0.0, 0.0), (0.6699211932502465, -114.46289062499994)] @@ -855,7 +852,7 @@ existing classes or even new classes with specific responsibilities. -When parse_history() is called, it should identify and return the correct history type. It can leverage the is_this_type() function that the implementers of this interface should implement to identify whether it's the correct type. +When parse_history() is called, it should identify and return the correct history type. It can leverage the is_this_type() function that the implementers of this interface should have to identify whether it's the correct type. @@ -865,7 +862,7 @@ existing classes or even new classes with specific responsibilities. -(1.0, 0.0, 0.0, 1.0, 532.4830907185875, 411.48828125) +(1.0, 0.0, 0.0, 1.0, 531.3502782185875, 411.48828125) (0.0, 0.0) @@ -891,23 +888,228 @@ existing classes or even new classes with specific responsibilities. 1 -is_this_type ++ is_this_type(in filename: string) -> bool + + + + + + + +1 + + ++ get_video(in index: int) -> Video + + + + + + + +1 + + +__iter__ + + + + + + + +1 + + +__size__ + + + + +Video + + + + + + + + + + + + + + + + + + + + + + + + + +(1.0, 0.0, 0.0, 1.0, 863.6850618434581, 361.7811660068871) + + +(0.0, 0.0) + + +644.0 + + +161.64602675087428 + + + + + +0 + + + + + + + + + + +0 + + ++ getID() -> string + + + + + + + +0 + + ++ getWatchTime() -> float + + + + + + + +0 + + ++ getWatchProgress() -> float + + + + + + + +0 + + ++ getTitle() -> string + + + + + + + +0 + + ++ getDescription() -> string + + + + + + + +Video - + + + + + - + in -filename +id - + + + +string + + + + +in + + +watch_time + + + + + +float + + + + +in + + +watch_progress + + + + + +float + + + + +in + + +title + + + + + +string + + + + +in + + +description + + + string -- 2.45.2 From a3c5b350fc09b4a1c43771b35ec1d61005f2760f Mon Sep 17 00:00:00 2001 From: fedir Date: Tue, 18 Feb 2025 19:37:01 +0100 Subject: [PATCH 3/3] Added `Video` class to `types.py`. --- shadowtube/types.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 shadowtube/types.py diff --git a/shadowtube/types.py b/shadowtube/types.py new file mode 100644 index 0000000..6a36e0e --- /dev/null +++ b/shadowtube/types.py @@ -0,0 +1,34 @@ +class Video: + def __init__( + self, + id: str, + title: str, + description: str, + watch_time: float, + watch_progress: float, + ): + self._id = id + self._title = title + self._description = description + self._watch_time = watch_time + self._watch_progress = watch_progress + + @property + def title(self): + return self._title + + @property + def id(self): + return self._id + + @property + def description(self): + return self._description + + @property + def watch_time(self): + return self._watch_time + + @property + def watch_progress(self): + return self._watch_progress -- 2.45.2