fimfarchive
fimfarchive copied to clipboard
How to run?
Could you please add some documentation as to how to get this up and running? All the commands from cloning the repo (I already figured that part out :P but I figure it's good to include for completeness) to creating the final zip.
Definitely! Until then, clone the repo end enter the directory.
git clone https://github.com/JockeTF/fimfarchive.git
cd fimfarchive
Then create a virtual environment. The commands may vary slightly depending on your platform.
python3 -m venv venv
source venv/bin/activate
Make sure the above command succeeded, and install the development dependencies.
pip install -r requirements.txt
You can now run fimfarchive as a python module.
python -m fimfarchive
Note that there isn't really anything useful you can do with that command now. However, you can mess around with an archive release through the interactive interpreter.
>>> # Create a fetcher instance for reading from the archive.
>>> from fimfarchive.fetchers import FimfarchiveFetcher
>>> fetcher = FimfarchiveFetcher('fimfarchive.zip')
>>>
>>> # Inspect the title of a story.
>>> story = fetcher.fetch(9)
>>> story.meta['title']
'The Greatest Equine Who has Ever Lived!'
>>>
>>> # Check the number of total words in the archive.
>>> sum(story.meta['num_words'] for story in fetcher)
2081635416
>>>
>>> # Do the same thing, but with a fancy progress bar.
>>> from fimfarchive.utils import tqdm
>>> sum(story.meta['num_words'] for story in tqdm(fetcher))
72%|################## | 120536/166411 [00:15<00:06, 7639.93it/s]