auto fill quality

This commit is contained in:
xiaomlove
2022-09-05 01:46:38 +08:00
parent dccee6ba3a
commit 6ef54d5fe0
12 changed files with 88 additions and 11 deletions

View File

@@ -605,4 +605,25 @@ class TorrentRepository extends BaseRepository
return Torrent::query()->whereIn('id', $idArr)->update(['pos_state' => $posState]); return Torrent::query()->whereIn('id', $idArr)->update(['pos_state' => $posState]);
} }
public function buildUploadFieldInput($name, $value, $noteText, $btnText): string
{
$btn = $note = '';
if ($btnText) {
$btn = '<div><input type="button" class="nexus-action-btn" value="'.$btnText.'"></div>';
}
if ($noteText) {
$note = '<span class="medium">'.$noteText.'</span>';
}
$input = <<<HTML
<div class="nexus-input-box" style="display: flex">
<div style="display: flex;flex-direction: column;flex-grow: 1">
<input type="text" name="$name" value="{$value}">
$note
</div>
$btn
</div>
HTML;
return $input;
}
} }

View File

@@ -1,6 +1,6 @@
<?php <?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.24'); defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.24');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-09-04'); defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-09-05');
defined('IN_TRACKER') || define('IN_TRACKER', false); defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP"); defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org"); defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");

View File

@@ -3683,8 +3683,10 @@ foreach ($rows as $row)
else else
print("<td class=\"rowfollow\">" . number_format($row["times_completed"]) . "</td>\n"); print("<td class=\"rowfollow\">" . number_format($row["times_completed"]) . "</td>\n");
if ($row["anonymous"] == "yes" && user_can('torrentmanage')) if (
{ $row["anonymous"] == "yes"
&& (user_can('torrentmanage') || (isset($row['owner']) && $row['owner'] == $CURUSER['id']))
) {
print("<td class=\"rowfollow\" align=\"center\"><i>".$lang_functions['text_anonymous']."</i><br />".(isset($row["owner"]) ? "(" . get_username($row["owner"]) .")" : "<i>".$lang_functions['text_orphaned']."</i>") . "</td>\n"); print("<td class=\"rowfollow\" align=\"center\"><i>".$lang_functions['text_anonymous']."</i><br />".(isset($row["owner"]) ? "(" . get_username($row["owner"]) .")" : "<i>".$lang_functions['text_orphaned']."</i>") . "</td>\n");
} }
elseif ($row["anonymous"] == "yes") elseif ($row["anonymous"] == "yes")

View File

@@ -68,6 +68,7 @@ $lang_edit = array
'text_audio_codec' => "音频编码", 'text_audio_codec' => "音频编码",
'row_content' => "内容", 'row_content' => "内容",
'ban_reason_label' => '原因', 'ban_reason_label' => '原因',
'fill_quality' => '填写质量',
); );
?> ?>

View File

@@ -40,6 +40,7 @@ $lang_upload = array
'text_chinese_title' => "中文名:", 'text_chinese_title' => "中文名:",
'text_english_title' => "英文名:", 'text_english_title' => "英文名:",
'text_titles_note' => "(如果英文名不存在,使用拼音或不填写)", 'text_titles_note' => "(如果英文名不存在,使用拼音或不填写)",
'fill_quality' => '填写质量',
); );
?> ?>

View File

@@ -68,6 +68,7 @@ $lang_edit = array
'text_audio_codec' => "音頻編碼", 'text_audio_codec' => "音頻編碼",
'row_content' => "內容", 'row_content' => "內容",
'ban_reason_label' => '原因', 'ban_reason_label' => '原因',
'fill_quality' => '填寫質量',
); );
?> ?>

View File

@@ -40,6 +40,7 @@ $lang_upload = array
'text_chinese_title' => "中文名:", 'text_chinese_title' => "中文名:",
'text_english_title' => "英文名:", 'text_english_title' => "英文名:",
'text_titles_note' => "(如果英文名不存在,請使用拼音或不填寫)", 'text_titles_note' => "(如果英文名不存在,請使用拼音或不填寫)",
'fill_quality' => '填寫質量',
); );
?> ?>

View File

