@involvex/youtube-music-cli 0.0.47 → 0.0.49
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.
- package/CHANGELOG.md +8 -0
- package/dist/cli.js.map +6 -6
- package/dist/youtube-music-cli +0 -0
- package/package.json +1 -1
- package/dist/eslint.config.js +0 -55
- package/dist/package.json +0 -120
- package/dist/scripts/build-cli.js +0 -46
- package/dist/source/app.js +0 -17
- package/dist/source/cli.js +0 -504
- package/dist/source/components/common/ErrorBoundary.js +0 -22
- package/dist/source/components/common/Help.js +0 -18
- package/dist/source/components/common/ShortcutsBar.js +0 -89
- package/dist/source/components/config/ConfigLayout.js +0 -84
- package/dist/source/components/config/KeybindingsLayout.js +0 -107
- package/dist/source/components/export/ExportLayout.js +0 -111
- package/dist/source/components/import/ImportLayout.js +0 -119
- package/dist/source/components/import/ImportProgress.js +0 -73
- package/dist/source/components/layouts/ExploreLayout.js +0 -72
- package/dist/source/components/layouts/HistoryLayout.js +0 -37
- package/dist/source/components/layouts/LyricsLayout.js +0 -89
- package/dist/source/components/layouts/MainLayout.js +0 -190
- package/dist/source/components/layouts/MiniPlayerLayout.js +0 -20
- package/dist/source/components/layouts/PlayerLayout.js +0 -9
- package/dist/source/components/layouts/PluginsLayout.js +0 -77
- package/dist/source/components/layouts/SearchLayout.js +0 -193
- package/dist/source/components/layouts/TrendingLayout.js +0 -59
- package/dist/source/components/player/NowPlaying.js +0 -45
- package/dist/source/components/player/PlayerControls.js +0 -83
- package/dist/source/components/player/ProgressBar.js +0 -19
- package/dist/source/components/player/QueueList.js +0 -36
- package/dist/source/components/player/Suggestions.js +0 -50
- package/dist/source/components/playlist/PlaylistList.js +0 -138
- package/dist/source/components/plugins/PluginInstallDialog.js +0 -41
- package/dist/source/components/plugins/PluginsAvailable.js +0 -55
- package/dist/source/components/plugins/PluginsList.js +0 -18
- package/dist/source/components/search/SearchBar.js +0 -55
- package/dist/source/components/search/SearchHistory.js +0 -35
- package/dist/source/components/search/SearchResults.js +0 -280
- package/dist/source/components/settings/Settings.js +0 -211
- package/dist/source/components/theme/ThemeSwitcher.js +0 -11
- package/dist/source/config/themes.config.js +0 -123
- package/dist/source/contexts/theme.context.js +0 -29
- package/dist/source/hooks/useKeyboard.js +0 -188
- package/dist/source/hooks/useKeyboardBlocker.js +0 -45
- package/dist/source/hooks/useNavigation.js +0 -5
- package/dist/source/hooks/usePlayer.js +0 -43
- package/dist/source/hooks/usePlaylist.js +0 -65
- package/dist/source/hooks/useSearch.js +0 -76
- package/dist/source/hooks/useSleepTimer.js +0 -48
- package/dist/source/hooks/useTerminalSize.js +0 -24
- package/dist/source/hooks/useTheme.js +0 -5
- package/dist/source/hooks/useYouTubeMusic.js +0 -112
- package/dist/source/main.js +0 -127
- package/dist/source/services/cache/cache.service.js +0 -67
- package/dist/source/services/completions/completions.service.js +0 -313
- package/dist/source/services/config/config.service.js +0 -191
- package/dist/source/services/discord/discord-rpc.service.js +0 -95
- package/dist/source/services/download/download.service.js +0 -350
- package/dist/source/services/export/export.service.js +0 -131
- package/dist/source/services/history/history.service.js +0 -83
- package/dist/source/services/import/import.service.js +0 -272
- package/dist/source/services/import/spotify.service.js +0 -171
- package/dist/source/services/import/track-matcher.service.js +0 -271
- package/dist/source/services/import/youtube-import.service.js +0 -84
- package/dist/source/services/logger/logger.service.js +0 -52
- package/dist/source/services/lyrics/lyrics.service.js +0 -93
- package/dist/source/services/mpris/mpris.service.js +0 -78
- package/dist/source/services/notification/notification.service.js +0 -57
- package/dist/source/services/player/dependency-check.service.js +0 -140
- package/dist/source/services/player/player.service.js +0 -478
- package/dist/source/services/player-state/player-state.service.js +0 -123
- package/dist/source/services/plugin/plugin-audio-api.js +0 -36
- package/dist/source/services/plugin/plugin-context.js +0 -256
- package/dist/source/services/plugin/plugin-hooks.service.js +0 -135
- package/dist/source/services/plugin/plugin-installer.service.js +0 -248
- package/dist/source/services/plugin/plugin-loader.service.js +0 -161
- package/dist/source/services/plugin/plugin-permissions.service.js +0 -194
- package/dist/source/services/plugin/plugin-registry.service.js +0 -215
- package/dist/source/services/plugin/plugin-ui-api.js +0 -46
- package/dist/source/services/plugin/plugin-updater.service.js +0 -206
- package/dist/source/services/scrobbling/scrobbling.service.js +0 -115
- package/dist/source/services/sleep-timer/sleep-timer.service.js +0 -45
- package/dist/source/services/version-check/version-check.service.js +0 -121
- package/dist/source/services/web/static-file.service.js +0 -185
- package/dist/source/services/web/web-server-manager.js +0 -507
- package/dist/source/services/web/web-streaming.service.js +0 -292
- package/dist/source/services/web/websocket.server.js +0 -267
- package/dist/source/services/youtube-music/api.js +0 -649
- package/dist/source/services/youtube-music/search.service.js +0 -38
- package/dist/source/stores/history.store.js +0 -64
- package/dist/source/stores/navigation.store.js +0 -90
- package/dist/source/stores/player.store.js +0 -789
- package/dist/source/stores/plugins.store.js +0 -177
- package/dist/source/types/actions.js +0 -1
- package/dist/source/types/cli.types.js +0 -1
- package/dist/source/types/config.types.js +0 -1
- package/dist/source/types/history.types.js +0 -1
- package/dist/source/types/import.types.js +0 -2
- package/dist/source/types/keyboard.types.js +0 -1
- package/dist/source/types/navigation.types.js +0 -1
- package/dist/source/types/player.types.js +0 -1
- package/dist/source/types/playlist.types.js +0 -1
- package/dist/source/types/plugin.types.js +0 -1
- package/dist/source/types/theme.types.js +0 -1
- package/dist/source/types/web.types.js +0 -2
- package/dist/source/types/youtube-music.types.js +0 -1
- package/dist/source/types/youtubei.types.js +0 -3
- package/dist/source/utils/constants.js +0 -135
- package/dist/source/utils/format.js +0 -24
- package/dist/source/utils/icons.js +0 -28
- package/dist/source/utils/search-filters.js +0 -100
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext, useEffect, useMemo, useReducer, useRef, } from 'react';
|
|
3
|
-
import { usePlayer } from "../hooks/usePlayer.js";
|
|
4
|
-
import { loadHistory, saveHistory } from "../services/history/history.service.js";
|
|
5
|
-
const MAX_HISTORY_ENTRIES = 500;
|
|
6
|
-
function historyReducer(state, action) {
|
|
7
|
-
switch (action.category) {
|
|
8
|
-
case 'SET_HISTORY':
|
|
9
|
-
return action.entries;
|
|
10
|
-
case 'ADD_ENTRY':
|
|
11
|
-
return [action.entry, ...state].slice(0, MAX_HISTORY_ENTRIES);
|
|
12
|
-
default:
|
|
13
|
-
return state;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const HistoryContext = createContext(null);
|
|
17
|
-
export function HistoryProvider({ children }) {
|
|
18
|
-
const [state, dispatch] = useReducer(historyReducer, []);
|
|
19
|
-
const { state: playerState } = usePlayer();
|
|
20
|
-
const lastLoggedId = useRef(null);
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
let cancelled = false;
|
|
23
|
-
void loadHistory().then(entries => {
|
|
24
|
-
if (!cancelled) {
|
|
25
|
-
dispatch({ category: 'SET_HISTORY', entries });
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
return () => {
|
|
29
|
-
cancelled = true;
|
|
30
|
-
};
|
|
31
|
-
}, []);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (!playerState.currentTrack) {
|
|
34
|
-
lastLoggedId.current = null;
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (!playerState.isPlaying) {
|
|
38
|
-
lastLoggedId.current = null;
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const videoId = playerState.currentTrack.videoId;
|
|
42
|
-
if (lastLoggedId.current === videoId) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
lastLoggedId.current = videoId;
|
|
46
|
-
const entry = {
|
|
47
|
-
track: playerState.currentTrack,
|
|
48
|
-
playedAt: new Date().toISOString(),
|
|
49
|
-
};
|
|
50
|
-
dispatch({ category: 'ADD_ENTRY', entry });
|
|
51
|
-
}, [playerState.currentTrack, playerState.isPlaying]);
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
void saveHistory(state);
|
|
54
|
-
}, [state]);
|
|
55
|
-
const value = useMemo(() => ({ history: state }), [state]);
|
|
56
|
-
return (_jsx(HistoryContext.Provider, { value: value, children: children }));
|
|
57
|
-
}
|
|
58
|
-
export function useHistory() {
|
|
59
|
-
const context = useContext(HistoryContext);
|
|
60
|
-
if (!context) {
|
|
61
|
-
throw new Error('useHistory must be used within HistoryProvider');
|
|
62
|
-
}
|
|
63
|
-
return context;
|
|
64
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext, useReducer, useMemo, } from 'react';
|
|
3
|
-
const defaultSearchFilters = {
|
|
4
|
-
artist: '',
|
|
5
|
-
album: '',
|
|
6
|
-
year: '',
|
|
7
|
-
duration: 'all',
|
|
8
|
-
};
|
|
9
|
-
const initialState = {
|
|
10
|
-
currentView: 'player',
|
|
11
|
-
previousView: null,
|
|
12
|
-
searchQuery: '',
|
|
13
|
-
searchCategory: 'all',
|
|
14
|
-
searchType: 'all',
|
|
15
|
-
selectedResult: 0,
|
|
16
|
-
selectedPlaylist: 0,
|
|
17
|
-
hasSearched: false,
|
|
18
|
-
searchLimit: 10,
|
|
19
|
-
history: [],
|
|
20
|
-
playerMode: 'full',
|
|
21
|
-
searchFilters: defaultSearchFilters,
|
|
22
|
-
};
|
|
23
|
-
function navigationReducer(state, action) {
|
|
24
|
-
switch (action.category) {
|
|
25
|
-
case 'NAVIGATE':
|
|
26
|
-
return {
|
|
27
|
-
...state,
|
|
28
|
-
currentView: action.view,
|
|
29
|
-
previousView: state.currentView,
|
|
30
|
-
history: [...state.history, state.currentView],
|
|
31
|
-
};
|
|
32
|
-
case 'GO_BACK':
|
|
33
|
-
if (state.history.length === 0) {
|
|
34
|
-
return state;
|
|
35
|
-
}
|
|
36
|
-
const previousViews = [...state.history];
|
|
37
|
-
const backView = previousViews.pop();
|
|
38
|
-
return {
|
|
39
|
-
...state,
|
|
40
|
-
currentView: backView,
|
|
41
|
-
previousView: state.currentView,
|
|
42
|
-
history: previousViews,
|
|
43
|
-
};
|
|
44
|
-
case 'SET_SEARCH_QUERY':
|
|
45
|
-
return { ...state, searchQuery: action.query };
|
|
46
|
-
case 'SET_SEARCH_CATEGORY':
|
|
47
|
-
return { ...state, searchCategory: action.category };
|
|
48
|
-
case 'SET_SEARCH_FILTERS':
|
|
49
|
-
return {
|
|
50
|
-
...state,
|
|
51
|
-
searchFilters: { ...state.searchFilters, ...action.filters },
|
|
52
|
-
};
|
|
53
|
-
case 'CLEAR_SEARCH_FILTERS':
|
|
54
|
-
return {
|
|
55
|
-
...state,
|
|
56
|
-
searchFilters: defaultSearchFilters,
|
|
57
|
-
};
|
|
58
|
-
case 'SET_SELECTED_RESULT':
|
|
59
|
-
return { ...state, selectedResult: action.index };
|
|
60
|
-
case 'SET_SELECTED_PLAYLIST':
|
|
61
|
-
return { ...state, selectedPlaylist: action.index };
|
|
62
|
-
case 'SET_HAS_SEARCHED':
|
|
63
|
-
return { ...state, hasSearched: action.hasSearched };
|
|
64
|
-
case 'SET_SEARCH_LIMIT':
|
|
65
|
-
return {
|
|
66
|
-
...state,
|
|
67
|
-
searchLimit: Math.max(1, Math.min(50, action.limit)),
|
|
68
|
-
};
|
|
69
|
-
case 'TOGGLE_PLAYER_MODE':
|
|
70
|
-
return {
|
|
71
|
-
...state,
|
|
72
|
-
playerMode: state.playerMode === 'full' ? 'mini' : 'full',
|
|
73
|
-
};
|
|
74
|
-
default:
|
|
75
|
-
return state;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const NavigationContext = createContext(null);
|
|
79
|
-
export function NavigationProvider({ children }) {
|
|
80
|
-
const [state, dispatch] = useReducer(navigationReducer, initialState);
|
|
81
|
-
const contextValue = useMemo(() => ({ state, dispatch }), [state, dispatch]);
|
|
82
|
-
return (_jsx(NavigationContext.Provider, { value: contextValue, children: children }));
|
|
83
|
-
}
|
|
84
|
-
export function useNavigation() {
|
|
85
|
-
const context = useContext(NavigationContext);
|
|
86
|
-
if (!context) {
|
|
87
|
-
throw new Error('useNavigation must be used within NavigationProvider');
|
|
88
|
-
}
|
|
89
|
-
return context;
|
|
90
|
-
}
|