mezoahmedii / picker

Randomly pick something to do
GNU General Public License v3.0
6 stars 5 forks source link

[Feature Request] Import / Export #13

Open Hatbringer opened 2 months ago

Hatbringer commented 2 months ago

The ability to export and import items from a text file would be highly useful.

mezoahmedii commented 1 month ago

Sure, I will add this in the next update

tfuxu commented 1 month ago

Import from Wheel of Names would also be really useful and should be trivial to implement. They use standard JSON, and the only relevant part for Picker would be entries object, as it contains the list of things.

Here's a basic parser:

import json

entries: list = []

with open("test.json", "r") as f:
    data = json.load(f)

for entry in data["entries"]:
    entries.append(entry["text"])

print(entries)

And a test file: test.json

mezoahmedii commented 1 month ago

I added the ability to open a text file in the newest version (v1.1.0), I might add importing from other websites in a future update