To use this library, first download the 79 gzip files described in the official post.
Next, run python place_vid/place_db.py /path/to/data/dir
to build the database.
This takes about 20 minutes, and the resulting SQLite database is about 12GB.
Likely the most common use-case for the data will be to make time-lapse videos of r/place. To create a video, try something like this:
from datetime import datetime
from place_vid import PlaceVideo, PlaceDB
db = PlaceDB('/path/to/place2022.db')
ts = datetime(2022, 4, 1, 10, 0)
place_video = PlaceVideo(db, 35, 148, 11, 9, ts=ts, speed='normal', scale=16, duration=26)
place_video.write_gif('cc.gif', fps=15)
Here the calling structure of the PlaceVideo
constructor is
PlaceVideo(db, x, y, w, h, ts=None, speed='normal', scale=1, duration=None)
where
db
is the filename of the database file created byplace_vid/place_db.py
x
,y
,w
,h
define the rectangle to capturets
is the starting time, which can be adatetime
objectspeed
is the rate at which the timelapse should play, and can be a real number.normal
is1200
scale
optional upscaling of the videoduration
length of time to capture
After instantiating the PlaceVideo
object, you can save the video using the
MoviePy
interface, by calling .write_videofile('movie.mp4', fps=24)
or even create an animated
GIF as in the above example.