Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
6dc53c5
Update 0 initial.sql
DutchJavaDev Feb 22, 2026
a9d54b8
Update migration.go
DutchJavaDev Feb 22, 2026
76bbfb5
Update main.go
DutchJavaDev Feb 22, 2026
6ed4e56
Create sourceHelper.go
DutchJavaDev Feb 22, 2026
1bef58d
Create queue.go
DutchJavaDev Feb 22, 2026
8135821
Create models.go
DutchJavaDev Feb 22, 2026
7729452
Create main.go
DutchJavaDev Feb 22, 2026
4344fdb
Create go.sum
DutchJavaDev Feb 22, 2026
f7f717d
Create go.mod
DutchJavaDev Feb 22, 2026
a92bff2
Create Dockerfile
DutchJavaDev Feb 22, 2026
f4b294b
Create database.go
DutchJavaDev Feb 22, 2026
6c54294
Update docker-compose.yml
DutchJavaDev Feb 22, 2026
6e7b44c
reminder
DutchJavaDev Feb 22, 2026
0f4db86
reminder
DutchJavaDev Feb 23, 2026
e7b4f21
reminder
DutchJavaDev Feb 24, 2026
a33195f
wip, tired
DutchJavaDev Feb 25, 2026
7b1fcbc
base logging
DutchJavaDev Feb 26, 2026
fc843f1
thsi took a while
DutchJavaDev Mar 7, 2026
27e8120
:)))))))))))))))))))))))
DutchJavaDev Mar 8, 2026
141bb36
Update AndroidManifest.xml
DutchJavaDev Mar 8, 2026
87173d2
Update models.dart
DutchJavaDev Mar 8, 2026
1e566bc
Update main.dart
DutchJavaDev Mar 8, 2026
e15cfa4
Update library_provider.dart
DutchJavaDev Mar 8, 2026
ae1e779
Create library_screen.dart
DutchJavaDev Mar 8, 2026
f5e9446
Delete playlists_screen.dart
DutchJavaDev Mar 8, 2026
b9eafd7
Update settings_screen.dart
DutchJavaDev Mar 8, 2026
82ea287
Update GeneratedPluginRegistrant.swift
DutchJavaDev Mar 8, 2026
5a9ae12
Update pubspec.lock
DutchJavaDev Mar 8, 2026
048e880
Update pubspec.yaml
DutchJavaDev Mar 8, 2026
a888dad
Update AndroidManifest.xml
DutchJavaDev Mar 8, 2026
0066ce1
Update build.sh
DutchJavaDev Mar 9, 2026
069a457
Update copy.sh
DutchJavaDev Mar 9, 2026
3828cc2
Update docker-compose.yml
DutchJavaDev Mar 9, 2026
055ffa4
Update Dockerfile
DutchJavaDev Mar 9, 2026
bf9786a
Update go.sum
DutchJavaDev Mar 9, 2026
43db20d
Update go.mod
DutchJavaDev Mar 9, 2026
947d129
Update log.go
DutchJavaDev Mar 9, 2026
e9a869d
Update main.go
DutchJavaDev Mar 9, 2026
19e0c23
Update models.go
DutchJavaDev Mar 9, 2026
c38de2a
Update queue.go
DutchJavaDev Mar 9, 2026
4ca4fec
Update sourceHelper.go
DutchJavaDev Mar 9, 2026
908c74f
Create storage.go
DutchJavaDev Mar 9, 2026
45245e1
Create util.go
DutchJavaDev Mar 9, 2026
5ae710b
Update migration.go
DutchJavaDev Mar 9, 2026
5b8f6ea
Update 0 initial.sql
DutchJavaDev Mar 9, 2026
b5da7d9
Merge branch 'KAN-5' of https://github.com/DutchJavaDev/LibreBeats in…
DutchJavaDev Mar 9, 2026
8da0b6c
Update storage.go
DutchJavaDev Mar 10, 2026
75019f5
Update sourceHelper.go
DutchJavaDev Mar 10, 2026
f6c3076
Update main.go
DutchJavaDev Mar 10, 2026
3b3fb2f
Update log.go
DutchJavaDev Mar 10, 2026
ca63a5f
Update docker-compose.yml
DutchJavaDev Mar 11, 2026
0fdf905
Update storage.go
DutchJavaDev Mar 11, 2026
91df9d6
Update 0 initial.sql
DutchJavaDev Mar 11, 2026
79e78fb
Update log.go
DutchJavaDev Mar 12, 2026
e30f43d
Update main.go
DutchJavaDev Mar 12, 2026
ba4ad99
Update models.go
DutchJavaDev Mar 12, 2026
5ec621a
Update storage.go
DutchJavaDev Mar 12, 2026
bdc031b
Update 0 initial.sql
DutchJavaDev Mar 12, 2026
1f15b5b
Update Dockerfile
DutchJavaDev Mar 13, 2026
7ee86b0
Update storage.go
DutchJavaDev Mar 13, 2026
88fea9d
Update docker-compose.yml
DutchJavaDev Mar 15, 2026
5906235
Update database.go
DutchJavaDev Mar 15, 2026
99fa273
Update Dockerfile
DutchJavaDev Mar 15, 2026
2b7b74b
Update log.go
DutchJavaDev Mar 15, 2026
f6ae274
Update main.go
DutchJavaDev Mar 15, 2026
ac681ba
Update models.go
DutchJavaDev Mar 15, 2026
3b53994
Update sourceHelper.go
DutchJavaDev Mar 15, 2026
d2d7150
Update storage.go
DutchJavaDev Mar 15, 2026
c624900
Update util.go
DutchJavaDev Mar 15, 2026
839cba2
Update Dockerfile
DutchJavaDev Mar 15, 2026
8b0ac14
Update 0 initial.sql
DutchJavaDev Mar 15, 2026
4e61099
Update 0 initial.sql
DutchJavaDev Mar 16, 2026
f2cdb9a
Update util.go
DutchJavaDev Mar 16, 2026
7ce7a6a
Update storage.go
DutchJavaDev Mar 16, 2026
f70837b
Update sourceHelper.go
DutchJavaDev Mar 16, 2026
8f4f5aa
Update main.go
DutchJavaDev Mar 16, 2026
814f32d
Update 0 initial.sql
DutchJavaDev Mar 19, 2026
b5ff6d2
Update main.go
DutchJavaDev Mar 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/backend/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ else
echo "Project directory already exists, skipping mkdir."
fi

