diff --git a/README.md b/README.md index 51576c6..d34445f 100644 --- a/README.md +++ b/README.md @@ -8,28 +8,46 @@ The CLI interface includes a REPL for running scripts. The REPL interactive mode also provides more details about using MPS through the `?help` command. ## Usage -To access the REPL, simply run `cargo run`. You will need the [Rust toolchain installed](https://rustup.rs/). +To access the REPL, simply run `cargo run`. You will need the [Rust toolchain installed](https://rustup.rs/). For a bit of extra performance, run `cargo run --release` instead. ## Examples + +### One-liners + +All songs by artist `` (in your library), sorted by similarity to a random first song by the artist. +```mps +files().(artist? like "")~(shuffle)~(advanced bliss_next); +``` + +All songs with a `.flac` file extension (anywhere in their path -- not necessarily at the end). +```mps +files().(filename? like ".flac"); +``` + +All songs by artist `` or ``, sorted by similarity to a random first song by either artist. +```mps +files().(artist? like "" || artist? like "")~(shuffle)~(advanced bliss_next); +``` + +### Bigger examples + For now, check out `./src/tests`, `./mps-player/tests`, and `./mps-interpreter/tests` for examples. One day I'll add pretty REPL example pictures and some script files... // TODO ## FAQ -### Is MPS Turing-Complete? -**No**. It can't perform arbitrary calculations (yet), which easily disqualifies MPS from being Turing-complete. ### Can I use MPS right now? -**Sure!** It's not complete, but MPS is completely useable for basic music queries right now. Hopefully most of the bugs have been ironed out as well... +**Sure!** It's not complete, but MPS is completely useable for basic music queries right now. Hopefully most of the bugs have been ironed out as well :) ### Why write a new language? -**I thought it would be fun**. I also wanted to be able to play my music without having to be at the whim of someone else's algorithm (and music), and playing just by album or artist was getting boring. I also thought designing a language specifically for iteration would be a novel approach to a language (though every approach is a novel approach for me). +**I thought it would be fun**. I also wanted to be able to play my music without having to be at the whim of someone else's algorithm (and music), and playing just by album or artist was getting boring. Designing a language specifically for iteration seemed like a cool & novel way of doing it, too (though every approach is a novel approach for me). ### What is MPS? **Music Playlist Script (MPS) is technically a query language for music files.** It uses an (auto-generated) SQLite3 database for SQL queries and can also directly query the filesystem. Queries can be modified by using filters, functions, and sorters built-in to MPS (see mps-interpreter's README.md). ### Is MPS a scripting language? -**No**. Technically, it was designed to be one, but it doesn't meet the requirements of a scripting language (yet). One day, I would like it be Turing-complete and then it could be considered a scripting language. At the moment it is barely a query language. +**Yes**. It evolved from a simple query language into something that can do arbitrary calculations. Whether it's Turing-complete is still unproved, but it's powerful enough to do what I want it to do. ## License diff --git a/extras/demo.png b/extras/demo.png index dfa320e..d4ce65c 100644 Binary files a/extras/demo.png and b/extras/demo.png differ diff --git a/src/main.rs b/src/main.rs index e3f4dc9..29c0408 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,28 +4,46 @@ //! The REPL interactive mode also provides more details about using MPS through the `?help` command. //! //! # Usage -//! To access the REPL, simply run `cargo run`. You will need the [Rust toolchain installed](https://rustup.rs/). +//! To access the REPL, simply run `cargo run`. You will need the [Rust toolchain installed](https://rustup.rs/). For a bit of extra performance, run `cargo run --release` instead. //! //! # Examples +//! +//! ## One-liners +//! +//! All songs by artist `` (in your library), sorted by similarity to a random first song by the artist. +//! ```mps +//! files().(artist? like "")~(shuffle)~(advanced bliss_next); +//! ``` +//! +//! All songs with a `.flac` file extension (anywhere in their path -- not necessarily at the end). +//! ```mps +//! files().(filename? like ".flac"); +//! ``` +//! +//! All songs by artist `` or ``, sorted by similarity to a random first song by either artist. +//! ```mps +//! files().(artist? like "" || artist? like "")~(shuffle)~(advanced bliss_next); +//! ``` +//! +//! ## Bigger examples +//! //! For now, check out `./src/tests`, `./mps-player/tests`, and `./mps-interpreter/tests` for examples. //! One day I'll add pretty REPL example pictures and some script files... //! // TODO //! //! # FAQ -//! ## Is MPS Turing-Complete? -//! **No**. It can't perform arbitrary calculations (yet), which easily disqualifies MPS from being Turing-complete. //! //! ## Can I use MPS right now? -//! **Sure!** It's not complete, but MPS is completely useable for basic music queries right now. Hopefully most of the bugs have been ironed out as well... +//! **Sure!** It's not complete, but MPS is completely useable for basic music queries right now. Hopefully most of the bugs have been ironed out as well :) //! //! ## Why write a new language? -//! **I thought it would be fun**. I also wanted to be able to play my music without having to be at the whim of someone else's algorithm (and music), and playing just by album or artist was getting boring. I also thought designing a language specifically for iteration would be a novel approach to a language (though every approach is a novel approach for me). +//! **I thought it would be fun**. I also wanted to be able to play my music without having to be at the whim of someone else's algorithm (and music), and playing just by album or artist was getting boring. Designing a language specifically for iteration seemed like a cool & novel way of doing it, too (though every approach is a novel approach for me). //! //! ## What is MPS? //! **Music Playlist Script (MPS) is technically a query language for music files.** It uses an (auto-generated) SQLite3 database for SQL queries and can also directly query the filesystem. Queries can be modified by using filters, functions, and sorters built-in to MPS (see mps-interpreter's README.md). //! //! ## Is MPS a scripting language? -//! **No**. Technically, it was designed to be one, but it doesn't meet the requirements of a scripting language (yet). One day, I would like it be Turing-complete and then it could be considered a scripting language. At the moment it is barely a query language. +//! **Yes**. It evolved from a simple query language into something that can do arbitrary calculations. Whether it's Turing-complete is still unproved, but it's powerful enough to do what I want it to do. //! mod channel_io;