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
60 changes: 60 additions & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ tauri = { version = "2", features = [] }
tauri-plugin-dialog = "2"
tauri-plugin-fs = "2"
serde = { version = "1", features = ["derive"] }
lofty = "0.24.0"
id3 = "1.17.0"

[build-dependencies]
tauri-build = { version = "2", features = [] }
5,934 changes: 5,934 additions & 0 deletions src-tauri/gen/schemas/linux-schema.json

Large diffs are not rendered by default.

34 changes: 32 additions & 2 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
use serde::Serialize;
use std::fs;
use std::path::Path;
use lofty::file::TaggedFileExt;
use lofty::probe::Probe;
use lofty::tag::Accessor;

#[derive(Serialize)]
struct DirEntry {
name: String,
path: String,
is_file: bool,
artist: Option<String>,
album: Option<String>,
genre: Option<String>,
title: Option<String>,
}

#[tauri::command]
Expand All @@ -18,10 +25,33 @@ fn read_directory(dir_path: String) -> Vec<DirEntry> {
for entry in read_dir.flatten() {
if let Ok(metadata) = entry.metadata() {
if metadata.is_file() {
let file_path_str = entry.path().to_string_lossy().to_string();
let file_name_str = entry.file_name().to_string_lossy().to_string();

let mut artist = None;
let mut album = None;
let mut genre = None;
let mut title = None;

if let Ok(tagged_file) = Probe::open(entry.path())
.and_then(|probe| probe.read()) {

if let Some(tag) = tagged_file.primary_tag().or_else(|| tagged_file.first_tag()) {
artist = tag.artist().map(|s| s.to_string());
album = tag.album().map(|s| s.to_string());
genre = tag.genre().map(|s| s.to_string());
title = tag.title().map(|s| s.to_string());
}
}

entries.push(DirEntry {
name: entry.file_name().to_string_lossy().to_string(),
path: entry.path().to_string_lossy().to_string(),
name: file_name_str,
path: file_path_str,
is_file: true,
artist,
album,
genre,
title,
});
}
}
Expand Down
44 changes: 36 additions & 8 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ <h1 class="text-xl font-bold tracking-tight">BitBeat</h1>
</button>
</nav>
<div class="mt-8">
<p class="px-3 text-xs font-bold text-[#ab9db9] uppercase tracking-wider mb-4">Themes</p>
<div class="flex items-center gap-3 px-3 mb-6">
<button class="theme-btn w-6 h-6 rounded-full bg-[#7f13ec] ring-2 ring-offset-2 ring-offset-background-dark ring-[#7f13ec] transition-all hover:scale-110" data-theme="#7f13ec" title="Purple"></button>
<button class="theme-btn w-6 h-6 rounded-full bg-[#3b82f6] ring-0 ring-offset-2 ring-offset-background-dark ring-[#3b82f6] transition-all hover:scale-110 opacity-60 hover:opacity-100" data-theme="#3b82f6" title="Blue"></button>
<button class="theme-btn w-6 h-6 rounded-full bg-[#10b981] ring-0 ring-offset-2 ring-offset-background-dark ring-[#10b981] transition-all hover:scale-110 opacity-60 hover:opacity-100" data-theme="#10b981" title="Green"></button>
<button class="theme-btn w-6 h-6 rounded-full bg-[#ef4444] ring-0 ring-offset-2 ring-offset-background-dark ring-[#ef4444] transition-all hover:scale-110 opacity-60 hover:opacity-100" data-theme="#ef4444" title="Red"></button>
<button class="theme-btn w-6 h-6 rounded-full bg-[#f59e0b] ring-0 ring-offset-2 ring-offset-background-dark ring-[#f59e0b] transition-all hover:scale-110 opacity-60 hover:opacity-100" data-theme="#f59e0b" title="Orange"></button>
</div>

<p class="px-3 text-xs font-bold text-[#ab9db9] uppercase tracking-wider mb-4">Your Collection</p>
<nav class="flex flex-col gap-1">
<button id="add-folder-btn"
Expand Down Expand Up @@ -147,17 +156,28 @@ <h1 id="playlist-title" class="text-6xl font-black tracking-tight text-white">Lo
class="w-14 h-14 bg-primary rounded-full flex items-center justify-center hover:scale-105 transition-transform shadow-lg shadow-primary/20">
<span class="material-symbols-outlined filled-icon text-white text-3xl">play_arrow</span>
</button>
<button class="text-[#ab9db9] hover:text-white transition-colors">
<button id="playlist-shuffle-btn" class="text-[#ab9db9] hover:text-white transition-colors">
<span class="material-symbols-outlined text-3xl">shuffle</span>
</button>
<button class="text-[#ab9db9] hover:text-white transition-colors" title="Open Folder">
<span class="material-symbols-outlined text-3xl">folder_open</span>
</button>
</div>
<div class="flex items-center gap-4 text-[#ab9db9] bg-[#302839]/50 rounded-lg px-4 py-2">
<span class="material-symbols-outlined text-xl">search</span>
<input type="text" id="search-input" placeholder="Find in playlist..."
class="bg-transparent border-none text-sm text-white focus:ring-0 placeholder-[#ab9db9] w-48" />
<div class="flex items-center gap-4">
<select id="filter-genre" class="bg-[#302839]/50 border-none text-sm text-[#ab9db9] focus:ring-1 focus:ring-primary rounded-lg hidden">
<option value="">All Genres</option>
</select>
<select id="filter-artist" class="bg-[#302839]/50 border-none text-sm text-[#ab9db9] focus:ring-1 focus:ring-primary rounded-lg hidden">
<option value="">All Artists</option>
</select>
<select id="filter-album" class="bg-[#302839]/50 border-none text-sm text-[#ab9db9] focus:ring-1 focus:ring-primary rounded-lg hidden">
<option value="">All Albums</option>
</select>
<div class="flex items-center gap-4 text-[#ab9db9] bg-[#302839]/50 rounded-lg px-4 py-2">
<span class="material-symbols-outlined text-xl">search</span>
<input type="text" id="search-input" placeholder="Find in playlist..."
class="bg-transparent border-none text-sm text-white focus:ring-0 placeholder-[#ab9db9] w-48" />
</div>
</div>
</div>

Expand Down Expand Up @@ -188,9 +208,11 @@ <h1 id="playlist-title" class="text-6xl font-black tracking-tight text-white">Lo
<div class="max-w-screen-2xl mx-auto flex items-center justify-between gap-4">
<!-- Now Playing -->
<div class="flex items-center gap-4 w-1/3">
<div
class="w-14 h-14 rounded-lg bg-primary/20 flex items-center justify-center shadow-lg border border-white/5">
<span id="footer-track-icon" class="material-symbols-outlined text-primary text-3xl">music_off</span>
<div class="relative w-14 h-14 rounded-lg bg-primary/20 shadow-lg border border-white/5 overflow-hidden group">
<div class="absolute inset-0 flex items-center justify-center z-10">
<span id="footer-track-icon" class="material-symbols-outlined text-primary text-3xl drop-shadow-md">music_off</span>
</div>
<canvas id="visualizer" class="absolute bottom-0 left-0 w-full h-full opacity-50 z-0"></canvas>
</div>
<div class="overflow-hidden">
<p id="track-title" class="text-sm font-bold text-white truncate">Not playing</p>
Expand All @@ -204,6 +226,9 @@ <h1 id="playlist-title" class="text-6xl font-black tracking-tight text-white">Lo
<!-- Player Controls -->
<div class="flex flex-col items-center gap-2 w-1/3 max-w-xl">
<div class="flex items-center gap-6">
<button id="shuffle-btn" class="text-[#ab9db9] hover:text-white transition-colors" title="Shuffle">
<span class="material-symbols-outlined text-xl">shuffle</span>
</button>
<button id="prev-btn" class="text-white hover:text-primary">
<span class="material-symbols-outlined filled-icon text-2xl">skip_previous</span>
</button>
Expand All @@ -214,6 +239,9 @@ <h1 id="playlist-title" class="text-6xl font-black tracking-tight text-white">Lo
<button id="next-btn" class="text-white hover:text-primary">
<span class="material-symbols-outlined filled-icon text-2xl">skip_next</span>
</button>
<button id="loop-btn" class="text-[#ab9db9] hover:text-white transition-colors" title="Loop">
<span class="material-symbols-outlined text-xl">repeat</span>
</button>
</div>
<div class="flex items-center gap-3 w-full">
<span id="current-time" class="text-[10px] font-bold text-[#ab9db9] w-8 text-right">0:00</span>
Expand Down
4 changes: 4 additions & 0 deletions src/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
@tailwind utilities;

@layer base {
:root {
--color-primary: #7f13ec; /* Default Purple */
}

html, body {
overflow: hidden;
}
Expand Down
Loading