Code Monkey home page Code Monkey logo

ambry's Introduction

Intro

Ambry is your personal audiobook shelf. Upload your books to a self hosted server and stream to any device over the web.

Running the server

NOTE: This README reflects the main branch of this project and is not necessarily accurate to the latest stable release.

The easiest way to get up and running quickly is to use the container image which is hosted on the GitHub container registry: https://github.com/doughsay/ambry/pkgs/container/ambry

The only external requirement is a PostgreSQL database.

You can optionally also supply a headless FireFox instance running marionette for web-scraping to import metadata from external sources such as GoodReads.

Compose example

Here is an example Docker Compose file that could be used to run Ambry and the required PostgreSQL database:

---
version: "3"
services:
  postgres:
    image: postgres:alpine
    container_name: postgres
    environment:
      - POSTGRES_HOST_AUTH_METHOD=trust
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: unless-stopped

  firefox:
    image: ghcr.io/ambry-app/firefox-headless-marionette:latest
    container_name: firefox
    restart: unless-stopped

  ambry:
    image: ghcr.io/ambry-app/ambry:latest
    container_name: ambry
    environment:
      - DATABASE_URL=postgres://postgres:postgres@postgres/postgres
      - MARIONETTE_URL=tcp://firefox:2828
      - SECRET_KEY_BASE=FpmsgoGanxtwT6/M9/LbP2vFQP70dVqz2G/lC23lzOo2cmGkl82lW18Q01Av3RGV
      - BASE_URL=http://localhost:9000
      - PORT=9000
    ports:
      - 9000:9000
    volumes:
      - uploads:/app/uploads
    restart: unless-stopped

volumes:
  pgdata:
  uploads:

WARNING: The secret key above is only an example, do not use a publicly available key!

Configuration

The following environment variables are used for configuration:

Variable Description Default Required?
BASE_URL The url at which you will be serving Ambry. e.g. https://ambry.mydomain.com N/A Yes
DATABASE_URL A postgresql URL. e.g. postgresql://username:password@host/database_name N/A Yes
SECRET_KEY_BASE A secret key string of at least 64 bytes, used for signing secrets like session cookies. N/A Yes
PORT The port you wish the server to listen on. 80 No
POOL_SIZE The number of postgresql database connections to open. 10 No
USER_REGISTRATION_ENABLED Whether or not users are allowed to register themselves with the server. no No
MAIL_PROVIDER Valid values: mailjet not-set No
MAIL_FROM_ADDRESS The email address that transactional emails are sent from noreply@<HOST> No
MARIONETTE_URL A tcp URL to a marionette enabled FireFox. e.g. tcp://hostname:2828 not-set No

Based on which mail provider you choose, you will need to supply provider specific configuration:

Mailjet

Variable Description
MAILJET_API_KEY The API key provided to you by Mailjet
MAILJET_SECRET The API secret provided to you by Mailjet

The mail provider is only used for sending registration emails and forgotten password emails. If you don't need or want this functionality, you can just leave the MAIL_PROVIDER variable unset.

Setting up a fully working email provider requires a domain name that you control that you can configure correctly with your chosen provider. Currently the only provider that's working with Ambry is Mailjet, but if there's interest in others, they can be very easily added.

First time setup

The first time Ambry is booted up, it will walk you through setting up your initial admin user account. Just visit the URL at which you're hosting Ambry to get started:

  • http(s)://your-ambry-domain/

Once that's done, the server will restart and you can log into your new account and get started using Ambry!

Local development

Ambry is a Phoenix LiveView application, so to run the server on your machine for local development follow standard steps for phoenix applications. To be able to transcode audio files, you'll also need ffmpeg and shaka-packager available in your path.

Requirements

For Elixir/Erlang you can easily install all the right versions using asdf by running asdf install from within the root directory. The versions are defined in .tool-versions.

# download hex and npm dependencies
mix deps.get
mix npm_deps.get

# create and migrate the database
mix ecto.setup

# run the server
iex -S mix phx.server

Seeds & example files

To add some example books and media to your local database, you can run:

mix seed

This will populate the database with some example books & media, and download & extract the example books & media files into your local uploads/ folder.