@@ -68,6 +68,7 @@ $lang_edit = array
'text_audio_codec' => "Audio Codec", 'text_audio_codec' => "Audio Codec",
'row_content' => "Content", 'row_content' => "Content",
'ban_reason_label' => 'Reason', 'ban_reason_label' => 'Reason',
'fill_quality' => 'Fill quality',
); );
?> ?>

View File

@@ -40,6 +40,7 @@ $lang_upload = array
'text_chinese_title' => "Chinese Name:", 'text_chinese_title' => "Chinese Name:",
'text_english_title' => "English Name:", 'text_english_title' => "English Name:",
'text_titles_note' => "(If no English Name exists, use pinyin or leave it blank)", 'text_titles_note' => "(If no English Name exists, use pinyin or leave it blank)",
'fill_quality' => 'Fill quality',
); );
?> ?>

View File

@@ -226,7 +226,7 @@ switch ($type)
case 'seeding': case 'seeding':
{ {
// $res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.id DESC") or sqlerr(); // $res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.id DESC") or sqlerr();
$fields = "torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers"; $fields = "torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers,snatched.seedtime,snatched.uploaded";
$tableWhere = "peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes'"; $tableWhere = "peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes'";
$order = "torrents.id DESC"; $order = "torrents.id DESC";
break; break;
@@ -236,7 +236,7 @@ switch ($type)
case 'leeching': case 'leeching':
{ {
// $res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers, torrents.added FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.id DESC") or sqlerr(); // $res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers, torrents.added FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.id DESC") or sqlerr();
$fields = "torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers, torrents.added"; $fields = "torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers, torrents.added,snatched.seedtime,snatched.uploaded";
$tableWhere = "peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no'"; $tableWhere = "peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no'";
$order = "torrents.id DESC"; $order = "torrents.id DESC";
break; break;
@@ -246,7 +246,7 @@ switch ($type)
case 'completed': case 'completed':
{ {
// $res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, torrents.banned, torrents.approval_status, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.id DESC") or sqlerr(); // $res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, torrents.banned, torrents.approval_status, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.id DESC") or sqlerr();
$fields = "torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, torrents.banned, torrents.approval_status, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat"; $fields = "torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, torrents.banned, torrents.approval_status, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.seedtime,snatched.uploaded, snatched.leechtime, snatched.completedat";
$tableWhere = "torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND userid=$id AND torrents.owner != $id"; $tableWhere = "torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND userid=$id AND torrents.owner != $id";
$order = "snatched.id DESC"; $order = "snatched.id DESC";
break; break;
@@ -256,7 +256,7 @@ switch ($type)
case 'incomplete': case 'incomplete':
{ {
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.downloaded, snatched.leechtime FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id ORDER BY snatched.id DESC") or sqlerr(); $res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.downloaded, snatched.leechtime FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id ORDER BY snatched.id DESC") or sqlerr();
$fields = "torrents.id AS torrent, torrents.name AS torrentname, small_descr, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.downloaded, snatched.leechtime"; $fields = "torrents.id AS torrent, torrents.name AS torrentname, small_descr, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.downloaded, snatched.leechtime,snatched.seedtime,snatched.uploaded";
$tableWhere = "torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id"; $tableWhere = "torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id";
$order = "snatched.id DESC"; $order = "snatched.id DESC";
break; break;

44
public/js/ptgen.js vendored
View File

@@ -27,3 +27,47 @@ jQuery('.btn-get-pt-gen').on('click', function () {
} }
}, 'json') }, 'json')
}) })
function autoSelect(value) {
// console.log(`autoSelect: ${value}`)
let names = ["source_sel", "medium_sel", "codec_sel", "audiocodec_sel", "standard_sel", "processing_sel", "team_sel"];
for (let i = 0; i < names.length; i++) {
const name = names[i];
const select = jQuery("select[name="+name+"]")
// console.log("check name: " + name)
select.children("option").each(function (index, option) {
let _option = jQuery(option)
let optionText = _option.text();
// console.log("check option text: " + optionText + " match value: " + value)
let pattern = new RegExp(value, "i");
if (optionText.match(pattern)) {
console.log(`name: ${name}, optionText: ${optionText} match value: ${value}, break`)
select.val(option.getAttribute('value'))
return false
}
})
}
}
jQuery("#compose").on("click", ".nexus-action-btn",function () {
let box = jQuery(this).closest(".nexus-input-box")
let inputValue = box.find("[name=name]").val();
if (inputValue.trim() == '') {
return
}
let parts = inputValue.split(/[\s]+/i)
let count = parts.length;
for (let i = 0; i < count; i++) {
if (i < count - 1) {
autoSelect(parts[i])
} else {
let arr = parts[i].split("-")
if (arr[0]) {
autoSelect(arr[0])
}
if (arr[1]) {
autoSelect(arr[1])
}
}
}
})

