jooola / earhorn

Listen, monitor and archive your Icecast streams!
GNU General Public License v3.0
10 stars 4 forks source link

Segments.csv not found after stream listener restart #116

Closed paddatrapper closed 2 years ago

paddatrapper commented 2 years ago

It looks like, after a network disruption, the stream listener restarted, but the stream archive couldn't find the new segments.csv file. I would guess because it wasn't created yet. The system continued to run without any additional errors, but no audio was uploaded to S3

2022-09-14 16:39:12.033 | DEBUG    | earhorn.stream_archive_s3:ingest_segment:24 - uploading segment /tmp/earhorn-0s3s3n4h/segment.2022-09-14-16-30-04.mp3 to s3://uct-radio-archive                                                           
2022-09-14 16:39:12.415 | DEBUG    | earhorn.stream:listen:107 - command exited with 0                                                                                                                                                         
2022-09-14 16:39:17.124 | INFO     | earhorn.stream:listen:112 - stream listener stopped                                                                                                                                                       
2022-09-14 16:39:21.475 | ERROR    | earhorn.stream:check_stream:77 - could not stream from 'https://edge.iono.fm/xice/uctradio_live_medium.aac'                                                                                               
2022-09-14 16:39:21.475 | DEBUG    | earhorn.stream:check_stream:78 - Client error '404 Not Found' for url 'https://edge.iono.fm/xice/uctradio_live_medium.aac'                                       
For more information check: https://httpstatuses.com/404                                                                                                                                                                                       
2022-09-14 16:39:21.476 | DEBUG    | earhorn.event:run:91 - when=datetime.datetime(2022, 9, 14, 16, 39, 21, 476112) kind='down' name='status'                                                       
2022-09-14 16:39:30.965 | ERROR    | earhorn.stream:check_stream:77 - could not stream from 'https://edge.iono.fm/xice/uctradio_live_medium.aac'                                                                                               
2022-09-14 16:39:30.965 | DEBUG    | earhorn.stream:check_stream:78 - Client error '404 Not Found' for url 'https://edge.iono.fm/xice/uctradio_live_medium.aac'                                     
For more information check: https://httpstatuses.com/404                                                                                                                                                                                       
2022-09-14 16:39:30.965 | DEBUG    | earhorn.event:run:91 - when=datetime.datetime(2022, 9, 14, 16, 39, 30, 965519) kind='down' name='status'                                                                                                  
2022-09-14 16:39:36.638 | DEBUG    | earhorn.event:run:91 - when=datetime.datetime(2022, 9, 14, 16, 39, 36, 638086) kind='up' name='status'                                                        
2022-09-14 16:39:36.638 | DEBUG    | earhorn.event:run:91 - when=datetime.datetime(2022, 9, 14, 16, 39, 36, 638157) kind='end' seconds=Decimal('0.0') duration=None name='silence'                  
2022-09-14 16:39:36.639 | INFO     | earhorn.stream:listen:90 - starting stream listener                                                                                                                                                       
2022-09-14 16:39:36.639 | DEBUG    | earhorn.stream:listen:93 - running command 'ffmpeg -hide_banner -nostats -re -vn -i https://edge.iono.fm/xice/uctradio_live_medium.aac -map 0 -af silencedetect=noise=-60dB:d=2 -f null /dev/null -map 0 -
map_metadata -1 -f segment -strftime 1 -segment_time 600 -segment_format mp3 -segment_list /tmp/earhorn-0s3s3n4h/segments.csv -reset_timestamps 1 /tmp/earhorn-0s3s3n4h/segment.%Y-%m-%d-%H-%M-%S.mp3'
2022-09-14 16:39:36.642 | DEBUG    | earhorn.stream_silence:parse_process_output:82 - starting to parse stdout                                                                                                                                 
Exception in thread Thread-6 (wait_for_segments):                                                                                                                                                                                              
Traceback (most recent call last):                                                                                                                                                                                                             
  File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner                                                                                                                                                                
    self.run()                                                                                                                                                                                                                                 
  File "/usr/local/lib/python3.10/threading.py", line 953, in run                                                                                                                                                                              
    self._target(*self._args, **self._kwargs)                                                                                                                                                                                                  
  File "/opt/venv/lib/python3.10/site-packages/earhorn/stream_archive.py", line 140, in wait_for_segments                                                                                                                                      
    with self.tmp_segment_list.open(                                                                                                                                                                                                           
  File "/usr/local/lib/python3.10/pathlib.py", line 1119, in open                                                                                                                                                                              
    return self._accessor.open(self, mode, buffering, encoding, errors,                                                                                                                                                                        
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/earhorn-0s3s3n4h/segments.csv'
jooola commented 2 years ago

I could reproduce this and fixed it in #117. A new patch release is being published.