NOTE: The example files omit the source files for a smaller download-size, so visiting the admin audit page (http://localhost:4000/admin/audit) will show them all as missing their sources.

ambry's People

Contributors

dependabot[bot] avatar doughsay avatar github-actions[bot] avatar kianmeng avatar lubien avatar mohammedzeglam-pg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ambry's Issues

Improve empty homepage experience

When starting the server for the first time, the homepage is empty. Not sure what to put there, but doing something seems better than nothing...

Add bookmarks feature

There's already an icon in the drop-down-player. Clicking it should open a modal or something similar with an interface for creating, deleting and seeking to bookmarks.

Allow state deletion / abandon book

A user should be allowed to "abandon" a book. i.e. delete a given player-state.

If they started listening to a book and for whatever reason don't want to continue and don't care about losing their saved progress, they can just request to delete the player-state.

Not sure where to put the button though...

Support chapters

This is a bit of an open-ended or "hard" problem to solve, since there's no guarantee any chapter information will be present in any uploaded source files.

  • sometimes audiobooks are split into mp3 files by chapter
  • sometimes m4b files contain embedded chapter metadata
  • sometimes no chapter information is present

So the problem is two fold:

  1. If chapter information is present in some way and we can reliably know that it is present, then we need to implement a data-model to store the information
  2. Once we do have chapter information, we need to build a UI to view/select chapters, and to change the "next"/"previous" buttons to allow skipping to chapter boundaries

Additionally, it would then also be nice to improve the sleep-timer feature to allow for "play until end of chapter".

Allow media file replacement

If you make a mistake (e.g. forget a file in a multi file upload), or upload corrupted files or something, it would be nice if you could just replace a media's files and re-process them.

Caveats: if a user has already started listening to it, it might cause issues for them.

Add navigation links to admin sections

If you're an admin user, there is currently no way to reach the admin section without manually typing in the URL. Would be nice to have a way to get there other than that.

Show more book covers in series tiles

Series tiles currently only show the cover of the first book in the series. It would be kinda cool if it maybe showed the first 3, in some kind of nice fanout or something.

Allow replacing media

Allow uploading an entirely new media source that replaces the current one. This might cause downstream issues with users who have already started (or finished) listening to the media, but we can just add a warning that this is a concern but still allow you to do it.

Add tagging for books

Allow for tagging of books so we can do rough categorization with things like genres.

MP4 concat re-encode processor

Sometimes, mp4s are just busted. The MP4 concat processor should support re-encoding the mp4s while it's concating them in this case.

Add CI (github actions)

  • check formatted
  • enforce no compile warnings
  • enforce no credo warnings
  • dialyzer maybe?

(no tests yet since there are none... ๐Ÿ˜ญ)

Build a users admin page

Features:

  • Create - emails temporary password to new user
  • Delete - also signs out
  • Invalidate session - signs user out
  • Flip admin bit
  • List sessions per user

Add some caching to CI

Caching is really tricky to get right with Elixir + GitHub actions, that's why it hasn't been added yet. But at some point it should be added...

Doesn't work on iOS (any browser) or Safari on macOS

This is because iOS and Safari do not support DASH, they only support HLS. Ambry is built around Dash.js, which only supports DASH, and also, Ambry only packages uploaded books into DASH streams.

So to fix this requires two major changes:

  1. Use something other than Dash.js (e.g. Google's shaka player)
  2. When uploading media files, convert them to two streams: one DASH and one HLS. (shaka packager already supports this)

Add tests

At least some tests, we don't need 100% out the gate

Add sleep timer feature

The ability to set a timer for when to stop playing is a common audiobook player feature.

Be less strict on counting when books are finished

Right now, you have to listen to within the last 10 seconds of the book for it to count as having been finished. This is usually within the closing credits and people stop listening before then, so a lot of users have books that are technically still in-progress, even though they "finished".

Control user sign up via env var

  • Introduce new env var called USER_SIGN_UP_MODE
  • Allow 3 possible values:
    • setup - First time setup. The first user that signs up is automatically made an admin.
    • enabled - Regular user sign-up is enabled and there are links to the sign-up page
    • disabled - User sign-up is disabled and there are no links to the sign-up page

Add faveicons

We need some icons of various sizes for browser tabs or mobile home-screens, etc.

Implement infinite scroll / auto-loading for list views

Instead of requiring the user to click the "load more" link, let's automatically load more when scroll position reaches the bottom.

Some inspiration: https://elixircasts.io/infinite-scroll-with-liveview

List views that should be affected:

  • Library recent books list
  • Series books list
  • Search results list

Lists that need some consideration:

These lists are embedded in pages with multiple lists and don't really have a good "scroll bottom".

  • Continue Listening
  • Authored / Narrated books

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.