Giter Site home page Giter Site logo

radioangrezi / angrezi-live-recorder Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 471 KB

a audio recorder for live radio with meta data and remote-triggered cuts. Connects to Airtime for auto-scheduled recordings.

License: MIT License

Python 49.33% HTML 46.64% CSS 3.23% Shell 0.81%
airtime streamripper radio recording python flask-application webservice

angrezi-live-recorder's Introduction

live-recorder

Audio recorder build in Python to work together with LibreTime / Airtime, for usage in radio studio (or similar).

Records a http radio stream (via streamripper) for a maximum duration of 24 hours. Allows to remotely trigger cuts via HTTP request. Comes with a very simple frontend.

Requirements

  • Python 2.7 (3.X is not supported by `api_client.py)
  • pip and virtualenv (recommended)
  • streamripper (binary, e.g. via apt install streamripper)
  • install requirements via pip install -r requirements.txt

Usage

`recorder.py --port 5000 --airtime-conf airtime.conf --stream https://st02.sslstream.dlf.de/dlf/02/128/mp3/stream.mp3 rec-test_%station_%Y-%m-%d-%H-%M-%S_%label.mp3

API

/status-summary/

Returns a JSON object containing info on the recorder (including: recording time, state, filename), current show (from Airtime), the On-Air-Light (from Airtime).

/recording-request-cut/

Shall inform recorder.py to start a new file.

Returns 200 and a success message if the request is posted to the pipe (other process). This does not mean that the cut did take place!

/recording-disconnect-stop/

Shall inform Airtime to disconnect the master source and recorder.py to stop recording (run idle).

Returns 200 and a success message if the request is posted to the pipe (other process). This does not mean that that all actions did take place!

/recording-connect-start/

Shall inform Airtime to connect the master source and recorder.py to start recording.

Returns 200 and a success message if the request is posted to the pipe (other process). This does not mean that that all actions did take place!

/airtime/live-info/

/airtime/on-air-light/

/airtime/bootstrap-info/

Proxy calls to Airtime API (without changes).

/disconnect-master/

/connect-master/

Direct calls to connect or disconnect the master source. Currently not used in frontend.

angrezi-live-recorder's People

Contributors

jelko avatar the-leonat avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

angrezi-live-recorder's Issues

recorder throws 500 when requesting to stop a recording

recorder throws 500 when requesting to stop a recording
recorded file is not renamed.

files not renamed:

radio-angrezi-live-2020-07-21-20-03-37_incomplete.cue
radio-angrezi-live-2020-07-21-20-03-37_incomplete.mp3

service log:

Connecting...
Jul 21 20:08:36 angrezi-streaming python[6971]: stream: Radio Angrezi
Jul 21 20:08:36 angrezi-streaming python[6971]: server name: Icecast 2.4.3
Jul 21 20:08:36 angrezi-streaming python[6971]: declared bitrate: 320
Jul 21 20:08:36 angrezi-streaming python[6971]: meta interval: 16000
Jul 21 20:08:39 angrezi-streaming python[6971]: [361B blob data]
Jul 21 20:08:39 angrezi-streaming python[6971]: shutting down
Jul 21 20:08:39 angrezi-streaming python[6971]: bye..
Jul 21 20:08:39 angrezi-streaming python[6971]: rm: cannot remove '*.cue': No such file or directory
Jul 21 20:08:39 angrezi-streaming python[6971]: ERROR:flask.app:Exception on /recording-disconnect-stop/ [GET]
Jul 21 20:08:39 angrezi-streaming python[6971]: Traceback (most recent call last):
Jul 21 20:08:39 angrezi-streaming python[6971]:   File "/opt/services/angrezi-live-recorder/venv/local/lib/python2.7/site-packages/flask/app.py", line 23
Jul 21 20:08:39 angrezi-streaming python[6971]:     response = self.full_dispatch_request()
Jul 21 20:08:39 angrezi-streaming python[6971]:   File "/opt/services/angrezi-live-recorder/venv/local/lib/python2.7/site-packages/flask/app.py", line 18
Jul 21 20:08:39 angrezi-streaming python[6971]:     rv = self.handle_user_exception(e)
Jul 21 20:08:39 angrezi-streaming python[6971]:   File "/opt/services/angrezi-live-recorder/venv/local/lib/python2.7/site-packages/flask_cors/extension.p
Jul 21 20:08:39 angrezi-streaming python[6971]:     return cors_after_request(app.make_response(f(*args, **kwargs)))
Jul 21 20:08:39 angrezi-streaming python[6971]:   File "/opt/services/angrezi-live-recorder/venv/local/lib/python2.7/site-packages/flask/app.py", line 17
Jul 21 20:08:39 angrezi-streaming python[6971]:     reraise(exc_type, exc_value, tb)
Jul 21 20:08:39 angrezi-streaming python[6971]:   File "/opt/services/angrezi-live-recorder/venv/local/lib/python2.7/site-packages/flask/app.py", line 18
Jul 21 20:08:39 angrezi-streaming python[6971]:     rv = self.dispatch_request()
Jul 21 20:08:39 angrezi-streaming python[6971]:   File "/opt/services/angrezi-live-recorder/venv/local/lib/python2.7/site-packages/flask/app.py", line 18
Jul 21 20:08:39 angrezi-streaming python[6971]:     return self.view_functions[rule.endpoint](**req.view_args)
Jul 21 20:08:39 angrezi-streaming python[6971]:   File "/opt/services/angrezi-live-recorder/run/recorder.py", line 330, in disconnect_stop
Jul 21 20:08:39 angrezi-streaming python[6971]:     RECORDER.stop()
Jul 21 20:08:39 angrezi-streaming python[6971]:   File "/opt/services/angrezi-live-recorder/run/recorder.py", line 153, in stop
Jul 21 20:08:39 angrezi-streaming python[6971]:     self.update_filename()
Jul 21 20:08:39 angrezi-streaming python[6971]:   File "/opt/services/angrezi-live-recorder/run/recorder.py", line 179, in update_filename
Jul 21 20:08:39 angrezi-streaming python[6971]:     os.rename(os.path.join(self.directory, self._filename), os.path.join(self.directory, self.filename))
Jul 21 20:08:39 angrezi-streaming python[6971]: OSError: [Errno 2] No such file or directory

(some) recordings fail or stop after 3 seconds

If two recordings are scheduled in rapid succession (without a break in between or with a very short break only), the second recording will (most likely) fail.

Guess:
The scheduled start of the second recording is (correctly) triggered, when the Recorder (process) is (technically) still running. The process naturally needs time to start and save the file and terminate. Since the start of the sucessive recording is correctly triggered, it will not be repeated (or queued), even though it does fail, which is logged correctly.

Report from plenum:

Probleme mit dem Recorder: Sendungen werden nicht richtig aufgezeichnet
Leo und Jelko ist die Fehlerquelle (nun) bekannt, kann aber voraussichtlich in 3 Wochen bearbeitet werden.
Bitte aktuell Aufnahmen manuell starten und den Start überprüfen.

@the-leonat Habe ich Details des Problems vergessen oder nicht beachtet?

pip install -r requirements.txt fails

20:07:09 milk@red:~/src/angrezi-live-recorder master ± pip install -r requirements.txt
Defaulting to user installation because normal site-packages is not writeable
WARNING: Keyring is skipped due to an exception: g-dbus-error-quark: The name org.freedesktop.secrets was not provided by any .service files (2)
Collecting APScheduler==3.6.3
  Downloading APScheduler-3.6.3-py2.py3-none-any.whl (58 kB)
     |████████████████████████████████| 58 kB 1.3 MB/s            
Collecting cffi==1.12.3
  Downloading cffi-1.12.3.tar.gz (456 kB)
     |████████████████████████████████| 456 kB 2.8 MB/s            
Collecting Click==7.0
  Downloading Click-7.0-py2.py3-none-any.whl (81 kB)
     |████████████████████████████████| 81 kB 2.0 MB/s            
Collecting configparser==4.0.2
  Downloading configparser-4.0.2-py2.py3-none-any.whl (22 kB)
Collecting enum34==1.1.6
  Downloading enum34-1.1.6-py3-none-any.whl (12 kB)
Collecting Flask==1.0.3
  Downloading Flask-1.0.3-py2.py3-none-any.whl (92 kB)
     |████████████████████████████████| 92 kB 2.3 MB/s            
Collecting Flask-Cors==3.0.8
  Downloading Flask_Cors-3.0.8-py2.py3-none-any.whl (14 kB)
Requirement already satisfied: future==0.18.2 in /usr/lib/python3.10/site-packages (from -r requirements.txt (line 8)) (0.18.2)
ERROR: Could not find a version that satisfies the requirement futures==3.3.0
ERROR: No matching distribution found for futures==3.3.0

FWIW, this is on Arch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.