backend.services

This module defines service modules to handle the various entities in our app.


backend.services.fileService

This module defines the functions that deal with file handling.

backend.services.fileService.construct_path(base_path: str, sub_dirs: list[str]) str[source]

Given a base path and a list of directory names, this function creates a path by concatenating the base path and the directory names in a way that’s independent of which OS you’re running the app from.

Parameters:
  • base_path (str) – the base path from which to begin to the path construction.

  • sub_dirs (list[str]) – a list of directory names; the path created will reflect the order of the directories listed here.

Returns:

the constructed path

Return type:

str

backend.services.fileService.organize_recorded_files(src_path: str, dest_path: str) int[source]
Defines the main organization logic for the app. The file organization is done as follows:
  • Move the recordings from a given source folder to the given destination

  • Determine the order in which the recordings were created

  • Rename the files with natural numbers in that order continuing on from the largest numbered file previously stored in that folder.

Parameters:
  • src_path (str) – path to the source folder

  • dest_path (str) – path to the destination folder

Returns:

number of files transferred

Return type:

int

backend.services.fileService.video_recordings(path: str, video_formats=['mp4', 'mkv', 'avi', 'mpg']) list[str][source]

Generates a list of video files present in the given path.

Parameters:
  • path (str) – path to the folder where you need to check for video recordings.

  • video_formats (list[str], optional) – supported formats; default = [‘mp4’, ‘mkv’, ‘avi’, ‘mpg’]

Returns:

the list of video files present in the given folder

Return type:

list[str]


backend.services.sessionService

class backend.services.sessionService.SessionService(session: Session, base_path: str = './Recordings')[source]

Bases: object

Class:

SessionService - A service class to handle a Session

Parameters:
  • session (Session) – a Session

  • base_path (str) – path to the source folder where the recorded snippets are stored during the session; defaults to ‘./Recordings’

end() int[source]

Organizes the recordings as desired in the intended destination.

Returns:

the number of files successfully organized

Return type:

int

get_source_folder() str[source]
set_destination_path() str[source]

Sets the destination folder for the recordings. You have to define your desired order of the directories in this method.

Returns:

path to the destination folder

Return type:

str

start(vlc_path: str)[source]

Starts the VLC media player.

Parameters:

vlc_path (str) – path to the VLC executable