Skip to content

Commit c60df2e

Browse files
committed
remove redundant commands
1 parent 50b3abf commit c60df2e

File tree

3 files changed

+22
-99
lines changed

3 files changed

+22
-99
lines changed

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,9 @@ Show Spotify Lyrics via Spotilyrics
6262
- `Logout from Spotilyrics` (`spotilyrics.logout`) – clear session and re-auth when needed.
6363
- `Set Tracks Cache Max Size` (`spotilyrics.setTracksCacheMaxSize`) – configure the maximum number of tracks cached for lyrics.
6464
- `Set Spotify OAuth Callback Port` (`spotilyrics.setPort`) – set the local callback port used for Spotify OAuth.
65-
- `Set Hide Song Title` (`spotilyrics.setHideSongTitle`) – set hiding the song title in the lyrics panel.
66-
- `Set Hide Song Icon` (`spotilyrics.setHideSongIcon`) – set hiding the song icon in the lyrics panel.
67-
- `Set Hide Song Author` (`spotilyrics.setHideSongAuthor`) – set hiding the song author in the panel title.
68-
- `Toggle Hide Song Title` (`spotilyrics.toggleHideSongTitle`) – toggle hiding the song title in the lyrics panel.
69-
- `Toggle Hide Song Icon` (`spotilyrics.toggleHideSongIcon`) – toggle hiding the song icon in the lyrics panel.
70-
- `Toggle Hide Song Author` (`spotilyrics.toggleHideSongAuthor`) – toggle hiding the song author in the panel title.
65+
- `Hide Song Title` (`spotilyrics.hideSongTitle`) – toggle the song title in the lyrics panel.
66+
- `Hide Song Icon` (`spotilyrics.hideSongIcon`) – toggle the song icon in the lyrics panel.
67+
- `Hide Song Artist` (`spotilyrics.hideSongArtist`) – toggle the song artist in the panel title.
7168

7269
---
7370

package.json

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@
5656
"default": false,
5757
"description": "Don't show the album icon on the panel card."
5858
},
59-
"spotilyrics.hideSongAuthor": {
59+
"spotilyrics.hideSongArtist": {
6060
"type": "boolean",
6161
"default": false,
62-
"description": "Don't show the song author in the panel title."
62+
"description": "Don't show the song artist in the panel title."
6363
}
6464
}
6565
},
@@ -85,36 +85,16 @@
8585
"title": "Set Spotify OAuth Callback Port"
8686
},
8787
{
88-
"command": "spotilyrics.setHideSongTitle",
89-
"title": "Set Hide Song Title"
88+
"command": "spotilyrics.hideSongTitle",
89+
"title": "Hide Song Title"
9090
},
9191
{
92-
"command": "spotilyrics.setHideSongIcon",
93-
"title": "Set Hide Song Icon"
92+
"command": "spotilyrics.hideSongIcon",
93+
"title": "Hide Song Icon"
9494
},
9595
{
96-
"command": "spotilyrics.setHideSongAuthor",
97-
"title": "Set Hide Song Author"
98-
},
99-
{
100-
"command": "spotilyrics.toggleHideSongTitle",
101-
"title": "Toggle Hide Song Title"
102-
},
103-
{
104-
"command": "spotilyrics.toggleHideSongIcon",
105-
"title": "Toggle Hide Song Icon"
106-
},
107-
{
108-
"command": "spotilyrics.setHideSongAuthor",
109-
"title": "Set Hide Song Author"
110-
},
111-
{
112-
"command": "spotilyrics.toggleHideSongAuthor",
113-
"title": "Toggle Hide Song Author"
114-
},
115-
{
116-
"command": "spotilyrics.toggleHideSongAuthor",
117-
"title": "Toggle Hide Song Author"
96+
"command": "spotilyrics.hideSongArtist",
97+
"title": "Hide Song Artist"
11898
}
11999
]
120100
},

src/extension.ts

Lines changed: 11 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -221,58 +221,7 @@ export async function activate(context: vscode.ExtensionContext) {
221221
);
222222

