FileManager

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

Bases: object

static delete_file(file_name: str, directory: str) None[source]

Delete File

Deletes a file from the server and database.

Parameters

file_namestr

The name of the file to delete.

directorystr

The directory where the file is stored.

upload_file(**kwargs) Video | dict[source]

Upload File

Uploads a video and thumbnail files to the server and database.

Parameters

VIDEO_FILENAMEstr

The name of the video file.

THUMBNAIL_FILENAMEstr, optional

The name of the thumbnail file.

TITLEstr

The title of the video.

OWNERstr

The username of the video owner.

VISIBILITYstr

The visibility of the video.

DESCRIPTIONstr, optional

The description of the video.

TAGSlist, optional

The tags of the video.

Returns

Video

The video object if the files are uploaded successfully.

dict

A dictionary with an error message if the files are not uploaded.