File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 20
20
local_share_dir = Path ("/home/hacker/.local/share/" )
21
21
local_share_dir .mkdir (parents = True , exist_ok = True )
22
22
os .chown (local_share_dir , 1000 , 1000 )
23
- timeline_path = local_share_dir / "lectures" / f"{ youtube_id } .jsonl "
23
+ timeline_path = local_share_dir / "lectures" / f"{ youtube_id } .zlib "
24
24
timeline_path .parent .mkdir (parents = True , exist_ok = True )
25
25
timeline_file = timeline_path .open ("ab" )
26
26
timeline_compressor = zlib .compressobj ()
@@ -54,7 +54,8 @@ def update_telemetry(youtube_id):
54
54
event ["youtube_id" ] = youtube_id
55
55
event ["timestamp" ] = time .time ()
56
56
timeline .append (event )
57
- timeline_file .write (timeline_compressor .compress (json .dumps (event ).encode () + b"\n " ))
57
+ timeline_file .write (timeline_compressor .compress (json .dumps (event ).encode () + b"\n " ) +
58
+ timeline_compressor .flush (zlib .Z_SYNC_FLUSH ))
58
59
timeline_file .flush ()
59
60
60
61
result = {}
You can’t perform that action at this time.
0 commit comments