mktorent

Ответить
ya
^-^
Сообщения: 2336
Зарегистрирован: 16 дек 2021, 19:56

mktorent

Сообщение ya »

Код: Выделить всё

NAME
       mktorrent - simple BitTorrent metainfo file creator

SYNOPSIS
       mktorrent [OPTIONS] <target directory or filename>

DESCRIPTION
       mktorrent  is  a text-based utility to create BitTorrent metainfo files used by trackers and torrent clients.  It can create metainfo files
       for single files or complete directories in a fast way.

OPTIONS
       -a <url>[,<url>]*

              specify the full tracker announce URLs. At least one is required and additional -a add backup trackers

       -c <comment>

              add a comment to the metainfo

       -d

              don't write the creation date

       -h

              show help screen

       -l <n>

              set the piece length to 2^n bytes, default is 18, that is 2^18 = 256kb

       -n <name>

              set the name of the torrent, default is the basename of the target

       -o <filename>

              set the path and filename of the created file, default is <name>.torrent

       -p

              set the private flag (dissalow DHT and Peer Exchange)

       -v
              verbose output

       -w <url>[,<url>]*

              add web seed URLs, additional -w add more URLs

COPYRIGH
       This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as  published  by
       the Free Software Foundation; either version 2, or (at your option) any later version.

AUTHORS
       Emil Renner Berthing <esmil@users.sourceforge.net>

       This manpage was written for the Debian GNU/Linux distribution by Nico Golde <nion@debian.org>

BUGS
       Please send bug reports, patches, feature requests, praise and general gossip about the program to: esmil@users.sourceforge.net
ya
^-^
Сообщения: 2336
Зарегистрирован: 16 дек 2021, 19:56

Re: mktorent

Сообщение ya »

addMagnetLinksAria2.sh

Код: Выделить всё

#!/bin/bash
# Download and create torrent files from magnet URIs into one of the queue directories of rTorrent
#   requires: aria2c
# Usage: addMagnetLinksAria2.sh [category] "magnet:?xt=urn:btih:foo…" ["magnet:?xt=urn:btih:bar…", …]


# include common rT helper functions/variables
. "$HOME/.profile_rtfunctions"

###### begin: Edit ######
# Subcategories under the root of queue directories that we want to use
categories=(
1 "various"
2 "unsafe"
3 "apps"
4 "cartoons"
5 "ebooks"
6 "hdtv"
7 "movies"
8 "pictures"
9 "songs"
10 "load"
11 "fullseed"
12 "rotating"
)
###### end: Edit ######


# Root of queue directories for rTorrent
queue_root_dir="$RTHOME/.rtorrent/.queue"

usage_str='Usage: addMagnetLinksAria2.sh [category] "magnet:?xt=urn:btih:foo…" ["magnet:?xt=urn:btih:bar…", …]'


# check for 'aria2c' command
if ! which aria2c &>/dev/null; then
    echo "Error: You don't have 'aria2c' command available, you likely need to:"
    echo "    sudo apt-get install aria2"
    exit 1
fi

# check for arguments
if [[ -z "${1+x}" ]]; then
    echo "$usage_str"
    exit
fi


# check for optional category argument: if not set then display selection dialog
if [[ "$1" =~ xt=urn:btih:([^&/]+) ]]; then
    # check for 'dialog' command
    if ! which dialog &>/dev/null; then
        echo "Error: You don't have 'dialog' command available, you likely need to:"
        echo "    sudo apt-get install dialog"
        exit 1
    fi

    # ncursed dialog command
    dialog_cmd=(dialog --keep-tite --menu "Select category in rTorrent" 19 32 12)

    # display the category selection dialog
    choice=$("${dialog_cmd[@]}" "${categories[@]}" 2>&1 >/dev/tty)

    # check for cancel
    if [[ "$?" = 0 ]]; then
        # select the corresponding text in the array.
        category=${categories[2 * $choice - 1]}
    else
        exit
    fi

    magnets="$@"
else
    category="$1"
    magnets="${@:2:$#}"
fi


# check whether category dir exists then create a magnet torrent file
if [[ ! -d "$queue_root_dir/$category" ]]; then
    echo "Error: Selected '$queue_root_dir/$category' directory does not exist."
    exit 1
fi

# check for magnet links
if [[ "${magnets}" = "" ]]; then
    echo "Error: No magnet links are given!"
    echo "$usage_str"
    exit 1
fi


# aria2c command
aria2c_cmd=(aria2c --bt-metadata-only=true --bt-save-metadata=true -d "$queue_root_dir/$category")

# process the magnet links
for m in $magnets; do
    # check for valid magnet URI
    if [[ "$m" =~ xt=urn:btih:([^&/]+) ]]; then
        # download and create torrent file
        "${aria2c_cmd[@]}" "$m"
    else
        echo "Error: Invalid magnet URI: '$m'"
    fi
done


https://github.com/chros73/rtorrent-ps-ch_setup/blob/master/ubuntu-14.04/home/chros73/bin/addMagnetLinksAria2.sh
ya
^-^
Сообщения: 2336
Зарегистрирован: 16 дек 2021, 19:56

Re: mktorent

Сообщение ya »

mktorrent -a dht:// -d *.mp4

find ~/html/ha0/public_html/video/WD20EFRX-68EUZN0_WCC4M3XSK6V9/ -iname "*.mp4" | while read file; do dir=$(basename $(dirname $file)); mktorrent -a dht:// "$file"; done
Последний раз редактировалось ya 31 июл 2022, 14:28, всего редактировалось 1 раз.
ya
^-^
Сообщения: 2336
Зарегистрирован: 16 дек 2021, 19:56

Re: mktorent

Сообщение ya »

FILE=/etc/docker
if [ ! -f "$FILE" ]; then
echo "$FILE does not exist."
fi

То же, что и выше:

[ ! -f /etc/docker ] && echo "$FILE does not exist."
ya
^-^
Сообщения: 2336
Зарегистрирован: 16 дек 2021, 19:56

Re: mktorent

Сообщение ya »

find . -iname "accepted_hits.bw" | while read file; do dir=$(basename $(dirname $file)); mv $file ${dir}.bw; done
find . -iname "accepted_hits.bw" | while read file; do dir=$(basename $(dirname $file)); mv $file ${dir}.bw; done
ya
^-^
Сообщения: 2336
Зарегистрирован: 16 дек 2021, 19:56

Re: mktorent

Сообщение ya »

find ~/html/ha0/public_html/video/WD20EFRX-68EUZN0_WCC4M3XSK6V9/ -iname "*.mp4" | while read file; do dir=$(basename $(dirname $file)); mktorrent -a dht:// "$file"; done
Ответить