Convert Figma logo to code with AI

sentriz logogonic

music streaming server / free-software subsonic server API implementation

1,590
112
1,590
53

Top Related Projects

11,664

๐ŸŽงโ˜๏ธ Modern Music Server and Streamer compatible with Subsonic/Airsonic

:satellite: :cloud: :notes:Airsonic, a Free and Open Source community driven media server (fork of Subsonic and Libresonic)

Server for Squeezebox and compatible players. This server is also called Lyrion Music Server.

Quick Overview

Gonic is a music streaming server and web interface compatible with Subsonic clients. It's designed to be lightweight, fast, and easy to set up, providing a self-hosted solution for streaming your personal music collection.

Pros

  • Lightweight and efficient, with low resource usage
  • Compatible with a wide range of Subsonic clients
  • Supports on-the-fly audio transcoding
  • Offers a clean and responsive web interface

Cons

  • Limited to Subsonic API compatibility, may not support newer features of some clients
  • Requires manual setup and configuration
  • May have fewer advanced features compared to some commercial streaming solutions
  • Documentation could be more comprehensive for advanced use cases

Getting Started

To get started with Gonic, follow these steps:

  1. Install Gonic:

    go install go.senan.xyz/gonic@latest
    
  2. Create a configuration file:

    mkdir -p ~/.config/gonic
    touch ~/.config/gonic/config
    
  3. Edit the configuration file with your desired settings:

    music-path         = "/path/to/your/music"
    podcast-path       = "/path/to/your/podcasts"
    cache-path         = "/var/cache/gonic"
    db-path            = "/var/lib/gonic/gonic.db"
    listen-addr        = "0.0.0.0:4747"
    scan-interval      = "1h"
    jukebox-enabled    = true
    
  4. Run Gonic:

    gonic
    
  5. Access the web interface at http://localhost:4747 and set up your admin account.

For more detailed instructions and configuration options, refer to the project's GitHub repository and documentation.

Competitor Comparisons

11,664

๐ŸŽงโ˜๏ธ Modern Music Server and Streamer compatible with Subsonic/Airsonic

Pros of Navidrome

  • More active development with frequent updates and releases
  • Larger community and user base, leading to better support and documentation
  • Built-in support for multiple users and advanced features like Last.fm scrobbling

Cons of Navidrome

  • Higher resource usage, especially for large music libraries
  • More complex setup process compared to Gonic's simplicity
  • Lacks some specific features like native podcast support

Code Comparison

Navidrome (Go):

func (s *Scanner) processAudioFile(ctx context.Context, dirPath string, f os.FileInfo) error {
    filePath := filepath.Join(dirPath, f.Name())
    mf, err := s.loadAudioFile(filePath)
    if err != nil {
        return err
    }
    return s.persistTrack(ctx, mf, filePath)
}

Gonic (Go):

func (s *Scanner) ScanFile(fullPath string) (*model.Track, error) {
    file, err := os.Open(fullPath)
    if err != nil {
        return nil, fmt.Errorf("open file: %w", err)
    }
    defer file.Close()
    return s.scanFileReader(file, fullPath)
}

Both projects use Go and have similar approaches to scanning audio files, but Navidrome's implementation appears more modular with separate functions for loading and persisting tracks.

:satellite: :cloud: :notes:Airsonic, a Free and Open Source community driven media server (fork of Subsonic and Libresonic)

Pros of Airsonic

  • More mature and feature-rich project with a larger user base
  • Supports a wider range of audio formats and streaming options
  • Offers a web-based interface for easier management and playback

Cons of Airsonic

  • Heavier resource usage due to its Java-based architecture
  • Slower development cycle and less frequent updates
  • More complex setup and configuration process

Code Comparison

Airsonic (Java):

public class MediaScannerService {
    private static final Logger LOG = LoggerFactory.getLogger(MediaScannerService.class);
    private MediaLibraryStatistics statistics;
    private boolean scanning;
    private Timer timer;
}

Gonic (Go):

type Scanner struct {
	db             *db.DB
	mediaFolder    string
	coverFolder    string
	seenTracks     map[string]struct{}
	seenTracksLock sync.Mutex
}

