151 lines
4.9 KiB
Markdown
151 lines
4.9 KiB
Markdown
# Setup Instructions
|
|
|
|
## LibreOffice Writer
|
|
|
|
### Setting Up the python-docx Library
|
|
```shell
|
|
pip install python-docx
|
|
```
|
|
|
|
## Chrome
|
|
|
|
### Starting Chrome with Remote Debugging for Python
|
|
|
|
To enable remote debugging in Chrome, which allows tools like Playwright for Python to connect to and control an existing Chrome instance, follow these steps:
|
|
|
|
#### Manually Enabling Remote Debugging in Chrome
|
|
|
|
1. **Locate the Chrome Shortcut**:
|
|
- Find the Chrome shortcut that you usually use to open the browser. This could be on your desktop, start menu, or taskbar.
|
|
|
|
2. **Edit Shortcut Properties**:
|
|
- Right-click on the Chrome shortcut and select `Properties`.
|
|
|
|
3. **Modify the Target Field**:
|
|
- In the `Target` field, add `--remote-debugging-port=9222` at the end of the path. Ensure there is a space between the path and the flag you add.
|
|
- It should look something like this: `"C:\Path\To\Chrome.exe" --remote-debugging-port=9222`.
|
|
|
|
4. **Apply and Close**:
|
|
- Click `Apply` and then `OK` to close the dialog.
|
|
|
|
5. **Start Chrome**:
|
|
- Use this modified shortcut to start Chrome. Chrome will now start with remote debugging enabled on port 9222.
|
|
|
|
6. **Confirm Remote Debugging**:
|
|
- Open a browser and navigate to `http://localhost:9222`. If you see a webpage with information about active tabs, remote debugging is working.
|
|
|
|
---
|
|
|
|
### Setting Up Playwright for Python
|
|
|
|
Playwright for Python is a browser automation library to control Chromium, Firefox, and WebKit with a single API.
|
|
|
|
#### Installing Playwright
|
|
|
|
- Ensure you have Python installed on your system. If not, download and install it from the [Python official website](https://www.python.org/).
|
|
|
|
- Install Playwright using pip (Python Package Installer). Open a command line or terminal and run:
|
|
|
|
```bash
|
|
pip install playwright
|
|
```
|
|
|
|
- After installing Playwright, you need to run the install command to download the necessary browser binaries:
|
|
|
|
```bash
|
|
playwright install
|
|
```
|
|
|
|
#### Writing a Playwright Script in Python
|
|
|
|
- Create a Python file for your automation script.
|
|
|
|
- Import the Playwright module at the beginning of your script:
|
|
|
|
```python
|
|
from playwright.sync_api import sync_playwright
|
|
```
|
|
|
|
- You can now use Playwright's API to control browsers.
|
|
|
|
#### Example Playwright Script
|
|
|
|
Here is a simple example to open a page using Playwright:
|
|
|
|
```python
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
def run(playwright):
|
|
browser = playwright.chromium.launch()
|
|
page = browser.new_page()
|
|
page.goto("http://example.com")
|
|
## other actions...
|
|
browser.close()
|
|
|
|
with sync_playwright() as playwright:
|
|
run(playwright)
|
|
```
|
|
|
|
- This script launches Chromium, opens a new page, navigates to `example.com`, and then closes the browser.
|
|
|
|
#### Troubleshooting
|
|
|
|
- If you encounter issues with Playwright, ensure that your Python environment is correctly set up and that you have installed Playwright and its dependencies correctly.
|
|
- For detailed documentation, visit the [Playwright for Python Documentation](https://playwright.dev/python/docs/intro).
|
|
|
|
|
|
## VLC Media Player
|
|
|
|
### Bugs fix
|
|
One thing on Ubuntu need to do, enter into the `meida`>`convert/save`>select files>`convert/save`
|
|
Then enter the profile of `Audio - MP3`, change the profile for mp3, section audiocodec from "MP3" to "MPEG Audio"
|
|
Otherwise the mp3 file will be created but with 0 bytes. It's a bug of VLC.
|
|
|
|
### Setting Up VLC's HTTP Interface
|
|
|
|
To enable and use the HTTP interface in VLC Media Player for remote control and status checks, follow these steps:
|
|
|
|
#### 1. Open VLC Preferences
|
|
|
|
- Open VLC Media Player.
|
|
- Go to `Tools` > `Preferences` from the menu.
|
|
|
|
#### 2. Show All Settings
|
|
|
|
- In the Preferences window, at the bottom left corner, select `All` under `Show settings` to display advanced settings.
|
|
|
|
#### 3. Enable Main Interfaces
|
|
|
|
- In the advanced preferences, expand the `Interface` section.
|
|
- Click on `Main interfaces`.
|
|
- Check the box for `Web` to enable the HTTP interface.
|
|
|
|
#### 4. Configure Lua HTTP
|
|
|
|
- Expand the `Main interfaces` node and select `Lua`.
|
|
- Under `Lua HTTP`, set a password in the `Lua HTTP` section. This password will be required to access the HTTP interface.
|
|
|
|
#### 5. Save and Restart VLC
|
|
|
|
- Click `Save` to apply the changes.
|
|
- Restart VLC Media Player for the changes to take effect.
|
|
|
|
#### 6. Accessing the HTTP Interface
|
|
|
|
- Open a web browser and go to `http://localhost:8080`.
|
|
- You will be prompted for a password. Enter the password you set in the Lua HTTP settings.
|
|
- Once logged in, you will have access to VLC's HTTP interface for remote control.
|
|
|
|
#### Packages
|
|
```bash
|
|
|
|
pip install opencv-python-headless Pillow imagehash
|
|
```
|
|
|
|
#### Troubleshooting
|
|
|
|
- If you cannot access the HTTP interface, check if your firewall or security software is blocking the connection.
|
|
- Ensure VLC is running and the correct port (default is 8080) is being used.
|
|
- If the port is in use by another application, you may change the port number in VLC's settings.
|
|
|