im working on a project here is my main.py #!/usr/bin/env python3
import os
import logging
import sys
import subprocess
import re
import json
import asyncio
import decky_plugin
import aiohttp
from aiohttp import web
from decky_plugin import DECKY_PLUGIN_DIR

# Set up logging
logging.basicConfig(level=logging.DEBUG)

def camel_to_title(s):
    # Split the string into words using a regular expression
    words = re.findall(r'[A-Z]?[a-z]+|[A-Z]+(?=[A-Z]|$)', s)
    # Convert the first character of each word to uppercase and join the words with spaces
    return ' '.join(word.capitalize() for word in words)



class Plugin:
    # Asyncio-compatible long-running code, executed in a task when the plugin is loaded
    async def _main(self):
        decky_plugin.logger.info("Hello World!")
        PIPE_PATH = "/tmp/NSLGameScanner_pipe"

    async def read_pipe(self, request):
        if not os.path.exists(self.PIPE_PATH):
            print(f"Pipe file {self.PIPE_PATH} not found")
            raise web.HTTPNotFound(text=f"Pipe file {self.PIPE_PATH} not found")

        pipe_fd = os.open(self.PIPE_PATH, os.O_RDONLY | os.O_NONBLOCK)
        data = []
        while True:
            try:
                line = os.read(pipe_fd, 1024)
            except BlockingIOError:
                await asyncio.sleep(0.1)  # No data, sleep and try again
            else:
                if line:
                    line = line.decode().strip()
                    print(f"Read from pipe: {line}")  # print to console
                    data.append(json.loads(line))  # Add the JSON data to the list
                else:
                    break  # End of file
        os.close(pipe_fd)

        return web.json_response(data)  # Return the data as a JSON response



    async def _unload(self):
        decky_plugin.logger.info("Goodbye World!")
        if self.site:
            await self.site.stop()
            decky_plugin.logger.info("Server stopped")  # Log server stop
            await self.runner.cleanup()
            decky_plugin.logger.info("Server cleanup completed")  # Log server cleanup


    # Migrations that should be performed before entering `_main()`.
    async def _migration(self):
        decky_plugin.logger.info("Migrating")

        # Initialize the web application and set up the route
        self.app = web.Application()
        self.app.router.add_get('/data', self.read_pipe)
        self.runner = web.AppRunner(self.app)
        self.site = None

        # Set the command to run your bash script
        command = "/bin/bash -c 'curl -Ls https://raw.githubusercontent.com/moraroy/NonSteamLaunchers-On-Steam-Deck/main/NonSteamLaunchers.sh | nohup /bin/bash -s -- \"Decky Plugin\"'"

        # Log the command for debugging
        decky_plugin.logger.info(f"Running command: {command}")

        # Set up the environment for the new process
        env = os.environ.copy()
        env['DISPLAY'] = ':0'
        env['XAUTHORITY'] = os.path.join(os.environ['HOME'], '.Xauthority')

        process = subprocess.Popen(command, shell=True, env=env)

        # Wait for the script to complete and get the exit code
        exit_code = process.wait()

        # Log the exit code for debugging
        decky_plugin.logger.info(f"Command exit code: {exit_code}")

        if exit_code == 0:
            decky_plugin.logger.info("Migration successful")
        else:
            decky_plugin.logger.error("Migration failed")

        # Start the web server and pipe related code here
        decky_plugin.logger.info("Hello World!")
        await self.runner.setup()
        decky_plugin.logger.info("Server setup completed")  # Log server setup
        self.site = web.TCPSite(self.runner, 'localhost', 8765)
        await self.site.start()
        decky_plugin.logger.info("Server started")  # Log server start