TwVideoManager.misc.files module

class TwVideoManager.misc.files.LocalFinder(script_name: str = None, video_dir: str = None)[source]

Bases: object

Finds and manages the video-downloading directory to upload the video files to the google drive and remove from disc for better disc-usage.

Variables:
  • script_name (str) – the video-downloading script name (Default: ‘bot.sh’). This is used for determining whether the sub-directory is video-downloading directory to manage or not.
  • video_dir (str) – the path to manage as a video-downloading directory.
dir

Return the Directory indicates LocalFinder.video_dir containing sub-directories and sub-files.

The video directory contains sub-directories, whose names are usually channel name. These sub-directories and sub-directories’ sub-files would be managed to share on remote storage such as Google Drive.

Return Directory:
 Video directory as a Directory
has_script(target: TwVideoManager.misc.models.Directory) → bool[source]

Returns if the directory has script file

The name of script file is determined based on class’ script_name and returns whether the directory has a file named ‘bot.sh” (as default) or not.

Parameters:target (Directory) – the target directory to find script file
Return bool:whether the directory has a file named ‘bot.sh” (as default) or not
stream_dir
Return List[Directory]:
 returns the stream-saving folders including script file.
video_files

returns all video files in the stream directories.

The video files’ extension must be included in pre-filled extension set (see TwVideoManager.constants. _EXTENSION_VIDEO.

Return List[File]:
 the video files in stream directories.
classmethod wrapper(path: str) → List[Union[TwVideoManager.misc.models.File, TwVideoManager.misc.models.Directory]][source]

Wraps sub-directories and sub-files with each Directory and File.

Parameters:path (str) – the path to wrap with class.
Return List[Union[File, Directory]]:
 Wrapped sub-directories and sub-files.