====== Automatic для keenetic'а====== Rss-фид downloader для transmission и иже с ними У некоторых людей, использующих transmission, возникает вопрос, как можно автоматически организовать скачку торрентов из rss-фидов, как это есть в utorrent'е. Домашняя страница проекта [[http://kylek.is-a-geek.org:31337/Automatic/]]. На данный момент этот пакет скомпиллирован и находится в репозитории, но из-за занятости знающих людей он не совсем готов к эксплуатации. Источник статьи [[http://forum.zyxmon.org/topic342-automatic-dlya-keenetica.html]] ===== Установка и настройка ===== Как ставить пакет opkg install automatic 1) После этого надо создать automatic.state файл (в него записываются ссылки на торрент-файлы, которые automatic уже скачал) touch /media/DISK_A1/system/var/transmission/automatic.state а в файле automatic.conf заменить 2 строки nano /media/DISK_A1/system/etc/automatic.conf на # path to the file which stores information about already downloaded torrents (so they don't get readded to Transmission) statefile = "/media/DISK_A1/system/var/transmission/automatic.state" 2) в automatic.conf также сменить путь до домашнего каталога transmission # For Transmission 1.2x only: Path to the Transmission configuration files transmission-home = "/media/DISK_A1/system/var/transmission" 3) скрипт запуска демона touch /media/DISK_A1/system/etc/init.d/S91automatic chmod +x /media/DISK_A1/system/etc/init.d/S91automatic nano /media/DISK_A1/system/etc/init.d/S91automatic #!/bin/sh MOUNTPNT="/media/DISK_A1" MOUNT="$MOUNTPNT/system" BIN="$MOUNT/usr/sbin/automatic" CONFIGFILE="$MOUNT/etc/automatic.conf" LOGFILE="$MOUNT/var/transmission/automatic.log" export PATH=$MOUNT/bin:$MOUNT/sbin:$MOUNT/usr/bin:$MOUNT/usr/sbin:/sbin:/usr/sbin:/bin:/usr/bin export LD_LIBRARY_PATH=$MOUNT/lib:$MOUNT/usr/lib:/lib:/usr/lib start() { $BIN -v 2 -c $CONFIGFILE -l $LOGFILE } stop() { killall automatic } restart() { killall automatic sleep 10 $BIN -v 2 -c $CONFIGFILE -l $LOGFILE } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo "Usage: $0 {start|stop|restart}" ;; esac 4) также из конфига было бы неплохо вообще убрать строки # list of feed URLs. You can specify one or more feeds, in case of the latter use curly brackets (see the "patterns" option for an example) # Obsolete. Use "feed" option instead. # url = "" этот параметр в 0.8 версии не работает уже **Файл конфигурации automatic.conf** ############################## ## Version-specific options ## ############################## # Transmission version. Options are "1.2", "1.3", and "external" transmission-version = "1.3" # For Transmission 1.2x only: Path to the Transmission configuration files transmission-home = "/media/DISK_A1/system/var/transmission" # Call an external program instead of transmission directly # # If you use this, set transmission-version to "external" # For best results, use an absolute path to the executable # Executable is passed a single parameter, the name of the .torrent # file that was downloaded. The .torrent file passed to this external # program may be removed after the program returns. # The program should return exit code 0 for success and non-0 for failure # Automatic won't respond to ctrl-C while waiting for this to return # # transmission-external = "/usr/local/bin/custom-add-torrent" # For Transmission 1.3x and newer only: set the host on which Transmission runs (default: localhost) # указываете хост, к которому будете подключаться, чаще всего это локалхост, т.е. 127.0.0.1 rpc-host = "localhost" # For Transmission 1.3x and newer only: set the RPC port on which Transmission & Clutch communicate (default: 9091) # rpc-порт, т.е. порт от веб-морды, чаще всего 9091 rpc-port = 9091 # For Transmission 1.3x and newer only: If you configured Transmission/Clutch to use password authentication, Automatic needs that information as well # авторизация на веб-морду rpc-auth = "user:password" ##################### ## General options ## ##################### # A feed contains at least a feed URL and some optional parameters: # "cookie" => If the feed sits behind a login-secured site, you may specify the cookie information here so that Automatic # can download the feed (and any torrents that are matched) # "id" => Give a feed a numeric ID which can be used to restrict certain filters to only be used with a specific feed. # # Sometimes the download URLs in the RSS feed don't point to the correct download location for the torrent. # Then a URL rewrite is necessary. You can use the following (optional) parameters to do that: # "url_pattern" => Pattern of the URL as found in the RSS feed. Use regular expressions and capture groups # to capture parts of the URL that need to be reused. # "url_replace" => The 'new' URL that ought to be used as the actual download link for the torrent. # You can insert the captured groups from 'url_pattern' here. # Example: # "url_pattern" => "http://www.sometorrentsite.com/rssdownload.php/(.+)$" # This URL has 1 capture group (the part in parentheses) # "url_replace" => "http://www.sometorrentsite.com/download.php?/\1" # Using '\1' in the URL places that part from the above URL # # at the end of the new URL # поле url - адрес до rss-рассылки # имеет примерно такой вид "http://myfirstfeed.com/rss.xml" # поле cookie - куки для данного сайта, если не знаете, как оформлять, то возьмите пример с сайта, где взяли рсс-фид, если есть заполненные для utorrent'a, то можно брать оттуда # поле id - номер фида, если их несколько, позволяет привязать фильтр к определенному фиду # поле url_pattern - не знаю, зачем. Сверху написано на англ. # поле url_replace - то же самое # последние два необязательны, т.е. их можно просто убрать # пример чуть ниже # feed = { url => "http://myfirstfeed.com/rss.xml" # cookie => "uid=12345;pass=1234567890" # id => 1 # url_pattern => "" # url_replace => "" # } feed = { url => "http://myfirstfeed.com/rss.xml" cookie => "uid=12345;pass=123456789e15100302b0ef6123456789" id => 2 } # interval in minutes between checks for new downloads # интервал обновления фидов, в минутах interval = 30 # Limit upload speed (in KB/s) for each torrent that is added to Transmission via Automatic # лимит исходящей скорости на закачиваемый торрент-файл #upload-limit = 10 # Automatically add downloaded torrents to Transmission (requires # transmission-daemon and transmission-remote to be installed or use # of "external" option) # If this is not set, all Automatic will do is save the .torrent file. use-transmission = yes # Instruct Transmission to immediately start downloading torrents after being added # If set to 'no' torrents will be added in a paused state # запускать загрузку автоматически (yes,no) start-torrents = yes # path where Automatic will store downloaded torrents # место, где будут храниться закачиваемые *.torrent файлы torrent-folder = "/media/DISK_A1/tmp" # path to the file which stores information about already downloaded torrents (so they don't get readded to Transmission) # путь до *.state файла, где будет список url уже загруженных торрент-файлов, чтоб не перекачаивать их с 30-минутным интервалом statefile = "/media/DISK_A1/system/var/transmission/automatic.state" # Prowl API key. You can use this to send push notifications to an iPhone or an iPad. See http://prowl.weks.net for more information #prowl-apikey = "" # patterns contains a number of regular expressions which are matched against the RSS feed entries # please don't use curly brackets within a regular expression, it'll horribly break the configuration parser :) # letter-casing does not matter # # !!! This is obsolete. See the option "filter" below !!! #patterns = { "Name.of.Something.I.Want.to.Download.Automatically.*HDTV" # "Something.else.to.download.*720p" # "(?!.*720p)Some.Video.But.Not.The.HD.Version" # } # A filter contains a regular expression which is matched against the RSS feed entries. Letter-casing does not matter in the regular # expression. You can list as many filters as you want. # Optional fields: # "folder" ==> Set a specific download folder for torrents that match this regular expression # "feedid" ==> Use this filter only for RSS items from the feed with the specified feed ID # # Please don't use curly brackets within a regular expression, it'll horribly break the configuration parser :) # # You can split very long patterns or folders (actually, any sub-option that is a string) over multiple lines, if you end the previous # line with a '\' or '+': # # filter = { pattern => "This.is.a.really.long.*" + # "regular.expression.spanning" \ # "multiple.lines" # } # # а теперь, собственно и фильтры # поле pattern - фильтр по названию, использующий регулярные выражения для отсеивания ненужных фидов # поле folder - путь, куда будет закачиваться файл # feedid - номер фида, к которому привязан фильтр (это как раз таки поле id в описании feed) # проверку регулярных выражений можно осуществить как опытным путем, так и на сайте http://www.regular-expressions.info/javascriptexample.html # filter = { pattern => "(?!.*(720p|iTunes))Name.of.Download" # folder => "/путь/до/куда/хотите" # feedid => 11 # } filter = { pattern => "Name.of.Something.I.Want.to.Download.Automatically.*HDTV" folder => "/your/download/folder" feedid => 1 } filter = { pattern => "(?!.*(720p|1080p))Something.Else.I.Desparately.Need.To.Watch.But.Not.In.HD" folder => "/your/download/folder" feedid => 1 } вот несколько примеро фильтров (pattern) c пояснениями # Name filter = { pattern => "(?!.*iTunes)Name.*720p.*AC3" folder => "/путь/до/куда/хотите" feedid => 11 } Здесь будут качаться торрент-файлы с именем Name, у которых в строке есть 720p и AC3, но будут пропускаться с iTunes. И будет фильтроваться фид c id 11 # Name Other filter = { pattern => "(?!.*(720p|iTunes))Name.*Other" folder => "/путь/до/куда/хотите" feedid => 11 } Здесь будут качаться торрент-файлы с именем Name+чтонибудьеще+Other, но будут пропускаться с iTunes, 720p. И будет фильтроваться фид c id 11 # Name Other filter = { pattern => "(?!.*(720p|iPhone))Name.Other" folder => "/путь/до/куда/хотите" feedid => 2 } Здесь будут качаться торрент-файлы с именем Name Other, но будут пропускаться с iPhone, 720p. И будет фильтроваться фид c id 2 # Name of Others filter = { pattern => "(?!.*(720p|iPhone|Reliz1|RG#2))Name.of.Others" folder => "/путь/до/куда/хотите" feedid => 2 } Здесь будут качаться торрент-файлы с именем Name of Others, но будут пропускаться с iPhone, 720p, а также Reliz1 и RG#2. И будет фильтроваться фид c id 2 ---- Для тех, кто знаком с английским и кого заинтересовало - прошу на форум оригинала [[http://forum.dsmg600.info/viewtopic.php?pid=15546]]. ---- ===== Возможные проблемы, решения и доп. примеры ===== novafilm feed = { url => "http://www.ulitka.tv/novafilm.xml" newstudio #http://ne****diogroup.tv/rss.php?user=1234&pass=5678 feed = { url => "http://ne****diogroup.tv/rss.php?user=1234&pass=5678" cookie => "bb_data=something_from_cookie_manager_of_browser" id => 3 } решение для lostfilm от **Davilka** feed = { url => "http://pipes.yahoo.com/pipes/pipe.run?_id=56e06d689df6186d0421b9b54bfbe358&_render=rss" ''laforsh пишет: Подскажите, плиз, - Automatic умеет работать с обновляемыми раздачами ? Умеет он парсить страницы по времени создания торрент-файла ?'' Не приходилось использовать для обновляемых раздач, но по логике, нет. Дело в том, что Automatic следит за тем, чтобы повторно не скачать один и тот же торрент, складывая ссылки на скачку в файл automatic.state и соответственно, если ссылка эта не меняется+фид не обновляется, то и торрент будет считаться уже скачанным. Да и парсит он только строчку темы фида регулярными выражениями... Возможно, для этих целей, более целесообразен **TorrentMonitor** [[http://blog.korphome.ru/torrentmonitor/]], упомянутый **schild'ом**