Fixed volume
This commit is contained in:
@@ -21,7 +21,7 @@ ARG TARGETPLATFORM
|
|||||||
|
|
||||||
RUN apt-get update && apt-get install -y curl tar xz-utils && \
|
RUN apt-get update && apt-get install -y curl tar xz-utils && \
|
||||||
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
||||||
echo "amd64" && false; \
|
echo "Unsupported platform: amd64" && false; \
|
||||||
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
|
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
|
||||||
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux_armv7l > yt-dlp && \
|
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux_armv7l > yt-dlp && \
|
||||||
chmod +x yt-dlp; \
|
chmod +x yt-dlp; \
|
||||||
@@ -34,7 +34,6 @@ RUN apt-get update && apt-get install -y curl tar xz-utils && \
|
|||||||
curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl.tar.xz > ffmpeg.tar.xz && \
|
curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl.tar.xz > ffmpeg.tar.xz && \
|
||||||
tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz; \
|
tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz; \
|
||||||
elif [ "$TARGETPLATFORM" = "linux/x86_64" ]; then \
|
elif [ "$TARGETPLATFORM" = "linux/x86_64" ]; then \
|
||||||
echo "Unsupported platform: $TARGETPLATFORM" && \
|
|
||||||
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux > yt-dlp && \
|
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux > yt-dlp && \
|
||||||
chmod +x yt-dlp && \
|
chmod +x yt-dlp && \
|
||||||
curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz > ffmpeg.tar.xz && \
|
curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz > ffmpeg.tar.xz && \
|
||||||
|
|||||||
@@ -272,13 +272,6 @@ async fn set_volume(path: web::Path<String>, volume: web::Json::<SetVolume>, dat
|
|||||||
for (_, track_handle) in handler.queue().current_queue().iter().enumerate() {
|
for (_, track_handle) in handler.queue().current_queue().iter().enumerate() {
|
||||||
let _ = track_handle.set_volume(bound_volume);
|
let _ = track_handle.set_volume(bound_volume);
|
||||||
}
|
}
|
||||||
if let Err(err) = handler.queue().pause() {
|
|
||||||
warn!("Could not pause track: {:?}", err);
|
|
||||||
return ResponseError::error_response(&ServiceError {
|
|
||||||
status: 422,
|
|
||||||
message: err.to_string()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpResponse::Ok().finish()
|
HttpResponse::Ok().finish()
|
||||||
@@ -295,5 +288,6 @@ pub fn init_routes(config: &mut web::ServiceConfig) {
|
|||||||
.service(stop)
|
.service(stop)
|
||||||
.service(resume)
|
.service(resume)
|
||||||
.service(pause)
|
.service(pause)
|
||||||
|
.service(set_volume)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -31,3 +31,7 @@ export async function pauseTrack(guildId: number): Promise<void> {
|
|||||||
export async function resumeTrack(guildId: number): Promise<void> {
|
export async function resumeTrack(guildId: number): Promise<void> {
|
||||||
await postRequest(`guilds/${guildId}/voice/resume`, {});
|
await postRequest(`guilds/${guildId}/voice/resume`, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function setVolume(guildId: number, volume: number): Promise<void> {
|
||||||
|
await postRequest(`guilds/${guildId}/voice/volume`, { volume: `${volume}` });
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
pauseTrack,
|
pauseTrack,
|
||||||
playTrack,
|
playTrack,
|
||||||
resumeTrack,
|
resumeTrack,
|
||||||
|
setVolume,
|
||||||
stopTrack
|
stopTrack
|
||||||
} from '@/api/guilds';
|
} from '@/api/guilds';
|
||||||
import { GuildChannel, GuildInfo } from '@/api/guilds.types';
|
import { GuildChannel, GuildInfo } from '@/api/guilds.types';
|
||||||
@@ -38,7 +39,8 @@ export default function Page() {
|
|||||||
|
|
||||||
const playForm = useForm({
|
const playForm = useForm({
|
||||||
initialValues: {
|
initialValues: {
|
||||||
trackUrl: ''
|
trackUrl: '',
|
||||||
|
volume: 50.0
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -101,12 +103,26 @@ export default function Page() {
|
|||||||
Resume
|
Resume
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ margin: '1em' }}>
|
<form
|
||||||
<Slider label='Volume' style={{ width: '20%' }} defaultValue={50} onChange={(v) => {}} />
|
style={{ margin: '1em' }}
|
||||||
<Button style={{ marginRight: '1em' }} onClick={() => {}}>
|
onSubmit={playForm.onSubmit((values) => {
|
||||||
|
setVolume(activeGuild!.id, values.volume)
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<Slider
|
||||||
|
defaultValue={50}
|
||||||
|
{...playForm.getInputProps('volume')}
|
||||||
|
marks={[
|
||||||
|
|
||||||
|
{ value: 25, label: '25%' },
|
||||||
|
{ value: 50, label: '50%' },
|
||||||
|
{ value: 75, label: '75%' },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
<Button type='submit'>
|
||||||
Set Volume
|
Set Volume
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</form>
|
||||||
</Tabs.Panel>
|
</Tabs.Panel>
|
||||||
))}
|
))}
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|||||||
Reference in New Issue
Block a user