Compare commits

..

No commits in common. "98de70d9f0ebe8294f484b252c5e779543138c16" and "a89ab1e6909b260f7ab717a3210801fd61ca8440" have entirely different histories.

14 changed files with 28 additions and 52 deletions

View file

@ -9,9 +9,6 @@ mount:
unmount:
bash ./mount-tool.sh unmount
clean:
CLEAN=1 bash ./mount-tool.sh unmount
run: mount
RAVE_STORAGE_DIR=/tmp/media-for-rave RAVE_CACHE_DIR=/tmp/cache-for-rave cargo r
@ -23,13 +20,13 @@ refresh:
sea generate entity -o ./entities/src --with-serde both --date-time-crate time --lib
scan:
curl -vv "http://localhost:1234/rest/startScan?c=supersonic&f=json&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0" | jq
curl -vv "http://localhost:1234/rest/startScan?c=supersonic&f=xml&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0" | xq
scanStatus:
curl -vv "http://localhost:1234/rest/getScanStatus?c=supersonic&f=json&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0" | jq
curl -vv "http://localhost:1234/rest/getScanStatus?c=supersonic&f=xml&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0" | xq
getAlbumList2:
curl -vv "http://localhost:1234/rest/getAlbumList2?c=supersonic&f=json&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0&type=newest" | jq
curl -vv "http://localhost:1234/rest/getAlbumList2?c=supersonic&f=xml&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0&type=newest" | xq
getAlbum ALBUM:
curl -vv "http://localhost:1234/rest/getAlbum?c=supersonic&f=json&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0&id={{ ALBUM }}" | jq
curl -vv "http://localhost:1234/rest/getAlbum?c=supersonic&f=xml&s=RTA3MKflcW&t=1058b65692a81c4aac17f5aff879891f&u=admin&v=1.8.0&id={{ ALBUM }}" | xq

View file

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

View file

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

View file

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

View file

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

View file

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
pub mod prelude;

View file

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

View file

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
pub use super::album::Entity as Album;
pub use super::artist::Entity as Artist;

View file

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

View file

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

View file

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

View file

@ -18,22 +18,22 @@ function mount_rave {
sudo mount /mnt/Media
# create the overlayfs
mkdir -p /tmp/overlay /tmp/work /tmp/media-for-rave /tmp/cache-for-rave
mkdir -p /tmp/overlay /tmp/work /tmp/media-for-rave
# mount the overlayfs
fuse-overlayfs -o lowerdir=/mnt/Media/Music -o upperdir=/tmp/overlay -o workdir=/tmp/work /tmp/media-for-rave
}
function unmount_rave {
# check if already unmounted, but only if CLEAN isn't set
if [ "${CLEAN:-}" != "1" ] && [ ! -d /tmp/media-for-rave ]; then exit 0; fi
# check if already unmounted
if [ ! -d /tmp/media-for-rave ]; then exit 0; fi
# unmount the overlayfs
umount /tmp/media-for-rave || true
# clean up the overlayfs if `CLEAN` is set
if [ "${CLEAN:-}" = "1" ]; then
rm -rf /tmp/overlay /tmp/work /tmp/media-for-rave /tmp/cache-for-rave || true
if [ "${CLEAN:-}" = "true" ]; then
rm -rf /tmp/overlay /tmp/work /tmp/media-for-rave
fi
# unmount the music directory

View file

@ -25,37 +25,20 @@ mod get_artists;
// rest/getArtist
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>> {
Route::new()
.at("/ping", ping::ping)
.at("/ping.view", ping::ping)
.at("/getLicense", get_license::get_license)
.at("/getLicense.view", get_license::get_license)
.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.view", 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.view", get_album::get_album)
.at("/stream", stream::stream)
.at("/stream.view", stream::stream)
.at("/startScan", start_scan::start_scan)
.at("/startScan.view", start_scan::start_scan)
.at("/getScanStatus", get_scan_status::get_scan_status)
.at("/getScanStatus.view", get_scan_status::get_scan_status)
.at("/search3", search3::search3)
.at("/search3.view", search3::search3)
.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.view", get_artists::get_artists)
.at("/getArtist", get_artist::get_artist)
.at("/getArtist.view", get_artist::get_artist)
.boxed()
}

View file

@ -12,26 +12,29 @@ pub use types::artist::Artist;
pub use types::child::Child;
pub use types::music_folder::MusicFolder;
#[derive(Debug, Clone, Serialize)]
#[derive(Debug, Clone)]
pub struct SubsonicResponse {
pub status: ResponseStatus,
pub version: VersionTriple,
#[serde(skip_serializing_if = "SubResponseType::is_empty")]
pub value: Box<SubResponseType>,
}
impl From<SubsonicResponse> for SubsonicResponseJson {
fn from(value: SubsonicResponse) -> Self {
Self {
subsonic_response: value,
status: value.status,
version: value.version,
value: value.value,
}
}
}
#[derive(Debug, Clone, Serialize)]
#[serde(rename = "subsonic-response")]
pub struct SubsonicResponseJson {
#[serde(rename = "subsonic-response")]
pub subsonic_response: SubsonicResponse,
pub status: ResponseStatus,
pub version: VersionTriple,
pub value: Box<SubResponseType>,
}
impl IntoResponse for SubsonicResponseJson {
@ -64,7 +67,7 @@ pub struct SubsonicResponseXml {
pub status: ResponseStatus,
#[serde(rename = "@version")]
pub version: VersionTriple,
#[serde(rename = "$value", skip_serializing_if = "SubResponseType::is_empty")]
#[serde(rename = "$value")]
pub value: Box<SubResponseType>,
}
@ -142,7 +145,6 @@ impl SubsonicResponse {
}
#[derive(Debug, Clone, Serialize)]
#[serde(untagged)]
pub enum SubResponseType {
#[serde(rename = "musicFolders")]
MusicFolders {
@ -202,12 +204,6 @@ pub enum SubResponseType {
Empty,
}
impl SubResponseType {
pub const fn is_empty(&self) -> bool {
matches!(self, Self::Empty)
}
}
#[derive(Debug, Clone, Copy)]
pub enum ResponseStatus {
Ok,