···11+# Bluesky Avatar Updater
22+33+## Overview
44+55+This repository contains a Python script intended to update your Bluesky avatar automatically based on the current hour. The script utilises environment variables for configuration and reads a JSON file of blob CIDs to determine the appropriate avatar for each hour. Please note that the implementation is not yet fully operational, as several issues remain to be resolved.
66+77+## Prerequisites
88+99+Before running the script, ensure you have the following:
1010+1111+- Python 3.6 or later installed.
1212+1313+- The required Python packages:
1414+ - `python-dotenv`
1515+ - `atproto`
1616+ - Standard libraries such as `os`, `json`, `logging`, and `datetime`
1717+- A valid Bluesky account with the necessary API credentials.
1818+1919+## Installation
2020+2121+1. **Clone the repository:**
2222+2323+ ```bash
2424+ git clone https://github.com/ewanc26/bluesky-avatar-updater.git
2525+ cd bluesky-avatar-updater
2626+ ```
2727+2828+2. **Create a virtual environment and install dependencies:**
2929+3030+ ```bash
3131+ python3 -m venv .venv
3232+ source .venv/bin/activate # On Windows use: .venv\Scripts\activate
3333+ pip install -r requirements.txt
3434+ ```
3535+3636+3. **Configure environment variables:**
3737+ - Place your `.env` file in the `../assets` directory relative to the script.
3838+ - The `.env` file should contain the following entries:
3939+4040+ ```env
4141+ ENDPOINT=your_endpoint
4242+ HANDLE=your_handle
4343+ PASSWORD=your_password
4444+ ```
4545+4646+4. **Prepare the JSON file:**
4747+ - Ensure that a `cids.json` file is located in the `../assets` directory. This file should map each hour (in two-digit format) to a corresponding blob CID.
4848+4949+## Usage
5050+5151+To run the script, execute:
5252+5353+```bash
5454+python -u ./src/main.py
5555+```
5656+5757+The script will:
5858+5959+- Load the environment configuration from `./assets/.env`.
6060+- Read the blob CIDs from `./assets/cids.json`.
6161+- Determine the current hour and select the appropriate blob CID.
6262+- Attempt to authenticate and update the avatar using the AT Protocol.
6363+6464+Execution logs will be recorded in `avatar_update.log` for your review.
6565+6666+## Known Issues
6767+6868+At present, the script isn’t fully working. We’ve noticed an error when updating the profile—specifically, the `put_record()` method is missing a required parameter. There have also been occasional authentication hiccoughs, which might be due to configuration issues or [API](https://atproto.blue) quirks.
6969+7070+If you’re keen to help sort these out or have ideas for improvements, please open a Pull Request. Your contributions are very welcome!
7171+7272+---
7373+7474+## Licence
7575+7676+This project is released under the MIT Licence. See the [LICENSE](./LICENSE) file for full details.