Producing Output Zips
It is about time to wrap up the archive generator, so it is time to actually generate archives. The basic steps are as follow:
-
Parse the Archives
-
Write the archives to the zip file.
Obviously the basics steps are not that complicated; Parsing the archives in the complicated part…
Part 1: Parsing Dates
I wrote a quick datetime parsing tool for converting to/from strings. The chat archives have a fairly standard format for dates, so it was pretty easy to implement. The only really weird thing is there is a single narrow no-break space character (U+202F) for some reason. All other spaces are normal spaces.
Part 2: Parsing Archives
parsing archives is split into creating group_info.json and creating messages.json. group_info.json contains the details for every person in the group. This includes their name, email, and if they are Human or a Bot. messages.json contains the data for every messages. For each message, there is a json object detailing who created the message (name, email, and user type), and further data of when it was created, the message text, and some ID values.
Message IDs
Each message in the main group gets its own topic ID; messages in threads use the topic ID of the message the thread is linked to. The message’s own ID is created using the Group ID, the Topic ID, and an ID unique to the message (if it is a top level message, this is the same as the topic ID).
#Part 4: Writing to Archives
This is a fairly simple step; the most interesting part is generating the archive name. I based it on the actual exported zip names by making the name chronovisor-generator_takeout- + the time it was exported.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.