mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-01-11 20:10:20 +00:00
Compare commits
2 commits
51b4c173ab
...
15067b19a4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15067b19a4 | ||
|
|
3bb33819a7 |
1 changed files with 13 additions and 5 deletions
|
|
@ -27,17 +27,15 @@ const EpisodeListing: React.FC = () => {
|
|||
}, [store.episodeListing]);
|
||||
|
||||
const close = () => {
|
||||
dispatch({
|
||||
type: 'episodeListing',
|
||||
payload: []
|
||||
});
|
||||
const mergedEpisodes = [...parseEpisodes(store.downloadOptions.e), ...selected];
|
||||
dispatch({
|
||||
type: 'downloadOptions',
|
||||
payload: {
|
||||
...store.downloadOptions,
|
||||
e: `${[...new Set([...parseSelect(store.downloadOptions.e), ...selected])].join(',')}`
|
||||
e: serializeEpisodes(mergedEpisodes)
|
||||
}
|
||||
});
|
||||
dispatch({ type: 'episodeListing', payload: [] });
|
||||
};
|
||||
|
||||
const getEpisodesForSeason = (season: string | 'all') => {
|
||||
|
|
@ -168,6 +166,16 @@ const EpisodeListing: React.FC = () => {
|
|||
</Dialog>
|
||||
);
|
||||
};
|
||||
const parseEpisodes = (e: string): string[] => {
|
||||
if (!e) return [];
|
||||
return e
|
||||
.split(',')
|
||||
.map((s) => s.trim())
|
||||
.filter((s) => s.length > 0);
|
||||
};
|
||||
const serializeEpisodes = (episodes: string[]): string => {
|
||||
return [...new Set(episodes)].join(',');
|
||||
};
|
||||
|
||||
const parseSelect = (s: string): string[] => {
|
||||
const ret: string[] = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue