Code Monkey home page Code Monkey logo

Comments (18)

haugene avatar haugene commented on May 21, 2024 1

Hey, and thanks :)

When I exec'ed into the container it doesn't seem unrar is installed.

root@3d1f6f2b91c2:/# unrar
bash: unrar: command not found

When you checked 'which unrar' and it said '/bin/unrar', was that on the commandline to your Synology, or inside the container? The script will be executed by transmission inside the container where unrar does not exist.

I added rar and unrar to the container, they are nice to have tools for simple scripts like this. Pull the image again using the dev tag and let me know how it goes ;)

from docker-transmission-openvpn.

mightymads avatar mightymads commented on May 21, 2024 1

Hi ethanopp,

Not sure I can be of much help, but I can tell you how I have configured it.

In my docker run script I have added:
-v /volume1/downloads/:/data \
-e "TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED=true" \
-e "TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME=/data/extract_torrent.sh" \

And I have placed extract_torrent.sh in:
/volume1/downloads

extract_torrent.sh looks like this:
#!/bin/bash
CUR_DIR=`pwd`
cd $TR_TORRENT_DIR
test -d "$TR_TORRENT_NAME" && cd "$TR_TORRENT_NAME"
unrar e -inul *.rar
7z e *.zip > /dev/null 2>&1
cd $CUR_DIR

Hope it helps.

from docker-transmission-openvpn.

mightymads avatar mightymads commented on May 21, 2024 1

@zaphod007 great work :-)

Without having tried this I assume you can simply change the lines:
unrar e -inul *.rar
7z e *.zip > /dev/null 2>&1

To something like:
unrar e -inul *.rar PATH_TO_DIR
7z e *-zip -oPATH_TO_DIR > /dev/null 2>&1

Where PATH_TO_DIR could be something like:
/volume1/my-extracted-files

from docker-transmission-openvpn.

zaphod007 avatar zaphod007 commented on May 21, 2024 1

works like a charm (just needed to add a blank space between -o and PATH in the last line and path to dir= /data/unrar/, thank you so much @mightymads !

from docker-transmission-openvpn.

mightymads avatar mightymads commented on May 21, 2024

Man you rule! Now my script is able to unrar files - sweet.

Would it be possible to add unzip, 7z or similar to the container as well?

For you question about 'which unrar' I must admit that I was doing a lot of hacking while trying to make unrar work so not really sure how correct my answer would be actually. Can we just leave it at that ;)

Thanks again for a fast fix!

from docker-transmission-openvpn.

haugene avatar haugene commented on May 21, 2024

Haha, no worries. Let's leave it at that :)

I added zip and unzip as well, I guess that covers the basics of packing and unpacking stuff. You can check it out, it's on the dev tag for now. I'm gonna merge it to master sometime soon, just got to clean up a little first.

from docker-transmission-openvpn.

haugene avatar haugene commented on May 21, 2024

Fix is merged to master and available on the main tag. That should close this...

from docker-transmission-openvpn.

mightymads avatar mightymads commented on May 21, 2024

Mange tak :-)

from docker-transmission-openvpn.

haugene avatar haugene commented on May 21, 2024

Bare hyggelig

from docker-transmission-openvpn.

ethanopp avatar ethanopp commented on May 21, 2024

mightymads / haugene,

I realize this issue is closed but was hoping you could help shed a little light on exactly how you pointed your container to the script...

I have the following simple script saved as a "unrar.sh"

#!/bin/bash find /data/completed/Sonarr -name '*.rar' -execdir unrar e -o- {} \;

In my docker run I have the following volume mounted
-v "/share/CACHEDEV1_DATA/Library/Application Support/Transmission-AirVPN":/unrar \

and then in my DockerEnv, I have
TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED=true TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME= "/unrar/unrar.sh"

The unrar.sh file is placed in /share/CACHEDEV1_DATA/Library/Application Support/Transmission-AirVPN

When I run the container I get the following error:
/etc/transmission/start.sh: 58: export: /unrar/unrar.sh: bad variable name

What am I doing wrong?

from docker-transmission-openvpn.

ethanopp avatar ethanopp commented on May 21, 2024

Thanks for the quick response!

Looking at your code actually made me realize an error in mine...

I had a space between
TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME= "/unrar/unrar.sh"

