13 agosto 2006

Descargar torrent automaticamente por correo

Al final he encontrado la manera de poder enviar .torrent y ponerlos a descargar automáticamente.

Gracias al script de Matt Comi y las instrucciones de su página puedes enviar un .torrent por correo a una dirección determinada y gracias a las reglas puede enviarlo a Transmission para su descarga.

El contenido del script modificado para abrir con Transmission:

using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"

set numberOfMessages to count theMessages

repeat with thisMessage in theMessages

set theSubject to subject of thisMessage
set theSender to sender of thisMessage

try
set nameOfAttachment to the name of the first mail attachment of thisMessage

if nameOfAttachment ends with ".torrent" then

set theFilename to "Chiquitin:Users:snaranja:Torrents:" & nameOfAttachment

save first mail attachment of thisMessage in theFilename

tell application "Transmission"
set theTorrent to open file theFilename

try
open theTorrent
on error
-- ignore any errors from the application
end try

end tell

end if

my sendMail(theSender, "Success", nameOfAttachment)

on error

my sendMail(theSender, "Failure", nameOfAttachment)

end try

end repeat

end tell

end perform mail action with messages

end using terms from

on sendMail(theSender, theStatus, theAttachment)

tell application "Mail"

set newMessage to (make new outgoing message at end of outgoing messages)

tell newMessage
set visible to false
make new to recipient at end of to recipients with properties {address:theSender}
set subject to "Torrent Download " & theStatus & " (" & theAttachment & ")"
send
end tell

end tell

end sendMail

No olvides modificar las preferencias de Transmission para que descargue por defecto en una ubicación determinada.

Además has de cambiar la ubicación para copiar el .torrent, la mia es "Chiquitin:Users:snaranja:Torrents:", tengo los torrent corriendo en el iBook de ahí lo de chiquitin, jeje.

Para evitar que te pueda llegar, casualmente, algún torrent no deseado añade a las reglas que el mensaje llegue desde una cuenta determinada, agrega un asunto en particular o create una cuenta especial para este uso.

Vía: TUAW

No hay comentarios: