Build now uses alpine, cleanup TODO
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
0b472366bd
commit
3ac94dde49
17
Dockerfile
17
Dockerfile
|
@ -1,4 +1,4 @@
|
||||||
FROM golang:1.18-bullseye
|
FROM golang:1.18-alpine
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
|
@ -7,10 +7,15 @@ ENV CXXFLAGS="-march=native -Ofast -flto"
|
||||||
ENV LDFLAGS="-flto"
|
ENV LDFLAGS="-flto"
|
||||||
ENV CGO_CFLAGS="-march=native -Ofast"
|
ENV CGO_CFLAGS="-march=native -Ofast"
|
||||||
|
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt update && \
|
RUN apk update && apk add --no-cache \
|
||||||
DEBIAN_FRONTEND=noninteractive apt install -y \
|
git gcc g++ bash autoconf automake cmake make libtool gettext \
|
||||||
git build-essential autoconf automake cmake make libtool libtool-bin gettext \
|
openssl-dev && \
|
||||||
libssl-dev libebur128-dev && \
|
git clone --depth 1 --branch v1.2.6 https://github.com/jiixyj/libebur128.git && cd libebur128 && \
|
||||||
|
mkdir build && cd build && \
|
||||||
|
cmake .. -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX:PATH=/usr && \
|
||||||
|
make -j$(nproc) && \
|
||||||
|
make install && \
|
||||||
|
cd ../.. && \
|
||||||
git clone --depth 1 --branch 0.2.2 https://github.com/libsndfile/libsamplerate.git && cd libsamplerate && \
|
git clone --depth 1 --branch 0.2.2 https://github.com/libsndfile/libsamplerate.git && cd libsamplerate && \
|
||||||
./autogen.sh && \
|
./autogen.sh && \
|
||||||
./configure --prefix /usr && \
|
./configure --prefix /usr && \
|
||||||
|
@ -66,7 +71,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt update && \
|
||||||
make -j$(nproc) && \
|
make -j$(nproc) && \
|
||||||
make install && \
|
make install && \
|
||||||
cd .. && \
|
cd .. && \
|
||||||
rm -rf /src/libsamplerate /src/libebur128 /src/lame-3.100 /src/ogg /src/opus /src/opusfile /src/flac /src/libopusenc /src/fdk-aac /src/alac
|
rm -rf /src/libebur128 /src/libsamplerate /src/lame-3.100 /src/ogg /src/opus /src/opusfile /src/flac /src/libopusenc /src/fdk-aac /src/alac
|
||||||
|
|
||||||
COPY . /code
|
COPY . /code
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
|
|
|
@ -52,6 +52,9 @@ $ go run git.gammaspectra.live/S.O.N.G/MeteorLight@<commit_hash>
|
||||||
```
|
```
|
||||||
|
|
||||||
### From Docker/Podman
|
### From Docker/Podman
|
||||||
|
|
||||||
|
Image is using `golang:1.18-alpine`, dependencies are built from scratch. See [Dockerfile](Dockerfile).
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ docker build -t meteorlight .
|
$ docker build -t meteorlight .
|
||||||
$ docker run --rm -it -v "$(pwd)/config.toml:/config.toml:ro" -v "$(pwd)/fallback.flac:/fallback.flac:ro" -p 8001:8001 -p 127.0.0.1:4040:4040 meteorlight
|
$ docker run --rm -it -v "$(pwd)/config.toml:/config.toml:ro" -v "$(pwd)/fallback.flac:/fallback.flac:ro" -p 8001:8001 -p 127.0.0.1:4040:4040 meteorlight
|
||||||
|
|
9
queue.go
9
queue.go
|
@ -253,7 +253,7 @@ func (q *Queue) AddTrack(entry *QueueTrackEntry, tail bool) error {
|
||||||
q.NowPlaying <- e
|
q.NowPlaying <- e
|
||||||
for _, mount := range q.mounts {
|
for _, mount := range q.mounts {
|
||||||
mount.MetadataQueue.Enqueue(&QueueMetadataPacket{
|
mount.MetadataQueue.Enqueue(&QueueMetadataPacket{
|
||||||
//TODO: carry error
|
//TODO: carry sample rate error
|
||||||
sampleNumber: int64(q.Duration * time.Duration(queue.GetSampleRate()) / time.Second),
|
sampleNumber: int64(q.Duration * time.Duration(queue.GetSampleRate()) / time.Second),
|
||||||
TrackEntry: e,
|
TrackEntry: e,
|
||||||
})
|
})
|
||||||
|
@ -268,6 +268,7 @@ func (q *Queue) AddTrack(entry *QueueTrackEntry, tail bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
removeCallback := func(queue *queue.Queue, entry *queue.QueueEntry) {
|
removeCallback := func(queue *queue.Queue, entry *queue.QueueEntry) {
|
||||||
|
//TODO: carry sample rate error
|
||||||
atomic.AddInt64((*int64)(&q.Duration), int64((time.Second*time.Duration(entry.ReadSamples))/time.Duration(entry.Source.GetSampleRate())))
|
atomic.AddInt64((*int64)(&q.Duration), int64((time.Second*time.Duration(entry.ReadSamples))/time.Duration(entry.Source.GetSampleRate())))
|
||||||
|
|
||||||
q.Remove(entry.Identifier)
|
q.Remove(entry.Identifier)
|
||||||
|
@ -522,7 +523,7 @@ func (q *Queue) HandleRadioRequest(writer http.ResponseWriter, request *http.Req
|
||||||
if strings.HasSuffix(request.URL.Path, mount.Mount) {
|
if strings.HasSuffix(request.URL.Path, mount.Mount) {
|
||||||
writer.Header().Set("Content-Type", mount.MimeType)
|
writer.Header().Set("Content-Type", mount.MimeType)
|
||||||
writer.Header().Set("Cache-Control", "no-store, max-age=604800")
|
writer.Header().Set("Cache-Control", "no-store, max-age=604800")
|
||||||
writer.Header().Set("Access-Control-Expose-Headers", "Accept-Ranges, Server, Content-Type, Icy-MetaInt")
|
writer.Header().Set("Access-Control-Expose-Headers", "Accept-Ranges, Server, Content-Type, Icy-MetaInt, X-Listener-Identifier")
|
||||||
writer.Header().Set("Vary", "*")
|
writer.Header().Set("Vary", "*")
|
||||||
|
|
||||||
rangeHeader := request.Header.Get("range")
|
rangeHeader := request.Header.Get("range")
|
||||||
|
@ -672,8 +673,6 @@ func (q *Queue) HandleRadioRequest(writer http.ResponseWriter, request *http.Req
|
||||||
return requestDone.Error
|
return requestDone.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: category
|
|
||||||
|
|
||||||
var frameType PacketStreamType
|
var frameType PacketStreamType
|
||||||
switch packet.KeepMode() {
|
switch packet.KeepMode() {
|
||||||
case packetizer.KeepLast:
|
case packetizer.KeepLast:
|
||||||
|
@ -927,7 +926,7 @@ func (q *Queue) HandleRadioRequest(writer http.ResponseWriter, request *http.Req
|
||||||
Headers: headers,
|
Headers: headers,
|
||||||
},
|
},
|
||||||
Start: func(packets []packetizer.Packet) error {
|
Start: func(packets []packetizer.Packet) error {
|
||||||
log.Printf("adding %s client to stream %s (%s, %s, agent \"%s\")\n", listenerIdentifier, mount.Mount, request.RemoteAddr, request.Proto, request.Header.Get("user-agent"))
|
log.Printf("adding %s client to stream %s (%s, %s, agent \"%s\", buffer %.2f seconds)\n", listenerIdentifier, mount.Mount, request.RemoteAddr, request.Proto, request.Header.Get("user-agent"), float64(sampleBufferLimit)/float64(mount.SampleRate))
|
||||||
if len(packets) > 0 {
|
if len(packets) > 0 {
|
||||||
sampleBufferMin := packets[len(packets)-1].GetStartSampleNumber() - sampleBufferLimit
|
sampleBufferMin := packets[len(packets)-1].GetStartSampleNumber() - sampleBufferLimit
|
||||||
for _, p := range packets {
|
for _, p := range packets {
|
||||||
|
|
Loading…
Reference in a new issue