Crate dim

source · []
Expand description

Dim is a media manager written in rust. It uses Diesel as the ORM and rocket for the http/s server

The project is split up into several crates:

  • database - Holds all the database models including some frequently used db operations
  • routes - All of the routes that we expose over http are stored in there
  • scanners - The filesystem scanner and daemon code is located here ffmpeg that is used by several parts of dim

Building

Dim can easily be built with cargo build –release. When built with –release, build.rs will compile the web ui and embed it into dim.

To run

Dim can be ran using docker, by pulling vgarleanu/dim-server, or locally. If ran locally, make sure PostgreSQL is running with the password for postgres: dimpostgres

Testing

To test run make test in the root, or cargo test in the root of each module including the root dir.

Re-exports

pub use routes::settings::get_global_settings;
pub use routes::settings::init_global_settings;
pub use routes::settings::set_global_settings;
pub use routes::settings::GlobalSettings;

Modules

Module contains our core initialization logic.

Module contains all the error definitions used in dim, and returned by the web-service.

Module contains our external api interfaces

Contains the code for fetching assets like posters and stills.

Contains our custom logger for rocket

Contains all of the routes exposed by the webapi. This module contains all the routes supported by the API.

Contains our media scanners and so on.

Contains the fairing which tracks streams across rest api

Contains all the logic needed for streaming and on-the-fly transcoding.

Tree-like structure for representing directories of files.

Various utilities

Websocket related logic.

Macros

Source: https://github.com/seanmonstar/warp/issues/619 Takes a list of handler expressions and ors them together in a balanced tree. That is, instead of a.or(b).or(c).or(d), it produces (a.or(b)).or(c.or(d)), thus nesting the types less deeply, which provides improvements in compile time.

Construct a serde_json::Value from a JSON literal.

Functions

Function builds a logger drain that drains to a json file located in logs/ and also to stdout.