extensions
extensions copied to clipboard
[Music] Add an option to toggle repeat
Extension
https://www.raycast.com/fedevitaledev/music
Description
Hello, I don't know if I can create a pull request for extensions, but here's the code: toggle-repeat.tsx in util
import { showToast, Toast } from "@raycast/api";
import { pipe } from "fp-ts/lib/function";
import * as TE from "fp-ts/TaskEither";
import * as music from "./util/scripts";
import { handleTaskEitherError } from "./util/utils";
export default pipe(
music.player.repeat.toggle,
TE.chain(() => music.player.repeat.get),
handleTaskEitherError("Failed to toggle repeat", (status) =>
showToast(Toast.Style.Success, `Repeat ${status ? "On" : "Off"}`)
)
);
add in play-controls:
const getRepeatStatus = pipe(tell("Music", "get song repeat"), TE.map((s) => s === "one"));
const setRepeatStatus = pipe(
RTE.ask<boolean>(),
RTE.chainTaskEitherK((isEnabled) => tell("Music", `set song repeat to ${isEnabled ? "one" : "off"}`))
);
export const repeat = {
get: getRepeatStatus,
set: setRepeatStatus,
toggle: pipe(getRepeatStatus, TE.chain((enabled) => setRepeatStatus(!enabled))),
};
Update package.json:
{
"name": "toggle-repeat",
"title": "Toggle Repeat",
"subtitle": "Apple Music",
"description": "Toggle Repeat",
"disabledByDefault": false,
"mode": "no-view"
},
Who will benefit from this feature?
Anyone who would want to quickly change the repeat mode to on -- to listen to a song on loop.
Anything else?
No response
Thank you for opening this issue!
🔔 @Rawnly @peterdev22 @danpalmer @octoxan @Shpigford @urwrstkn8mare @michalzuch @validatedev you might want to have a look.
💡 Author and Contributors commands
The author and contributors of fedevitaledev/music can trigger bot actions by commenting:
@raycastbot close this issueCloses the issue.@raycastbot close as not plannedCloses the issue as not planned.@raycastbot rename this issue to "Awesome new title"Renames the issue.@raycastbot reopen this issueReopens the issue.@raycastbot assign meAssigns yourself to the issue.@raycastbot good first issueAdds the "Good first issue" label to the issue.@raycastbot keep this issue openMake sure the issue won't go stale and will be kept open by the bot.
ofc you can create a PR! I'd be happy to review it and approve!