fix: a few bugs, support .view urls hopefully

This commit is contained in:
Lys 2023-11-28 04:02:38 +02:00
parent 1778ce53cb
commit 159395e35d
Signed by: lyssieth
GPG key ID: C9CF3D614FAA3940
4 changed files with 29 additions and 22 deletions

View file

@ -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

View file

@ -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

View file

@ -27,18 +27,21 @@ mod get_artist;
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<.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(
.at("/getAlbumList", get_album_list::get_album_list) "/getMusicFolders<.view?>",
.at("/getAlbumList2", get_album_list::get_album_list) get_music_folders::get_music_folders,
.at("/getAlbum", get_album::get_album) )
.at("/stream", stream::stream) .at("/getAlbumList<.view?>", get_album_list::get_album_list)
.at("/startScan", start_scan::start_scan) .at("/getAlbumList2<.view?>", get_album_list::get_album_list)
.at("/getScanStatus", get_scan_status::get_scan_status) .at("/getAlbum<.view?>", get_album::get_album)
.at("/search3", search3::search3) .at("/stream<.view?>", stream::stream)
.at("/getCoverArt", get_cover_art::get_cover_art) .at("/startScan<.view?>", start_scan::start_scan)
.at("/getArtists", get_artists::get_artists) .at("/getScanStatus<.view?>", get_scan_status::get_scan_status)
.at("/getArtist", get_artist::get_artist) .at("/search3<.view?>", search3::search3)
.at("/getCoverArt<.view?>", get_cover_art::get_cover_art)
.at("/getArtists<.view?>", get_artists::get_artists)
.at("/getArtist<.view?>", get_artist::get_artist)
.boxed() .boxed()
} }

View file

@ -34,6 +34,7 @@ impl From<SubsonicResponse> for SubsonicResponseJson {
pub struct SubsonicResponseJson { pub struct SubsonicResponseJson {
pub status: ResponseStatus, pub status: ResponseStatus,
pub version: VersionTriple, pub version: VersionTriple,
#[serde(flatten)]
pub value: Box<SubResponseType>, pub value: Box<SubResponseType>,
} }