From 76d9d47a44906df89fdbefb39973372813261183 Mon Sep 17 00:00:00 2001
From: maxid <97409287+maxdorninger@users.noreply.github.com>
Date: Sat, 3 Jan 2026 14:54:48 +0100
Subject: [PATCH 1/3] deduplicate code in download movie/season dialogs
---
.../download-dialog-wrapper.svelte | 32 +++
.../download-movie-dialog.svelte | 208 ++++----------
.../download-season-dialog.svelte | 261 ++++++------------
.../download-dialogs/search-tabs.svelte | 47 ++++
.../download-dialogs/torrent-table.svelte | 102 +++++++
5 files changed, 308 insertions(+), 342 deletions(-)
create mode 100644 web/src/lib/components/download-dialogs/download-dialog-wrapper.svelte
create mode 100644 web/src/lib/components/download-dialogs/search-tabs.svelte
create mode 100644 web/src/lib/components/download-dialogs/torrent-table.svelte
diff --git a/web/src/lib/components/download-dialogs/download-dialog-wrapper.svelte b/web/src/lib/components/download-dialogs/download-dialog-wrapper.svelte
new file mode 100644
index 0000000..ff37b35
--- /dev/null
+++ b/web/src/lib/components/download-dialogs/download-dialog-wrapper.svelte
@@ -0,0 +1,32 @@
+
+
+
+ {triggerText}
+
+
+ {title}
+
+ {description}
+
+
+ {@render children()}
+
+
diff --git a/web/src/lib/components/download-dialogs/download-movie-dialog.svelte b/web/src/lib/components/download-dialogs/download-movie-dialog.svelte
index f62da2d..bdebfbe 100644
--- a/web/src/lib/components/download-dialogs/download-movie-dialog.svelte
+++ b/web/src/lib/components/download-dialogs/download-movie-dialog.svelte
@@ -1,19 +1,18 @@
-
- Download Movie
-
-
- Download a Movie
-
- Search and download torrents for a specific season or season packs.
-
-
-
-
- Standard Mode
- Advanced Mode
-
-
-
- {
- search();
- }}
- >
- Search for Torrents
-
-
-
-
-
-
Enter a custom query
-
-
- {
- search();
- }}
- >
- Search for Torrents
-
-
-
- The custom query will override the default search string like "A Minecraft Movie
- (2025)".
-
-
-
-
- {#if torrentsError}
- An error occurred: {torrentsError}
- {/if}
-
- {#await torrentsPromise}
-
-
-
Loading torrents...
-
- {:then}
-
Found Torrents:
-
-
-
-
- Title
- {#each tableColumnHeadings as { name, id } (id)}
- sortData(id)} class="cursor-pointer">
-
- {name}
- {#if getSortedColumnState(id) === true}
-
- {:else if getSortedColumnState(id) === false}
-
- {:else}
-
-
- {/if}
-
-
- {/each}
- Actions
-
-
-
- {#each torrentsData as torrent (torrent.id)}
-
- {torrent.title}
- {(torrent.size / 1024 / 1024 / 1024).toFixed(2)}GB
- {torrent.seeders}
- {torrent.score}
- {torrent.indexer ?? 'Unknown'}
-
- {#each torrent.flags as flag (flag)}
- {flag}
- {/each}
-
-
- downloadTorrent(torrent.id!)}
- />
-
-
- {:else}
- {#if torrentsData === null}
-
-
- Start searching by clicking the search button!
-
-
- {:else}
-
- No torrents found.
-
- {/if}
- {/each}
-
-
-
- {:catch error}
-
Failed to load torrents.
-
Error: {error.message}
- {/await}
-
-
-
+
+
+ {#snippet basicModeContent()}
+ Search for Torrents
+ {/snippet}
+
+ {#if torrentsError}
+ An error occurred: {torrentsError}
+ {/if}
+
+ {#snippet rowSnippet(torrent)}
+ {torrent.title}
+ {(torrent.size / 1024 / 1024 / 1024).toFixed(2)}GB
+ {torrent.seeders}
+ {torrent.score}
+ {torrent.indexer ?? 'Unknown'}
+
+ {#each torrent.flags as flag (flag)}
+ {flag}
+ {/each}
+
+
+ downloadTorrent(torrent.id)}
+ />
+
+ {/snippet}
+
+
diff --git a/web/src/lib/components/download-dialogs/download-season-dialog.svelte b/web/src/lib/components/download-dialogs/download-season-dialog.svelte
index b9171ab..c262f50 100644
--- a/web/src/lib/components/download-dialogs/download-season-dialog.svelte
+++ b/web/src/lib/components/download-dialogs/download-season-dialog.svelte
@@ -1,5 +1,5 @@
-
- Download Seasons
-
-
- Download a Season
-
- Search and download torrents for a specific season or season packs.
-
-
-
-
- Standard Mode
- Advanced Mode
-
-
-
-
- Enter a season number from 1 to {show.seasons.at(-1)?.number}
-
-
-
- {
- search();
- }}
- >
- Search for Torrents
-
-
-
- Enter the season's number you want to search for. The first, usually 1, or the last
- season number usually yield the most season packs. Note that only Seasons which are
- listed in the "Seasons" cell will be imported!
-
-
-
-
-
-
Enter a custom query
-
-
- {
- search();
- }}
- >
- Search for Torrents
-
-
-
- The custom query will override the default search string like "The Simpsons Season 3".
- Note that only Seasons which are listed in the "Seasons" cell will be imported!
-
-
-
-
- {#if torrentsError}
- An error occurred: {torrentsError}
- {/if}
-
- {#await torrentsPromise}
-
-
-
Loading torrents...
-
- {:then}
-
Found Torrents:
-
-
-
-
- Title
- {#each tableColumnHeadings as { name, id } (id)}
- sortData(id)} class="cursor-pointer">
-
- {name}
- {#if getSortedColumnState(id) === true}
-
- {:else if getSortedColumnState(id) === false}
-
- {:else}
-
-
- {/if}
-
-
- {/each}
- Actions
-
-
-
- {#each torrentsData as torrent (torrent.id)}
-
- {torrent.title}
- {(torrent.size / 1024 / 1024 / 1024).toFixed(2)}GB
- {torrent.usenet}
- {torrent.usenet ? 'N/A' : torrent.seeders}
- {torrent.age
- ? formatSecondsToOptimalUnit(torrent.age)
- : torrent.usenet
- ? 'N/A'
- : ''}
- {torrent.score}
- {torrent.indexer ?? 'unknown'}
-
- {#if torrent.flags}
- {#each torrent.flags as flag (flag)}
- {flag}
- {/each}
- {/if}
-
-
- {#if torrent.season}
- {convertTorrentSeasonRangeToIntegerRange(torrent.season)}
- {/if}
-
-
- downloadTorrent(torrent.id!)}
- />
-
-
- {:else}
- {#if torrentsData === null}
-
-
- Start searching by clicking the search button!
-
-
- {:else}
-
- No torrents found.
-
- {/if}
- {/each}
-
-
-
- {:catch error}
-
Failed to load torrents.
-
Error: {error.message}
- {/await}
-
-
-
+
+
+ {#snippet basicModeContent()}
+
+ Enter a season number from 1 to {show.seasons.at(-1)?.number}
+
+
+
+ Search for Torrents
+
+
+ Enter the season's number you want to search for. The first, usually 1, or the last season
+ number usually yield the most season packs. Note that only Seasons which are listed in the
+ "Seasons" cell will be imported!
+
+ {/snippet}
+
+ {#if torrentsError}
+ An error occurred: {torrentsError}
+ {/if}
+
+ {#snippet rowSnippet(torrent)}
+ {torrent.title}
+ {(torrent.size / 1024 / 1024 / 1024).toFixed(2)}GB
+ {torrent.usenet}
+ {torrent.usenet ? 'N/A' : torrent.seeders}
+ {torrent.age
+ ? formatSecondsToOptimalUnit(torrent.age)
+ : torrent.usenet
+ ? 'N/A'
+ : ''}
+ {torrent.score}
+ {torrent.indexer ?? 'unknown'}
+
+ {#if torrent.flags}
+ {#each torrent.flags as flag (flag)}
+ {flag}
+ {/each}
+ {/if}
+
+
+ {#if torrent.season}
+ {convertTorrentSeasonRangeToIntegerRange(torrent.season)}
+ {/if}
+
+
+ downloadTorrent(torrent.id)}
+ />
+
+ {/snippet}
+
+
diff --git a/web/src/lib/components/download-dialogs/search-tabs.svelte b/web/src/lib/components/download-dialogs/search-tabs.svelte
new file mode 100644
index 0000000..faaa510
--- /dev/null
+++ b/web/src/lib/components/download-dialogs/search-tabs.svelte
@@ -0,0 +1,47 @@
+
+
+
+
+ Standard Mode
+ Advanced Mode
+
+
+
+ {@render basicModeContent()}
+
+
+
+
+
Enter a custom query
+
+
+ Search for Torrents
+
+
+ {advancedModeHelpText}
+
+
+
+
diff --git a/web/src/lib/components/download-dialogs/torrent-table.svelte b/web/src/lib/components/download-dialogs/torrent-table.svelte
new file mode 100644
index 0000000..8358db6
--- /dev/null
+++ b/web/src/lib/components/download-dialogs/torrent-table.svelte
@@ -0,0 +1,102 @@
+
+
+
+ {#await torrentsPromise}
+
+
+
Loading torrents...
+
+ {:then data}
+
Found Torrents:
+
+
+
+
+ Title
+ {#each columns as column (column.id)}
+ toggleSort(column.id)} class="cursor-pointer">
+
+ {column.name}
+ {#if getSortedColumnState(column.id) === true}
+
+ {:else if getSortedColumnState(column.id) === false}
+
+ {:else}
+
+
+ {/if}
+
+
+ {/each}
+ Actions
+
+
+
+ {#if data}
+ {@const sortedData = sort(data, sortBy.col, sortBy.ascending)}
+ {#each sortedData as torrent (torrent.id)}
+
+ {@render rowSnippet(torrent)}
+
+ {:else}
+
+ No torrents found.
+
+ {/each}
+ {:else}
+
+
+ Start searching by clicking the search button!
+
+
+ {/if}
+
+
+
+ {:catch error}
+
Failed to load torrents.
+
Error: {error.message}
+ {/await}
+
From e6daba279cc60ebd6e3ea684cdd1fcd6a4743303 Mon Sep 17 00:00:00 2001
From: maxid <97409287+maxdorninger@users.noreply.github.com>
Date: Sat, 3 Jan 2026 16:04:21 +0100
Subject: [PATCH 2/3] fix torrents table sorting by always returning a new
array
---
web/src/lib/components/download-dialogs/torrent-table.svelte | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/web/src/lib/components/download-dialogs/torrent-table.svelte b/web/src/lib/components/download-dialogs/torrent-table.svelte
index 8358db6..a12b38f 100644
--- a/web/src/lib/components/download-dialogs/torrent-table.svelte
+++ b/web/src/lib/components/download-dialogs/torrent-table.svelte
@@ -29,7 +29,7 @@
}
function sort(data: any[], column: string, ascending: boolean): any[] {
let modifier = ascending ? 1 : -1;
- data.sort((a, b) => {
+ return [...data].sort((a, b) => {
if (a[column] < b[column]) {
return -1 * modifier;
} else if (a[column] > b[column]) {
@@ -38,7 +38,6 @@
return 0;
}
});
- return data;
}
From 30ccd0e12806a587b44c06e08df26feea51699da Mon Sep 17 00:00:00 2001
From: maxid <97409287+maxdorninger@users.noreply.github.com>
Date: Sat, 3 Jan 2026 16:04:38 +0100
Subject: [PATCH 3/3] fix torrents title text overflowing
---
.../components/download-dialogs/download-movie-dialog.svelte | 2 +-
.../components/download-dialogs/download-season-dialog.svelte | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/web/src/lib/components/download-dialogs/download-movie-dialog.svelte b/web/src/lib/components/download-dialogs/download-movie-dialog.svelte
index bdebfbe..749c5f6 100644
--- a/web/src/lib/components/download-dialogs/download-movie-dialog.svelte
+++ b/web/src/lib/components/download-dialogs/download-movie-dialog.svelte
@@ -109,7 +109,7 @@
{/if}
{#snippet rowSnippet(torrent)}
- {torrent.title}
+ {torrent.title}
{(torrent.size / 1024 / 1024 / 1024).toFixed(2)}GB
{torrent.seeders}
{torrent.score}
diff --git a/web/src/lib/components/download-dialogs/download-season-dialog.svelte b/web/src/lib/components/download-dialogs/download-season-dialog.svelte
index c262f50..65bfc80 100644
--- a/web/src/lib/components/download-dialogs/download-season-dialog.svelte
+++ b/web/src/lib/components/download-dialogs/download-season-dialog.svelte
@@ -131,7 +131,7 @@
{/if}
{#snippet rowSnippet(torrent)}
- {torrent.title}
+ {torrent.title}
{(torrent.size / 1024 / 1024 / 1024).toFixed(2)}GB
{torrent.usenet}
{torrent.usenet ? 'N/A' : torrent.seeders}