edne / shouty Goto Github PK
View Code? Open in Web Editor NEWMinimal and pythonic wrapper to libshout2
License: MIT License
Minimal and pythonic wrapper to libshout2
License: MIT License
Hello,
I'm wondering if I can handle my use case w/ this lib (w/ some glue code of course).
I'm looking for a lighter replacement for liquidsoap as it does too much and I only need to play a playlist + idv3 tags on each file holding metadata.
Questions:
code tells me that a connection is meant to work w/ one single file
a. open 1 connection per file when you have 100 files is still ok? (well, they get closed by ctx manager indeed, still... :))
b. should I open only one connection and attach metadata on the fly on current connection?
CPU usage. Judging from your experience (I know the lib is not that old): are they any issue I might encounter w/ one of the above options?
Thanks in advance!
I set up a VPS to host a Flask app with a web player streaming music from an IceCast stream. In the Flask app I connect to the IceCast server with:
import shouty
params = {
'host': 'x.x.x.x',
'port': 8000,
'user': 'source',
'password': 'hackme',
'format': shouty.Format.MP3,
'mount': '/stream'
}
def streamRadio():
with shouty.connect(**params) as connection:
with open('music.mp3', 'rb') as f:
while True:
chunk = f.read(4096)
if not chunk:
break
connection.send(chunk)
connection.sync()
For host I use the IP address of the VPS and I have the IP for hostname in icecast.xml
. For testing, I launch the Flask Dev Server and got to the VPS address x.x.x.x:5000
. When the page loads with the web player, it tries to connect to the IceCast server using the streamRadio()
function. This returns the error Error description: Login failed
. I have tested running the Flask app on my computer and connecting to IceCast on the VPS and it worked. Is there something wrong with how I set up the parameter in the Flask app for the VPS?
Implement a logging system
I was using shouty in local dev without any problems. When I move the flask app to a VPS, I am now getting the error RuntimeError: Library shout not found
when I execute:
def streamRadio():
with shouty.connect(**params) as connection:
print(connection)
with open('music.mp3', 'rb') as f:
while True:
chunk = f.read(4096)
print(chunk)
if not chunk:
break
connection.send(chunk)
connection.sync()
I'm confused whether this is a bug or a problem with my flask app.
Implement a binding for shout_set_audio_info()
Notify the user when he tries to stream a file with the wrong format
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.