Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement playlists #60

Draft
wants to merge 71 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
95f27a2
playlistView and initial addToPlaylist button
D0m1nos Oct 9, 2024
fcaf442
add playlist-router and playlist storage
D0m1nos Oct 9, 2024
2880308
show playlist name on the UI
D0m1nos Oct 9, 2024
ee93ab1
add playlistItem
D0m1nos Oct 9, 2024
1dbb91b
Switched to songs instead of ResourceIDs, implemented PlaylistSongs api
D0m1nos Oct 9, 2024
342e3b4
changed router type from Song[] to Playlist, playlist info shown on ui
D0m1nos Oct 10, 2024
2fa257b
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 10, 2024
af90724
implement the other playlist request APIs
D0m1nos Oct 10, 2024
4b9b1d2
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 11, 2024
cbbcf04
basic playlist functionality on new ui
D0m1nos Oct 11, 2024
3b360dc
changed file structure to be in line with the rest
D0m1nos Oct 11, 2024
512a25b
playlistItem styling
D0m1nos Oct 11, 2024
bb17da8
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 11, 2024
f173c27
fix static analysis failing
D0m1nos Oct 11, 2024
5fc4646
fix warnings
D0m1nos Oct 11, 2024
e715cdd
more warnings fixed
D0m1nos Oct 11, 2024
97ccfcb
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 12, 2024
f0934f6
basic playlist scenes
D0m1nos Oct 12, 2024
43e37a6
show song list when clicking on a playlist
D0m1nos Oct 12, 2024
288b339
play songs from playlist with working queue + styling
D0m1nos Oct 12, 2024
728dd8f
lint fix
D0m1nos Oct 12, 2024
d84f1a3
implement playlist creation scene
D0m1nos Oct 12, 2024
394ed86
styling following the figma design
D0m1nos Oct 12, 2024
30e497d
avoid entering playlist when deleting it (event propagation)
D0m1nos Oct 12, 2024
5bdd9ce
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 12, 2024
8b6b354
automatically refresh scene when deleting a playlist
D0m1nos Oct 12, 2024
8d3e66d
new playlist creation box
D0m1nos Oct 12, 2024
529cb13
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 12, 2024
8fb9317
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 13, 2024
6589ad6
fix styling, playlists refresh when adding a song
D0m1nos Oct 13, 2024
af2649c
add playlist edit mode
D0m1nos Oct 13, 2024
580241d
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 14, 2024
7811f9d
tailwind my beloved
D0m1nos Oct 14, 2024
ad88add
use Button component instead of IconButton
D0m1nos Oct 14, 2024
b189fa6
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 14, 2024
bcbd77c
fix buttons, add rename playlist api
D0m1nos Oct 15, 2024
6335b18
add playlistNames api
D0m1nos Oct 15, 2024
7f52464
temporary context menu to edit playlists
D0m1nos Oct 16, 2024
121a5ae
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 16, 2024
8b9e26b
fix errors, add none order type, remove old playlist create scene
D0m1nos Oct 17, 2024
be49089
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 17, 2024
1e62f66
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 21, 2024
d81ce8f
fix errors, fix styling issues
D0m1nos Oct 21, 2024
f875cf1
clearer variable names
D0m1nos Oct 21, 2024
4983797
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 24, 2024
d11b3ff
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 24, 2024
4e903d0
playlist notices
D0m1nos Oct 24, 2024
0235278
playlist router returns Result, show error messages
D0m1nos Oct 24, 2024
5db857d
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 25, 2024
c9ac0ef
clean comments, use new context menu on playlist items
D0m1nos Oct 25, 2024
4552ed9
add remove song from playlist button, cleaned code
D0m1nos Oct 25, 2024
b945452
add 'playlistChooser' to add a song to a specific playlist
D0m1nos Oct 25, 2024
d93928b
prevent clicking on 'add to playlist' button, playlist-list styling
D0m1nos Oct 25, 2024
43a2ab6
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Oct 31, 2024
a37ea3e
fix scroll and styling
D0m1nos Oct 31, 2024
ec63681
fix ci
D0m1nos Oct 31, 2024
604c7e5
remove wrong background color on item
D0m1nos Oct 31, 2024
d5cece2
add indicator if song is in a playlist, playlist router docs
D0m1nos Oct 31, 2024
8144013
context menu hover disappear
D0m1nos Nov 1, 2024
24c8f58
use splitProps on context menu item
D0m1nos Nov 1, 2024
025a852
fix eslint warnings
D0m1nos Nov 1, 2024
dd61358
removed some comments, check if queue already exists
D0m1nos Nov 2, 2024
337f5d2
Merge branch 'master' of https://github.com/Team-BTMC/osu-radio
D0m1nos Nov 20, 2024
a4aa9c3
fix songlist context menu, fix playlistview
D0m1nos Nov 21, 2024
22a5078
fix context menus + prettier
D0m1nos Nov 22, 2024
54d3978
fix edit mode
D0m1nos Nov 23, 2024
28db214
fix playlist item context menu
D0m1nos Nov 23, 2024
7f894df
fixes + styling
D0m1nos Nov 23, 2024
5d2aa27
create playlist context menu item
D0m1nos Nov 26, 2024
0112aa1
enter to create + fix playlist view bug
D0m1nos Nov 26, 2024
9440b5a
fix context menu
D0m1nos Nov 26, 2024
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
30 changes: 28 additions & 2 deletions src/@types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ export type Song = {
// Colors
primaryColor?: string;
secondaryColor?: string;

// Playlists
playlists?: string[];
} & Resource;

