Skip to content

Commit

Permalink
update to v2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
rachpt committed Aug 28, 2018
1 parent 3f0fdac commit a02b7ae
Show file tree
Hide file tree
Showing 13 changed files with 196 additions and 45 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

An Autoseed used to reseed Movies in PT sites powered by shell scripts. Get a python version [HERE](https://github.com/Rhilip/Pt-Autoseed).

目前适用于 从 HDSky / TTG / HDChina 自动转载 电影 [针对 iPad 资源特别优化] 至 HUDBT / WHUPT / NPUBITS / NanYangPT / BYRBT 站。
目前适用于 从 HDSky / TTG / HDChina 自动转载 电影 [针对 iPad 资源特别优化] 至 HUDBT / WHUPT / NPUBITS / NanYangPT / BYRBT / 北洋园 PT 站。

[![release](https://img.shields.io/badge/Version-2.3-brightgreen.svg)](https://github.com/rachpt/AutoSeed/releases/tag/v2.3) [![GitHub license](https://img.shields.io/badge/license-AGPL-blue.svg)](https://raw.githubusercontent.com/rachpt/AutoSeed/master/LICENSE)
[![release](https://img.shields.io/badge/Version-2.4-brightgreen.svg)](https://github.com/rachpt/AutoSeed/releases/tag/v2.4) [![GitHub license](https://img.shields.io/badge/license-AGPL-blue.svg)](https://raw.githubusercontent.com/rachpt/AutoSeed/master/LICENSE)

| 源站点(from) | 支持站点(to) | 时间(time) |
| :---------------: | :-----------------------: | :----------: |
Expand All @@ -14,6 +14,7 @@ An Autoseed used to reseed Movies in PT sites powered by shell scripts. Get a py
| | https://nanyangpt.com | 2018-06-07 |
| | https://bt.byr.cn | 2018-06-17 |
| | https://hdcmct.org | 2018-07-28 |
| | https://tjupt.org | 2018-08-28 |

## 特点

Expand Down Expand Up @@ -96,6 +97,9 @@ t_id: [55997]
```

## 更新日志
- 2018-08-28 --> 2.4
- 添加对 北洋园pt 的支持。
- 修复部分错误。

- 2018-08-23 --> 2.3
- 添加对 CMCT 的支持,以后不再维护该项。
Expand Down
17 changes: 11 additions & 6 deletions edit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# FileName: edit.sh
#
# Author: rachpt@126.com
# Version: 2.3v
# Date: 2018-08-27
# Version: 2.4v
# Date: 2018-08-28
#
#------------------------------------#
#---main.sh is running?---#
Expand Down Expand Up @@ -34,6 +34,10 @@ function edit_post_byrbt()
{
http --ignore-stdin -f POST "$edit_postUrl" 'id'="$t_id" 'name'="[$smallDescr_byrbt][$dot_name][$movie_type_byrbt][$movie_country_byrbt]" 'small_descr'="$subname_chs_include" 'url'="$imdbUrl" 'dburl'='' 'nfoaction'='keep' 'descr'="$byrbt_des" 'type'="$byrbt_selectType" 'secocat'="$second_type_byrbt" 'anonymous'="`([ "$anonymous" = 'yes' ] && echo 1) || echo 0`" 'visible'="1" "$cookie"
}
function edit_post_tjupt()
{
http --ignore-stdin -f POST "$edit_postUrl" 'id'="$t_id" 'small_descr'="$subname_chs_include" 'url'="$imdbUrl" 'descr'="$tjupt_des" 'type'="$selectType" 'cname'="$smallDescr_tjupt" 'ename'="$dot_name" 'issuedate'="$issuedate_tjupt" 'language'="$language_tjupt" 'format'="$formatratio_tjupt" 'formatradio'="$formatradio_tjupt" 'subsinfo'="$subsinfo_tjupt" 'district'="$district_tjupt" "$country_tjupt"="$country_tjupt" 'source_sel'="$source_sel_tjupt" 'team_sel'="$team_sel_tjupt" 'anonymous'="`([ "$anonymous" = 'yes' ] && echo 1) || echo 0`" 'visible'="1" "$cookie"
}
#------------------------------------#
old_new_torrent_name=''
for edit_loop in `egrep -n "small_descr=$default_subname" "$log_Path" |awk -F ':' '{print $1}'`
Expand Down Expand Up @@ -79,16 +83,17 @@ do
edit_post_byrbt
echo "$default_subname" "$smallDescr"
sed -i "${edit_loop}s#$default_subname#$smallDescr#" "$log_Path"
elif [ "$check_site" = "https://tjupt.org" ]; then
source "$AUTO_ROOT_PATH/post/tjupt.sh"
edit_post_tjupt
echo "$default_subname" "$smallDescr"
sed -i "${edit_loop}s#$default_subname#$smallDescr#" "$log_Path"
fi
fi

[ "$old_new_torrent_name" ] && if [ "$old_new_torrent_name" != "$new_torrent_name" ]; then
rm -f "$source_detail_desc" "$source_detail_html"
fi
old_new_torrent_name="$new_torrent_name"
done

#------------------------------------#
#---clean---#
rm -f "$source_detail_desc" "$source_detail_html"

2 changes: 1 addition & 1 deletion get_desc/desc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ fi
#---poster---#
sed -i "1 {s/^[ \t]*//g}" "$source_detail_desc"
source "$AUTO_ROOT_PATH/get_desc/poster.sh"
cat "$source_detail_html"

9 changes: 6 additions & 3 deletions get_desc/generate_desc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# FileName: get_desc/generate_desc.sh
#
# Author: rachpt@126.com
# Version: 2.3v
# Date: 2018-08-27
# Version: 2.4v
# Date: 2018-08-28
#
#-------------------------------------#
#
Expand All @@ -13,7 +13,10 @@ search_keyword_get_douban_url()
search_get_douban_url="$(http --pretty=format --ignore-stdin GET "https://api.douban.com/v2/movie/search?q=${base_movie_name_search}"|grep 'movie.douban.com/subject'|head -n 1|awk -F '"' '{print $4}')"

if [ "$search_get_douban_url" ]; then
search_desc_url="$doubabUrl"
search_desc_url="$search_get_douban_url"
echo "搜索得到豆瓣链接:$search_get_douban_url" >> "$log_Path"
else
echo '未搜索到豆瓣链接!' >> "$log_Path"
fi
}

Expand Down
4 changes: 2 additions & 2 deletions get_desc/poster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Author: rachpt@126.com
# Version: 2.3v
# Date: 2018-08-25
# Date: 2018-08-27
#
#-------------------------------------#
#
Expand Down Expand Up @@ -35,7 +35,7 @@ deal_with_byrbt_images()
elif [ $img_counter_bytbt -gt 24 ]; then
break # jump out
fi
tmp_desc_img_file="$AUTO_ROOT_PATH/tmp/$(echo $RANDOM)-$(echo $RANDOM)-$(echo "${img_in_desc_url##*/}"|sed "s#[^-a-zA-Z0-9.]##g")"
tmp_desc_img_file="$AUTO_ROOT_PATH/tmp/$(echo $RANDOM)-$(echo $RANDOM)-$(echo "${img_in_desc_url##*/}"|sed "s/[uU]nt/no-name/g;s#[^-a-zA-Z0-9.]##g")"
http --ignore-stdin -dco "$tmp_desc_img_file" "$img_in_desc_url" >/dev/null 2>&1

byr_upload_img_url="$(http -f POST "$byrbt_upload_pic_URL" upload@"$tmp_desc_img_file" "$cookie_byrbt"|egrep -o "http[-a-zA-Z0-9./:()]+images[-a-zA-Z0-9./:(_ )]+[^''\"]*" |sed "s/http:/https:/g")" # byrbt
Expand Down
12 changes: 7 additions & 5 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# FileName: main.sh
#
# Author: rachpt@126.com
# Version: 2.3v
# Date: 2018-08-23
# Version: 2.2v
# Date: 2018-06-23
#
#-----------import settings-------------#
AUTO_ROOT_PATH="$(dirname "$(readlink -f "$0")")"
source "$AUTO_ROOT_PATH/settings.sh"
source "$AUTO_ROOT_PATH/test.sh"
#----------------lock func--------------#
function is_locked()
{
Expand Down Expand Up @@ -86,10 +87,10 @@ function main_loop()
echo "+++++++++++++[start]+++++++++++++" >> "$log_Path"
echo "[`date '+%Y-%m-%d %H:%M:%S'`] 准备发布 [$TR_TORRENT_NAME]" >> "$log_Path"
source "$AUTO_ROOT_PATH/post/post.sh"
rm -f "$torrentPath" # delete uploaded torrent

write_log_main # write log
unset TR_TORRENT_NAME # next torrent
rm -f "$torrentPath" # delete uploaded torrent
clean_commit_main=1
fi
done
Expand All @@ -103,7 +104,7 @@ function main_loop()
#--------------timeout func--------------#
TimeOut()
{
waitfor=380
waitfor=480
main_loop_command=$*
$main_loop_command &
main_loop_pid=$!
Expand All @@ -112,6 +113,7 @@ TimeOut()
main_loop_sleep_pid=$!

wait $main_loop_pid > /dev/null 2>&1
sleep 2
kill -9 $main_loop_sleep_pid > /dev/null 2>&1
}

Expand All @@ -122,6 +124,6 @@ TimeOut()
if [ "$(find "$flexget_path" -iname '*.torrent*')" ]; then
is_locked
TimeOut main_loop
#main_loop
trap remove_lock EXIT
fi

42 changes: 23 additions & 19 deletions post/add.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# FileName: post/add.sh
#
# Author: rachpt@126.com
# Version: 2.2v
# Date: 2018-07-28
# Version: 2.4v
# Date: 2018-08-28
#
#-------------settings----------------#

Expand All @@ -22,36 +22,40 @@ function set_ratio()
set_commit_nanyangpt=`"$trans_remote" ${HOST}:${PORT} --auth ${USER}:${PASSWORD} -t $oneTorrentID -i |grep 'tracker.nanyangpt.com'`
set_commit_byrbt=`"$trans_remote" ${HOST}:${PORT} --auth ${USER}:${PASSWORD} -t $oneTorrentID -i |grep 'tracker.byr.cn'`
set_commit_cmct=`"$trans_remote" ${HOST}:${PORT} --auth ${USER}:${PASSWORD} -t $oneTorrentID -i |grep 'tracker.hdcmct.org'`
set_commit_tjupt=`"$trans_remote" ${HOST}:${PORT} --auth ${USER}:${PASSWORD} -t $oneTorrentID -i |grep 'tjupt.org'`
#---add new site's seed ratio here---#
#set_commit_new=`"$trans_remote" ${HOST}:${PORT} --auth ${USER}:${PASSWORD} -t $oneTorrentID -i |grep 'tracker.new.com'

if [ "$TR_TORRENT_NAME" = "$oneTorrent" ]; then

if [ -n "$set_commit_hust" ]; then
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_hudbt
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_hudbt
break
elif [ -n "$set_commit_whu" ]; then
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_whu
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_whu
break
elif [ -n "$set_commit_npupt" ]; then
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_npupt
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_npupt
break
elif [ -n "$set_commit_nanyangpt" ]; then
sleep 1
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_nanyangpt
sleep 4
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_nanyangpt
break
elif [ -n "$set_commit_byrbt" ]; then
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_byrbt
break
elif [ -n "$set_commit_cmct" ]; then
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_cmct
break
#---add new site's seed ratio here---#
#elif [ -n "$set_commit_new" ]; then
# "$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_new
# break
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_nanyangpt
sleep 4
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_nanyangpt
break
elif [ -n "$set_commit_byrbt" ]; then
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_byrbt
break
elif [ -n "$set_commit_cmct" ]; then
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_cmct
break
elif [ -n "$set_commit_tjupt" ]; then
"$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_tjupt
break
#---add new site's seed ratio here---#
#elif [ -n "$set_commit_new" ]; then
# "$trans_remote" ${HOST}:${PORT} -n ${USER}:${PASSWORD} -t $oneTorrentID -sr $ratio_new
# break
fi
fi
done
Expand Down
1 change: 0 additions & 1 deletion post/byrbt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ else
fi

movie_type_byrbt="$(egrep "[类分][  ]*[别类型]" "$source_detail_desc"|head -n 1|sed "s/.*[类分][  ]*[别类型][  ]*//g;s/[ ]*//g;s/[\n\r]*//g")"
movie_country_byrbt="$(egrep "[国地产][  ]*[家区地]" "$source_detail_desc"|head -n 1|sed "s/.*[国地产][  ]*[家区地][  ]*//g;s/,/\//g;;s/[ ]*//g;s/[\n\r]*//g")"

16 changes: 13 additions & 3 deletions post/param.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Author: rachpt@126.com
# Version: 2.3v
# Date: 2018-08-21
# Date: 2018-08-27
#
#-------------------------------------#
from_desc_get_prarm()
Expand All @@ -28,13 +28,15 @@ from_desc_get_prarm()
whu_selectType='401'
hudbt_selectType='401'
source_sel_cmct='1'
team_sel_tjupt='2'
elif [ "`egrep '[国地产][  ]*[家区地][  ]*马来西亚|[国地产][  ]*[家区地][  ]*日本|[国地产][  ]*[家区地][  ]*韩国|[国地产][  ]*[家区地][  ]*印度|[国地产][  ]*[家区地][  ]*泰国|[国地产][  ]*[家区地][  ]*伊朗' "$source_detail_desc"`" ]; then
whu_selectType='414'
hudbt_selectType='414'
elif [ "`egrep '[国地产][  ]*[家区地][  ]*中国台湾|[国地产][  ]*[家区地][  ]*台湾|[国地产][  ]*[家区地][  ]*香港|[国地产][  ]*[家区地][  ]*中国香港|[国地产][  ]*[家区地][  ]*澳门' "$source_detail_desc"`" ]; then
whu_selectType='413'
hudbt_selectType='413'
source_sel_cmct='2'
team_sel_tjupt='5'
fi
if [ -z "$whu_selectType" ]; then
whu_selectType="$default_select_type_whu"
Expand Down Expand Up @@ -82,12 +84,14 @@ from_desc_get_prarm()
whu_selectType='404'
byrbt_selectType='410'
cmct_selectType='503'
tjupt_selectType='411'
# other site
else
nanyangpt_selectType="$default_select_type_nanyangpt"
npupt_selectType="$default_select_type_npupt"
byrbt_selectType="$default_select_type_byrbt"
cmct_selectType="$default_select_type_cmct"
tjupt_selectType="$default_select_type_tjupt"
fi

#---npupt source---#
Expand All @@ -101,8 +105,10 @@ from_desc_get_prarm()
npupt_select_source='4'
second_type_byrbt='14'
source_sel_cmct='10'
team_sel_tjupt='3'
elif [ "`egrep '[国地产][  ]*[家区地][  ]*美国|[国地产][  ]*[家区地][  ]*英国|[国地产][  ]*[家区地][  ]*加拿大' "$source_detail_desc"`" ]; then
npupt_select_source='5'
team_sel_tjupt='1'
fi
if [ -z "$npupt_select_source" ]; then
npupt_select_source="$default_standard_npupt" #7
Expand All @@ -121,13 +127,14 @@ from_desc_get_prarm()
#---get 2 subname---#
if [ -n "`grep -i "CH[ST]" "$source_detail_desc"`" ]; then
subname_chs_include='中文字幕'
subsinfo_tjupt='2'
elif [ "$original_other_info" ]; then
subname_chs_include="$original_other_info"
else
subname_chs_include=''
fi
subname_1=`grep "译[  ]*名" "$source_detail_desc" |sed "s/.*译[  ]*名[  ]*//;s/\n//g;s/\r//g;s/[ ]*//g"|sed "s#[/]\?[a-zA-Z0-9:]\{3,\}[/]\?##g"`
subname_2=`grep "片[  ]*名" "$source_detail_desc" |sed "s/.*片[  ]*名[  ]*//;s/\n//g;s/\r//g;s/[ ]*//g"|sed "s#[/]\?[a-zA-Z0-9:]\{3,\}[/]\?##g"`
subname_1=`grep "译[  ]*名" "$source_detail_desc" |sed "s/.*译[  ]*名[  ]*//;s/\n//g;s/\r//g;s/[ ]*//g"|sed "s#[/]\?[a-zA-Z0-9:‘' ]\{3,\}[/]\?##g"`
subname_2=`grep "片[  ]*名" "$source_detail_desc" |sed "s/.*片[  ]*名[  ]*//;s/\n//g;s/\r//g;s/[ ]*//g"|sed "s#[/]\?[a-zA-Z0-9:‘' ]\{3,\}[/]\?##g"`

if [ -z "$imdbUrl" ]; then
imdbUrl="$(grep -o 'tt[0-9]\{7\}' "$source_detail_desc"|head -n 1)"
Expand Down Expand Up @@ -185,6 +192,9 @@ from_desc_get_prarm()
fi
fi
fi
#---com info---#
movie_country_byrbt="$(egrep "[国地产][  ]*[家区地]" "$source_detail_desc"|head -n 1|sed "s/.*[国地产][  ]*[家区地][  ]*//g;s/,/\//g;;s/[ ]*//g;s/[\n\r]*//g")"

}

#-------------------------------#
Expand Down
16 changes: 14 additions & 2 deletions post/post.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# FileName: post/post.sh
#
# Author: rachpt@126.com
# Version: 2.3v
# Date: 2018-08-22
# Version: 2.4v
# Date: 2018-08-28
#
#---get desc---#
source "$AUTO_ROOT_PATH/get_desc/desc.sh"
Expand Down Expand Up @@ -63,6 +63,13 @@ upload_torrent()
t_id=`http --ignore-stdin -f POST "$postUrl" name="$dot_name" small_descr="$smallDescr" url="$imdbUrl" descr="$cmct_des" type="$selectType" medium_sel="$medium_sel_cmct" codec_sel="$codec_sel_cmct" standard_sel="$standardSel" source_sel="$source_sel_cmct" uplver="$anonymous" file@"$torrentPath" "$cookie"|grep hit=1|head -n 1|cut -d = -f 5|cut -d '&' -f 1`
fi

#---tjupt post---#
elif [ "$postUrl" = "https://tjupt.org/takeupload.php" ]; then
t_id=`http --ignore-stdin -f --print=h POST "$postUrl" file@"${torrentPath}" 'small_descr'="$subname_chs_include" 'url'="$imdbUrl" 'descr'="$tjupt_des" 'type'="$selectType" 'cname'="$smallDescr_tjupt" 'ename'="$dot_name" 'issuedate'="$issuedate_tjupt" 'language'="$language_tjupt" 'format'="$formatratio_tjupt" 'formatratio'="$formatratio_tjupt" 'subsinfo'="$subsinfo_tjupt" 'district'="$country_tjupt" 'source_sel'="$source_sel_tjupt" 'team_sel'="$team_sel_tjupt" 'uplver'="$anonymous" "$cookie"| grep "id=" |grep 'detail'|head -n 1|cut -d '=' -f 2|cut -d '&' -f 1`

if [ -z "$t_id" ]; then
t_id=`http --ignore-stdin -f POST "$postUrl" small_descr="$subname_chs_include" url="$imdbUrl" descr="$tjupt_des" type="$selectType" cname="$smallDescr_tjupt" ename="$dot_name" issuedate="$issuedate_tjupt" language="$language_tjupt" format="$formatratio_tjupt" formatradio="$formatradio_tjupt" subsinfo="$subsinfo_tjupt" district="$district_tjupt" "$country_tjupt"="$country_tjupt" source_sel="$source_sel_tjupt" team_sel="$team_sel_tjupt" uplver="$anonymous" file@"$torrentPath" "$cookie"|grep hit=1|head -n 1|cut -d = -f 5|cut -d & -f 1`
fi

#---momel moduel post, hudbt & whu---#
else
Expand Down Expand Up @@ -123,6 +130,11 @@ if [ "$enable_cmct" = 'yes' ]; then
source "$AUTO_ROOT_PATH/post/cmct.sh"
upload_torrent
fi

if [ "$enable_tjupt" = 'yes' ]; then
source "$AUTO_ROOT_PATH/post/tjupt.sh"
upload_torrent
fi
#-------------unset---------------#
unset_tempfiles

Loading

0 comments on commit a02b7ae

Please sign in to comment.