Updating to this seems to avoid the error I was previously getting TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME="/unrar/unrar.sh"

Now I'm just downloading something to see if my bash script works, may have to steal yours if it doesn't.

Thanks again!

from docker-transmission-openvpn.

ethanopp avatar ethanopp commented on May 21, 2024

Script doesn't seem to work when a download completes...

What is odd though is if I SSH into the container and manually run the script, it works as expected.

Any other ideas?

I've set the scripts permissions to 0777

from docker-transmission-openvpn.

ethanopp avatar ethanopp commented on May 21, 2024

Restarted everything... seems to be working now.

Thanks again for the help!

from docker-transmission-openvpn.

jamesmanning avatar jamesmanning commented on May 21, 2024

@haugene I didn't want to open a new issue about this since it's likely intentional / by-design, but is there a chance that the image could change in such a way that automatically extracting rar/zip/etc either Just Worked(tm) or could be turned on with a single boolean setting? It's completely fine if not, of course, and this thread is perfect for how to get a script going that'll handle it, but I just wanted to see if it was possible to have something more "in the box". 😄 Maybe something like the script from @mightymads being included in the transmission dir (looks like the image already includes the things the script depends on AFAICT) so it would end up in /etc/transmission in the image, then the default TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME could point to it and a user would only need to turn on TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED for this (I would imagine common?) case? Thanks!!

from docker-transmission-openvpn.

haugene avatar haugene commented on May 21, 2024

Hi!

I'm not opposed to a boolean switch saying "unzip/untar stuff automatically and bundling a script for it. I'd suggest you create a new issue for it, describe the need and link it to this issue and the script you're mentioning and then see if someone can help bundle it. I'm not sure I'll be able to look at it in a while, kind of moving and changing jobs, so a lot happening :)

from docker-transmission-openvpn.

zaphod007 avatar zaphod007 commented on May 21, 2024

Hello all,

after a long journey as a total noob I got everything working thanks to countless hours of reading through this and other material, however I still lack some basic skill obviously as I cant figure out what/how to change the script to move the unpacked items in a specific directory on my data mount instead of the same directory where the rar files are. Can somebody help me? This is what I use and it works for me, thanks to @mightymads post above:
In my docker run script I have added:
-v /volume1/downloads/:/data
-e "TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED=true"
-e "TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME=/data/extract_torrent.sh" \

And I have placed extract_torrent.sh in:
/volume1/downloads

extract_torrent.sh looks like this:
#!/bin/bash
CUR_DIR=pwd
cd $TR_TORRENT_DIR
test -d "$TR_TORRENT_NAME" && cd "$TR_TORRENT_NAME"
unrar e -inul *.rar
7z e *.zip > /dev/null 2>&1
cd $CUR_DIR

from docker-transmission-openvpn.

ensignvorik avatar ensignvorik commented on May 21, 2024

Just wanted to thank the poster for their script and haugene for implementing unrar and that 3 years after posting, this post is still useful.

from docker-transmission-openvpn.

waleedayoub avatar waleedayoub commented on May 21, 2024

Hello all,

after a long journey as a total noob I got everything working thanks to countless hours of reading through this and other material, however I still lack some basic skill obviously as I cant figure out what/how to change the script to move the unpacked items in a specific directory on my data mount instead of the same directory where the rar files are. Can somebody help me? This is what I use and it works for me, thanks to @mightymads post above: In my docker run script I have added: -v /volume1/downloads/:/data -e "TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED=true" -e "TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME=/data/extract_torrent.sh" \

And I have placed extract_torrent.sh in: /volume1/downloads

extract_torrent.sh looks like this: #!/bin/bash CUR_DIR=pwd cd $TR_TORRENT_DIR test -d "$TR_TORRENT_NAME" && cd "$TR_TORRENT_NAME" unrar e -inul *.rar 7z e *.zip > /dev/null 2>&1 cd $CUR_DIR

Hi there, found this thread while trying to implement my own unrar when a torrent is completed, so thanks all!
One question I can't figure out: Where does the $TR_TORRENT_NAME environment variable get set? Is that something that is only available once a torrent is downloaded temporarily? When I docker exec into my transmission container, I don't see this as a variable. Thanks in advance! And hope people are still reading this :)

from docker-transmission-openvpn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.