Hi,
I have created a FM receiver using GNU and the output is fed to an audio
sink to listen live and to a wavefile sink to record. There was no option
to edit the recording time in GUI, so I edited the python code to record
and rename the file every 5 mins. But the problem is only the first file
has data and other files are created but with no data.The code i've written
for this as follows:
 *def create_new_file(self):*























*current_time = datetime.datetime.now()        elapsed_time = current_time
- self.start_time        if elapsed_time.total_seconds() >= REC_TIME_SEC:
          self.blocks_wavfile_sink_0.close()            filename =
'E:\\Record\\{}.mp3'.format(current_time.strftime("%Y%m%d_%H%M%S"))
    self.blocks_wavfile_sink_0 = blocks.wavfile_sink(filename, 1, 48000,
8)            self.start_time = current_time                def
check_and_create_file(self):        current_time = datetime.datetime.now()
      elapsed_time = current_time - self.start_time        if
elapsed_time.total_seconds() >= REC_TIME_SEC:
self.create_new_file()                def work(self, input_items,
output_items):        current_time = datetime.datetime.now()
elapsed_time = current_time - self.start_time
self.total_items_written+=len(output_items[0])        # Call
create_new_file multiple times if enough time has elapsed        if
elapsed_time.total_seconds() >= REC_TIME_SEC:
self.create_new_file()            current_time = datetime.datetime.now()
        elapsed_time = current_time - self.start_time             return
len(output_items[0])*
Thank you in advance..

Reply via email to