sudo rm -rf "$BUILD_DIRECTORY"

# Create local backend folder if missing
# Tree should look like this
# ├── librebeats_api/build (output directory)
Expand All @@ -37,9 +39,6 @@ fi
# # # Switch to your project directory
cd "$BUILD_DIRECTORY"

# # # Pull the latest images
docker compose pull

# # # To generate and apply all secrets at once you can run: https://supabase.com/docs/guides/self-hosting/docker#quick-setup-experimental
if [ "$GENERATE_KEYS" = true ]; then
echo "Generating new keys."
Expand Down
6 changes: 4 additions & 2 deletions src/backend/copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ cp -rf $_WORKING_DIR/supabase/* "$BUILD_DIRECTORY"
# # # Switch to your project directory
cd "$BUILD_DIRECTORY/service/migration" || exit 1

docker compose build migrations
docker compose up migrations -d --force-recreate
docker compose build audio
docker compose up audio -d

# --force-recreate
25 changes: 22 additions & 3 deletions src/backend/supabase/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,29 @@ services:
db:
condition: service_healthy
environment:
SUPABASE_SERVICE_KEY: ${SERVICE_ROLE_KEY}
SUPABASE_URL: http://kong:8000
POSTGRES_BACKEND_URL: postgresql://supabase_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/postgres
JWT_SECRET: ${JWT_SECRET}

# Ytdlp wrapper, Upload service, and logger for librebeats audio processing
audio:
container_name: supabase-audio
build:
context: ./service/audio
dockerfile: Dockerfile
restart: "no"
depends_on:
migrations:
condition: service_completed_successfully
db:
condition: service_healthy
storage:
condition: service_healthy
environment:
POSTGRES_BACKEND_URL: postgresql://supabase_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/postgres
QUEUE_NAME: audiopipe-input
STORAGE_URL: http://kong:8000/storage/v1
STORAGE_KEY: ${SERVICE_ROLE_KEY}
AUDIO_BUCKET_ID: audio-files
IMAGE_BUCKET_ID: image-files

# Comment out everything below this point if you are using an external Postgres database
db:
Expand Down
27 changes: 27 additions & 0 deletions src/backend/supabase/service/audio/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Stage 1: Builder (stays the same)
FROM golang:1.26-alpine AS builder
WORKDIR /app
COPY go.mod go.sum* ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o main

# Stage 2: Final image with Alpine
FROM alpine:latest
WORKDIR /app

# Install required system packages
RUN apk add --no-cache ffmpeg

# Download and install the OFFICIAL musl-compatible yt-dlp binary
RUN wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_musllinux -O /usr/bin/yt-dlp \
&& chmod +x /usr/bin/yt-dlp

# Install deno (using Alpine's package or musl build)
RUN apk add --no-cache deno

# Copy the static binary and config
COPY --from=builder /app/main .
COPY cookies.txt /app/cookies.txt

CMD ["./main"]
99 changes: 99 additions & 0 deletions src/backend/supabase/service/audio/database.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package main

import (
"context"
"os"
"time"

"github.com/jackc/pgx/v5"
)

type ILibreDb interface {
NewRawAudioEntry(source string, audioLocation string, thumbnailLocation string, durration int) (RawBeat, error)
NewBeatEntry(rawBeat *RawBeat, title string, arties string, tags string, streamingUrl string, thumbnailUrl string) error
}

type LibreDb struct {
ILibreDb
ConnectionString string
}

func NewLibreDb() LibreDb {

var _ ILibreDb = (*LibreDb)(nil)

connectionString := os.Getenv("POSTGRES_BACKEND_URL")

if connectionString == "" {
panic("POSTGRES_BACKEND_URL environment variable is not set")
}
return LibreDb{
ConnectionString: connectionString,
}
}

func (db *LibreDb) NewRawAudioEntry(source string, audioLocation string, thumbnailLocation string, durration int) (RawBeat, error) {
connection, err := pgx.Connect(context.Background(), db.ConnectionString)

if err != nil {
return RawBeat{}, err
}

statement, err := connection.Begin(context.Background())

if err != nil {
return RawBeat{}, err
}

lastinsertedId := -1

err = statement.QueryRow(context.Background(), "INSERT INTO Librebeats.RawBeat (Source, AudioLocation, ThumbnailLocation, Durration) VALUES($1, $2, $3, $4) RETURNING Id", source, audioLocation, thumbnailLocation, durration).
Scan(&lastinsertedId)

if err != nil {
return RawBeat{}, err
}

err = statement.Commit(context.Background())

if err != nil {
return RawBeat{}, err
}

return RawBeat{
Id: lastinsertedId,
Source: &source,
AudioLocation: &audioLocation,
ThumbnailLocation: &thumbnailLocation,
DownloadCount: 0,
CreatedAtUtc: time.Now(),
}, nil
}

func (db *LibreDb) NewBeatEntry(rawBeat *RawBeat, title string, arties string, tags string, streamingUrl string, thumbnailUrl string) error {
connection, err := pgx.Connect(context.Background(), db.ConnectionString)

if err != nil {
return err
}

statement, err := connection.Begin(context.Background())

if err != nil {
return err
}

_, err = statement.Exec(context.Background(), "INSERT INTO Librebeats.Beat (RawBeatId, Title, Artist, Tags, StreamingUrl, ThumbnailUrl) VALUES($1, $2, $3, $4, $5, $6) RETURNING Id", rawBeat.Id, title, arties, tags, streamingUrl, thumbnailUrl)

if err != nil {
return err
}

err = statement.Commit(context.Background())

if err != nil {
return err
}

return nil
}
25 changes: 25 additions & 0 deletions src/backend/supabase/service/audio/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module audio

go 1.25.5

require github.com/google/uuid v1.6.0

require (
github.com/georgysavva/scany v1.2.3 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.8.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.0.6 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgtype v1.6.2 // indirect
github.com/jackc/pgx/v4 v4.10.1 // indirect
github.com/jackc/pgx/v5 v5.8.0 // indirect
github.com/jackc/puddle v1.1.3 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/supabase-community/storage-go v0.8.1 // indirect
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/text v0.29.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
)
Loading