View File

@@ -20,6 +20,7 @@ if ($enableoffer == 'yes') {
$has_allowed_offer = false; $has_allowed_offer = false;
} }
$uploadfreely = user_can_upload("torrents"); $uploadfreely = user_can_upload("torrents");
do_log("uploadfreely: $uploadfreely, has_allowed_offer: $has_allowed_offer");
$allowtorrents = ($has_allowed_offer || $uploadfreely); $allowtorrents = ($has_allowed_offer || $uploadfreely);
$allowspecial = user_can_upload("music"); $allowspecial = user_can_upload("music");
@@ -38,7 +39,7 @@ $showteam = (($allowtorrents && get_searchbox_value($brsectiontype, 'showteam'))
$showaudiocodec = (($allowtorrents && get_searchbox_value($brsectiontype, 'showaudiocodec')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showaudiocodec'))); //whether show languages or not $showaudiocodec = (($allowtorrents && get_searchbox_value($brsectiontype, 'showaudiocodec')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showaudiocodec'))); //whether show languages or not
$settingMain = get_setting('main'); $settingMain = get_setting('main');
$torrentRep = new \App\Repositories\TorrentRepository();
stdhead($lang_upload['head_upload']); stdhead($lang_upload['head_upload']);
?> ?>
<form id="compose" enctype="multipart/form-data" action="takeupload.php" method="post" name="upload"> <form id="compose" enctype="multipart/form-data" action="takeupload.php" method="post" name="upload">
@@ -62,9 +63,12 @@ stdhead($lang_upload['head_upload']);
if ($altname_main == 'yes'){ if ($altname_main == 'yes'){
tr($lang_upload['row_torrent_name'], "<b>".$lang_upload['text_english_title']."</b>&nbsp;<input type=\"text\" style=\"width: 250px;\" name=\"name\" />&nbsp;&nbsp;&nbsp; tr($lang_upload['row_torrent_name'], "<b>".$lang_upload['text_english_title']."</b>&nbsp;<input type=\"text\" style=\"width: 250px;\" name=\"name\" />&nbsp;&nbsp;&nbsp;
<b>".$lang_upload['text_chinese_title']."</b>&nbsp;<input type=\"text\" style=\"width: 250px\" name=\"cnname\"><br /><font class=\"medium\">".$lang_upload['text_titles_note']."</font>", 1); <b>".$lang_upload['text_chinese_title']."</b>&nbsp;<input type=\"text\" style=\"width: 250px\" name=\"cnname\"><br /><font class=\"medium\">".$lang_upload['text_titles_note']."</font>", 1);
} } else {
else $autoFillText = $lang_upload['fill_quality'];
tr($lang_upload['row_torrent_name'], "<input type=\"text\" style=\"width: 99%;\" id=\"name\" name=\"name\" /><br /><font class=\"medium\">".$lang_upload['text_torrent_name_note']."</font>", 1); $nameInput = $torrentRep->buildUploadFieldInput("name", "", "", $autoFillText);
tr($lang_upload['row_torrent_name'], $nameInput, 1);
}
if ($smalldescription_main == 'yes') if ($smalldescription_main == 'yes')
tr($lang_upload['row_small_description'], "<input type=\"text\" style=\"width: 99%;\" name=\"small_descr\" /><br /><font class=\"medium\">".$lang_upload['text_small_description_note']."</font>", 1); tr($lang_upload['row_small_description'], "<input type=\"text\" style=\"width: 99%;\" name=\"small_descr\" /><br /><font class=\"medium\">".$lang_upload['text_small_description_note']."</font>", 1);
get_external_tr(); get_external_tr();