diff --git a/locales/ar.ftl b/locales/ar.ftl
index 4197253..3d45764 100644
--- a/locales/ar.ftl
+++ b/locales/ar.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = لا توجد نتائج
-search-torrents-result-download = تحميل: {$link}
-search-torrents-unknown-error = حدث خطأ أثناء البحث
-torrent-message-seeds-peers = البذور: {$seeds}, الأقران: {$peers}
-torrent-message-speed = السرعة: {$speed}s
-torrent-message-eta = الوقت المتبقي: {$eta}
-torrent-message-progress = التقدم: {$progress}
-torrent-message-remove = إزالة: {$link}
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ تحميل: {$download}
+search-empty-results = لا توجد نتائج
+search-unknown-error = حدث خطأ أثناء البحث
+torrent-message-in-progress =
+ {$title}
+ ---
+ البذور: {$seeds} ({$maxSeeds}), القرناء: {$peers} ({$maxPeers})
+ السرعة: {$speed}
+ الوقت المتوقع: {$eta}
+ التقدم: {$progress}
+ ---
+ إزالة: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ التقدم: {$progress}
+ ---
+ إزالة: {$remove}
torrent-unsupported-tracker-error = المتتبع غير مدعوم
torrent-download-error = حدث خطأ أثناء إضافة التورنت
torrent-remove-error = حدث خطأ أثناء إزالة التورنت
diff --git a/locales/bn.ftl b/locales/bn.ftl
new file mode 100644
index 0000000..8232d51
--- /dev/null
+++ b/locales/bn.ftl
@@ -0,0 +1,26 @@
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ ডাউনলোড: {$download}
+search-empty-results = কোন ফলাফল নেই
+search-unknown-error = অনুসন্ধানের সময় একটি ত্রুটি ঘটেছে
+torrent-message-in-progress =
+ {$title}
+ ---
+ বীজ: {$seeds} ({$maxSeeds}), সহকর্মী: {$peers} ({$maxPeers})
+ গতি: {$speed}
+ ইটিএ: {$eta}
+ অগ্রগতি: {$progress}
+ ---
+ সরান: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ অগ্রগতি: {$progress}
+ ---
+ সরান: {$remove}
+torrent-unsupported-tracker-error = ট্র্যাকার সমর্থিত নয়
+torrent-download-error = টরেন্ট যোগ করার সময় একটি ত্রুটি ঘটেছে
+torrent-remove-error = টরেন্ট সরানোর সময় একটি ত্রুটি ঘটেছে
diff --git a/locales/cs.ftl b/locales/cs.ftl
new file mode 100644
index 0000000..42758a4
--- /dev/null
+++ b/locales/cs.ftl
@@ -0,0 +1,26 @@
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Stáhnout: {$download}
+search-empty-results = Žádné výsledky
+search-unknown-error = Během hledání došlo k chybě
+torrent-message-in-progress =
+ {$title}
+ ---
+ Zdroje: {$seeds} ({$maxSeeds}), Peery: {$peers} ({$maxPeers})
+ Rychlost: {$speed}
+ ETA: {$eta}
+ Pokrok: {$progress}
+ ---
+ Odstranit: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Pokrok: {$progress}
+ ---
+ Odstranit: {$remove}
+torrent-unsupported-tracker-error = Tracker není podporován
+torrent-download-error = Při přidávání torrentu došlo k chybě
+torrent-remove-error = Při odstraňování torrentu došlo k chybě
diff --git a/locales/de.ftl b/locales/de.ftl
index 1984e61..b7a8988 100644
--- a/locales/de.ftl
+++ b/locales/de.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = Keine Ergebnisse
-search-torrents-result-download = Herunterladen: {$link}
-search-torrents-unknown-error = Beim Suchen ist ein Fehler aufgetreten
-torrent-message-seeds-peers = Seeds: {$seeds}, Peers: {$peers}
-torrent-message-speed = Geschwindigkeit: {$speed}\/s
-torrent-message-eta = Verbleibende Zeit: {$eta}
-torrent-message-progress = Fortschritt: {$progress}
-torrent-message-remove = Entfernen: {$link}
-torrent-unsupported-tracker-error = Tracker wird nicht unterstützt
-torrent-download-error = Beim Hinzufügen des Torrents ist ein Fehler aufgetreten
-torrent-remove-error = Beim Entfernen des Torrents ist ein Fehler aufgetreten
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Herunterladen: {$download}
+search-empty-results = Keine Ergebnisse
+search-unknown-error = Bei der Suche ist ein Fehler aufgetreten
+torrent-message-in-progress =
+ {$title}
+ ---
+ Seeds: {$seeds} ({$maxSeeds}), Peers: {$peers} ({$maxPeers})
+ Geschwindigkeit: {$speed}
+ ETA: {$eta}
+ Fortschritt: {$progress}
+ ---
+ Entfernen: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Fortschritt: {$progress}
+ ---
+ Entfernen: {$remove}
+torrent-unsupported-tracker-error = Tracker nicht unterstützt
+torrent-download-error = Fehler beim Hinzufügen des Torrents
+torrent-remove-error = Fehler beim Entfernen des Torrents
diff --git a/locales/el.ftl b/locales/el.ftl
index fa3d6a1..1a57eb4 100644
--- a/locales/el.ftl
+++ b/locales/el.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = Δεν υπάρχουν αποτελέσματα
-search-torrents-result-download = Λήψη: {$link}
-search-torrents-unknown-error = Παρουσιάστηκε σφάλμα κατά την αναζήτηση
-torrent-message-seeds-peers = Seeds: {$seeds}, Peers: {$peers}
-torrent-message-speed = Ταχύτητα: {$speed}s
-torrent-message-eta = Υπολειπόμενος χρόνος: {$eta}
-torrent-message-progress = Πρόοδος: {$progress}
-torrent-message-remove = Αφαίρεση: {$link}
-torrent-unsupported-tracker-error = Ο tracker δεν υποστηρίζεται
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Λήψη: {$download}
+search-empty-results = Δεν υπάρχουν αποτελέσματα
+search-unknown-error = Παρουσιάστηκε σφάλμα κατά την αναζήτηση
+torrent-message-in-progress =
+ {$title}
+ ---
+ Σπόροι: {$seeds} ({$maxSeeds}), Ομότιμοι: {$peers} ({$maxPeers})
+ Ταχύτητα: {$speed}
+ ETA: {$eta}
+ Πρόοδος: {$progress}
+ ---
+ Κατάργηση: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Πρόοδος: {$progress}
+ ---
+ Κατάργηση: {$remove}
+torrent-unsupported-tracker-error = Ο ιχνηλάτης δεν υποστηρίζεται
torrent-download-error = Παρουσιάστηκε σφάλμα κατά την προσθήκη του torrent
-torrent-remove-error = Παρουσιάστηκε σφάλμα κατά την αφαίρεση του torrent
+torrent-remove-error = Παρουσιάστηκε σφάλμα κατά την κατάργηση του torrent
diff --git a/locales/en.ftl b/locales/en.ftl
index 49555f4..4bb11b9 100644
--- a/locales/en.ftl
+++ b/locales/en.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = No results
-search-torrents-result-download = Download: {$link}
-search-torrents-unknown-error = An error occurred during the search
-torrent-message-seeds-peers = Seeds: {$seeds}, Peers: {$peers}
-torrent-message-speed = Speed: {$speed}s
-torrent-message-eta = ETA: {$eta}
-torrent-message-progress = Progress: {$progress}
-torrent-message-remove = Remove: {$link}
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Download: {$download}
+search-empty-results = No results
+search-unknown-error = An error occurred during the search
+torrent-message-in-progress =
+ {$title}
+ ---
+ Seeds: {$seeds} ({$maxSeeds}), Peers: {$peers} ({$maxPeers})
+ Speed: {$speed}
+ ETA: {$eta}
+ Progress: {$progress}
+ ---
+ Remove: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Progress: {$progress}
+ ---
+ Remove: {$remove}
torrent-unsupported-tracker-error = Tracker not supported
torrent-download-error = An error occurred while adding the torrent
torrent-remove-error = An error occurred while removing the torrent
diff --git a/locales/es.ftl b/locales/es.ftl
index ba9cc41..794f470 100644
--- a/locales/es.ftl
+++ b/locales/es.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = No hay resultados
-search-torrents-result-download = Descargar: {$link}
-search-torrents-unknown-error = Se produjo un error durante la búsqueda
-torrent-message-seeds-peers = Seeds: {$seeds}, Peers: {$peers}
-torrent-message-speed = Velocidad: {$speed}s
-torrent-message-eta = Tiempo restante: {$eta}
-torrent-message-progress = Progreso: {$progress}
-torrent-message-remove = Eliminar: {$link}
-torrent-unsupported-tracker-error = El tracker no es compatible
-torrent-download-error = Se produjo un error al agregar el torrent
-torrent-remove-error = Se produjo un error al eliminar el torrent
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Descargar: {$download}
+search-empty-results = No hay resultados
+search-unknown-error = Ocurrió un error durante la búsqueda
+torrent-message-in-progress =
+ {$title}
+ ---
+ Semillas: {$seeds} ({$maxSeeds}), Pares: {$peers} ({$maxPeers})
+ Velocidad: {$speed}
+ ETA: {$eta}
+ Progreso: {$progress}
+ ---
+ Eliminar: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Progreso: {$progress}
+ ---
+ Eliminar: {$remove}
+torrent-unsupported-tracker-error = Rastreador no soportado
+torrent-download-error = Ocurrió un error al agregar el torrent
+torrent-remove-error = Ocurrió un error al eliminar el torrent
diff --git a/locales/fr.ftl b/locales/fr.ftl
index 17b34b5..7c96bdb 100644
--- a/locales/fr.ftl
+++ b/locales/fr.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = Aucun résultat
-search-torrents-result-download = Télécharger: {$link}
-search-torrents-unknown-error = Une erreur s'est produite lors de la recherche
-torrent-message-seeds-peers = Seeds: {$seeds}, Peers: {$peers}
-torrent-message-speed = Vitesse: {$speed}s
-torrent-message-eta = Temps restant: {$eta}
-torrent-message-progress = Progression: {$progress}
-torrent-message-remove = Supprimer: {$link}
-torrent-unsupported-tracker-error = Tracker non supporté
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Télécharger: {$download}
+search-empty-results = Aucun résultat
+search-unknown-error = Une erreur s'est produite lors de la recherche
+torrent-message-in-progress =
+ {$title}
+ ---
+ Sources: {$seeds} ({$maxSeeds}), Pairs: {$peers} ({$maxPeers})
+ Vitesse: {$speed}
+ ETA: {$eta}
+ Progression: {$progress}
+ ---
+ Supprimer: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Progression: {$progress}
+ ---
+ Supprimer: {$remove}
+torrent-unsupported-tracker-error = Tracker non pris en charge
torrent-download-error = Une erreur s'est produite lors de l'ajout du torrent
torrent-remove-error = Une erreur s'est produite lors de la suppression du torrent
diff --git a/locales/he.ftl b/locales/he.ftl
index 2cf478a..5974b0d 100644
--- a/locales/he.ftl
+++ b/locales/he.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = אין תוצאות
-search-torrents-result-download = הורד: {$link}
-search-torrents-unknown-error = אירעה שגיאה במהלך החיפוש
-torrent-message-seeds-peers = Seeds: {$seeds}, Peers: {$peers}
-torrent-message-speed = מהירות: {$speed}s
-torrent-message-eta = זמן שנותר: {$eta}
-torrent-message-progress = התקדמות: {$progress}
-torrent-message-remove = הסר: {$link}
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ הורד: {$download}
+search-empty-results = אין תוצאות
+search-unknown-error = אירעה שגיאה במהלך החיפוש
+torrent-message-in-progress =
+ {$title}
+ ---
+ זורעים: {$seeds} ({$maxSeeds}), עמיתים: {$peers} ({$maxPeers})
+ מהירות: {$speed}
+ ETA: {$eta}
+ התקדמות: {$progress}
+ ---
+ הסר: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ התקדמות: {$progress}
+ ---
+ הסר: {$remove}
torrent-unsupported-tracker-error = המעקב אינו נתמך
torrent-download-error = אירעה שגיאה בעת הוספת הטורנט
torrent-remove-error = אירעה שגיאה בעת הסרת הטורנט
diff --git a/locales/hi.ftl b/locales/hi.ftl
index a888dbf..20cec48 100644
--- a/locales/hi.ftl
+++ b/locales/hi.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = कोई परिणाम नहीं
-search-torrents-result-download = डाउनलोड: {$link}
-search-torrents-unknown-error = खोज के दौरान एक त्रुटि हुई
-torrent-message-seeds-peers = बीज: {$seeds}, साथियों: {$peers}
-torrent-message-speed = गति: {$speed}s
-torrent-message-eta = शेष समय: {$eta}
-torrent-message-progress = प्रगति: {$progress}
-torrent-message-remove = हटाएं: {$link}
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ डाउनलोड: {$download}
+search-empty-results = कोई परिणाम नहीं
+search-unknown-error = खोज के दौरान एक त्रुटि हुई
+torrent-message-in-progress =
+ {$title}
+ ---
+ बीज: {$seeds} ({$maxSeeds}), सहकर्मीं: {$peers} ({$maxPeers})
+ गति: {$speed}
+ ईटीए: {$eta}
+ प्रगति: {$progress}
+ ---
+ हटाएं: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ प्रगति: {$progress}
+ ---
+ हटाएं: {$remove}
torrent-unsupported-tracker-error = ट्रैकर समर्थित नहीं है
torrent-download-error = टोरेंट जोड़ते समय एक त्रुटि हुई
torrent-remove-error = टोरेंट हटाते समय एक त्रुटि हुई
diff --git a/locales/hu.ftl b/locales/hu.ftl
new file mode 100644
index 0000000..22f9c0c
--- /dev/null
+++ b/locales/hu.ftl
@@ -0,0 +1,26 @@
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Letöltés: {$download}
+search-empty-results = Nincs találat
+search-unknown-error = Hiba történt a keresés során
+torrent-message-in-progress =
+ {$title}
+ ---
+ Seedek: {$seeds} ({$maxSeeds}), Peerek: {$peers} ({$maxPeers})
+ Sebesség: {$speed}
+ ETA: {$eta}
+ Haladás: {$progress}
+ ---
+ Eltávolítás: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Haladás: {$progress}
+ ---
+ Eltávolítás: {$remove}
+torrent-unsupported-tracker-error = A tracker nem támogatott
+torrent-download-error = Hiba történt a torrent hozzáadása során
+torrent-remove-error = Hiba történt a torrent eltávolítása során
diff --git a/locales/id.ftl b/locales/id.ftl
index 1c0f597..ad1e705 100644
--- a/locales/id.ftl
+++ b/locales/id.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = Tidak ada hasil
-search-torrents-result-download = Unduh: {$link}
-search-torrents-unknown-error = Terjadi kesalahan saat pencarian
-torrent-message-seeds-peers = Seeds: {$seeds}, Peers: {$peers}
-torrent-message-speed = Kecepatan: {$speed}s
-torrent-message-eta = Waktu tersisa: {$eta}
-torrent-message-progress = Kemajuan: {$progress}
-torrent-message-remove = Hapus: {$link}
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Unduh: {$download}
+search-empty-results = Tidak ada hasil
+search-unknown-error = Terjadi kesalahan selama pencarian
+torrent-message-in-progress =
+ {$title}
+ ---
+ Benih: {$seeds} ({$maxSeeds}), Rekanan: {$peers} ({$maxPeers})
+ Kecepatan: {$speed}
+ ETA: {$eta}
+ Kemajuan: {$progress}
+ ---
+ Hapus: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Kemajuan: {$progress}
+ ---
+ Hapus: {$remove}
torrent-unsupported-tracker-error = Pelacak tidak didukung
torrent-download-error = Terjadi kesalahan saat menambahkan torrent
torrent-remove-error = Terjadi kesalahan saat menghapus torrent
diff --git a/locales/it.ftl b/locales/it.ftl
index 3d90337..5897474 100644
--- a/locales/it.ftl
+++ b/locales/it.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = Nessun risultato
-search-torrents-result-download = Scarica: {$link}
-search-torrents-unknown-error = Si è verificato un errore durante la ricerca
-torrent-message-seeds-peers = Seeds: {$seeds}, Peers: {$peers}
-torrent-message-speed = Velocità: {$speed}s
-torrent-message-eta = Tempo rimanente: {$eta}
-torrent-message-progress = Progresso: {$progress}
-torrent-message-remove = Rimuovi: {$link}
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Scarica: {$download}
+search-empty-results = Nessun risultato
+search-unknown-error = Si è verificato un errore durante la ricerca
+torrent-message-in-progress =
+ {$title}
+ ---
+ Seed: {$seeds} ({$maxSeeds}), Nodi: {$peers} ({$maxPeers})
+ Velocità: {$speed}
+ ETA: {$eta}
+ Progresso: {$progress}
+ ---
+ Rimuovi: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Progresso: {$progress}
+ ---
+ Rimuovi: {$remove}
torrent-unsupported-tracker-error = Tracker non supportato
torrent-download-error = Si è verificato un errore durante l'aggiunta del torrent
torrent-remove-error = Si è verificato un errore durante la rimozione del torrent
diff --git a/locales/ja.ftl b/locales/ja.ftl
index c3ab2c7..312162f 100644
--- a/locales/ja.ftl
+++ b/locales/ja.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = 結果がありません
-search-torrents-result-download = ダウンロード: {$link}
-search-torrents-unknown-error = 検索中にエラーが発生しました
-torrent-message-seeds-peers = シード: {$seeds}, ピア: {$peers}
-torrent-message-speed = 速度: {$speed}s
-torrent-message-eta = 残り時間: {$eta}
-torrent-message-progress = 進行状況: {$progress}
-torrent-message-remove = 削除: {$link}
-torrent-unsupported-tracker-error = トラッカーはサポートされていません
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ ダウンロード: {$download}
+search-empty-results = 結果がありません
+search-unknown-error = 検索中にエラーが発生しました
+torrent-message-in-progress =
+ {$title}
+ ---
+ シード: {$seeds} ({$maxSeeds}), ピア: {$peers} ({$maxPeers})
+ 速度: {$speed}
+ ETA: {$eta}
+ 進行状況: {$progress}
+ ---
+ 削除: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ 進行状況: {$progress}
+ ---
+ 削除: {$remove}
+torrent-unsupported-tracker-error = トラッカーがサポートされていません
torrent-download-error = トレントの追加中にエラーが発生しました
torrent-remove-error = トレントの削除中にエラーが発生しました
diff --git a/locales/ko.ftl b/locales/ko.ftl
index 97c3543..d8a264a 100644
--- a/locales/ko.ftl
+++ b/locales/ko.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = 결과 없음
-search-torrents-result-download = 다운로드: {$link}
-search-torrents-unknown-error = 검색 중 오류가 발생했습니다
-torrent-message-seeds-peers = 시드: {$seeds}, 피어: {$peers}
-torrent-message-speed = 속도: {$speed}s
-torrent-message-eta = 남은 시간: {$eta}
-torrent-message-progress = 진행 상황: {$progress}
-torrent-message-remove = 제거: {$link}
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ 다운로드: {$download}
+search-empty-results = 결과 없음
+search-unknown-error = 검색 중 오류가 발생했습니다
+torrent-message-in-progress =
+ {$title}
+ ---
+ 배포: {$seeds} ({$maxSeeds}), 피어: {$peers} ({$maxPeers})
+ 속도: {$speed}
+ ETA: {$eta}
+ 진행: {$progress}
+ ---
+ 제거: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ 진행: {$progress}
+ ---
+ 제거: {$remove}
torrent-unsupported-tracker-error = 트래커가 지원되지 않습니다
-torrent-download-error = 토렌트 추가 중 오류가 발생했습니다
-torrent-remove-error = 토렌트 제거 중 오류가 발생했습니다
+torrent-download-error = 토렌트를 추가하는 동안 오류가 발생했습니다
+torrent-remove-error = 토렌트를 제거하는 동안 오류가 발생했습니다
diff --git a/locales/nl.ftl b/locales/nl.ftl
index 258db9e..3fc96c1 100644
--- a/locales/nl.ftl
+++ b/locales/nl.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = Geen resultaten
-search-torrents-result-download = Download: {$link}
-search-torrents-unknown-error = Er is een fout opgetreden tijdens het zoeken
-torrent-message-seeds-peers = Zaden: {$seeds}, Peers: {$peers}
-torrent-message-speed = Snelheid: {$speed}s
-torrent-message-eta = Resterende tijd: {$eta}
-torrent-message-progress = Voortgang: {$progress}
-torrent-message-remove = Verwijderen: {$link}
-torrent-unsupported-tracker-error = Tracker wordt niet ondersteund
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Downloaden: {$download}
+search-empty-results = Geen resultaten
+search-unknown-error = Er is een fout opgetreden tijdens het zoeken
+torrent-message-in-progress =
+ {$title}
+ ---
+ Seeds: {$seeds} ({$maxSeeds}), Peers: {$peers} ({$maxPeers})
+ Snelheid: {$speed}
+ ETA: {$eta}
+ Voortgang: {$progress}
+ ---
+ Verwijderen: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Voortgang: {$progress}
+ ---
+ Verwijderen: {$remove}
+torrent-unsupported-tracker-error = Tracker niet ondersteund
torrent-download-error = Er is een fout opgetreden bij het toevoegen van de torrent
torrent-remove-error = Er is een fout opgetreden bij het verwijderen van de torrent
diff --git a/locales/pl.ftl b/locales/pl.ftl
index 7b70d8d..05ace48 100644
--- a/locales/pl.ftl
+++ b/locales/pl.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = Brak wyników
-search-torrents-result-download = Pobierz: {$link}
-search-torrents-unknown-error = Wystąpił błąd podczas wyszukiwania
-torrent-message-seeds-peers = Nasiona: {$seeds}, Rówieśnicy: {$peers}
-torrent-message-speed = Prędkość: {$speed}s
-torrent-message-eta = Pozostały czas: {$eta}
-torrent-message-progress = Postęp: {$progress}
-torrent-message-remove = Usuń: {$link}
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Pobierz: {$download}
+search-empty-results = Brak wyników
+search-unknown-error = Wystąpił błąd podczas wyszukiwania
+torrent-message-in-progress =
+ {$title}
+ ---
+ Seedy: {$seeds} ({$maxSeeds}), Peery: {$peers} ({$maxPeers})
+ Prędkość: {$speed}
+ ETA: {$eta}
+ Postęp: {$progress}
+ ---
+ Usuń: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Postęp: {$progress}
+ ---
+ Usuń: {$remove}
torrent-unsupported-tracker-error = Tracker nie jest obsługiwany
torrent-download-error = Wystąpił błąd podczas dodawania torrenta
torrent-remove-error = Wystąpił błąd podczas usuwania torrenta
diff --git a/locales/pt.ftl b/locales/pt.ftl
index 2461f46..1f71232 100644
--- a/locales/pt.ftl
+++ b/locales/pt.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = Nenhum resultado
-search-torrents-result-download = Baixar: {$link}
-search-torrents-unknown-error = Ocorreu um erro durante a pesquisa
-torrent-message-seeds-peers = Seeds: {$seeds}, Peers: {$peers}
-torrent-message-speed = Velocidade: {$speed}s
-torrent-message-eta = Tempo restante: {$eta}
-torrent-message-progress = Progresso: {$progress}
-torrent-message-remove = Remover: {$link}
-torrent-unsupported-tracker-error = Tracker não suportado
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Baixar: {$download}
+search-empty-results = Nenhum resultado
+search-unknown-error = Ocorreu um erro durante a pesquisa
+torrent-message-in-progress =
+ {$title}
+ ---
+ Sementes: {$seeds} ({$maxSeeds}), Fontes: {$peers} ({$maxPeers})
+ Velocidade: {$speed}
+ ETA: {$eta}
+ Progresso: {$progress}
+ ---
+ Remover: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Progresso: {$progress}
+ ---
+ Remover: {$remove}
+torrent-unsupported-tracker-error = Rastreador não suportado
torrent-download-error = Ocorreu um erro ao adicionar o torrent
torrent-remove-error = Ocorreu um erro ao remover o torrent
diff --git a/locales/ro.ftl b/locales/ro.ftl
new file mode 100644
index 0000000..6ea4131
--- /dev/null
+++ b/locales/ro.ftl
@@ -0,0 +1,26 @@
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Descărcare: {$download}
+search-empty-results = Niciun rezultat
+search-unknown-error = A apărut o eroare în timpul căutării
+torrent-message-in-progress =
+ {$title}
+ ---
+ Semințe: {$seeds} ({$maxSeeds}), Peers: {$peers} ({$maxPeers})
+ Viteză: {$speed}
+ ETA: {$eta}
+ Progres: {$progress}
+ ---
+ Eliminare: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Progres: {$progress}
+ ---
+ Eliminare: {$remove}
+torrent-unsupported-tracker-error = Trackerul nu este suportat
+torrent-download-error = A apărut o eroare la adăugarea torrentului
+torrent-remove-error = A apărut o eroare la eliminarea torrentului
diff --git a/locales/ru.ftl b/locales/ru.ftl
index 0641857..79e221f 100644
--- a/locales/ru.ftl
+++ b/locales/ru.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = Нет результатов
-search-torrents-result-download = Скачать: {$link}
-search-torrents-unknown-error = Во время поиска произошла ошибка
-torrent-message-seeds-peers = Сиды: {$seeds}, Личи: {$peers}
-torrent-message-speed = Скорость: {$speed}s
-torrent-message-eta = Осталось: {$eta}
-torrent-message-progress = Прогресс: {$progress}
-torrent-message-remove = Удалить: {$link}
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Скачать: {$download}
+search-empty-results = Нет результатов
+search-unknown-error = Произошла ошибка во время поиска
+torrent-message-in-progress =
+ {$title}
+ ---
+ Сиды: {$seeds} ({$maxSeeds}), Пиры: {$peers} ({$maxPeers})
+ Скорость: {$speed}
+ Ожидаемое время: {$eta}
+ Прогресс: {$progress}
+ ---
+ Удалить: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Прогресс: {$progress}
+ ---
+ Удалить: {$remove}
torrent-unsupported-tracker-error = Трекер не поддерживается
-torrent-download-error = При добавлении торрента произошла ошибка
-torrent-remove-error = При удалении торрента произошла ошибка
+torrent-download-error = Произошла ошибка при добавлении торрента
+torrent-remove-error = Произошла ошибка при удалении торрента
diff --git a/locales/sv.ftl b/locales/sv.ftl
index 8fe7ac5..d6c3d0a 100644
--- a/locales/sv.ftl
+++ b/locales/sv.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = Inga resultat
-search-torrents-result-download = Ladda ner: {$link}
-search-torrents-unknown-error = Ett fel inträffade under sökningen
-torrent-message-seeds-peers = Frön: {$seeds}, Jämlikar: {$peers}
-torrent-message-speed = Hastighet: {$speed}s
-torrent-message-eta = Återstående tid: {$eta}
-torrent-message-progress = Framsteg: {$progress}
-torrent-message-remove = Ta bort: {$link}
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Ladda ner: {$download}
+search-empty-results = Inga resultat
+search-unknown-error = Ett fel inträffade under sökningen
+torrent-message-in-progress =
+ {$title}
+ ---
+ Frön: {$seeds} ({$maxSeeds}), Jämlikar: {$peers} ({$maxPeers})
+ Hastighet: {$speed}
+ ETA: {$eta}
+ Framsteg: {$progress}
+ ---
+ Ta bort: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Framsteg: {$progress}
+ ---
+ Ta bort: {$remove}
torrent-unsupported-tracker-error = Tracker stöds inte
-torrent-download-error = Ett fel inträffade när torrenten lades till
-torrent-remove-error = Ett fel inträffade när torrenten togs bort
+torrent-download-error = Ett fel inträffade vid tillägg av torrent
+torrent-remove-error = Ett fel inträffade vid borttagning av torrent
diff --git a/locales/th.ftl b/locales/th.ftl
index 83d261c..ec21710 100644
--- a/locales/th.ftl
+++ b/locales/th.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = ไม่มีผลลัพธ์
-search-torrents-result-download = ดาวน์โหลด: {$link}
-search-torrents-unknown-error = เกิดข้อผิดพลาดระหว่างการค้นหา
-torrent-message-seeds-peers = Seeds: {$seeds}, Peers: {$peers}
-torrent-message-speed = ความเร็ว: {$speed}s
-torrent-message-eta = เวลาที่เหลือ: {$eta}
-torrent-message-progress = ความคืบหน้า: {$progress}
-torrent-message-remove = ลบ: {$link}
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ ดาวน์โหลด: {$download}
+search-empty-results = ไม่มีผลลัพธ์
+search-unknown-error = เกิดข้อผิดพลาดระหว่างการค้นหา
+torrent-message-in-progress =
+ {$title}
+ ---
+ ผู้ส่ง: {$seeds} ({$maxSeeds}), เพียร์: {$peers} ({$maxPeers})
+ ความเร็ว: {$speed}
+ ETA: {$eta}
+ ความคืบหน้า: {$progress}
+ ---
+ ลบ: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ ความคืบหน้า: {$progress}
+ ---
+ ลบ: {$remove}
torrent-unsupported-tracker-error = ไม่รองรับตัวติดตาม
torrent-download-error = เกิดข้อผิดพลาดขณะเพิ่มทอร์เรนต์
torrent-remove-error = เกิดข้อผิดพลาดขณะลบทอร์เรนต์
diff --git a/locales/tr.ftl b/locales/tr.ftl
index 89caffa..7444976 100644
--- a/locales/tr.ftl
+++ b/locales/tr.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = Sonuç yok
-search-torrents-result-download = İndir: {$link}
-search-torrents-unknown-error = Arama sırasında bir hata oluştu
-torrent-message-seeds-peers = Tohumlar: {$seeds}, Eşler: {$peers}
-torrent-message-speed = Hız: {$speed}s
-torrent-message-eta = Kalan süre: {$eta}
-torrent-message-progress = İlerleme: {$progress}
-torrent-message-remove = Kaldır: {$link}
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ İndir: {$download}
+search-empty-results = Sonuç yok
+search-unknown-error = Arama sırasında bir hata oluştu
+torrent-message-in-progress =
+ {$title}
+ ---
+ Gönderim: {$seeds} ({$maxSeeds}), Kişi: {$peers} ({$maxPeers})
+ Hız: {$speed}
+ ETA: {$eta}
+ İlerleme: {$progress}
+ ---
+ Kaldır: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ İlerleme: {$progress}
+ ---
+ Kaldır: {$remove}
torrent-unsupported-tracker-error = İzleyici desteklenmiyor
torrent-download-error = Torrent eklenirken bir hata oluştu
torrent-remove-error = Torrent kaldırılırken bir hata oluştu
diff --git a/locales/uk.ftl b/locales/uk.ftl
new file mode 100644
index 0000000..2093f8e
--- /dev/null
+++ b/locales/uk.ftl
@@ -0,0 +1,26 @@
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Завантажити: {$download}
+search-empty-results = Немає результатів
+search-unknown-error = Під час пошуку сталася помилка
+torrent-message-in-progress =
+ {$title}
+ ---
+ Сіди: {$seeds} ({$maxSeeds}), Піри: {$peers} ({$maxPeers})
+ Швидкість: {$speed}
+ ETA: {$eta}
+ Прогрес: {$progress}
+ ---
+ Видалити: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Прогрес: {$progress}
+ ---
+ Видалити: {$remove}
+torrent-unsupported-tracker-error = Трекер не підтримується
+torrent-download-error = Під час додавання торрента сталася помилка
+torrent-remove-error = Під час видалення торрента сталася помилка
diff --git a/locales/vi.ftl b/locales/vi.ftl
index 337eac5..43316ad 100644
--- a/locales/vi.ftl
+++ b/locales/vi.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = Không có kết quả
-search-torrents-result-download = Tải xuống: {$link}
-search-torrents-unknown-error = Đã xảy ra lỗi trong quá trình tìm kiếm
-torrent-message-seeds-peers = Seeds: {$seeds}, Peers: {$peers}
-torrent-message-speed = Tốc độ: {$speed}s
-torrent-message-eta = Thời gian còn lại: {$eta}
-torrent-message-progress = Tiến độ: {$progress}
-torrent-message-remove = Xóa: {$link}
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ Tải về: {$download}
+search-empty-results = Không có kết quả
+search-unknown-error = Đã xảy ra lỗi trong quá trình tìm kiếm
+torrent-message-in-progress =
+ {$title}
+ ---
+ Chia sẻ: {$seeds} ({$maxSeeds}), Ngang hàng: {$peers} ({$maxPeers})
+ Tốc độ: {$speed}
+ ETA: {$eta}
+ Tiến độ: {$progress}
+ ---
+ Xóa: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ Tiến độ: {$progress}
+ ---
+ Xóa: {$remove}
torrent-unsupported-tracker-error = Trình theo dõi không được hỗ trợ
torrent-download-error = Đã xảy ra lỗi khi thêm torrent
torrent-remove-error = Đã xảy ra lỗi khi xóa torrent
diff --git a/locales/zh.ftl b/locales/zh.ftl
index 1399b6b..9a0624c 100644
--- a/locales/zh.ftl
+++ b/locales/zh.ftl
@@ -1,11 +1,26 @@
-search-torrents-empty = 没有结果
-search-torrents-result-download = 下载: {$link}
-search-torrents-unknown-error = 搜索时发生错误
-torrent-message-seeds-peers = 种子: {$seeds}, 同伴: {$peers}
-torrent-message-speed = 速度: {$speed}s
-torrent-message-eta = 剩余时间: {$eta}
-torrent-message-progress = 进度: {$progress}
-torrent-message-remove = 删除: {$link}
-torrent-unsupported-tracker-error = 不支持的追踪器
+search-message =
+ {$title}
+ ---
+ {$size} | {$seeds}/{$peers} | {DATETIME($publishDate)}
+ ---
+ 下载: {$download}
+search-empty-results = 没有结果
+search-unknown-error = 搜索过程中发生错误
+torrent-message-in-progress =
+ {$title}
+ ---
+ 做种数: {$seeds} ({$maxSeeds}), 用户: {$peers} ({$maxPeers})
+ 速度: {$speed}
+ 预计时间: {$eta}
+ 进度: {$progress}
+ ---
+ 删除: {$remove}
+torrent-message-completed =
+ {$title}
+ ---
+ 进度: {$progress}
+ ---
+ 删除: {$remove}
+torrent-unsupported-tracker-error = 不支持的跟踪器
torrent-download-error = 添加种子时发生错误
torrent-remove-error = 删除种子时发生错误
diff --git a/src/composers/TorrentsComposer.ts b/src/composers/TorrentsComposer.ts
index e7c8b17..2af452a 100644
--- a/src/composers/TorrentsComposer.ts
+++ b/src/composers/TorrentsComposer.ts
@@ -33,7 +33,7 @@ export class TorrentsComposer<
private searchEngines: SearchEngine[];
private qBittorrent: QBittorrentClient;
private chatMessages = new Map();
- private chatTorrents = new Map();
+ private chatTorrents = new Map>();
private timeout: NodeJS.Timeout;
private logger: Logger;
@@ -71,14 +71,16 @@ export class TorrentsComposer<
private async handleSearchQuery(ctx: Filter) {
const query = ctx.message.text;
- const { results, error } = await this.searchTorrents(query);
+ let results: (readonly [SearchEngine, SearchResult])[];
- if (!results || error) {
- return ctx.reply(ctx.t('search-torrents-unknown-error'));
+ try {
+ results = await this.searchTorrents(query);
+ } catch {
+ return ctx.reply(ctx.t('search-unknown-error'));
}
if (results.length === 0) {
- return ctx.reply(ctx.t('search-torrents-empty'));
+ return ctx.reply(ctx.t('search-empty-results'));
}
// TODO: Add buttons to navigate between pages
@@ -88,11 +90,9 @@ export class TorrentsComposer<
.join('\n\n\n');
try {
- await ctx.reply(text, {
- parse_mode: 'HTML',
- });
- } catch {
- return ctx.reply(ctx.t('search-torrents-unknown-error'));
+ await ctx.reply(text, { parse_mode: 'HTML' });
+ } catch (error) {
+ this.logger.error(error, 'An error occured whire sending search results');
}
}
@@ -118,15 +118,16 @@ export class TorrentsComposer<
return ctx.reply(ctx.t('torrent-download-error'));
}
- const { hash, error } = await this.addTorrent({
- torrent,
- tags: [
- `uid_${uid}`,
- `i18n_${ctx.chatId}_${ctx.from.language_code ?? 'en'}`,
- ],
- });
+ let hash: string;
- if (!hash || error) {
+ try {
+ const uidTag = `uid_${uid}`;
+ const i18nTag = `i18n_${ctx.chatId}_${ctx.from.language_code ?? 'en'}`;
+ hash = await this.addTorrent({
+ torrent,
+ tags: [uidTag, i18nTag],
+ });
+ } catch {
return ctx.reply(ctx.t('torrent-download-error'));
}
@@ -135,9 +136,9 @@ export class TorrentsComposer<
const chatTorrents = this.chatTorrents.get(ctx.chatId);
if (chatTorrents) {
- chatTorrents.push(hash);
+ chatTorrents.add(hash);
} else {
- this.chatTorrents.set(ctx.chatId, [hash]);
+ this.chatTorrents.set(ctx.chatId, new Set([hash]));
}
await this.createOrUpdateTorrentsMessage(ctx.chatId, true);
@@ -147,18 +148,20 @@ export class TorrentsComposer<
if (!ctx.message.text) {
return;
}
+
const uid = ctx.message.text.replace('/rm_', '');
- const { torrent, error } = await this.getTorrentByUid(uid);
+ let hash: string;
- if (!torrent || error) {
+ try {
+ ({ hash } = await this.getTorrentByUid(uid));
+ } catch {
return ctx.reply(ctx.t('torrent-remove-error'));
}
- const { hash } = torrent;
- const { error: deletingError } = await this.deleteTorrent(hash);
-
- if (deletingError) {
+ try {
+ await this.deleteTorrent(hash);
+ } catch {
return ctx.reply(ctx.t('torrent-remove-error'));
}
@@ -173,13 +176,11 @@ export class TorrentsComposer<
const results = await se.search(query);
return results.map((result) => [se, result] as const);
});
-
const results = await Promise.all(promises);
-
- return { results: results.flat() };
+ return results.flat();
} catch (error) {
this.logger.error(error, 'An error occured while searching torrents');
- return { error };
+ throw error;
}
}
@@ -195,20 +196,19 @@ export class TorrentsComposer<
torrents: [torrent],
tags,
});
- return { hash };
+ return hash;
} catch (error) {
this.logger.error(error, 'An error occured while adding new torrent');
- return { error };
+ throw error;
}
}
private async getTorrents(hashes: string[]) {
try {
- const torrents = await this.qBittorrent.getTorrents({ hashes });
- return { torrents };
+ return this.qBittorrent.getTorrents({ hashes });
} catch (error) {
this.logger.error(error, 'An error occured while fetching torrents');
- return { error };
+ throw error;
}
}
@@ -217,20 +217,19 @@ export class TorrentsComposer<
const [torrent] = await this.qBittorrent.getTorrents({
tag: `uid_${uid}`,
});
- return { torrent };
+ return torrent;
} catch (error) {
this.logger.error(error, 'An error occured while fetching torrents');
- return { error };
+ throw error;
}
}
private async deleteTorrent(hash: string) {
try {
await this.qBittorrent.deleteTorrents([hash], true);
- return {};
} catch (error) {
this.logger.error(error, 'An error occured while fetching torrents');
- return { error };
+ throw error;
}
}
@@ -296,73 +295,74 @@ export class TorrentsComposer<
chatId: number,
refresh: boolean = false,
) {
- const hashes = this.chatTorrents.get(chatId);
+ const hashMap = this.chatTorrents.get(chatId);
- if (!hashes || hashes.length === 0) {
+ if (!hashMap || hashMap.size === 0) {
this.chatMessages.delete(chatId);
this.chatTorrents.delete(chatId);
return;
}
- const { torrents, error } = await this.getTorrents(hashes);
+ let torrents: QBTorrent[];
- if (!torrents || error) {
+ try {
+ torrents = await this.getTorrents([...hashMap.values()]);
+ } catch {
return;
}
- const pending: QBTorrent[] = [];
- const completed: QBTorrent[] = [];
+ const completedTorrents: QBTorrent[] = [];
+ const pendingTorrents: QBTorrent[] = [];
for (const torrent of torrents) {
if (torrent.progress < 1) {
- pending.push(torrent);
+ pendingTorrents.push(torrent);
} else {
- completed.push(torrent);
+ completedTorrents.push(torrent);
}
}
let message = this.chatMessages.get(chatId);
- if (message && (completed.length > 0 || pending.length === 0 || refresh)) {
+ if (
+ message &&
+ (completedTorrents.length > 0 || pendingTorrents.length === 0 || refresh)
+ ) {
await this.deleteTorrentsMessage(message);
message = undefined;
}
- if (pending.length > 0) {
- const hashes = pending.map((torrent) => torrent.hash);
- this.chatTorrents.set(chatId, hashes);
- } else {
- this.chatTorrents.delete(chatId);
- }
+ if (completedTorrents.length > 0) {
+ const text = completedTorrents
+ .map((torrent) => this.formatTorrent(chatId, torrent))
+ .join('\n\n\n');
- if (completed.length > 0) {
try {
- const completedText = completed
- .map((torrent) => this.formatTorrent(chatId, torrent))
- .join('\n\n\n');
- await this.bot.api.sendMessage(chatId, completedText, {
+ await this.bot.api.sendMessage(chatId, text, {
parse_mode: 'HTML',
});
} catch (error) {
this.logger.error(
error,
'An error occured while sending completed torrents message',
- error,
);
}
}
- if (pending.length === 0) {
- return;
- }
+ if (pendingTorrents.length > 0) {
+ const hashes = pendingTorrents.map((torrent) => torrent.hash);
+ this.chatTorrents.set(chatId, new Set(hashes));
- const pendingText = pending
- .map((torrent) => this.formatTorrent(chatId, torrent))
- .join('\n\n\n');
+ const text = pendingTorrents
+ .map((torrent) => this.formatTorrent(chatId, torrent))
+ .join('\n\n\n');
- await (message
- ? this.updateTorrentsMessage(message, pendingText)
- : this.sendTorrentsMessage(chatId, pendingText));
+ await (message
+ ? this.updateTorrentsMessage(message, text)
+ : this.sendTorrentsMessage(chatId, text));
+ } else {
+ this.chatTorrents.delete(chatId);
+ }
}
private async createOrUpdateTorrentsMessages() {
@@ -372,100 +372,51 @@ export class TorrentsComposer<
}
private formatSearchResult(ctx: C, se: SearchEngine, result: SearchResult) {
- const lines = [];
-
const uid = `${se.name}_${result.id}`;
- const title = `${result.title}`;
- const download = ctx.t('search-torrents-result-download', {
- link: `/dl_${uid}`,
+ const size = formatBytes(result.size ?? 0);
+ const download = `/dl_${uid}`;
+
+ return ctx.t('search-message', {
+ title: result.title,
+ size,
+ seeds: result.seeds ?? 0,
+ peers: result.peers ?? 0,
+ publishDate: result.publishDate ?? '---',
+ download,
});
-
- const info: string[] = [];
-
- if (typeof result.totalSize === 'number') {
- info.push(formatBytes(result.totalSize));
- }
-
- if (
- typeof result.seeds === 'number' ||
- typeof result.leeches === 'number'
- ) {
- const seeds = `${result.seeds ?? 0}`;
- const peers = `${result.leeches ?? 0}`;
- info.push(`${seeds}/${peers}`);
- }
-
- if (result.date) {
- const date = result.date.toLocaleDateString(
- ctx.from?.language_code ?? 'en',
- );
- info.push(date);
- }
-
- lines.push(title);
- lines.push('---');
- lines.push(info.join(' | '));
- lines.push('---');
- lines.push(download);
-
- return lines.join('\n');
}
private formatTorrent(chatId: number, torrent: QBTorrent) {
- const lines = [];
-
- let uid: string | undefined;
- let locale: string = 'en';
-
- const prefixUid = 'uid_';
- const prefixI18n = `i18n_${chatId}_`;
- const completed = torrent.progress === 1;
-
- for (const tag of torrent.tags) {
- if (tag.startsWith(prefixUid)) {
- uid = tag.replace(prefixUid, '');
- } else if (tag.startsWith(prefixI18n)) {
- locale = tag.replace(prefixI18n, '');
- }
- }
+ const tagPrefixI18n = `i18n_${chatId}_`;
+ const tagPrefixUid = 'uid_';
+ const tagI18n = torrent.tags.find((tag) => tag.startsWith(tagPrefixI18n));
+ const tagUid = torrent.tags.find((tag) => tag.startsWith(tagPrefixUid));
+ const locale = tagI18n?.replace(tagPrefixI18n, '') ?? 'en';
+ const uid = tagUid?.replace(tagPrefixUid, '');
+ const speed = `${formatBytes(torrent.dlspeed)}/s`;
+ const eta =
+ torrent.eta >= 8_640_000 ? '∞' : formatDuration(torrent.eta, locale);
+ const progress = `${Math.round(torrent.progress * 100 * 100) / 100}%`;
+ const remove = `/rm_${uid}`;
const t = fluent.withLocale(locale);
- lines.push(`${torrent.name}`);
- lines.push('---');
-
- if (!completed) {
- const seedAndPeers = t('torrent-message-seeds-peers', {
- seeds: `${torrent.num_seeds} (${torrent.num_complete})`,
- peers: `${torrent.num_leechs} (${torrent.num_incomplete})`,
- });
- const speed = t('torrent-message-speed', {
- speed: formatBytes(torrent.dlspeed),
- });
- const eta = t('torrent-message-eta', {
- eta:
- torrent.eta >= 8_640_000 ? '∞' : formatDuration(torrent.eta, locale),
- });
-
- lines.push(seedAndPeers);
- lines.push(speed);
- lines.push(eta);
- }
-
- const progress = t('torrent-message-progress', {
- progress: `${Math.round(torrent.progress * 100 * 100) / 100}%`,
- });
-
- lines.push(progress);
- lines.push('---');
-
- if (uid) {
- const remove = t('torrent-message-remove', {
- link: `/rm_${uid}`,
- });
- lines.push(remove);
- }
-
- return lines.join('\n');
+ return torrent.progress < 1
+ ? t('torrent-message-in-progress', {
+ title: torrent.name,
+ seeds: torrent.num_seeds,
+ maxSeeds: torrent.num_complete,
+ peers: torrent.num_leechs,
+ maxPeers: torrent.num_incomplete,
+ speed,
+ eta,
+ progress,
+ remove,
+ })
+ : t('torrent-message-completed', {
+ title: torrent.name,
+ progress,
+ remove,
+ });
}
}
diff --git a/src/searchEngines/RutrackerSearchEngine.ts b/src/searchEngines/RutrackerSearchEngine.ts
index 1d3affd..a92b54a 100644
--- a/src/searchEngines/RutrackerSearchEngine.ts
+++ b/src/searchEngines/RutrackerSearchEngine.ts
@@ -107,22 +107,22 @@ export class RutrackerSearchEngine extends SearchEngine {
}
const title = tds.eq(3).find('a').text();
- const totalSize = Number.parseInt(tds.eq(5).attr('data-ts_text') ?? '0');
+ const size = Number.parseInt(tds.eq(5).attr('data-ts_text') ?? '0');
const seeds = Number.parseInt(tds.eq(6).text()) ?? 0;
- const leeches = Number.parseInt(tds.eq(7).text()) ?? 0;
- const date = this.parseDate(tds.eq(9).attr('data-ts_text'));
- const trackerUrl = tds.eq(3).find('a').attr('href');
+ const peers = Number.parseInt(tds.eq(7).text()) ?? 0;
+ const publishDate = this.parseDate(tds.eq(9).attr('data-ts_text'));
+ const detailsUrl = tds.eq(3).find('a').attr('href');
const downloadUrl = tds.eq(5).find('a').attr('href');
- if (title && trackerUrl && downloadUrl) {
+ if (title && downloadUrl) {
results.push({
id,
title,
- totalSize,
+ size,
seeds,
- leeches,
- date,
- trackerUrl: `${BASE_URL}/${trackerUrl}`,
+ peers,
+ publishDate,
+ detailsUrl: detailsUrl && `${BASE_URL}/${detailsUrl}`,
downloadUrl: `${BASE_URL}/${downloadUrl}`,
});
}
@@ -132,8 +132,6 @@ export class RutrackerSearchEngine extends SearchEngine {
}
async downloadTorrentFile(id: string) {
- await this.ensureLoggedIn();
-
const url = `${DOWNLOAD_URL}?t=${id}`;
const response = await fetch(url, {
headers: {
diff --git a/src/searchEngines/SearchEngine.ts b/src/searchEngines/SearchEngine.ts
index 540f15a..b946986 100644
--- a/src/searchEngines/SearchEngine.ts
+++ b/src/searchEngines/SearchEngine.ts
@@ -1,11 +1,11 @@
export interface SearchResult {
id: string;
title: string;
- totalSize?: number;
- seeds?: number;
- leeches?: number;
- date?: Date;
- trackerUrl?: string;
+ size: number;
+ seeds: number;
+ peers: number;
+ publishDate?: Date;
+ detailsUrl?: string;
downloadUrl: string;
}