Revert "[update] solve meta raw&mini id grwon up problem"
This reverts commit cd60e14cbe.
This commit is contained in:
@@ -116,8 +116,8 @@ class RecordingMetaFile(JsonSerialize):
|
||||
__slots__ = ('_filename', '_filepath', '_id_db', '_create_time', '_file_version', '_file_uuid', '_data_format', '_last_time',
|
||||
'_device', '_configuration', '_channel_mask', '_database',
|
||||
'_dirty', '_last_modify_time', '_file_size_cache',
|
||||
'_recording_file_ch', '_size',
|
||||
'_parameter', '_parent', '_recording_file_name', '_recording_mini_ch',
|
||||
'_recording_file_ch', '_recording_sub_file', '_size',
|
||||
'_parameter', '_parent', '_recording_file_name', '_recording_sub_mini', '_recording_mini_ch',
|
||||
'_raw_serial_number', '_mini_serial_number', '_device_id')
|
||||
|
||||
def __init__(self, filepath: Union[str, Path], data_format: bytes = None, id_db = 0, database = None):
|
||||
@@ -168,6 +168,10 @@ class RecordingMetaFile(JsonSerialize):
|
||||
self._raw_serial_number = {}
|
||||
self._mini_serial_number = {}
|
||||
|
||||
self._recording_sub_file = {}
|
||||
self._recording_sub_mini = {}
|
||||
|
||||
|
||||
self._size = 0
|
||||
|
||||
self._dirty = True
|
||||
@@ -305,6 +309,7 @@ class RecordingMetaFile(JsonSerialize):
|
||||
if database is not None :
|
||||
self._database = database
|
||||
self._database.put_queue(['data_meta_write', meta_data, self._device_id, str(self._file_uuid), self._id_db])
|
||||
# database.put_queue(['data_meta_write', self, meta_data, _path, self._id_db])
|
||||
|
||||
with self._filepath.open('wb') as _f:
|
||||
f = FileEncoder(_f)
|
||||
@@ -354,15 +359,19 @@ class RecordingMetaFile(JsonSerialize):
|
||||
|
||||
def update_subfile(self, database = None):
|
||||
meta_data = {
|
||||
'raw_data': self._recording_sub_file,
|
||||
'mini_data': self._recording_sub_mini,
|
||||
'channels': str(self._channel_mask.channels()),
|
||||
'size': str(self._size),
|
||||
'time_duration': str(self._last_time),
|
||||
'uuid': str(self._file_uuid),
|
||||
}
|
||||
_path = str(self._filepath).replace('/', '^')
|
||||
|
||||
if database is not None :
|
||||
self._database = database
|
||||
self._database.put_queue(['data_meta_write', meta_data, self._device_id, str(self._file_uuid), self._id_db])
|
||||
# database.put_queue(['data_meta_write', self, meta_data, _path, self._id_db])
|
||||
return None
|
||||
|
||||
@property
|
||||
@@ -1071,7 +1080,6 @@ class RecordingFileWriter:
|
||||
|
||||
def channels_update(self, channels):
|
||||
channels.sort()
|
||||
self._database.put_queue(['data_meta_update_raw_empty_channel', self._meta._id_db, channels])
|
||||
self._channel_list.extend(channels)
|
||||
return self._channel_list
|
||||
|
||||
@@ -1085,6 +1093,9 @@ class RecordingFileWriter:
|
||||
return None
|
||||
|
||||
def close(self):
|
||||
# if self._recording_file is not None:
|
||||
# self._recording_file.close()
|
||||
# self._recording_file = None
|
||||
print('close1')
|
||||
self._close = True
|
||||
if len(self._recording_file_dict) > 0:
|
||||
@@ -1463,10 +1474,16 @@ class RecordingFileWriter:
|
||||
|
||||
def update_raw_dict_id(self, _channel, _id):
|
||||
self._recording_file_dict[int(_channel)]._id_db = _id
|
||||
# self._database.put_queue(['data_meta_update_channel_raw_id', self._meta._id_db, _channel, _id])
|
||||
if int(_channel) not in self._meta._recording_sub_file:
|
||||
self._meta._recording_sub_file[int(_channel)] = []
|
||||
self._meta._recording_sub_file[int(_channel)].append(_id)
|
||||
return None
|
||||
|
||||
def update_mini_dict_id(self, _scale, _channel, _id):
|
||||
self._recording_mini_dict[str(_scale)][int(_channel)]._id_db = _id
|
||||
# self._database.put_queue(['data_meta_update_channel_mini_id', self._meta._id_db, _channel, _scale, _id])
|
||||
if int(_channel) not in self._meta._recording_sub_mini:
|
||||
self._meta._recording_sub_mini[int(_channel)] = {}
|
||||
if int(_scale) not in self._meta._recording_sub_mini[int(_channel)]:
|
||||
self._meta._recording_sub_mini[int(_channel)][int(_scale)] = []
|
||||
self._meta._recording_sub_mini[int(_channel)][int(_scale)].append(_id)
|
||||
return None
|
||||
@@ -553,4 +553,4 @@ class DataBaseProcess(Process):
|
||||
except psycopg2.Error as e:
|
||||
print('e', e)
|
||||
|
||||
return True
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user