Peeron instructions (PICSL) as an Alternative Source #56

Open
opened 2025-01-27 10:18:42 +01:00 by FrederikBaerentsen · 0 comments

This feature is currently a work in progress.

If Rebrickable fails to locate the instructions for a set, the system will suggest using Peeron as an alternative source.

Example Flow

  1. Search Rebrickable
    Searching an old set on Rebrickable will fail.

  2. Peeron Search Results
    When searching Peeron, a selection of available pages will be displayed:

  3. Selecting and Downloading Instructions
    Users can select the desired pages, after which a PDF will be created and downloaded:

  4. Error Handling

    • If Peeron fails to find the set, an error message will be displayed.
    • If Peeron finds the set but cannot locate the instructions, an error message will also be shown.

PDF creation

if img_response.ok:

    img_data = img_response.content
    image = Image.open(BytesIO(img_data))
    width, height = image.size

    # Add the image to the PDF
    pdf.add_page(format=(width * 0.264583, height * 0.264583))  # Convert pixels to mm (1 px = 0.264583 mm)
    pdf.image(BytesIO(img_data), x=0, y=0, w=width * 0.264583, h=height * 0.264583)

# Save the PDF
pdf.output(filename)

This unfortunately needs three extra libraries:

from io import BytesIO
from PIL import Image
from fpdf import FPDF

To do

The basic functionality is working, but the following tasks remain:

  • Add the necessary environment variables (various urls and filename template)
  • Update the socket configuration to support different download urls (or add a new download method to the socket)

Proof of concept code (in a self-contained python script) can be seen here https://gitea.baerentsen.space/FrederikBaerentsen/InstructionsDownloader/src/branch/main/dl_peeron.py. This is before i changed to using BytesIO stream without saving the image locally.

This feature is currently a work in progress. If Rebrickable fails to locate the instructions for a set, the system will suggest using Peeron as an alternative source. ### Example Flow 1. **Search Rebrickable** Searching an old set on Rebrickable will fail. ![](https://xbackbone.baerentsen.space/LaMU8/NURiXIFE79.png/raw) 2. **Peeron Search Results** When searching Peeron, a selection of available pages will be displayed: ![](https://xbackbone.baerentsen.space/LaMU8/fIWigifu76.png/raw) 3. **Selecting and Downloading Instructions** Users can select the desired pages, after which a PDF will be created and downloaded: ![](https://xbackbone.baerentsen.space/LaMU8/tANikUlo76.png/raw) 4. **Error Handling** - If Peeron fails to find the set, an error message will be displayed. - If Peeron finds the set but cannot locate the instructions, an error message will also be shown. ### PDF creation ```` if img_response.ok: img_data = img_response.content image = Image.open(BytesIO(img_data)) width, height = image.size # Add the image to the PDF pdf.add_page(format=(width * 0.264583, height * 0.264583)) # Convert pixels to mm (1 px = 0.264583 mm) pdf.image(BytesIO(img_data), x=0, y=0, w=width * 0.264583, h=height * 0.264583) # Save the PDF pdf.output(filename) ```` This unfortunately needs three extra libraries: ```` from io import BytesIO from PIL import Image from fpdf import FPDF ```` ### To do The basic functionality is working, but the following tasks remain: - Add the necessary environment variables (various urls and filename template) - Update the socket configuration to support different download urls (or add a new download method to the socket) Proof of concept code (in a self-contained python script) can be seen here https://gitea.baerentsen.space/FrederikBaerentsen/InstructionsDownloader/src/branch/main/dl_peeron.py. This is before i changed to using BytesIO stream without saving the image locally.
FrederikBaerentsen added the
Kind/Feature
label 2025-01-27 10:18:42 +01:00
FrederikBaerentsen added this to the General Improvements project 2025-01-27 10:18:42 +01:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: FrederikBaerentsen/BrickTracker#56
No description provided.