Added TorrServer instance support! 🎞 (#1603)

* Added integration with TorrServe 🎞

* Updated

* Updated

* Update functions.php

* Updated

* Update functions.php

* Update functions.php

* Updated

* Update TorrServerAPI.php

* Updated

* Updated

* Updated

* Updated

* Updated

* Updated

* Update TorrServerAPI.php

* Update TorrServerAPI.php

* Update TorrServerAPI.php

* Updated

* Updated

* Update config.php

* Update Attach.php

* Update Torrent.php

* Update CHANGELOG.md

* Update TorrServerAPI.php

* Update TorrServerAPI.php

* Update displaying_torrent.php

* Update Torrent.php

* Update TorrServerAPI.php

* Update TorrServerAPI.php

* Update TorrServerAPI.php

* Update TorrServerAPI.php

* Update TorrServerAPI.php

* Updated

* Update viewtopic_attach.tpl

* Updated

* Update tor_m3u_format.svg

* Updated

* Updated

* Update tor_m3u_format.png

* Update TorrServerAPI.php

* Update TorrServerAPI.php

* Updated

* Update Torrent.php

* Update functions_delete.php

* Updated

* Update TorrServerAPI.php

* Updated

* Updated

* Updated

* Update TorrServerAPI.php

* Update TorrServerAPI.php

* Update displaying_torrent.php

* Update TorrServerAPI.php

* Update CHANGELOG.md

Co-Authored-By: YouROK <4067300+yourok@users.noreply.github.com>

---------

Co-authored-by: YouROK <4067300+yourok@users.noreply.github.com>
This commit is contained in:
Roman Kelesidis 2024-08-20 22:16:49 +07:00 committed by GitHub
commit c6b4672734
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 344 additions and 5 deletions

View file

@ -214,6 +214,7 @@ if ($tor_reged && $tor_info) {
'MAGNET' => $tor_magnet,
'HASH' => !empty($tor_info['info_hash']) ? strtoupper(bin2hex($tor_info['info_hash'])) : false,
'HASH_V2' => !empty($tor_info['info_hash_v2']) ? strtoupper(bin2hex($tor_info['info_hash_v2'])) : false,
'FILELIST_ICON' => $images['icon_tor_filelist'],
'FILELIST_LINK' => FILELIST_URL . $tor_info['topic_id'],
'REGED_TIME' => bb_date($tor_info['reg_time']),
'REGED_DELTA' => delta_time($tor_info['reg_time']),
@ -222,6 +223,14 @@ if ($tor_reged && $tor_info) {
'COMPLETED' => $tor_completed_count,
]);
// TorrServer integration
if ($bb_cfg['torr_server']['enabled']) {
$template->assign_block_vars('postrow.attach.tor_reged.tor_server', [
'TORR_SERVER_M3U_LINK' => (new \TorrentPier\TorrServerAPI())->getM3UPath($attach_id),
'TORR_SERVER_M3U_ICON' => $images['icon_tor_m3u_icon'],
]);
}
if ($comment) {
$template->assign_block_vars('postrow.attach.tor_reged.comment', ['COMMENT' => $comment]);
}

View file

@ -16,7 +16,8 @@
*/
function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0, $user_id = 0)
{
$lang = [];
global $lang, $bb_cfg;
// Generate Array, if it's not an array
if ($post_id_array === 0 && $attach_id_array === 0 && $page === 0) {
return;
@ -185,6 +186,12 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
DB()->sql_freeresult($result);
if ($num_rows == 0) {
// TorrServer integration
if ($bb_cfg['torr_server']['enabled']) {
$torrServer = new \TorrentPier\TorrServerAPI();
$torrServer->removeM3U($attach_id_array[$i]);
}
$sql = 'SELECT attach_id, physical_filename, thumbnail
FROM ' . BB_ATTACHMENTS_DESC . '
WHERE attach_id = ' . (int)$attach_id_array[$i];