// Serialization is in JSON that's why properties are only single letter
Expand Down Expand Up @@ -126,12 +129,19 @@ export type TableMap = {
songs: { [key: ResourceID]: Song };
audio: { [key: ResourceID]: AudioSource };
images: { [key: ResourceID]: ImageSource };
playlists: { [key: string]: Playlist };
colors: { [key: ResourceID]: ColorsSource };
playlists: { [key: string]: ResourceID[] };
settings: Settings;
system: System;
};

export type Playlist = {
name: string;
count: number;
length: number; // total length in seconds
songs: Song[];
};

// I guess this is definition of all binary blob files that can be access from the database code?
export type BlobMap = {
times;
Expand Down Expand Up @@ -174,7 +184,14 @@ export type Tag = {
isSpecial?: boolean;
};

export type OrderOptions = "title" | "artist" | "creator" | "bpm" | "duration" | "dateAdded";
export type OrderOptions =
| "title"
| "artist"
| "creator"
| "bpm"
| "duration"
| "dateAdded"
| "none";

export type OrderDirection = "asc" | "desc";

Expand All @@ -201,6 +218,11 @@ export type QueueCreatePayload = {
startSong: ResourceID;
};

// idk if this is necessary because i'm only passing a string
export type PlaylistSongsQueryPayload = {
playlistName: string;
};

export type OsuSearchAbleProperties =
| "bpm"
| "artist"
Expand Down Expand Up @@ -239,3 +261,7 @@ export type InfiniteScrollerInitResponse = Optional<{
initialIndex: number;
count: number;
}>;

export type PlaylistNamesResponse = Optional<{
playlistNames: string[];
}>;
3 changes: 3 additions & 0 deletions src/ListenAPI.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export type ListenAPI = {

"songView::reset": () => void;

"playlist::resetList": () => void;
"playlist::resetSongList": () => void;

"window::maximizeChange": (maximized: boolean) => void;

notify: (notice: NoticeType) => void;
Expand Down
19 changes: 19 additions & 0 deletions src/RequestAPI.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import type {
InfiniteScrollerRequest,
InfiniteScrollerResponse,
Optional,
Playlist,
PlaylistNamesResponse,
PlaylistSongsQueryPayload,
QueueCreatePayload,
ResourceID,
ResourceTables,
Expand Down Expand Up @@ -37,6 +40,12 @@ export type RequestAPI = {
"queue::create": (payload: QueueCreatePayload) => void;
"queue::shuffle": () => void;

"playlist::add": (playlistName: string, song: Song) => Result<void, string>;
"playlist::remove": (playlistName: string, song: Song) => Result<void, string>;
"playlist::create": (name: string) => Result<void, string>;
"playlist::delete": (name: string) => Result<void, string>;
"playlist::rename": (oldName: string, newName: string) => Result<void, string>;

"dir::select": () => Optional<string>;
"dir::autoGetOsuDir": () => Optional<string>;
"dir::submit": (dir: string) => void;
Expand Down Expand Up @@ -66,6 +75,16 @@ export type RequestAPI = {
) => InfiniteScrollerResponse<Song>;
"query::queue::init": () => InfiniteScrollerInitResponse;
"query::queue": (request: InfiniteScrollerRequest) => InfiniteScrollerResponse<Song>;
"query::playlists::init": () => InfiniteScrollerInitResponse;
"query::playlists": (request: InfiniteScrollerRequest) => InfiniteScrollerResponse<Playlist>;
"query::playlistSongs::init": (
payload: PlaylistSongsQueryPayload,
) => InfiniteScrollerInitResponse;
"query::playlistSongs": (
request: InfiniteScrollerRequest,
payload: PlaylistSongsQueryPayload,
) => InfiniteScrollerResponse<Song>;
"query::playlistNames": () => PlaylistNamesResponse;

"save::localVolume": (volume: number, song: ResourceID) => void;

Expand Down
5 changes: 4 additions & 1 deletion src/main/lib/song/order.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Order, Result, Song } from "../../../@types";
import { ok } from "../rust-like-utils-backend/Result";
import { fail, ok } from "../rust-like-utils-backend/Result";
import { averageBPM, msToBPM } from "./average-bpm";

export default function order(ordering: Order): Result<(a: Song, b: Song) => number, string> {
Expand Down Expand Up @@ -46,6 +46,9 @@ export default function order(ordering: Order): Result<(a: Song, b: Song) => num
case "duration":
return ok((a: Song, b: Song) => (a.duration - b.duration) * sortDirection);

case "none":
return fail("");

default:
return ok((a: Song, b: Song) => {
if (a[option] === "") {
Expand Down
1 change: 1 addition & 0 deletions src/main/router/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "./discord-router";
import "./error-router";
import "./local-volume-router";
import "./parser-router";
import "./playlist-router";
import "./queue-router";
import "./resource-router";
import "./settings-router";
Expand Down
Loading