Skip to content

Commit

Permalink
Update Currently Playing command
Browse files Browse the repository at this point in the history
  • Loading branch information
michalzuch committed Dec 6, 2024
1 parent 6fa6ca1 commit ea040a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 5 additions & 1 deletion extensions/music/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Apple Music Changelog

## [Update Currently Playing] - 2024-12-06

- Update Currently Playing command to update the subtitle with the currently playing track.

## [New Command] - 2024-02-10

- Added a new command that removes the currently playing track from the current playlist and skips to the next track.
- Added a new command that removes the currently playing track from the current playlist and skips to the next track.

## [Update] - 2023-10-12

Expand Down
6 changes: 4 additions & 2 deletions extensions/music/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"danpalmer",
"itsjustxan",
"Shpigford",
"urwrstkn8mare"
"urwrstkn8mare",
"michalzuch"
],
"license": "MIT",
"keywords": [
Expand Down Expand Up @@ -108,7 +109,8 @@
"subtitle": "Apple Music",
"description": "Get info about currently playing track.",
"disabledByDefault": true,
"mode": "no-view"
"mode": "no-view",
"interval": "30s"
},
{
"name": "remove-current-playing-from-current-playlist",
Expand Down
6 changes: 3 additions & 3 deletions extensions/music/src/currently-playing.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { showToast, Toast } from "@raycast/api";
import { updateCommandMetadata } from "@raycast/api";
import { pipe } from "fp-ts/lib/function";
import * as TE from "fp-ts/TaskEither";

Expand All @@ -7,7 +7,7 @@ import * as music from "./util/scripts";
export default async () => {
await pipe(
music.currentTrack.getCurrentTrack(),
TE.map((track) => showToast(Toast.Style.Success, track.name, `${track.album} - ${track.artist}`)),
TE.mapLeft(() => showToast(Toast.Style.Failure, "Could not get currently playing track"))
TE.map((track) => updateCommandMetadata({ subtitle: `${track.name} - ${track.artist}` })),
TE.mapLeft(() => updateCommandMetadata({ subtitle: "Could not get currently playing track" }))
)();
};

0 comments on commit ea040a7

Please sign in to comment.