Database

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

Bases: object

DATABASES = ['videos.json', 'playlists.json']
add_playlist(playlist_: Playlist) dict[source]

Add Playlist

The add_playlist method is used to add a playlist to the database.

Parameters

playlist_Playlist

The playlist object to be added to the database.

Returns

dict

A dictionary containing the playlist object and a message.

add_video(video_: Video) dict[source]

Add Video

The add_video method is used to add a video to the database.

Parameters

video_Video

The video object to be added to the database.

Returns

dict

A dictionary containing the video object and a message.

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

Add Video to Playlist

The add_video_to_playlist method is used to add a video to a playlist.

Parameters

playlist_Playlist

The playlist object to add the video to.

video_Video

The video object to be added to the playlist.

Returns

dict

A dictionary containing the playlist object and a message.

delete_playlist(playlist_: Playlist) dict[source]

Delete Playlist

The delete_playlist method is used to delete a playlist from the database.

Parameters

playlist_Playlist

The playlist object to be deleted from the database.

Returns

dict

A dictionary containing the playlist object and a message

delete_video(video_: Video) dict[source]

Delete Video

The delete_video method is used to delete a video from the database.

Parameters

video_Video

The video object to be deleted from the database.

Returns

dict

A dictionary containing the video object and a message.

get_index(video_: Video, playlist_: Video) int[source]

Get Index

The get_index method is used to get the index of a video or playlist.

Parameters

video_Video

The video object to get the index of.

playlist_Playlist

The playlist object to get the index of.

Returns

int

The index of the video or playlist.

load_playlists() None[source]

Load Playlists

The load_playlists method is used to load the playlists from the database.

load_videos() None[source]

Load Videos

The load_videos method is used to load the videos from the database.

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

Remove Video from Playlist

The remove_video_from_playlist method is used to remove a video from a playlist.

Parameters

playlist_Playlist

The playlist object to remove the video from.

video_Video

The video object to be removed from the playlist.

Returns

dict

A dictionary containing the playlist object and a message.

save_playlists() dict[source]

Save Playlists

The save_playlists method is used to save the playlists to the database.

Returns

dict

A dictionary containing a message.

save_videos() dict[source]

Save Videos

The save_videos method is used to save the videos to the database.

Returns

dict

A dictionary containing a message