Rtorrent: $d.name= problem

Created on 24 Aug 2020  Â·  9Comments  Â·  Source: rakshasa/rtorrent

Hello,

I have a small script which converts any video file`s sound to AAC and send to cloud.

The problem is I can send the downloaded file name but ffmpeg gives error "no file found."

Here is the line:

method.set_key = event.download.finished,notify_me,"execute2=/media/NAS/convert/conv.sh,$d.name="

here is the script:

#!/bin/bash
File="$1"
ffmpeg -i "$1" -acodec aac -vcodec copy AAC.mkv
rclone -v sync "${1}_AAC.mkv" remote:film
Subject="$1"
recipients="[email protected]"
/usr/sbin/sendmail -vt <<EOF
To: ${recipients}
Subject: ${Subject}
Example Message
EOF

I can get mail with correct subject (filename) but ffmpeg does not work.

Any help ?

All 9 comments

using $d.name=, you are passing along to the script only the _name_ of the completed torrent.
instead, you probably want to pass as an argument the _position on disk_ of the file!

if you have modified your rtorrent.rc to include the more robust d.data_path method:
https://github.com/rakshasa/rtorrent/wiki/Common-Tasks-in-rTorrent#getting-the-full-path-of-data-of-a-torrent

then you should pass that one to your script, instead.
the script will then accept the d.data_path target file/folder and, if needed, should pick a single file to work on.

Problem is not ffmpeg. İt does not get filename with this syntax "$1"

Because rclone is working. İ think i need find a fix for ffmpeg

25 AÄŸu 2020 Sal 00:48 tarihinde piramiday notifications@github.com ÅŸunu
yazdı:

using $d.name=, you are passing along to the script only the name of
the completed torrent.
instead, you probably want to pass as an argument the position on disk
of the file!

if you have modified your rtorrent.rc to include the more robust
d.data_path method:

https://github.com/rakshasa/rtorrent/wiki/Common-Tasks-in-rTorrent#getting-the-full-path-of-data-of-a-torrent

then you should pass that one to your script, instead.
the script will then accept the d.data_path target file/folder and, if
needed, should pick a single file to work on.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/rakshasa/rtorrent/issues/1022#issuecomment-679404785,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAFMLA3Z3KEQRL6OWP4CQATSCLU5LANCNFSM4QJ4VUYQ
.

@YaPaY please try and be more specific.

you wrote both:

Problem is not ffmpeg.

and

İ think i need find a fix for ffmpeg

so it's really not obvious what you are trying to accomplish.

in general, I'd expect a post-processing script to receive as input the path of the downloaded data, not the name of the torrent.
that's why I was suggesting to pass to the script $d.data_path= rather than $d.name=.

furthermore, in your script you use ffmpeg to create a file named AAC.mkv, and then you try to rclone a file with a different name, that is, ${1}_AAC.mkv. maybe that's another error.

in any case, please spend some time to prepare your next reply!
and if you solve the problem, please close this issue. good luck!

If another script works, then that is by accident of a fitting CWD – d.name is NOT the proper attribute for passing a data path. Read what @piramiday wrote.

i will try with data.path and inform you asap. Thanks

conv2.sh
`#!/bin/bash
ffmpeg -i "$1" -acodec aac -vcodec copy AAC.mkv

rclone -v sync "${1}_AAC.mkv" remote:mefilm

Subject="$1"

recipients="[email protected]"

/usr/sbin/sendmail -vt <

To: ${recipients}

Subject: ${Subject}

Example Message

EOF
`

and .rctorrent.conf
method.set_key = event.download.finished,notify_me,"execute2=/media/USB/biten/conv2.sh,$d.data_path="

rclone won`t work I know. I am trying to fix first ffmpeg, the rest is pretty easy

the script works because I am getting mail but the subject is null.

Something is wrong/missing in here.

edit: no the script does not triggering, sorry for misinformation

Whether it gets called or not, fix your bugs first: use of random CWD instead of /tmp, and your inconsistent file naming.

fix your bugs first:

because of it I opened a post here.

use of random CWD instead of /tmp

I have no idea what is random CWD. I am not bash scripter. I am looking for the way auto converting audio file to aac with ffmpeg. Thats all.

this issue tracker is for rtorrent: so far, it does not look there is any issue whatsoever with your rtorrent.
you should probably become more expert with bash and writing scripts before trying to accomplish this.
the problem you seem to have is a great exercise for you to learn bash, but you should do that on your own and posting to stackoverflow, instead, not here.
most often, if you are in full control of your bash script, you will be able to understand right away what to do inside rtorrent to successfully trigger that script.

the issue with rtorrent
as I said, earlier you were passing from rtorrent to you bash script only the name of the torrent, which is meaningless if you are interested in the mkv file.
you should implement the data path method and pass that one, instead.
note that with data path, the input parameter will be a file if the torrent consists of a single file, but it will be a folder if the torrent consists of multiple files.
as long as you are doing this, the rtorrent aspect of it is completed and you should close this issue.

the issue with your script

  1. use an abundance of echo calls to understand what you are doing;
  2. as I explained, you cannot rely on "$1" alone but have to think through the possible cases of what you are trying to accomplish, file vs folder;
  3. I already wrote that there was an inconsistency between the two file names you were creating and then rsyncing, yet you did not even read that ($1_AAC.mkv, vs AAC.mkv);
  4. again -- use echo! you can then easily look at the debug log and see what ffmpeg was complaining about, etc;
  5. as long as your script is not working on its own, don't think about loading it in rtorrent;
  6. I understand language might be a barrier, but you really need to think through and read your message at least twice before posting.

I won't be able to help any more than this. good luck!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  Â·  5Comments

lzbk picture lzbk  Â·  6Comments

ghost picture ghost  Â·  4Comments

crazy-max picture crazy-max  Â·  4Comments

Bystroushaak picture Bystroushaak  Â·  4Comments