Summary

Airsonic is a more established and feature-rich media server, offering a web interface and support for various audio formats. However, it comes with higher resource requirements and a more complex setup. Gonic, on the other hand, is a lightweight alternative written in Go, focusing on simplicity and efficiency. It may lack some advanced features but offers faster performance and easier deployment, especially for users with limited resources or those preferring a minimalist approach.

Pros of Airsonic-Advanced

  • More feature-rich with advanced functionality like playlists, podcasts, and internet radio
  • Larger and more active community, potentially leading to better support and more frequent updates
  • Supports a wider range of audio formats and streaming protocols

Cons of Airsonic-Advanced

  • Heavier resource usage due to its Java-based architecture
  • More complex setup and configuration process
  • Larger codebase, which may lead to slower development and potential bugs

Code Comparison

Gonic (Go):

func (c *Controller) ServeArtwork(w http.ResponseWriter, r *http.Request) {
    artID, err := strconv.Atoi(chi.URLParam(r, "id"))
    if err != nil {
        http.Error(w, "invalid artwork id", 400)
        return
    }
    // ... (artwork serving logic)
}

Airsonic-Advanced (Java):

@GetMapping("/getCoverArt")
public void getCoverArt(HttpServletRequest request, HttpServletResponse response) throws Exception {
    request = wrapRequest(request);
    Player player = playerService.getPlayer(request, response);
    String id = request.getParameter("id");
    // ... (cover art serving logic)
}

Both projects serve similar purposes as music streaming servers, but Gonic is written in Go and focuses on simplicity and performance, while Airsonic-Advanced is Java-based with a broader feature set. Gonic may be more suitable for users seeking a lightweight solution, whereas Airsonic-Advanced caters to those desiring a full-featured media server with extensive capabilities.

Server for Squeezebox and compatible players. This server is also called Lyrion Music Server.

Pros of slimserver

  • More mature and feature-rich project with a larger user base
  • Supports a wider range of audio formats and streaming services
  • Offers a comprehensive web-based interface for management and playback

Cons of slimserver

  • Heavier resource usage due to its extensive feature set
  • More complex setup and configuration process
  • Written in Perl, which may be less familiar to some developers

Code Comparison

slimserver (Perl):

sub initPlugin {
    my $class = shift;
    $class->SUPER::initPlugin(@_);
    Slim::Control::Request::addDispatch(['mycommand', '_command'], [1, 1, 0, \&myCommandHandler]);
}

gonic (Go):

func (c *Controller) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    c.Router.ServeHTTP(w, r)
}

The code snippets highlight the different languages and approaches used in each project. slimserver uses Perl and follows a more traditional plugin-based architecture, while gonic is written in Go and utilizes a modern HTTP router pattern.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

free-software subsonic server API implementation, supporting its many clients

features

  • browsing by folder (keeping your full tree intact) see here
  • browsing by tags (using taglib - supports mp3, opus, flac, ape, m4a, wav, etc.)
  • on-the-fly audio transcoding and caching (requires ffmpeg) (thank you spijet)
  • subsonic jukebox mode, for gapless server-side audio playback instead of streaming (thank you lxea)
  • support for podcasts (thank you lxea)
  • pretty fast scanning (with my library of ~50k tracks, initial scan takes about 10m, and about 6s after incrementally)
  • multiple users, each with their own transcoding preferences, playlists, top tracks, top artists, etc.
  • last.fm scrobbling
  • listenbrainz scrobbling (thank you spezifisch, lxea)
  • artist similarities and biographies from the last.fm api
  • support for multi valued tags like albumartists and genres (see more)
  • a web interface for configuration (set up last.fm, manage users, start scans, etc.)
  • support for the album-artist tag, to not clutter your artist list with compilation album appearances
  • written in go, so lightweight and suitable for a raspberry pi, etc. (see ARM images below)
  • newer salt and token auth
  • tested on airsonic-refix, symfonium, dsub, jamstash, subsonic.el, sublime music, soundwaves, stmp, strawberry, and ultrasonic