223223
context.subscriptions.push(
224-
vscode.commands.registerCommand('spotilyrics.setHideSongTitle', async () => {
225-
const config = vscode.workspace.getConfiguration('spotilyrics');
226-
const input = await vscode.window.showQuickPick(['hide', 'show'], {
227-
canPickMany: false,
228-
});
229-
230-
if (!input) {
231-
return;
232-
}
233-
const value = input == 'hide';
234-
await config.update('hideSongTitle', value, vscode.ConfigurationTarget.Global);
235-
vscode.window.showInformationMessage(
236-
`Song title has been ${value ? 'hidden' : 'shown'}`
237-
);
238-
})
239-
);
240-
context.subscriptions.push(
241-
vscode.commands.registerCommand('spotilyrics.setHideSongIcon', async () => {
242-
const config = vscode.workspace.getConfiguration('spotilyrics');
243-
const input = await vscode.window.showQuickPick(['hide', 'show'], {
244-
canPickMany: false,
245-
});
246-
247-
if (!input) {
248-
return;
249-
}
250-
const value = input == 'hide';
251-
await config.update('hideSongIcon', value, vscode.ConfigurationTarget.Global);
252-
vscode.window.showInformationMessage(
253-
`Song icon has been ${value ? 'hidden' : 'shown'}`
254-
);
255-
})
256-
);
257-
context.subscriptions.push(
258-
vscode.commands.registerCommand('spotilyrics.setHideSongAuthor', async () => {
259-
const config = vscode.workspace.getConfiguration('spotilyrics');
260-
const input = await vscode.window.showQuickPick(['hide', 'show'], {
261-
canPickMany: false,
262-
});
263-
264-
if (!input) {
265-
return;
266-
}
267-
const value = input == 'hide';
268-
await config.update('hideSongAuthor', value, vscode.ConfigurationTarget.Global);
269-
vscode.window.showInformationMessage(
270-
`Song author has been ${value ? 'hidden' : 'shown'}`
271-
);
272-
})
273-
);
274-
context.subscriptions.push(
275-
vscode.commands.registerCommand('spotilyrics.toggleHideSongTitle', async () => {
224+
vscode.commands.registerCommand('spotilyrics.hideSongTitle', async () => {
276225
const config = vscode.workspace.getConfiguration('spotilyrics');
277226
const value = !config.get('hideSongTitle');
278227
await config.update('hideSongTitle', value, vscode.ConfigurationTarget.Global);
@@ -282,7 +231,7 @@ export async function activate(context: vscode.ExtensionContext) {
282231
})
283232
);
284233
context.subscriptions.push(
285-
vscode.commands.registerCommand('spotilyrics.toggleHideSongIcon', async () => {
234+
vscode.commands.registerCommand('spotilyrics.hideSongIcon', async () => {
286235
const config = vscode.workspace.getConfiguration('spotilyrics');
287236
const value = !config.get('hideSongIcon');
288237
await config.update('hideSongIcon', value, vscode.ConfigurationTarget.Global);
@@ -292,12 +241,12 @@ export async function activate(context: vscode.ExtensionContext) {
292241
})
293242
);
294243
context.subscriptions.push(
295-
vscode.commands.registerCommand('spotilyrics.toggleHideSongAuthor', async () => {
244+
vscode.commands.registerCommand('spotilyrics.hideSongArtist', async () => {
296245
const config = vscode.workspace.getConfiguration('spotilyrics');
297-
const value = !config.get('hideSongAuthor');
298-
await config.update('hideSongAuthor', value, vscode.ConfigurationTarget.Global);
246+
const value = !config.get('hideSongArtist');
247+
await config.update('hideSongArtist', value, vscode.ConfigurationTarget.Global);
299248
vscode.window.showInformationMessage(
300-
`Song author has been ${value ? 'hidden' : 'shown'}`
249+
`Song artist has been ${value ? 'hidden' : 'shown'}`
301250
);
302251
})
303252
);
@@ -465,14 +414,14 @@ function updatePanelMeta(
465414
return;
466415
}
467416

468-
const showTitle = !vscode.workspace.getConfiguration('spotilyrics').get('hideSongTitle');
469-
const showAuthor = !vscode.workspace.getConfiguration('spotilyrics').get('hideSongAuthor');
417+
const hideTitle = vscode.workspace.getConfiguration('spotilyrics').get('hideSongTitle');
418+
const hideArtist = vscode.workspace.getConfiguration('spotilyrics').get('hideSongArtist');
470419

471-
if (!showTitle && !showAuthor) {
420+
if (hideTitle && hideArtist) {
472421
panel.title = 'Spotify Lyrics';
473-
} else if (showTitle && !showAuthor) {
422+
} else if (!hideTitle && hideArtist) {
474423
panel.title = trackName;
475-
} else if (showAuthor && !showTitle) {
424+
} else if (!hideArtist && hideTitle) {
476425
panel.title = artistName;
477426
} else {
478427
panel.title = `${artistName} - ${trackName}`;
@@ -513,9 +462,6 @@ async function updateLyrics(context: vscode.ExtensionContext) {
513462
albumImages[albumImages.length - 1].url
514463
);
515464

516-
for (const artist of currentlyPlayingResponse.item.artists) {
517-
artistNames.push(artist.name);
518-
}
519465
const artists: string = artistNames.join(' ');
520466
if (
521467
!currentPlayingState ||

0 commit comments

Comments
 (0)