@involvex/youtube-music-cli 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,7 +47,7 @@ function SearchLayout() {
47
47
  useKeyBinding(KEYBINDINGS.DECREASE_RESULTS, decreaseLimit);
48
48
  // Open search history
49
49
  const goToHistory = useCallback(() => {
50
- if (isTyping) {
50
+ if (!isTyping) {
51
51
  dispatch({ category: 'NAVIGATE', view: VIEW.SEARCH_HISTORY });
52
52
  }
53
53
  }, [isTyping, dispatch]);
@@ -82,7 +82,7 @@ function SearchLayout() {
82
82
  return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsxs(Box, { borderStyle: "single", borderColor: theme.colors.secondary, paddingX: 1, children: [_jsx(Text, { bold: true, color: theme.colors.primary, children: "Search" }), _jsxs(Text, { color: theme.colors.dim, children: [' ', "| Limit: ", navState.searchLimit, " (Use [ or ] to adjust)"] })] }), _jsx(SearchBar, { isActive: isTyping && !isSearching, onInput: input => {
83
83
  void performSearch(input);
84
84
  } }), (isLoading || isSearching) && (_jsx(Text, { color: theme.colors.accent, children: "Searching..." })), error && _jsx(Text, { color: theme.colors.error, children: error }), !isLoading && navState.hasSearched && (_jsx(SearchResults, { results: results, selectedIndex: navState.selectedResult, isActive: !isTyping })), !isLoading && navState.hasSearched && results.length === 0 && !error && (_jsx(Text, { color: theme.colors.dim, children: "No results found" })), _jsx(Text, { color: theme.colors.dim, children: isTyping
85
- ? 'Type to search, Enter to start, H for history'
86
- : `Arrows to navigate, Enter to play, ]/[ more/fewer results (${navState.searchLimit}), Esc to type` })] }));
85
+ ? 'Type to search, Enter to start, Esc to clear'
86
+ : `Arrows to navigate, Enter to play, ]/[ more/fewer results (${navState.searchLimit}), H for history, Esc to type` })] }));
87
87
  }
88
88
  export default React.memo(SearchLayout);
@@ -31,7 +31,7 @@ export class DiscordRpcService {
31
31
  resolve();
32
32
  });
33
33
  client
34
- .login({ clientId: '1234567890' }) // Public client ID for music players
34
+ .login({ clientId: '1473580336964177960' }) // Public client ID for music players
35
35
  .catch(reject);
36
36
  });
37
37
  this.client = client;
@@ -218,18 +218,37 @@ class MusicService {
218
218
  async getSuggestions(trackId) {
219
219
  try {
220
220
  const yt = await getClient();
221
- const video = (await yt.getInfo(trackId));
222
- const suggestions = video.related?.contents || [];
223
- return suggestions.slice(0, 10).map((item) => ({
224
- videoId: item.id || '',
225
- title: typeof item.title === 'string'
226
- ? item.title
227
- : item.title?.text || 'Unknown',
228
- artists: [],
229
- }));
221
+ let video = null;
222
+ try {
223
+ video = (await yt.getInfo(trackId));
224
+ }
225
+ catch (error) {
226
+ logger.warn('MusicService', 'getSuggestions getInfo failed', {
227
+ error: error instanceof Error ? error.message : String(error),
228
+ });
229
+ return [];
230
+ }
231
+ const suggestions = video?.related?.contents ?? [];
232
+ const tracks = [];
233
+ for (const item of suggestions) {
234
+ const videoId = item?.id || '';
235
+ if (!videoId)
236
+ continue;
237
+ const title = typeof item.title === 'string' ? item.title : item.title?.text;
238
+ if (!title)
239
+ continue;
240
+ tracks.push({
241
+ videoId,
242
+ title,
243
+ artists: [],
244
+ });
245
+ }
246
+ return tracks.slice(0, 10);
230
247
  }
231
248
  catch (error) {
232
- console.error('Failed to get suggestions:', error);
249
+ logger.error('MusicService', 'getSuggestions failed', {
250
+ error: error instanceof Error ? error.message : String(error),
251
+ });
233
252
  return [];
234
253
  }
235
254
  }
@@ -364,7 +364,7 @@ function PlayerManager() {
364
364
  void loadAndPlayTrack();
365
365
  // Note: state.volume intentionally excluded - volume changes should not restart playback
366
366
  // eslint-disable-next-line react-hooks/exhaustive-deps
367
- }, [state.currentTrack, dispatch, musicService]);
367
+ }, [state.currentTrack, state.isPlaying, dispatch, musicService]);
368
368
  // Handle progress tracking
369
369
  useEffect(() => {
370
370
  if (state.isPlaying && state.currentTrack) {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@involvex/youtube-music-cli",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "- A Commandline music player for youtube-music",
5
5
  "repository": {
6
6
  "type": "git",