Initial commit

This commit is contained in:
2022-03-02 18:02:15 +01:00
commit 1575bc8058
7 changed files with 2488 additions and 0 deletions

1645
Torrent/Info_Parameteres.txt Normal file

File diff suppressed because it is too large Load Diff

106
Torrent/KFL_template.txt Normal file
View File

@@ -0,0 +1,106 @@
General;"
_____ _____ ___ ___ ___ _ _ _____ _
|_ _| | ____| / | / |/ | | | / / | ___| | |
| | | |__ / /| | / /| /| | | |/ / | |__ | |
| | | __| / / | | / / |__/ | | | |\ \ | __| | |
| | | |___ / / | | / / | | | | \ \ | | | |___
|_| |_____| /_/ |_| /_/ |_| |_| \_\ |_| |_____|
_____ _____ _____ _____ _____ __ _ _____ _____
| _ \ | _ \ | ____| / ___/ | ____| | \ | | |_ _| | ____|
| |_| | | |_| | | |__ | |___ | |__ | \| | | | | |__
| ___/ | _ / | __| \___ \ | __| | |\ | | | | __|
| | | | \ \ | |___ ___| | | |___ | | \ | | | | |___
|_| |_| \_\ |_____| /_____/ |_____| |_| \_| |_| |_____|
|
=========================================================================
|
$if(%FileName%, %FileName%,)
|
=========================================================================
|
|
=========================================================================
|
$if(%Title%,Title.................: %Title%,)
$if(%Collection%,Collection............: %Collection%,)
$if(%Season%,Episode...............: %Season%,)
$if(%FileSize/String4%,Size..................: %FileSize/String4%,)
$if(%OverallBitRate/String%,Overall Bitrate.......: %OverallBitRate/String%,)
$if(%FrameRate/String%,Frame Rate............: %FrameRate/String%,)
$if(%Format%,Format................: %Format%,)
$if(%Format_Version%,Format Version........: %Format_Version%,)
$if(%Duration/String%,Duration..............: %Duration/String%,)
$if(%Video_Format_WithHint_List%,Video Codec...........: %Video_Format_WithHint_List%,)
$if(%Audio_Format_WithHint_List%,Audio Codec...........: %Audio_Format_WithHint_List%,)
$if(%Text_Format_WithHint_List%,Subtitle Codec........: %Text_Format_WithHint_List%,)
$if(%VideoCount%,Video Count...........: %VideoCount%,)
$if(%AudioCount%,Audio Count...........: %AudioCount%,)
$if(%TextCount%,Subtitle Count........: %TextCount%,)
$if(%Track/Position%,Piste.................: %Track/Position%,)
$if(%Album%,Album.................: %Album%,)
$if(%Performer%,Performer.............: %Performer%,)
$if(%Genre%,Genre.................: %Genre%,)
$if(%Cover%,Cover.................: %Cover%,)\n
|"
Video;"
==============================================
Video %StreamKindPos%
==============================================
$if(%ID/String%,ID....................: %ID/String%,)
$if(%Format_Commercial%%Format/Info%,Format................: %Format_Commercial% %Format/Info%,)
$if(%Width%%Height%,Resolution............: %Width%x%Height%,)
$if(%DisplayAspectRatio/String%,Aspect Ratio..........: %DisplayAspectRatio/String%,)
$if(%Format_Profile%,Codec Profile.........: %Codec/String%%Format_Profile%,)
$if(%CodecID%,ID Codec..............: %CodecID%,)
$if(%Duration/String1%,Duration..............: %Duration/String1%,)
$if(%StreamSize/String%,Size..................: %StreamSize/String%,)
$if(%BitRate/String%,Bit Rate..............: %BitRate/String%,)
$if(%BitDepth/String%,Bit Depth.............: %BitDepth/String%,)
$if(%FrameRate% fps,Framerate.............: %FrameRate% fps,)
$if(%FrameRate_Mode%,Frame Rate Mode.......: %FrameRate_Mode%,)
$if(%Encoded_Library_Name%,Encoding Library......: %Encoded_Library_Name%,)
$if(%Default%,Default...............: %Default%,)\n
|"
Audio;"
==============================================
Audio %StreamKindPos%
==============================================
$if(%ID/String%,ID....................: %ID/String%,)
$if(%Language/String%,Language..............: %Language/String%,)
$if(%Title%,Title.................: %Title%,)
$if(%Format_Commercial%,Format................: %Format_Commercial% %Format/Info%,)
$if(%CodecID%,Codec ID..............: %CodecID%,)
$if(%Duration/String1%,Duration..............: %Duration/String1%,)
$if(%FrameRate%,Frame Rate............: %FrameRate%,)
$if(%BitRate/String%,Bit Rate..............: %BitRate/String%,)
$if(%BitRate_Mode%,Bitrate Mode..........: %BitRate_Mode%,)
$if(%BitDepth/String%,Bit Depth.............: %BitDepth/String%,)
$if(%SamplingRate/String%,Sampling Rate.........: %SamplingRate/String%,)
$if(%StreamSize/String%,Stream Size...........: %StreamSize/String%,)
$if(%Default%,Default...............: %Default%,)
$if(%ChannelPositions%,Channel Layout........: %ChannelPositions%,)
Channels..............: %Channel(s)/String%\n
|"
Text;"
==============================================
Subtitle %StreamKindPos%
==============================================
$if(%ID%,ID....................: %ID%,)
$if(%StreamKind/String%,Stream Kind...........: %StreamKind/String%,)
$if(%Title%,Title.................: %Title%,)
$if(%Format/Info%,Format................: %Format_Commercial% %Format/Info%,)
$if(%CodecID%,Codec ID..............: %CodecID%,)
$if(%ElementCount%,Element Count.........: %ElementCount%,)
$if(%StreamSize/String%,Stream Size...........: %StreamSize/String%,)
$if(%Default%,Default...............: %Default%,)
$if(%Forced%,Forced................: %Forced%,)
$if(%Language/String%,Language..............: %Language/String%,)\n
|"
Menu;"
==============================================
Chapters %StreamKindPos%
==============================================
$if(%Chapters_Pos_Begin%,Chapter Pos Begin.....: %Chapters_Pos_Begin%,)
$if(%Chapters_Pos_End%,Chapter Pos End.....: %Chapters_Pos_End%,)\n"

