Skip to content

Commit

Permalink
Fix POST params
Browse files Browse the repository at this point in the history
  • Loading branch information
avdata99 committed Apr 25, 2021
1 parent 06641c0 commit f9f2aa8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion yaasr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os


__VERSION__ = '0.4.11'
__VERSION__ = '0.4.12'
BASE_FOLDER = os.path.dirname(__file__)
STREAMS_FOLDER = os.path.join(BASE_FOLDER, "streams")

Expand Down
8 changes: 7 additions & 1 deletion yaasr/recorder/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ def load(self):
def generate_stream_path(self, extension):
now = datetime.now(self.timezone)
stime = now.strftime(self.str_chunk_time_format)
if not os.path.isdir(self.destination_folder):
default_folder = '~'
logger.error(f'Destination folder doesn\'t exists {self.destination_folder}. Using {default_folder}')
self.destination_folder = default_folder
stream_path = os.path.join(self.destination_folder, f'{self.short_name}-{stime}.{extension}')
return now, stream_path

Expand All @@ -74,6 +78,7 @@ def record(self, total_seconds=0, chunk_bytes_size=1024, chunk_time_size=60):
"""

c = 0
# try all streams
for stream in self.streams:

c += 1
Expand Down Expand Up @@ -158,6 +163,7 @@ def chunk_finished(self, stream_path):
}
data.update({'post_process_functions': ppfs})
self.notify('CHUNK_FINISHED', data)
logger.info('Chunk finished: finished (?) and notified')

def notify(self, event_name, data={}, error=None):
""" notify status to an external URL """
Expand All @@ -176,6 +182,6 @@ def notify(self, event_name, data={}, error=None):
# Use secure tokens from your server to avoid assholes.
headers.update(self.notify_headers)
try:
requests.post(url=url, headers=headers, params=data)
requests.post(url=url, headers=headers, data=data)
except Exception as e:
logger.error(f'Error notifying: {e}')

0 comments on commit f9f2aa8

Please sign in to comment.