chasebank87 / fabric-connector

Provides an API to the Fabric, and its helper tools
26 stars 10 forks source link

Overview

FabricYTProxy is a Python-based application that integrates with Fabric and YT binaries to provide a proxy service. It includes a FastAPI server for handling API requests and a system tray application for managing the API server status. The application supports both macOS and Windows platforms.

Table of Contents

Installation

A MacOS and Windows executable is provided for easy installation. Click the latest release.

When running on windows, fabric is ran using WSL, we need a WSL1 or WSL2 distribution running and set as default, fabric installed, fabric configures, and the user must be the same as your windows user.

Prerequisites

Ensure you have Python 3.7+ installed on your system. You will also need to have the Fabric and YT binaries installed and accessible in your system's PATH.

Portable executables are available for MacOS and Windows (Releases)[https://github.com/chasebank87/fabric-connector/releases]

Steps

  1. Clone the repository (into Obsidian-Plugins Folder?):

    git clone https://github.com/chasebank87/fabric-connector.git
    cd fabric-connector
  2. Install the required Python packages:

    pip install -r requirements.txt
  3. Ensure the paths to the Fabric and YT binaries are correctly set in the code:

    FABRIC_PATH = "/path/to/fabric"
    YT_PATH = "/path/to/yt"

Dependencies

The project relies on several Python packages, which are listed in requirements.txt:

Configuration

When using windows

Usage

Running the Application

To start the application, run:

python main.py

This will start the system tray application and the FastAPI server.

System Tray Application

The system tray application provides options to:

API Endpoints

The FastAPI server exposes several endpoints:

POST /fabric

Runs the Fabric binary with the provided command and returns the output.

Request Body:

{
  "pattern": "pattern_name",
  "data": "input_data"
}

Response:

{
  "output": "result_output"
}

POST /yt

Runs the YT binary with the provided command and returns the output.

Request Body:

{
  "pattern": "pattern_name",
  "url": "video_url"
}

Response:

{
  "output": "result_output"
}

GET /patterns

Returns a list of available patterns from the Fabric binary.

Response:

{
  "data": {
    "patterns": [
      {"name": "pattern1"},
      {"name": "pattern2"}
    ]
  }
}

Development

Building for macOS

To build a macOS application bundle, use pyinstaller:

pyinstaller main.spec

Building for Windows

To build a Windows executable, use pyinstaller:

pyinstaller main.spec

Running Tests

To run tests, use:

pytest tests/

License

This project is licensed under the MIT License. See the LICENSE file for details.


For more information, please refer to the documentation.