Compare commits
3 commits
a89ab1e690
...
98de70d9f0
| Author | SHA1 | Date | |
|---|---|---|---|
| 98de70d9f0 | |||
| 159395e35d | |||
| 1778ce53cb |
14 changed files with 52 additions and 28 deletions
11
Justfile
11
Justfile
|
|
@ -9,6 +9,9 @@ mount:
|
||||||
unmount:
|
unmount:
|
||||||
bash ./mount-tool.sh unmount
|
bash ./mount-tool.sh unmount
|
||||||
|
|
||||||
|
clean:
|
||||||
|
CLEAN=1 bash ./mount-tool.sh unmount
|
||||||
|
|
||||||
run: mount
|
run: mount
|
||||||
RAVE_STORAGE_DIR=/tmp/media-for-rave RAVE_CACHE_DIR=/tmp/cache-for-rave cargo r
|
RAVE_STORAGE_DIR=/tmp/media-for-rave RAVE_CACHE_DIR=/tmp/cache-for-rave cargo r
|
||||||
|
|
||||||
|
|
@ -20,13 +23,13 @@ refresh:
|
||||||
sea generate entity -o ./entities/src --with-serde both --date-time-crate time --lib
|
sea generate entity -o ./entities/src --with-serde both --date-time-crate time --lib
|
||||||
|
|
||||||
scan:
|
scan:
|
||||||
curl -vv "http://localhost:1234/rest/startScan?c=supersonic&f=xml&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0" | xq
|
curl -vv "http://localhost:1234/rest/startScan?c=supersonic&f=json&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0" | jq
|
||||||
|
|
||||||
scanStatus:
|
scanStatus:
|
||||||
curl -vv "http://localhost:1234/rest/getScanStatus?c=supersonic&f=xml&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0" | xq
|
curl -vv "http://localhost:1234/rest/getScanStatus?c=supersonic&f=json&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0" | jq
|
||||||
|
|
||||||
getAlbumList2:
|
getAlbumList2:
|
||||||
curl -vv "http://localhost:1234/rest/getAlbumList2?c=supersonic&f=xml&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0&type=newest" | xq
|
curl -vv "http://localhost:1234/rest/getAlbumList2?c=supersonic&f=json&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0&type=newest" | jq
|
||||||
|
|
||||||
getAlbum ALBUM:
|
getAlbum ALBUM:
|
||||||
curl -vv "http://localhost:1234/rest/getAlbum?c=supersonic&f=xml&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0&id={{ ALBUM }}" | xq
|
curl -vv "http://localhost:1234/rest/getAlbum?c=supersonic&f=json&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0&id={{ ALBUM }}" | jq
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
|
||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
|
||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
|
||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
|
||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
|
||||||
|
|
||||||
pub mod prelude;
|
pub mod prelude;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
|
||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
|
||||||
|
|
||||||
pub use super::album::Entity as Album;
|
pub use super::album::Entity as Album;
|
||||||
pub use super::artist::Entity as Artist;
|
pub use super::artist::Entity as Artist;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
|
||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
|
||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
|
||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
||||||
|
|
@ -18,22 +18,22 @@ function mount_rave {
|
||||||
sudo mount /mnt/Media
|
sudo mount /mnt/Media
|
||||||
|
|
||||||
# create the overlayfs
|
# create the overlayfs
|
||||||
mkdir -p /tmp/overlay /tmp/work /tmp/media-for-rave
|
mkdir -p /tmp/overlay /tmp/work /tmp/media-for-rave /tmp/cache-for-rave
|
||||||
|
|
||||||
# mount the overlayfs
|
# mount the overlayfs
|
||||||
fuse-overlayfs -o lowerdir=/mnt/Media/Music -o upperdir=/tmp/overlay -o workdir=/tmp/work /tmp/media-for-rave
|
fuse-overlayfs -o lowerdir=/mnt/Media/Music -o upperdir=/tmp/overlay -o workdir=/tmp/work /tmp/media-for-rave
|
||||||
}
|
}
|
||||||
|
|
||||||
function unmount_rave {
|
function unmount_rave {
|
||||||
# check if already unmounted
|
# check if already unmounted, but only if CLEAN isn't set
|
||||||
if [ ! -d /tmp/media-for-rave ]; then exit 0; fi
|
if [ "${CLEAN:-}" != "1" ] && [ ! -d /tmp/media-for-rave ]; then exit 0; fi
|
||||||
|
|
||||||
# unmount the overlayfs
|
# unmount the overlayfs
|
||||||
umount /tmp/media-for-rave || true
|
umount /tmp/media-for-rave || true
|
||||||
|
|
||||||
# clean up the overlayfs if `CLEAN` is set
|
# clean up the overlayfs if `CLEAN` is set
|
||||||
if [ "${CLEAN:-}" = "true" ]; then
|
if [ "${CLEAN:-}" = "1" ]; then
|
||||||
rm -rf /tmp/overlay /tmp/work /tmp/media-for-rave
|
rm -rf /tmp/overlay /tmp/work /tmp/media-for-rave /tmp/cache-for-rave || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# unmount the music directory
|
# unmount the music directory
|
||||||
|
|
|
||||||
|
|
@ -25,20 +25,37 @@ mod get_artists;
|
||||||
// rest/getArtist
|
// rest/getArtist
|
||||||
mod get_artist;
|
mod get_artist;
|
||||||
|
|
||||||
|
// TODO: Fix the `.ping` issue, figure out how to make it work without the duplication.
|
||||||
pub fn build() -> Box<dyn Endpoint<Output = poem::Response>> {
|
pub fn build() -> Box<dyn Endpoint<Output = poem::Response>> {
|
||||||
Route::new()
|
Route::new()
|
||||||
.at("/ping", ping::ping)
|
.at("/ping", ping::ping)
|
||||||
|
.at("/ping.view", ping::ping)
|
||||||
.at("/getLicense", get_license::get_license)
|
.at("/getLicense", get_license::get_license)
|
||||||
|
.at("/getLicense.view", get_license::get_license)
|
||||||
.at("/getMusicFolders", get_music_folders::get_music_folders)
|
.at("/getMusicFolders", get_music_folders::get_music_folders)
|
||||||
|
.at(
|
||||||
|
"/getMusicFolders.view",
|
||||||
|
get_music_folders::get_music_folders,
|
||||||
|
)
|
||||||
.at("/getAlbumList", get_album_list::get_album_list)
|
.at("/getAlbumList", get_album_list::get_album_list)
|
||||||
|
.at("/getAlbumList.view", get_album_list::get_album_list)
|
||||||
.at("/getAlbumList2", get_album_list::get_album_list)
|
.at("/getAlbumList2", get_album_list::get_album_list)
|
||||||
|
.at("/getAlbumList2.view", get_album_list::get_album_list)
|
||||||
.at("/getAlbum", get_album::get_album)
|
.at("/getAlbum", get_album::get_album)
|
||||||
|
.at("/getAlbum.view", get_album::get_album)
|
||||||
.at("/stream", stream::stream)
|
.at("/stream", stream::stream)
|
||||||
|
.at("/stream.view", stream::stream)
|
||||||
.at("/startScan", start_scan::start_scan)
|
.at("/startScan", start_scan::start_scan)
|
||||||
|
.at("/startScan.view", start_scan::start_scan)
|
||||||
.at("/getScanStatus", get_scan_status::get_scan_status)
|
.at("/getScanStatus", get_scan_status::get_scan_status)
|
||||||
|
.at("/getScanStatus.view", get_scan_status::get_scan_status)
|
||||||
.at("/search3", search3::search3)
|
.at("/search3", search3::search3)
|
||||||
|
.at("/search3.view", search3::search3)
|
||||||
.at("/getCoverArt", get_cover_art::get_cover_art)
|
.at("/getCoverArt", get_cover_art::get_cover_art)
|
||||||
|
.at("/getCoverArt.view", get_cover_art::get_cover_art)
|
||||||
.at("/getArtists", get_artists::get_artists)
|
.at("/getArtists", get_artists::get_artists)
|
||||||
|
.at("/getArtists.view", get_artists::get_artists)
|
||||||
.at("/getArtist", get_artist::get_artist)
|
.at("/getArtist", get_artist::get_artist)
|
||||||
|
.at("/getArtist.view", get_artist::get_artist)
|
||||||
.boxed()
|
.boxed()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,29 +12,26 @@ pub use types::artist::Artist;
|
||||||
pub use types::child::Child;
|
pub use types::child::Child;
|
||||||
pub use types::music_folder::MusicFolder;
|
pub use types::music_folder::MusicFolder;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
pub struct SubsonicResponse {
|
pub struct SubsonicResponse {
|
||||||
pub status: ResponseStatus,
|
pub status: ResponseStatus,
|
||||||
pub version: VersionTriple,
|
pub version: VersionTriple,
|
||||||
|
#[serde(skip_serializing_if = "SubResponseType::is_empty")]
|
||||||
pub value: Box<SubResponseType>,
|
pub value: Box<SubResponseType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<SubsonicResponse> for SubsonicResponseJson {
|
impl From<SubsonicResponse> for SubsonicResponseJson {
|
||||||
fn from(value: SubsonicResponse) -> Self {
|
fn from(value: SubsonicResponse) -> Self {
|
||||||
Self {
|
Self {
|
||||||
status: value.status,
|
subsonic_response: value,
|
||||||
version: value.version,
|
|
||||||
value: value.value,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
#[serde(rename = "subsonic-response")]
|
|
||||||
pub struct SubsonicResponseJson {
|
pub struct SubsonicResponseJson {
|
||||||
pub status: ResponseStatus,
|
#[serde(rename = "subsonic-response")]
|
||||||
pub version: VersionTriple,
|
pub subsonic_response: SubsonicResponse,
|
||||||
pub value: Box<SubResponseType>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IntoResponse for SubsonicResponseJson {
|
impl IntoResponse for SubsonicResponseJson {
|
||||||
|
|
@ -67,7 +64,7 @@ pub struct SubsonicResponseXml {
|
||||||
pub status: ResponseStatus,
|
pub status: ResponseStatus,
|
||||||
#[serde(rename = "@version")]
|
#[serde(rename = "@version")]
|
||||||
pub version: VersionTriple,
|
pub version: VersionTriple,
|
||||||
#[serde(rename = "$value")]
|
#[serde(rename = "$value", skip_serializing_if = "SubResponseType::is_empty")]
|
||||||
pub value: Box<SubResponseType>,
|
pub value: Box<SubResponseType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,6 +142,7 @@ impl SubsonicResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
pub enum SubResponseType {
|
pub enum SubResponseType {
|
||||||
#[serde(rename = "musicFolders")]
|
#[serde(rename = "musicFolders")]
|
||||||
MusicFolders {
|
MusicFolders {
|
||||||
|
|
@ -204,6 +202,12 @@ pub enum SubResponseType {
|
||||||
Empty,
|
Empty,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SubResponseType {
|
||||||
|
pub const fn is_empty(&self) -> bool {
|
||||||
|
matches!(self, Self::Empty)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub enum ResponseStatus {
|
pub enum ResponseStatus {
|
||||||
Ok,
|
Ok,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue