A set of useful custom tools that I use a lot
Project description
eclipsetools
eclipsetools is a toolkit for various features I like having for my projects. Although it's intended to be used by me, it offers utilities that anyone might find useful for inclusion in their projects. It is lightweight and easy to integrate!
Features
- Video Tools: A set of functions like crop, trim, blur, and more for working with video files. All functions that modify files save out a new file and do not alter the original input file.
- Image Tools: Provides basic image operations such as resizing, cropping, rotation, and adjustments to contrast, hue, and brightness.
- File Tools: File handling operations including copying directories, reading/writing files, and JSON utilities.
- Task Tools: Background task management with a tray icon interface for managing long-running or background tasks.
Examples
Video Tools:
from eclipsetools import vt
video_folder_path = "path/to/your/folder"
video_paths = vt.get_videos_in_folder(video_folder_path)
saved_paths = vt.perform_operations(video_paths, [
vt.Operation.Resize(128, 128, keep_aspect_ratio=True, save_path="*_001"), # the star is the name of the input file
vt.Operation.Crop(64, 128, save_path="*[_001:_002]"), # this will replace the _001 with _002
vt.Operation.RotateFlip(90, "h", save_path="*[_002:_final]"), # this will rotate 90 degrees and flip on horizontal axis
])
vt.delete_all_but_last_operation_files(saved_paths) # this will remove all the files that were created besides the final ones
Image Tools: Basically the same as video tools but both "vt" and "it" have different meta functions for getting info from files among other things
from eclipsetools import it
image_folder_path = "path/to/your/folder"
image_paths = it.get_images_in_folder(image_folder_path)
saved_paths = it.perform_operations(image_paths, [
it.Operation.Resize(128, 128, keep_aspect_ratio=True, save_path="*_001"), # the star is the name of the input file
it.Operation.Crop(64, 128, save_path="*[_001:_002]"), # this will replace the _001 with _002
it.Operation.RotateFlip(90, "h", save_path="*[_002:_final]"), # this will rotate 90 degrees and flip on horizontal axis
])
it.delete_all_but_last_operation_files(saved_paths) # this will remove all the files that were created besides the final ones
File Tools:
from eclipsetools import ft
source_folder = "path/to/your/src_folder"
destination_folder = "path/to/your/dest_folder"
ft.copy_directory(source_folder, destination_folder, renaming=[
("_001", "_002"), # replaces all _001 with _002 in all file and folder names
("fancy", "dirty"), # replaces all fancy with dirty in all file and folder names
],
ignore=[], # list of absolute paths of files or folders from the source folder to ignore
overwrite_files=True,
ignore_files=False # when true this will only copy over folders, no files
)
Task Tools:
from eclipsetools import tt
class ExampleTask(tt.BackgroundTask):
def __init__(self) -> None:
super().__init__("ExampleTask")
def start(self):
print("Start")
def update(self):
from random import random
print(random())
def end(self):
print("End")
service = tt.BackgroundService()
service.add_task(ExampleTask())
service.run()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
eclipsetools-0.0.3.tar.gz
(17.3 kB
view hashes)
Built Distribution
Close
Hashes for eclipsetools-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8577df29c630d88865c67987c2dd672d853b8e62ec90a02dbb97258207f2ce1a |
|
MD5 | a85736246569136cad404cb741955a26 |
|
BLAKE2b-256 | 6da17ab8cb09ed235937948346fca2da6f31b9dacd39258a686836f37e9b5d41 |