{"id":16697,"date":"2020-02-01T00:15:28","date_gmt":"2020-01-31T16:15:28","guid":{"rendered":"http:\/\/4563.org\/?p=16697"},"modified":"2020-02-01T00:15:28","modified_gmt":"2020-01-31T16:15:28","slug":"qbit%e8%87%aa%e5%8a%a8rclone%e4%b8%8a%e4%bc%a0%e8%84%9a%e6%9c%ac-with-tag-%e6%89%93%e6%a0%87%e7%ad%be%e7%9a%84%e8%87%aa%e5%8a%a8%e4%b8%8a%e4%bc%a0","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=16697","title":{"rendered":"qbit\u81ea\u52a8rclone\u4e0a\u4f20\u811a\u672c- with tag \u6253\u6807\u7b7e\u7684\u81ea\u52a8\u4e0a\u4f20"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>\u5343\u725b<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>qbit\u81ea\u52a8rclone\u4e0a\u4f20\u811a\u672c- with tag \u6253\u6807\u7b7e\u7684\u81ea\u52a8\u4e0a\u4f20<\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 \u5343\u725b \u4e8e 2020-2-1 00:35 \u7f16\u8f91 <\/p>\n<p> \u7ffb\u4e86\u4e0b\u8bba\u575b\uff0c\u786e\u5b9e\u6682\u65f6\u6ca1\u6709\u627e\u5230\u6211\u60f3\u8981\u7684\u8fd9\u4e2a\u811a\u672c\u3002\u56e0\u6b64\u5c31\u81ea\u5df1diy\u4e86\u4e00\u4e2a<br \/>  \u611f\u8c22\u8bba\u575b\u524d\u8f88\u4eec\u505a\u51fa\u7684\u8d21\u732e\uff0c\u7279\u522b\u662f@xcy1020 \u7684\u811a\u672c\uff0c\u6211\u7684\u662f\u57fa\u4e8e\u4ed6\u7684\u811a\u672c\u5185\u5bb9\u6539\u51fa\u6765\u7684<br \/>  \u6548\u679c\u662f\u8fd9\u6837\u7684\uff1a<br \/>  1. \u624b\u52a8\u5bf9\u67d0\u4e2a\u79cd\u5b50\u8fdb\u884c\u7279\u6b8a\u6807\u8bb0\u3002<br \/>  https:\/\/img.tujidu.com\/image\/5e34507b7fe5c<br \/>  2. \u6807\u8bb0\u8fc7\u540e\u4e0d\u7528\u7ba1\u5b83<br \/>  \u811a\u672c\u5b9a\u65f6\u6267\u884c\uff0c\u4f1a\u5728\u6267\u884c\u65f6\u5c06\u5176\u8bbe\u7f6e\u4e3a\u4e0a\u4f20\u4e2d\u3002\u4e0a\u4f20\u7ed3\u675f\u540e\u4f1a\u4fdd\u6301\u5728\u7ed3\u675f\u7684\u6807\u7b7e\u4e2d<br \/>  https:\/\/img.tujidu.com\/image\/5e345569e6a9c<br \/>  \u8fd9\u6837\u4f60\u5c31\u53ef\u4ee5\u5728\u4e0d\u5f71\u54cdpt\u7684\u60c5\u51b5\u4e0b\uff0c\u968f\u5fc3\u6240\u6b32\u7684\u4e0a\u4f20\u5230gd\u6216\u8005\u662fonedrive\u4e0a\u4e86<\/p>\n<p>  \u4f7f\u7528\u65b9\u6cd5\uff1a<br \/>  \u8ba1\u5212\u4efb\u52a1\uff0c\u5b9a\u65f61-3-5\u5206\u949f\u968f\u610f\u65f6\u95f4\u4e00\u6b21\u6267\u884c\u8be5sh\u6587\u4ef6\u3002\u600e\u4e48\u600e\u4e48\u5b9a\u65f6\u4f60\u81ea\u5df1\u53bb\u7814\u7a76<br \/>  *\/1 * * * * bash \/home\/\u7528\u6237\u540d\/data\/qb_auto_rclone.sh<br \/>  \u4f7f\u7528\u4e4b\u524d\u4f60\u5f97\u8981\u5728\u4f60\u7684qbittorrent\u4e2d\u5efa\u7acb\u4e00\u4e2a\u79cd\u5b50tag<br \/>  https:\/\/img.tujidu.com\/image\/5e344f969945a<br \/>  \u5185\u5bb9\u662f\uff1a\u3010\u5f85\u4e0a\u4f20\u4e91\u7aef\u3011<br \/>  \u4e4b\u540e\u4f7f\u7528\u7684\u5177\u4f53\u811a\u672c\u4ee3\u7801\u5982\u4e0b<br \/>  \/home\/\u7528\u6237\u540d\/data\/qb_auto_rclone.sh:<\/p>\n<p>  #!\/bin\/sh<\/p>\n<p>  qb_version=&quot;4.2.1&quot;<br \/>  qb_username=&quot;\u7528\u6237\u540d&quot;<br \/>  qb_password=&quot;\u5bc6\u7801&quot;<br \/>  qb_web_url=&quot;http:\/\/127.0.0.1:2017&quot;<br \/>  log_dir=&quot;\/home\/tujidu\/data\/qbauto&quot;<br \/>  rclone_dest=&quot;BG:&quot; #rclone destination\u5173\u952e\u5b57 \u8fd0\u884crclone config\u67e5\u770bname\u5b57\u6bb5\u5373\u53ef<br \/>  rclone_parallel=&quot;32&quot; #rclone\u4e0a\u4f20\u7ebf\u7a0b \u9ed8\u8ba44<br \/>  from_dc_tag=&quot;\/Upload&quot; # \u4e0a\u4f20\u540e\u7684\u76f8\u5bf9\u6839\u76ee\u5f55\uff0c\u53ef\u4e3a\u7a7a<\/p>\n<p>  # \u4e0b\u9762\u7684\u4e5f\u53ef\u4ee5\u81ea\u5b9a\u4e49\uff0c\u4f46\u662f\u63a8\u8350\u4e0d\u6539\u52a8<br \/>  unfinished_tag=&quot;\u3010\u5f85\u4e0a\u4f20\u4e91\u7aef\u3011&quot; # \u8fd9\u4e2a\u662f\u624b\u52a8\u8bbe\u7f6e\u67d0\u4e9btag\uff0c\u56e0\u4e3a\u6709\u7528\u624d\u4e0a\u4f20<br \/>  uploading_tag=&quot;\u3010\u6b63\u5728\u4e0a\u4f20\u3011&quot;<br \/>  finished_tag=&quot;\u3010\u7ed3\u675f\u3011&quot;<br \/>  noupload_tag=&quot;\u65e0\u6548-\u4e0d\u4e0a\u4f20&quot;<\/p>\n<p>  if [ ! -d ${log_dir} ]<br \/>  then<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; mkdir -p ${log_dir}<br \/>  fi<\/p>\n<p>  version=$(echo ${qb_version} | grep -P -o &quot;(.){2}&quot; | sed s\/\\.\/\/g)<\/p>\n<p>  function qb_login(){<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; if [ ${version} -gt 404 ]<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; qb_v=&quot;1&quot;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cookie=$(curl -i &#8211;header &quot;Referer: ${qb_web_url}&quot; &#8211;data &quot;username=${qb_username}&amp;password=${qb_password}&quot; &quot;${qb_web_url}\/api\/v2\/auth\/login&quot; | grep -P -o &#8216;SID=S{32}&#8217;)<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if [ -n ${cookie} ]<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;[$(date &#8216;+%Y-%m-%d %H:%M:%S&#8217;)] \u767b\u5f55\u6210\u529f\uff01cookie:${cookie}&quot; &gt;&gt; ${log_dir}\/autodel.log<\/p>\n<p>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;[$(date &#8216;+%Y-%m-%d %H:%M:%S&#8217;)] \u767b\u5f55\u5931\u8d25\uff01&quot; &gt;&gt; ${log_dir}\/autodel.log<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fi<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; elif [[ ${version} -le 404 &amp;&amp; ${version} -ge 320 ]]<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; qb_v=&quot;2&quot;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cookie=$(curl -i &#8211;header &quot;Referer: ${qb_web_url}&quot; &#8211;data &quot;username=${qb_username}&amp;password=${qb_password}&quot; &quot;${qb_web_url}\/login&quot; | grep -P -o &#8216;SID=S{32}&#8217;)<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if [ -n ${cookie} ]<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;[$(date &#8216;+%Y-%m-%d %H:%M:%S&#8217;)] \u767b\u5f55\u6210\u529f\uff01cookie:${cookie}&quot; &gt;&gt; ${log_dir}\/autodel.log<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;[$(date &#8216;+%Y-%m-%d %H:%M:%S&#8217;)] \u767b\u5f55\u5931\u8d25&quot; &gt;&gt; ${log_dir}\/autodel.log<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fi<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; elif [[ ${version} -ge 310 &amp;&amp; ${version} -lt 320 ]]<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; qb_v=&quot;3&quot;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;\u9648\u5e74\u8001\u7248\u672c\uff0c\u8bf7\u53ca\u65f6\u5347\u7ea7&quot;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; else<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; qb_v=&quot;0&quot;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; fi<br \/>  }<\/p>\n<p>  # \u5148\u79fb\u9664\u6307\u5b9atag\uff0c\u540e\u589e\u52a0\u81ea\u5df1\u7684tag<br \/>  function qb_change_hash_tag(){<br \/>  &nbsp; &nbsp; file_hash=$1<br \/>  &nbsp; &nbsp; fromTag=$2<br \/>  &nbsp; &nbsp; toTag=$3<br \/>  &nbsp; &nbsp; if [ ${qb_v} == &quot;1&quot; ]<br \/>  &nbsp; &nbsp; then # \u8fd9\u91cc\u662f\u6dfb\u52a0\u67d0\u4e9btag\u7684\u65b9\u6cd5<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curl -s -X POST -d &quot;hashes=${file_hash}&amp;tags=${fromTag}&quot; &quot;${qb_web_url}\/api\/v2\/torrents\/removeTags&quot; &#8211;cookie &quot;${cookie}&quot;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;curl -s -X POST -d &quot;hashes=${file_hash}&amp;tags=${toTag}&quot; &quot;${qb_web_url}\/api\/v2\/torrents\/addTags&quot; &#8211;cookie &quot;${cookie}&quot;<br \/>  &nbsp; &nbsp; elif [ ${qb_v} == &quot;2&quot; ]<br \/>  &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;curl -s -X POST -d &quot;hashes=${file_hash}&amp;category=${fromTag}&quot; &quot;${qb_web_url}\/command\/removeCategories&quot; &#8211;cookie ${cookie}<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;curl -s -X POST -d &quot;hashes=${file_hash}&amp;category=${toTag}&quot; &quot;${qb_web_url}\/command\/setCategory&quot; &#8211;cookie ${cookie}<br \/>  &nbsp; &nbsp; else<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;echo &quot;qb_v=${qb_v}&quot;<br \/>  &nbsp; &nbsp; fi<br \/>  }<\/p>\n<p>  function rclone_copy(){<br \/>  &nbsp; &nbsp; torrent_name=$1<br \/>  &nbsp; &nbsp; torrent_hash=$2<br \/>  &nbsp; &nbsp; torrent_path=$3<\/p>\n<p>  &nbsp; &nbsp; # tag = \u5f85\u4e0a\u4f20<br \/>  &nbsp; &nbsp; # \u8fd9\u91cc\u6267\u884c\u4e0a\u4f20\u7a0b\u5e8f<br \/>  &nbsp; &nbsp; if [ -f &quot;${torrent_path}&quot; ]<br \/>  &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp;&nbsp; &nbsp; echo &quot;[$(date &#8216;+%Y-%m-%d %H:%M:%S&#8217;)] \u7c7b\u578b\uff1a\u6587\u4ef6&quot;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp; echo &quot;[$(date &#8216;+%Y-%m-%d %H:%M:%S&#8217;)] \u7c7b\u578b\uff1a\u6587\u4ef6&quot; &gt;&gt; ${log_dir}\/qb.log<br \/>  &nbsp; &nbsp;&nbsp; &nbsp; type=&quot;file&quot;<br \/>  &nbsp; &nbsp; elif [ -d &quot;${torrent_path}&quot; ]<br \/>  &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp;&nbsp; &nbsp; echo &quot;[$(date &#8216;+%Y-%m-%d %H:%M:%S&#8217;)] \u7c7b\u578b\uff1a\u76ee\u5f55&quot;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp; echo &quot;[$(date &#8216;+%Y-%m-%d %H:%M:%S&#8217;)] \u7c7b\u578b\uff1a\u76ee\u5f55&quot; &gt;&gt; ${log_dir}\/qb.log<br \/>  &nbsp; &nbsp;&nbsp; &nbsp; type=&quot;dir&quot;<br \/>  &nbsp; &nbsp; else<br \/>  &nbsp; &nbsp;&nbsp; &nbsp; echo &quot;[$(date &#8216;+%Y-%m-%d %H:%M:%S&#8217;)] \u672a\u77e5\u7c7b\u578b\uff0c\u53d6\u6d88\u4e0a\u4f20&quot;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp; echo &quot;[$(date &#8216;+%Y-%m-%d %H:%M:%S&#8217;)] \u672a\u77e5\u7c7b\u578b\uff0c\u53d6\u6d88\u4e0a\u4f20&quot; &gt;&gt; ${log_dir}\/qb.log<br \/>  &nbsp; &nbsp;&nbsp; &nbsp; # tag = \u4e0d\u4e0a\u4f20<br \/>  &nbsp; &nbsp;&nbsp; &nbsp; qb_change_hash_tag ${torrent_hash} ${unfinished_tag} ${noupload_tag}<br \/>  &nbsp; &nbsp;&nbsp; &nbsp; return<br \/>  &nbsp; &nbsp; fi<br \/>  &nbsp; &nbsp; # tag = \u4e0a\u4f20\u4e2d<br \/>  &nbsp; &nbsp; qb_change_hash_tag ${torrent_hash} ${unfinished_tag} ${uploading_tag}<br \/>  &nbsp; &nbsp; # \u6267\u884c\u4e0a\u4f20<br \/>  &nbsp; &nbsp; if [ ${type} == &quot;file&quot; ]<br \/>  &nbsp; &nbsp; then # \u8fd9\u91cc\u662frclone\u4e0a\u4f20\u7684\u65b9\u6cd5<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;rclone_copy_cmd=$(rclone -v copy &#8211;transfers ${rclone_parallel} &#8211;log-file${log_dir}\/qbauto_copy.log &quot;${torrent_path}&quot; ${rclone_dest}\/${from_dc_tag})<br \/>  &nbsp; &nbsp; elif [ ${type} == &quot;dir&quot; ]<br \/>  &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rclone_copy_cmd=$(rclone -v copy &#8211;transfers ${rclone_parallel} &#8211;log-file ${log_dir}\/qbauto_copy.log &quot;${torrent_path}&quot;\/ ${rclone_dest}\/${from_dc_tag}\/&quot;${torrent_name}&quot;)<br \/>  &nbsp; &nbsp; fi<\/p>\n<p>  &nbsp; &nbsp; # tag = \u5df2\u4e0a\u4f20<br \/>  &nbsp; &nbsp; qb_change_hash_tag ${torrent_hash} ${uploading_tag} ${finished_tag}<br \/>  }<\/p>\n<p>  function file_lock(){<br \/>  &nbsp; &nbsp; $(touch qbup.lock)<br \/>  }<br \/>  function can_go_lock(){<br \/>  &nbsp; &nbsp; lockStatus=$(ls | grep qbup.lock)<br \/>  &nbsp; &nbsp; if [ -z &quot;${lockStatus}&quot; ]<br \/>  &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;noLock=&quot;1&quot;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;return<br \/>  &nbsp; &nbsp; fi<br \/>  &nbsp; &nbsp; noLock=&quot;0&quot;<br \/>  }<br \/>  function file_unlock(){<br \/>  &nbsp; &nbsp; $(rm -rf qbup.lock)<br \/>  }<\/p>\n<p>  function doUpload(){<br \/>  &nbsp; &nbsp; torrentInfo=$1<br \/>  &nbsp; &nbsp; i=$2<br \/>  &nbsp; &nbsp; echo $2<br \/>  &nbsp; &nbsp; echo ${i}<\/p>\n<p>  &nbsp; &nbsp; torrent_name=$(echo ${torrentInfo} | jq &quot;.[$i] | .name&quot; | sed s\/&quot;\/\/g)<br \/>  &nbsp; &nbsp; torrent_hash=$(echo ${torrentInfo} | jq &quot;.[$i] | .hash&quot; | sed s\/&quot;\/\/g)<br \/>  &nbsp; &nbsp; save_path=$(echo ${torrentInfo} | jq &quot;.[$i] | .save_path&quot; | sed s\/&quot;\/\/g)<br \/>  &nbsp; &nbsp; torrent_path=&quot;${save_path}${torrent_name}&quot; # \u8fd9\u91cc\u5c31\u662f\u4ed6\u7684\u672c\u5730\u5b9e\u9645\u8def\u5f84\uff0c\u5c1d\u8bd5\u5c06\u8fd9\u91cc\u4e0a\u4f20\u4e0a\u53bb<\/p>\n<p>  &nbsp; &nbsp; can_go_lock<br \/>  &nbsp; &nbsp; if [[ ${noLock} == &quot;1&quot; ]] # \u5395\u6240\u95e8\u80fd\u5f00<br \/>  &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;file_lock # \u9501\u4e0a\u5395\u6240\u95e8<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;echo &#8216;\u6267\u884c\u4e0a\u4f20\u6ca1\u4e8b\u7684~~~&#8217;;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;echo ${torrent_name}<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;echo ${torrent_hash}<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;echo ${torrent_path}<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;rclone_copy ${torrent_name} ${torrent_hash} ${torrent_path}<br \/>  &nbsp; &nbsp; else<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;echo &#8216;\u5df2\u6709\u7a0b\u5e8f\u5728\u4e0a\u4f20\uff0c\u9000\u51fa&#8217;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;return # \u6253\u4e0d\u5f00\u95e8\uff0c\u6362\u4e2a\u65f6\u95f4\u6765<br \/>  &nbsp; &nbsp; fi<br \/>  &nbsp; &nbsp; file_unlock # \u6253\u5f00\u5395\u6240\u95e8\uff0c\u51fa\u53bb<br \/>  }<\/p>\n<p>  # \u6bcf\u6b21\u53ea\u67e5\u8be2\u4e00\u6761\u6570\u636e\uff0c\uff01\uff01\u4e0a\u4f20\u4e00\u6761\u6570\u636e\uff01\uff01<br \/>  function qb_get_status(){<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; qb_login<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; if [ ${qb_v} == &quot;1&quot; ]<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; completed_torrents_num=$(curl -s &quot;${qb_web_url}\/api\/v2\/torrents\/info?filter=completed&quot; &#8211;cookie &quot;${cookie}&quot; | jq &#8216;.[] | length&#8217; | wc -l)<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;\u4efb\u52a1\u6570\uff1a&quot;.${completed_torrents_num}<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for((i=0;i&lt;${completed_torrents_num};i++));<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; do<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curtag=$(curl -s &quot;${qb_web_url}\/api\/v2\/torrents\/info?filter=completed&quot; &#8211;cookie &quot;${cookie}&quot; | jq &quot;.[$i] | .tags&quot; | sed s\/&quot;\/\/g | grep -P -o &quot;${unfinished_tag}&quot;)<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if [ -z &quot;${curtag}&quot; ]<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curtag=&quot;null&quot;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fi<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if [ ${curtag} == &quot;${unfinished_tag}&quot; ]<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;torrentInfo=$(curl -s &quot;${qb_web_url}\/api\/v2\/torrents\/info?filter=completed&quot; &#8211;cookie &quot;${cookie}&quot;)<\/p>\n<p>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; doUpload &quot;${torrentInfo}&quot; ${i}<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; # \u6bcf\u6b21\u53ea\u4e0a\u4f20\u4e00\u4e2a\u6570\u636e\uff0c\u5426\u5219\u7684\u8bdd\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u591a\u7ebf\u7a0b\u7684\u4e89\u7528\u95ee\u9898<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; return<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fi<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; done<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; elif [ ${qb_v} == &quot;2&quot; ]<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; completed_torrents_num=$(curl -s &quot;${qb_web_url}\/query\/torrents?filter=completed&quot; &#8211;cookie &quot;${cookie}&quot; | jq &#8216;.[] | length&#8217; | wc -l)<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for((i=0;i&lt;${completed_torrents_num};i++));<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; do<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curtag=$(curl -s &quot;${qb_web_url}\/query\/torrents?filter=completed&quot; &#8211;cookie &quot;${cookie}&quot; | jq &quot;.[$i] | .category&quot; | sed s\/&quot;\/\/g)<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if [ -z &quot;${curtag}&quot; ]<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curtag=&quot;null&quot;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fi<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if [ ${curtag} == &quot;${unfinished_tag}&quot; ]<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; then<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; torrentInfo=$(curl -s &quot;${qb_web_url}\/query\/torrents?filter=completed&quot; &#8211;cookie &quot;${cookie}&quot;)<\/p>\n<p>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; doUpload &quot;${torrentInfo}&quot; ${i}<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; # \u6bcf\u6b21\u53ea\u4e0a\u4f20\u4e00\u4e2a\u6570\u636e\uff0c\u5426\u5219\u7684\u8bdd\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u591a\u7ebf\u7a0b\u7684\u4e89\u7528\u95ee\u9898<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; return<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fi<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; done<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;\u5565\u4e8b\u90fd\u4e0d\u5e72&quot;;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; else<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;\u83b7\u53d6\u9519\u8bef&quot;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;qb_v=${qb_v}&quot;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; fi<br \/>  }<\/p>\n<p>  qb_get_status<\/p>\n<p>  \u6700\u540e\u9644\u56fe\u4e00\u5f20\uff0c\u8868\u660e\u6210\u529f\u4e86<br \/>  https:\/\/img.tujidu.com\/image\/5e34572f73ed9\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>Reves<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6211\u641e\u4e86\u4e2a\u6587\u4ef6\u5939\uff0c\u5f52\u6863\u4e0a\u4f20\u7528\uff0c\u518d\u7528crontab\u5199\u4e2a\u547d\u4ee4\u6bcf\u5929\u51cc\u66683\u70b9rclone\u4e0a\u4f20\u8be5\u6587\u4ef6\u5939\u7684\u5168\u90e8\u6587\u4ef6\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u5343\u725b<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tReves \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-2-1 00:33<br \/>  \u6211\u641e\u4e86\u4e2a\u6587\u4ef6\u5939\uff0c\u5f52\u6863\u4e0a\u4f20\u7528\uff0c\u518d\u7528crontab\u5199\u4e2a\u547d\u4ee4\u6bcf\u5929\u51cc\u66683\u70b9rclone\u4e0a\u4f20\u8be5\u6587\u4ef6\u5939\u7684\u5168\u90e8\u6587\u4ef6 &#8230;<\/p>\n<p> yc022t \u6709\u65f6\u5019\u5c31\u662f\u60f3\u8981\u770b\u4e2a\u7535\u5f71\u4ec0\u4e48\u7684\u542c\u86cb\u75bc\u7684\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>riwsh<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u9a6c\u514b\u7559\u540d\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>wenwei7532<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u611f\u8c22\u5206\u4eab<\/p>\n<p>  \u524d\u6392<\/p>\n<p>  \u7d2b\u85af\u5e03\u4e01\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5343\u725b \u5927\u4f6c\u6709\u8bdd\u8bf4 : qbit\u81ea\u52a8&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/16697"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16697"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/16697\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16697"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}