installation

the default login is admin/admin.
password can then be changed from the web interface

...from source

https://github.com/sentriz/gonic/wiki/installation#from-source

...with docker

https://github.com/sentriz/gonic/wiki/installation#with-docker

...with systemd

https://github.com/sentriz/gonic/wiki/installation#with-systemd

...elsewhere

configuration options

env varcommand line argdescription
GONIC_MUSIC_PATH-music-pathpath to your music collection (see also multi-folder support below)
GONIC_PODCAST_PATH-podcast-pathpath to a podcasts directory
GONIC_PLAYLISTS_PATH-playlists-pathpath to new or existing directory with m3u files for subsonic playlists. items in the directory should be in the format <userid>/<name>.m3u. for example the admin user could have 1/my-playlist.m3u. gonic create and make changes to these playlists over the subsonic api.
GONIC_CACHE_PATH-cache-pathpath to store audio transcodes, covers, etc
GONIC_DB_PATH-db-pathoptional path to database file
GONIC_HTTP_LOG-http-logoptional http request logging, enabled by default
GONIC_LISTEN_ADDR-listen-addroptional host and port to listen on (eg. 0.0.0.0:4747, 127.0.0.1:4747) (default 0.0.0.0:4747)
GONIC_TLS_CERT-tls-certoptional path to a TLS cert (enables HTTPS listening)
GONIC_TLS_KEY-tls-keyoptional path to a TLS key (enables HTTPS listening)
GONIC_PROXY_PREFIX-proxy-prefixoptional url path prefix to use if behind reverse proxy. eg /gonic (see example configs below)
GONIC_SCAN_INTERVAL-scan-intervaloptional interval (in minutes) to check for new music (automatic scanning disabled if omitted)
GONIC_SCAN_AT_START_ENABLED-scan-at-start-enabledoptional whether to perform an initial scan at startup
GONIC_SCAN_WATCHER_ENABLED-scan-watcher-enabledoptional whether to watch file system for new music and rescan
GONIC_JUKEBOX_ENABLED-jukebox-enabledoptional whether the subsonic jukebox api should be enabled
GONIC_JUKEBOX_MPV_EXTRA_ARGS-jukebox-mpv-extra-argsoptional extra command line arguments to pass to the jukebox mpv daemon
GONIC_PODCAST_PURGE_AGE-podcast-purge-ageoptional age (in days) to purge podcast episodes if not accessed
GONIC_EXCLUDE_PATTERN-exclude-patternoptional files matching this regex pattern will not be imported. eg @eaDir|[aA]rtwork|[cC]overs|[sS]cans|[sS]pectrals
GONIC_MULTI_VALUE_GENRE-multi-value-genreoptional setting for multi-valued genre tags when scanning (see more)
GONIC_MULTI_VALUE_ARTIST-multi-value-artistoptional setting for multi-valued artist tags when scanning (see more)
GONIC_MULTI_VALUE_ALBUM_ARTIST-multi-value-album-artistoptional setting for multi-valued album artist tags when scanning (see more)
GONIC_TRANSCODE_CACHE_SIZE-transcode-cache-sizeoptional size of the transcode cache in MB (0 = no limit)
GONIC_TRANSCODE_EJECT_INTERVAL-transcode-eject-intervaloptional interval (in minutes) to eject transcode cache (0 = never)
GONIC_EXPVAR-expvaroptional enable the /debug/vars endpoint (exposes useful debugging attributes as well as database stats)

multi valued tags (v0.16+)

gonic can support potentially multi valued tags like genres, artists, and albumartists. in both cases gonic will individual entries in its database for each.

this means being able to click find album "X" under both "techno" and "house" for example. or finding the album "My Life in the Bush of Ghosts" under either "David Byrne" or "Brian Eno". it also means not cluttering up your artists list with "A & X", "A and Y", "A ft. Z", etc. you will only have A, X, Y, and Z.

the available modes are:

