mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
server: fixes wav not saved correctly and mp3 generation invalid if started from /tmp from another device
This commit is contained in:
1
server/.gitignore
vendored
1
server/.gitignore
vendored
@@ -178,3 +178,4 @@ audio_*.wav
|
|||||||
|
|
||||||
# ignore local database
|
# ignore local database
|
||||||
reflector.sqlite3
|
reflector.sqlite3
|
||||||
|
data/
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ class AudioFileWriterProcessor(Processor):
|
|||||||
self.out_stream = self.out_container.add_stream(
|
self.out_stream = self.out_container.add_stream(
|
||||||
"pcm_s16le", rate=data.sample_rate
|
"pcm_s16le", rate=data.sample_rate
|
||||||
)
|
)
|
||||||
for packet in self.out_stream.encode(data):
|
for packet in self.out_stream.encode(data):
|
||||||
self.out_container.mux(packet)
|
self.out_container.mux(packet)
|
||||||
await self.emit(data)
|
await self.emit(data)
|
||||||
|
|
||||||
async def _flush(self):
|
async def _flush(self):
|
||||||
if self.out_container:
|
if self.out_container:
|
||||||
for packet in self.out_stream.encode(None):
|
for packet in self.out_stream.encode():
|
||||||
self.out_container.mux(packet)
|
self.out_container.mux(packet)
|
||||||
self.out_container.close()
|
self.out_container.close()
|
||||||
self.out_container = None
|
self.out_container = None
|
||||||
|
|||||||
@@ -108,7 +108,9 @@ class Transcript(BaseModel):
|
|||||||
out.close()
|
out.close()
|
||||||
|
|
||||||
# move temporary file to final location
|
# move temporary file to final location
|
||||||
Path(tmp.name).rename(fn)
|
import shutil
|
||||||
|
|
||||||
|
shutil.move(tmp.name, fn.as_posix())
|
||||||
|
|
||||||
def unlink(self):
|
def unlink(self):
|
||||||
self.data_path.unlink(missing_ok=True)
|
self.data_path.unlink(missing_ok=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user