VideoService

class VideoService.__main__.VideoService(DATABASE: str = '.\\Database', VIDEOS: str = '.\\Database\\Videos', THUMBNAILS: str = '.\\Database\\THUMBNAILS', UPLOADS: str = '.\\Uploads')[source]

Bases: object

This class will manage all the backend of the service, and you will just need to call it’s methods when required by the server.

add_video_to_playlist(video_: Video, playlist_: Playlist) dict[source]

Add Video To Playlist

Function to add a video to a playlist.

Parameters

video_Video

Video to add.

playlist_Playlist

Playlist to add the video to.

Returns

dict

A dictionary with the result of the operation.

create_playlist(TITLE: str, OWNER: str, VISIBILITY: str, DESCRIPTION: str = None, TAGS: list[str] = None) dict[source]

Create Playlist

Function to create a playlist.

Parameters

TITLEstr

Title of the playlist.

OWNERstr

Owner of the playlist.

VISIBILITYstr

Visibility of the playlist.

DESCRIPTIONstr, optional

Description of the playlist.

TAGSlist[str], optional

Tags of the playlist.

Returns

dict

A dictionary with the result of the operation.

delete_playlist(playlist_: Playlist) dict[source]

Delete Playlist

Function to delete a playlist.

Parameters

playlist_Playlist

Playlist to delete.

Returns

dict

A dictionary with the result of the operation.

delete_video(video_: Video) dict[source]

Delete Video

Function to delete a video.

Parameters

video_Video

Video to delete.

Returns

dict

A dictionary with the result of the operation.

remove_video_from_playlist(video_: Video, playlist_: Playlist) dict[source]

Remove Video From Playlist

Function to remove a video from a playlist.

Parameters

video_Video

Video to remove.

playlist_Playlist

Playlist to remove the video from.

Returns

dict

A dictionary with the result of the operation.

save_playlists() dict[source]

Save Playlists

Function to save playlists to the database.

Returns

dict

A dictionary with the result of the operation.

save_videos() dict[source]

Save Videos

Function to save videos to the database.

Returns

dict

A dictionary with the result of the operation.

update_likes(video_: Video, likes: int) dict[source]

Update Likes

Function to update the likes of a video.

Parameters

video_Video

Video to update.

likesint

Number of likes to update.

Returns

dict

A dictionary with the result of the operation.

update_views(video_: Video, views: int) dict[source]

Update Views

Function to update the views of a video.

Parameters

video_Video

Video to update.

viewsint

Number of views to update.

Returns

dict

A dictionary with the result of the operation.

upload(TITLE: str, VIDEO_FILENAME: str, OWNER: str, VISIBILITY: str, THUMBNAIL_FILENAME: str = None, DESCRIPTION: str = None, TAGS: list[str] = None) dict[source]

Upload

Function to upload a video to the server and database.

Parameters

TITLEstr

Title of the video.

VIDEO_FILENAMEstr

Filename of the video.

OWNERstr

Owner of the video.

VISIBILITYstr

Visibility of the video.

THUMBNAIL_FILENAMEstr, optional

Filename of the thumbnail.

DESCRIPTIONstr, optional

Description of the video.

TAGSlist[str], optional

Tags of the video.

Returns

dict

A dictionary with the result of the operation.