valuedesc
multigonic will explictly look for multi value fields in your audio metadata such as "genres" or "album_artists". software like musicbrainz picard, beets (v1.6.1+ / master), or betanin can set set these
delim <delim>gonic will look at your normal audio metadata fields like "genre" or "album_artist", but split them on a delimiter. for example you could set -multi-value-genre "delim ;" to split the single genre field on ";". note this mode is not recommended unless you use an uncommon delimiter such as ";" or "|". using a delimiter like "&" will likely lead to many false positives
none (default)gonic will not attempt to do any multi value processing

screenshots

multiple folders support (v0.15+)

gonic supports multiple music folders. this can be handy if you have your music separated by albums, compilations, singles. or maybe 70s, 80s, 90s. whatever.

on top of that - if you don't decide your folder names, or simply do not want the same name in your subsonic client, gonic can parse aliases for the folder names with the optional ALIAS->PATH syntax

if you're running gonic with the command line, stack the -music-path arg

$ gonic -music-path "/path/to/albums" -music-path "/path/to/compilations" # without aliases
# or
$ gonic -music-path "my albums->/path/to/albums" -music-path "my compilations->/path/to/compilations" # with aliases

if you're running gonic with ENV_VARS, or docker, try separate with a comma

export GONIC_MUSIC_PATH="/path/to/albums,/path/to/compilations" # without aliases
# or
export GONIC_MUSIC_PATH="my albums->/path/to/albums,my compilations->/path/to/compilations" # with aliases

if you're running gonic with the config file, you can repeat the music-path option

# without aliases
music-path /path/to/albums
music-path /path/to/compilations

# or

# with aliases
music-path my albums->/path/to/albums
music-path my compilations->/path/to/compilations

after that, most subsonic clients should allow you to select which music folder to use. queries like show me "recently played compilations" or "recently added albums" are possible for example.

directory structure

when browsing by folder, any arbitrary and nested folder layout is supported, with the following caveats:

  • files from the same album must all be in the same folder
  • all files in a folder must be from the same album

please see here for more context

music
รขย”ยœรขย”ย€รขย”ย€ drum and bass
รขย”ย‚ร‚ย ร‚ย  รขย”ย”รขย”ย€รขย”ย€ Photek
รขย”ย‚ร‚ย ร‚ย      รขย”ย”รขย”ย€รขย”ย€ (1997) Modus Operandi
รขย”ย‚ร‚ย ร‚ย          รขย”ยœรขย”ย€รขย”ย€ 01.10 The Hidden Camera.flac
รขย”ย‚ร‚ย ร‚ย          รขย”ยœรขย”ย€รขย”ย€ 02.10 Smoke Rings.flac
รขย”ย‚ร‚ย ร‚ย          รขย”ยœรขย”ย€รขย”ย€ 03.10 Minotaur.flac
รขย”ย‚ร‚ย ร‚ย          รขย”ย”รขย”ย€รขย”ย€ folder.jpg
รขย”ย”รขย”ย€รขย”ย€ experimental
    รขย”ย”รขย”ย€รขย”ย€ Alan Vega
        รขย”ยœรขย”ย€รขย”ย€ (1980) Alan Vega
        รขย”ย‚ร‚ย ร‚ย  รขย”ยœรขย”ย€รขย”ย€ 01.08 Jukebox Babe.flac
        รขย”ย‚ร‚ย ร‚ย  รขย”ยœรขย”ย€รขย”ย€ 02.08 Fireball.flac
        รขย”ย‚ร‚ย ร‚ย  รขย”ยœรขย”ย€รขย”ย€ 03.08 Kung Foo Cowboy.flac
        รขย”ย‚ร‚ย ร‚ย  รขย”ย”รขย”ย€รขย”ย€ folder.jpg
        รขย”ย”รขย”ย€รขย”ย€ (1990) Deuce Avenue
            รขย”ยœรขย”ย€รขย”ย€ 01.13 Body Bop Jive.flac
            รขย”ยœรขย”ย€รขย”ย€ 02.13 Sneaker Gun Fire.flac
            รขย”ยœรขย”ย€รขย”ย€ 03.13 Jab Gee.flac
            รขย”ย”รขย”ย€รขย”ย€ folder.jpg