diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0d3c24584..2fa495c0f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,7 +9,7 @@
- [CLI] TorrentPier installer ☕️ [\#1576](https://github.com/torrentpier/torrentpier/pull/1576), [\#1582](https://github.com/torrentpier/torrentpier/pull/1582), [\#1585](https://github.com/torrentpier/torrentpier/pull/1585), [\#1591](https://github.com/torrentpier/torrentpier/pull/1591) ([belomaxorka](https://github.com/belomaxorka))
- Added some new HTML meta-tags [\#1562](https://github.com/torrentpier/torrentpier/pull/1562) ([belomaxorka](https://github.com/belomaxorka))
- Added robots meta-tag support 🤖 [\#1587](https://github.com/torrentpier/torrentpier/pull/1587) ([belomaxorka](https://github.com/belomaxorka))
-- Added [TorrServer](https://github.com/YouROK/TorrServer) instance support! 🎞 [\#1603](https://github.com/torrentpier/torrentpier/pull/1603), [\#1623](https://github.com/torrentpier/torrentpier/pull/1623), [\#1624](https://github.com/torrentpier/torrentpier/pull/1624) ([belomaxorka](https://github.com/belomaxorka))
+- Added [TorrServer](https://github.com/YouROK/TorrServer) instance support! 🎞 [\#1603](https://github.com/torrentpier/torrentpier/pull/1603), [\#1623](https://github.com/torrentpier/torrentpier/pull/1623), [\#1624](https://github.com/torrentpier/torrentpier/pull/1624), [\#1628](https://github.com/torrentpier/torrentpier/pull/1628) ([belomaxorka](https://github.com/belomaxorka))
- Newtopic: Added configuring robots indexing [\#1599](https://github.com/torrentpier/torrentpier/pull/1599) ([belomaxorka](https://github.com/belomaxorka))
- Added showing releaser stats in profile [\#1568](https://github.com/torrentpier/torrentpier/pull/1568) ([belomaxorka](https://github.com/belomaxorka))
- Improved `filelist.php` [\#1586](https://github.com/torrentpier/torrentpier/pull/1586) ([belomaxorka](https://github.com/belomaxorka))
@@ -20,7 +20,7 @@
- Increased `USEREMAIL_MAX_LENGTH` [\#1566](https://github.com/torrentpier/torrentpier/pull/1566) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#1570](https://github.com/torrentpier/torrentpier/pull/1570), [\#1571](https://github.com/torrentpier/torrentpier/pull/1571), [\#1575](https://github.com/torrentpier/torrentpier/pull/1575), [\#1589](https://github.com/torrentpier/torrentpier/pull/1589), [\#1592](https://github.com/torrentpier/torrentpier/pull/1592), [\#1605](https://github.com/torrentpier/torrentpier/pull/1605), [\#1611](https://github.com/torrentpier/torrentpier/pull/1611), [\#1612](https://github.com/torrentpier/torrentpier/pull/1612), [\#1615](https://github.com/torrentpier/torrentpier/pull/1615), [\#1627](https://github.com/torrentpier/torrentpier/pull/1627) ([belomaxorka](https://github.com/belomaxorka))
- Updated deps [\#1563](https://github.com/torrentpier/torrentpier/pull/1563), [\#1564](https://github.com/torrentpier/torrentpier/pull/1564), [\#1608](https://github.com/torrentpier/torrentpier/pull/1608), [\#1609](https://github.com/torrentpier/torrentpier/pull/1609), [\#1610](https://github.com/torrentpier/torrentpier/pull/1610) ([belomaxorka](https://github.com/belomaxorka))
-- New Crowdin updates [\#1569](https://github.com/torrentpier/torrentpier/pull/1569), [\#1572](https://github.com/torrentpier/torrentpier/pull/1572), [\#1573](https://github.com/torrentpier/torrentpier/pull/1573), [\#1574](https://github.com/torrentpier/torrentpier/pull/1574), [\#1588](https://github.com/torrentpier/torrentpier/pull/1588), [\#1590](https://github.com/torrentpier/torrentpier/pull/1590), [\#1600](https://github.com/torrentpier/torrentpier/pull/1600), [\#1601](https://github.com/torrentpier/torrentpier/pull/1601), [\#1606](https://github.com/torrentpier/torrentpier/pull/1606), [\#1607](https://github.com/torrentpier/torrentpier/pull/1607), [\#1625](https://github.com/torrentpier/torrentpier/pull/1625), [\#1626](https://github.com/torrentpier/torrentpier/pull/1626), [\#1629](https://github.com/torrentpier/torrentpier/pull/1629) ([Exileum](https://github.com/Exileum))
+- New Crowdin updates [\#1569](https://github.com/torrentpier/torrentpier/pull/1569), [\#1572](https://github.com/torrentpier/torrentpier/pull/1572), [\#1573](https://github.com/torrentpier/torrentpier/pull/1573), [\#1574](https://github.com/torrentpier/torrentpier/pull/1574), [\#1588](https://github.com/torrentpier/torrentpier/pull/1588), [\#1590](https://github.com/torrentpier/torrentpier/pull/1590), [\#1600](https://github.com/torrentpier/torrentpier/pull/1600), [\#1601](https://github.com/torrentpier/torrentpier/pull/1601), [\#1606](https://github.com/torrentpier/torrentpier/pull/1606), [\#1607](https://github.com/torrentpier/torrentpier/pull/1607), [\#1625](https://github.com/torrentpier/torrentpier/pull/1625), [\#1626](https://github.com/torrentpier/torrentpier/pull/1626), [\#1629](https://github.com/torrentpier/torrentpier/pull/1629), [\#1630](https://github.com/torrentpier/torrentpier/pull/1630) ([Exileum](https://github.com/Exileum))
## [v2.4.4](https://github.com/torrentpier/torrentpier/tree/v2.4.4) (2024-07-22)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.3...v2.4.4)
diff --git a/filelist.php b/filelist.php
index 3b4412928..8c87d76d2 100644
--- a/filelist.php
+++ b/filelist.php
@@ -15,12 +15,12 @@ require __DIR__ . '/common.php';
$user->session_start();
if ($bb_cfg['bt_disable_dht'] && IS_GUEST) {
- bb_simple_die($lang['BT_PRIVATE_TRACKER'], 403);
+ bb_die($lang['BT_PRIVATE_TRACKER'], 403);
}
$topic_id = isset($_GET[POST_TOPIC_URL]) ? (int)$_GET[POST_TOPIC_URL] : 0;
if (!$topic_id) {
- bb_simple_die($lang['INVALID_TOPIC_ID'], 404);
+ bb_die($lang['INVALID_TOPIC_ID'], 404);
}
$sql = 'SELECT t.attach_id, t.info_hash, t.info_hash_v2, t.size, ad.physical_filename
@@ -31,7 +31,7 @@ $sql = 'SELECT t.attach_id, t.info_hash, t.info_hash_v2, t.size, ad.physical_fil
LIMIT 1';
if (!$row = DB()->fetch_row($sql)) {
- bb_simple_die($lang['INVALID_TOPIC_ID_DB'], 404);
+ bb_die($lang['INVALID_TOPIC_ID_DB'], 404);
}
// Protocol meta
@@ -45,7 +45,7 @@ $t_hash_field = $meta_v2 ? 'piecesRoot' : 'sha1';
$file_path = get_attachments_dir() . '/' . $row['physical_filename'];
if (!is_file($file_path)) {
- bb_simple_die($lang['TOR_NOT_FOUND'], 410);
+ bb_die($lang['TOR_NOT_FOUND'], 410);
}
$file_contents = file_get_contents($file_path);
@@ -60,18 +60,18 @@ if ($bb_cfg['flist_max_files']) {
}
if ($file_count > $bb_cfg['flist_max_files']) {
- bb_simple_die(sprintf($lang['BT_FLIST_LIMIT'], $bb_cfg['flist_max_files'], $file_count), 410);
+ bb_die(sprintf($lang['BT_FLIST_LIMIT'], $bb_cfg['flist_max_files'], $file_count), 410);
}
}
try {
$torrent = \Arokettu\Torrent\TorrentFile::loadFromString($file_contents);
} catch (\Exception $e) {
- bb_simple_die(htmlCHR("{$lang['TORFILE_INVALID']}: {$e->getMessage()}"), 410);
+ bb_die(htmlCHR("{$lang['TORFILE_INVALID']}: {$e->getMessage()}"), 410);
}
if (IS_GUEST && $torrent->isPrivate()) {
- bb_simple_die($lang['BT_PRIVATE_TORRENT'], 403);
+ bb_die($lang['BT_PRIVATE_TORRENT'], 403);
}
$files = $torrent->$t_version_field()->$t_files_field();
diff --git a/library/ajax/ffprobe_info.php b/library/ajax/ffprobe_info.php
new file mode 100644
index 000000000..755d558ab
--- /dev/null
+++ b/library/ajax/ffprobe_info.php
@@ -0,0 +1,106 @@
+ajax_die($lang['MODULE_OFF']);
+}
+
+if (!$attach_id = (int)$this->request['attach_id'] or !is_numeric($attach_id)) {
+ $this->ajax_die($lang['INVALID_ATTACH_ID']);
+}
+
+if (!$file_index = (int)$this->request['file_index'] or !is_numeric($file_index)) {
+ $this->ajax_die("Invalid file index: $file_index");
+}
+
+if (!$info_hash = (string)$this->request['info_hash'] or !ctype_xdigit($info_hash)) {
+ $this->ajax_die("Invalid info_hash: $info_hash");
+}
+
+$isAudio = !empty($this->request['is_audio']);
+
+// Get ffprobe info from TorrServer
+$ffpInfo = (new \TorrentPier\TorrServerAPI())->getFfpInfo($info_hash, $file_index, $attach_id);
+$ffpInfo = $ffpInfo->{$file_index};
+if (isset($ffpInfo->streams)) {
+ // Video codec information
+ $videoCodecIndex = array_search('video', array_column($ffpInfo->streams, 'codec_type'));
+ if (is_int($videoCodecIndex)) {
+ $videoCodecInfo = $ffpInfo->streams[$videoCodecIndex];
+ }
+ // Audio codec information
+ $audioTracks = array_filter($ffpInfo->streams, function ($e) {
+ return $e->codec_type === 'audio';
+ });
+ // Audio tracks information
+ $audioDub = array_map(function ($stream) {
+ global $lang;
+
+ $result = '' . sprintf($lang['AUDIO_TRACK'], (!isset($stream->index) || $stream->index === 0) ? 1 : $stream->index) . '
';
+ if (isset($stream->tags->language)) {
+ if (isset($stream->tags->title)) {
+ $result .= '' . mb_strtoupper($stream->tags->language, 'UTF-8') . ' (' . $stream->tags->title . ')' . '';
+ } else {
+ $result .= '' . mb_strtoupper($stream->tags->language, 'UTF-8') . '';
+ }
+ $result .= '
';
+ }
+
+ if (!empty($stream->codec_name)) {
+ $result .= sprintf($lang['AUDIO_CODEC'], $stream->codec_long_name, mb_strtoupper($stream->codec_name, 'UTF-8')) . '
';
+ }
+ if (!empty($stream->bit_rate)) {
+ $result .= sprintf($lang['BITRATE'], humn_bitrate($stream->bit_rate)) . '
';
+ }
+ if (!empty($stream->sample_rate)) {
+ $result .= sprintf($lang['SAMPLE_RATE'], $stream->sample_rate) . '
';
+ }
+ if (!empty($stream->channels)) {
+ $result .= sprintf($lang['CHANNELS'], $stream->channels) . '
';
+ }
+ if (!empty($stream->channel_layout)) {
+ $result .= sprintf($lang['CHANNELS_LAYOUT'], $stream->channel_layout);
+ }
+
+ return $result;
+ }, $audioTracks);
+
+ // Generate output data
+ $data = [
+ 'filesize' => sprintf($lang['FILESIZE'] . ': %s', humn_size($ffpInfo->format->size)),
+ 'resolution' => (!$isAudio && isset($videoCodecInfo)) ? sprintf($lang['RESOLUTION'], $videoCodecInfo->width . 'x' . $videoCodecInfo->height) : '',
+ 'video_codec' => (!$isAudio && isset($videoCodecInfo->codec_name)) ? sprintf($lang['VIDEO_CODEC'], $videoCodecInfo->codec_long_name, mb_strtoupper($videoCodecInfo->codec_name, 'UTF-8')) : '',
+ 'audio_dub' => implode('
# | -{FILES_COUNT} | +{FILES_COUNT_TITLE} | {L_STREAM} |
---|---|---|---|
{m3ulist.ROW_NUMBER} | -{m3ulist.TITLE} | +{m3ulist.TITLE} + + | {L_COPY_STREAM_LINK} · {L_DOWNLOAD_M3U_FILE} @@ -26,6 +51,13 @@ |
{L_NO_ITEMS} | +|||
{L_M3U_NOTICE} | @@ -36,6 +68,7 @@