README
This commit is contained in:
@@ -13,6 +13,7 @@ class ReplayFrame:
|
||||
def set_delta(self, delta):
|
||||
if type(delta) is not int:
|
||||
raise Exception("Delta is not type of int")
|
||||
self.delta = delta
|
||||
|
||||
def set_position(self, x, y):
|
||||
self.x = x
|
||||
@@ -24,7 +25,7 @@ class ReplayFrame:
|
||||
self.buttons = buttons
|
||||
|
||||
def __str__(self):
|
||||
return "%s|%s|%s|%s," % (self.delta, self.x, self.y, self.buttons)
|
||||
return "%d|%s|%s|%d," % (self.delta, repr(self.x), repr(self.y), self.buttons)
|
||||
|
||||
def __bytes__(self):
|
||||
return str(self).encode()
|
||||
|
||||
@@ -12,7 +12,7 @@ NIGHTCORE = 1 << 9
|
||||
FLASHLIGHT = 1 << 10
|
||||
AUTOPLAY = 1 << 11
|
||||
SPUNOUT = 1 << 12
|
||||
RELAX2 = 1 << 13
|
||||
AUTOPILOT = 1 << 13
|
||||
PERFECT = 1 << 14
|
||||
KEY4 = 1 << 15
|
||||
KEY5 = 1 << 16
|
||||
|
||||
@@ -2,6 +2,8 @@ import struct
|
||||
import string
|
||||
import lzma
|
||||
|
||||
from .frame import ReplayFrame
|
||||
|
||||
from .helpers import osuModes
|
||||
from .helpers import osuMods
|
||||
from .helpers import osuRanks
|
||||
@@ -199,12 +201,19 @@ class Replay:
|
||||
# Write replay data --------------------------------------------------------
|
||||
|
||||
def write(self, frame):
|
||||
if type(frame) is list:
|
||||
t_frame = type(frame)
|
||||
if t_frame is list:
|
||||
for _frame in frame: # (frames)
|
||||
self.write(_frame)
|
||||
return
|
||||
|
||||
self._replay_data.value += bytes(frame)
|
||||
if t_frame is ReplayFrame:
|
||||
self._replay_data.value += bytes(frame)
|
||||
elif t_frame is bytes:
|
||||
self._replay_data.value += frame
|
||||
elif t_frame is str:
|
||||
self._replay_data.value += frame.encode()
|
||||
else:
|
||||
raise Exception("Invalid frame data")
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# IO replay data -----------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user