Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.4.2
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ target
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Bazel build artifacts
bazel-*
.bazel-cache
14 changes: 14 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Rusty MP3 Player - Bazel Module"""

module(
name = "rusty-mp3",
version = "0.1.0",
)

bazel_dep(name = "rules_rust", version = "0.48.0")

rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(edition = "2021")
use_repo(rust, "rust_toolchains")

register_toolchains("@rust_toolchains//:all")
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
# rusty-mp3
Simple mp3 player written in Rust for learning purposes

## Project Structure

- `src/` - Source code for the MP3 player
- `tests/` - Integration and unit tests
- `docs/` - Project documentation in reStructuredText format

## Building

This project uses Bazel as its build system. To build the project:

```bash
bazel build //src:rusty-mp3
```

## Running

To run the MP3 player:

```bash
bazel run //src:rusty-mp3
```

## Testing

To run the tests:

```bash
bazel test //tests:all
```

## Documentation

See the `docs/` directory for detailed documentation:
- `docs/index.rst` - Main documentation
- `docs/architecture.rst` - Architecture overview
65 changes: 65 additions & 0 deletions docs/architecture.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Architecture
============

This document describes the architecture of the Rusty MP3 player.

Components
----------

The MP3 player is designed with the following components:

Main Application
~~~~~~~~~~~~~~~~

The main application entry point handles:

* Command-line argument parsing
* Application initialization
* Coordinating between different components

MP3 Parser (Future)
~~~~~~~~~~~~~~~~~~~

The MP3 parser component will be responsible for:

* Reading MP3 file headers
* Parsing MP3 frames
* Extracting audio data and metadata

Audio Player (Future)
~~~~~~~~~~~~~~~~~~~~~

The audio player component will handle:

* Audio output device management
* Audio buffer management
* Playback control (play, pause, stop, seek)

Design Principles
-----------------

The project follows these design principles:

* **Modularity**: Components are separated into distinct modules
* **Testability**: Code is written to be easily testable
* **Learning-focused**: Code is documented and easy to understand
* **Bazel build**: Modern build system with clear dependencies

Technology Stack
----------------

* **Language**: Rust
* **Build System**: Bazel (using Bazelmod/bzlmod)
* **Audio Libraries**: TBD (possibly rodio or cpal)
* **Testing**: Rust's built-in test framework

Build System
------------

The project uses Bazel with Bazelmod (MODULE.bazel) for build configuration.
This provides:

* Reproducible builds
* Clear dependency management
* Fast incremental builds
* Cross-platform support
69 changes: 69 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Rusty MP3 Player Documentation
===============================

Welcome to the Rusty MP3 Player documentation!

Overview
--------

Rusty MP3 is a simple MP3 player written in Rust for learning purposes.
This project aims to provide a basic understanding of:

* Audio file handling
* MP3 format parsing
* Audio playback in Rust
* Building Rust projects with Bazel

Getting Started
---------------

Building the Project
~~~~~~~~~~~~~~~~~~~~

This project uses Bazel as its build system. To build the project::

bazel build //src:rusty-mp3

Running the Player
~~~~~~~~~~~~~~~~~~

To run the MP3 player::

bazel run //src:rusty-mp3

Testing
~~~~~~~

To run the tests::

bazel test //tests:all

Project Structure
-----------------

The project is organized as follows:

* ``src/`` - Source code for the MP3 player
* ``tests/`` - Integration and unit tests
* ``docs/`` - Project documentation in reStructuredText format

Future Enhancements
-------------------

Planned features include:

* MP3 file parsing
* Audio playback support
* Playlist management
* Command-line interface
* Configuration options

Contributing
------------

This is a learning project. Feel free to experiment and extend it!

License
-------

This project is for educational purposes.
8 changes: 8 additions & 0 deletions src/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("@rules_rust//rust:defs.bzl", "rust_binary")

rust_binary(
name = "rusty-mp3",
srcs = ["main.rs"],
edition = "2021",
visibility = ["//visibility:public"],
)
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!("Rusty MP3 Player");
println!("A simple MP3 player written in Rust for learning purposes");
}
7 changes: 7 additions & 0 deletions tests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
load("@rules_rust//rust:defs.bzl", "rust_test")

rust_test(
name = "integration_test",
srcs = ["integration_test.rs"],
edition = "2021",
)
4 changes: 4 additions & 0 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#[test]
fn test_basic() {
assert_eq!(2 + 2, 4);
}