216
Torrent/torrent.sh Executable file
View File

@@ -0,0 +1,216 @@
# /bin/bash
## Check install des dep.
hash mediainfo 2>/dev/null || {
echo >&2 "MediaInfo n'est pas installé. Installez-le avant de relancer ce script."
exit
}
hash transmission-create 2>/dev/null || {
echo >&2 "transmission-create n'est pas installé. Installez-le avant de relancer ce script."
exit
}
# Init Var
TORRENT="false"
SERIE="false"
HELP="false"
TENCODE="false"
PUBLIC="false"
usage() {
echo "Usage: torrent [ -A | --source-Audio ] [ -V | --source-Video ] [ -S | --source-Sub ]
[ -t | --torrent ] [ -s | --serie ] [ -e | --team-encode ]
[ -h | --help ]"
exit 2
}
ARGS=$(getopt -a -n "torrent" -o tsheoV:A:S: --long torrent,serie,help,team-encode,public-torrent,Video:,Audio:,Sub: -- "$@")
eval set -- "$ARGS"
VALID_ARGS=$?
if [ "$VALID_ARGS" != "0" ]; then
usage
fi
while true; do
case "$1" in
-t | --torrent)
TORRENT="true"
shift
;;
-s | --serie)
SERIE="true"
shift
;;
-h | --help)
HELP="true"
shift
;;
-e | --team-encode)
TENCODE="true"
shift
;;
-o | --public-torrent)
PUBLIC="true"
shift
;;
-V | --Video)
SOURCE_VIDEO="$2"
shift 2
;;
-A | --Audio)
SOURCE_AUDIO="$2"
shift 2
;;
-S | --Sub)
SOURCE_SUB="$2"
shift 2
;;
--)
shift
break
;;
*)
echo "Unknown option %s\n" "$1"
usage
;;
esac
done
if [ $HELP == true ]; then
echo "---------------------------------------
Prérequis :
Installer les dépendances : transmission-create et mediainfo
sudo apt install transmission-cli
sudo apt install mediainfo
- Se rendre dans le dossier du script
- chmod u+x torrent.sh
----------------------------------------------------------------
Option disponible :
-t = Pour créer un torrent en même temps que le NFO
-e = Pour préciser que la release a été encodé par vous
-A = Source des Audio
-V = Source Video
-S = Source des Sous-Titres
-s = A utiliser si votre release est une série !
Important : Pour une série, un seul .torrent et un seul NFO sera crée pour le dossier.
----------------------------------------------------------------
Utilisation :
Pour faire le .torrent et le NFO d'un film :
./torrent.sh -t -e -A Ma.Release.Audio -V Ma.Release.Video -S Ma.Release.Sous_Titres /chemin/absolu/vers/la/release
Pour faire le .torrent et le NFO d'une série :
./torrent.sh -t -e -A Ma.Source.Audio -V Ma.Source.Video -S Ma.Source.Sous_Titres -s /chemin/absolu/vers/le/dossier/de/la/release
"
fi
if [ -z "$1" ]; then
echo "N'oubliez pas de mettre le fichier vidéo ou dossier en argument.\nExemple : ./torrent.sh Gattaca.1997.Multi.Bluray.1080p.x265-KFL.mkv"
exit
fi
if [ "$2" != "" ]; then
echo "Mettez le fichier vidéo ou dossier entre guillemets.\nExemple : ./torrent.sh \"[Gattaca.1997.Multi.Bluray.1080p.x265-KFL.mkv\""
exit
fi
# S_SUB=$SOURCE_SUB
# S_AUDIO=$SOURCE_AUDIO
# S_VIDEO=$SOURCE_VIDEO
fs=$SOURCE_SUB
S_SUB=$(echo $fs | sed -E 's/[^a-zA-Z0-9_.)(]/./gm;t;d')
echo $S_SUB
fa=$SOURCE_AUDIO
fa2=$(echo $fa | sed -E 's/[^a-zA-Z0-9_./-/)(]/./gm;t;d')
S_AUDIO=$(echo $fa2) #| sed -E 's/ //gm;t;d')
echo $S_AUDIO
fv=$SOURCE_VIDEO
S_VIDEO=$(echo $fv | sed -E 's/[^a-zA-Z0-9_.)(]/./gm;t;d')
echo $S_VIDEO
script_path=$(pwd)
i="${1}"
if [[ -f "${i}" ]]; then
if [ $TORRENT == true ]; then
tracker="http://connect.p2ptracker.cc:8080/gKLQHb8eCuSmgKAd63lUz0g0PzDMxv27/announce"
tkpr="$tracker"
transmission-create -o "${i%.*}.torrent" -p -t $tkpr -c "Upload par KFL" --include ".*\.\(mpg\|avi\|3g2\|3gp\|asf\|avi\|f4v\|flv\|m2t\|m2ts\|m2v\|m4v\|mjpeg\|mkv\|mov\|mp4\|mpeg\|mts\|mxf\|ogv\|rm\|vob\|webm\|wmv\|m4a\|m4b\|aif\|aac\|ac3\|aiff\|flac\|mp3\|wma\)" "${i}"
fi
if [ $PUBLIC == true ]; then
tkpub=$(curl https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt | sed '/^[ \t\r\n]*$/d' | tail -n5 | tr '\n' ' ')
publist="$tkpub"
transmission-create -o "${i%.*}.PUBLIC.torrent" -t $publist $ -c "Upload par KFL" --include ".*\.\(mpg\|avi\|3g2\|3gp\|asf\|avi\|f4v\|flv\|m2t\|m2ts\|m2v\|m4v\|mjpeg\|mkv\|mov\|mp4\|mpeg\|mts\|mxf\|ogv\|rm\|vob\|webm\|wmv\|m4a\|m4b\|aif\|aac\|ac3\|aiff\|flac\|mp3\|wma\)" "${i}"
fi
nfo=$(mediainfo --Inform="file://$script_path/KFL_template.txt" "$i")
new_nfo=$(echo "$nfo" | sed '/^$/d')
if [ $TENCODE == true ]; then new_nfo=$(echo "$new_nfo" | awk 'NR==20{print "Encodage..............: KFL avec Handbrake Linux"}1'); fi
if [[ ! -z "$SOURCE_SUB" ]]; then new_nfo=$(echo "$new_nfo" | awk 'NR==20{print "Source Sous-Titres....: '$S_SUB' "}1'); fi
if [[ ! -z "$SOURCE_AUDIO" ]]; then new_nfo=$(echo "$new_nfo" | awk 'NR==20{print "Source Audio..........: '$S_AUDIO'"}1'); fi
if [[ ! -z "$SOURCE_VIDEO" ]]; then new_nfo=$(echo "$new_nfo" | awk 'NR==20{print "Source Video..........: '${S_VIDEO}'"}1'); fi
echo "$new_nfo" >"${i%.*}.nfo"
elif [[ -d "${i}" ]]; then
dirpath=$(dirname $i)/$(basename $i)
if [ $SERIE == false ]; then
for f in $(find $dirpath -name "*.mkv" -or -name "*.mp4" -or -name "*.avi" -type f); do
if [ $TORRENT == true ]; then
tracker="http://connect.p2ptracker.cc:8080/gKLQHb8eCuSmgKAd63lUz0g0PzDMxv27/announce"
tkpr="$tracker"
transmission-create -o "${f%.*}.torrent" -p -t $tkpr -c "Upload par KFL" --include ".*\.\(mpg\|avi\|3g2\|3gp\|asf\|avi\|f4v\|flv\|m2t\|m2ts\|m2v\|m4v\|mjpeg\|mkv\|mov\|mp4\|mpeg\|mts\|mxf\|ogv\|rm\|vob\|webm\|wmv\|m4a\|m4b\|aif\|aac\|ac3\|aiff\|flac\|mp3\|wma\)" "${f}"
fi
if [ $PUBLIC == true ]; then
tkpub=$(curl https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt | sed '/^[ \t\r\n]*$/d' | tail -n5 | tr '\n' ' ')
publist="$tkpub"
transmission-create -o "${f%.*}.PUBLIC.torrent" -a $publist $ -c "Upload par KFL" --include ".*\.\(mpg\|avi\|3g2\|3gp\|asf\|avi\|f4v\|flv\|m2t\|m2ts\|m2v\|m4v\|mjpeg\|mkv\|mov\|mp4\|mpeg\|mts\|mxf\|ogv\|rm\|vob\|webm\|wmv\|m4a\|m4b\|aif\|aac\|ac3\|aiff\|flac\|mp3\|wma\)" "${f}"
fi
nfo=$(mediainfo --Inform="file://$script_path/KFL_template.txt" "$f")
new_nfo=$(echo "$nfo" | sed '/^$/d')
if [ $TENCODE == true ]; then new_nfo=$(echo "$new_nfo" | awk 'NR==20{print "Encodage..............: KFL avec Handbrake Linux"}1'); fi
if [[ ! -z "$SOURCE_SUB" ]]; then new_nfo=$(echo "$new_nfo" | awk 'NR==20{print "Source Sous-Titres....: '$S_SUB'"}1'); fi
if [[ ! -z "$SOURCE_AUDIO" ]]; then new_nfo=$(echo "$new_nfo" | awk 'NR==20{print "Source Audio..........: '$S_AUDIO'"}1'); fi
if [[ ! -z "$SOURCE_VIDEO" ]]; then new_nfo=$(echo "$new_nfo" | awk 'NR==20{print "Source Video..........: '$S_VIDEO'"}1'); fi
echo "$new_nfo" >"${f%.*}.nfo"
done
elif [ $SERIE == true ]; then
f=$(find $dirpath -name "*.mkv" -or -name "*.mp4" -or -name "*.avi" -type f | sed -n "1p")
cnt=$(find $dirpath -name "*.mkv" -or -name "*.mp4" -or -name "*.avi" -type f | wc -l)
if [ $TORRENT == true ]; then
tracker="http://connect.p2ptracker.cc:8080/gKLQHb8eCuSmgKAd63lUz0g0PzDMxv27/announce"
tkpr="$tracker"
transmission-create -o "$dirpath/$(basename $i).torrent" -p -t $tkpr -c "Upload par KFL" --include ".*\.mkv" "$dirpath"
fi
if [ $PUBLIC == true ]; then
tkpub=$(curl https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt | sed '/^[ \t\r\n]*$/d' | tail -n5 | tr '\n' ' ')
publist="$tkpub"
transmission-create -o "$dirpath/$(basename $i).PUBLIC.torrent" -a $publist -c "Upload par KFL" --include ".*\.mkv" "$dirpath"
fi
nfo=$(mediainfo --Inform="file://$script_path/KFL_template.txt" "$f")
new_nfo=$(echo "$nfo" | sed '/^$/d')
new_nfo=$(echo "$new_nfo" | awk 'NR==20{print "Poids Total...........: "}1')
new_nfo=$(echo "$new_nfo" | awk 'NR==20{print "Nombre Episodes.......: '$(printf $cnt)'"}1')
if [ $TENCODE == true ]; then new_nfo=$(echo "$new_nfo" | awk 'NR==20{print "Encodage..............: KFL avec Handbrake Linux\n"}1'); fi
if [[ ! -z "$SOURCE_SUB" ]]; then new_nfo=$(echo "$new_nfo" | awk 'NR==20{print "Source Sous-Titres....: '$S_SUB'"}1'); fi
if [[ ! -z "$SOURCE_AUDIO" ]]; then new_nfo=$(echo "$new_nfo" | awk 'NR==20{print "Source Audio..........: '$S_AUDIO'"}1'); fi
if [[ ! -z "$SOURCE_VIDEO" ]]; then new_nfo=$(echo "$new_nfo" | awk 'NR==20{print "Source Video..........: '$S_VIDEO'"}1'); fi
echo "$new_nfo" >"$dirpath/$(basename $i).nfo"
mv "$dirpath/$(basename $i).nfo" "$dirpath/$(basename $i).torrent" ./
fi
else
echo "${i} is not valid"
exit 1
fi