Unrar/extract files after torrent finishes (Transmission)

  • Hi,


    I have a setup with Couchpotato, Sonarr and Transmission. Couchpotato is able to unrar files after completion, but Sonarr doesn't have this function.
    I know there is a function in Transmission called "Script to process after torrent finishes".
    Here I should be able to select a script that does the unrar for me, but is there any script like this available and how do I install it?


    Have tried searching, found auto-unrar, but I can't understand how to install it.


    Thank you!

  • Just create an sh script with one of these:


    Code
    find /path/to/downloads -name '*.rar' -execdir unrar e -o- {} \;


    Code
    unrar e -r -o- *.rar


    Then point transmission to the script to run it after download finished. In my experience though, this doesn't work 100% of the time; so I have my script just run on cron every hour.

    Modpic.gif

    Dell Precision T3500
    Processor:
    Intel Core i7 960 @3.2ghz
    Memory:
    26GB RAM
    Kernel: Linux 5.10.0-0.bpo.9-amd64
    Version: 5.6.2-1 (Usul) Debian Buster [From Fresh Install of 5]

  • Just create an sh script with one of these:


    Code
    find /path/to/downloads -name '*.rar' -execdir unrar e -o- {} \;


    Code
    unrar e -r -o- *.rar


    Then point transmission to the script to run it after download finished. In my experience though, this doesn't work 100% of the time; so I have my script just run on cron every hour.


    Thank you,
    But will this also handle rars that are splitted. Like .r00, .r01 etc..


  • Thank you,
    But will this also handle rars that are splitted. Like .r00, .r01 etc..


    Those are rar parts that have a head file that is filename.rar, it'll unrar it like normal.

    Modpic.gif

    Dell Precision T3500
    Processor:
    Intel Core i7 960 @3.2ghz
    Memory:
    26GB RAM
    Kernel: Linux 5.10.0-0.bpo.9-amd64
    Version: 5.6.2-1 (Usul) Debian Buster [From Fresh Install of 5]


  • Great!
    Never made an sh-script, can you share yours?


    Just paste this into a blank text file save as unrar.txt and then change the extension from .txt to .sh


    Bash
    #!/bin/bash
    find /path/to/downloads -name '*.rar' -execdir unrar e -o- {} \;


    Next make it executable:


    Code
    chmod a+x unrar.sh




    Then move it to where you want and point transmission to it.

    Modpic.gif

    Dell Precision T3500
    Processor:
    Intel Core i7 960 @3.2ghz
    Memory:
    26GB RAM
    Kernel: Linux 5.10.0-0.bpo.9-amd64
    Version: 5.6.2-1 (Usul) Debian Buster [From Fresh Install of 5]


  • Great! Will it be able to unrar files in different folders?
    If I point it to /path/to/downloads/media/ and there are two folders in /media, one named /.tv and one named /.mov
    Will it extract the files in these folder automatically?

  • It will search all files and folders in the directory and unrar them

    Modpic.gif

    Dell Precision T3500
    Processor:
    Intel Core i7 960 @3.2ghz
    Memory:
    26GB RAM
    Kernel: Linux 5.10.0-0.bpo.9-amd64
    Version: 5.6.2-1 (Usul) Debian Buster [From Fresh Install of 5]

  • It will search all files and folders in the directory and unrar them


    I tried the script, it does run well from Terminal. Thank you!
    Is there any way to check if Transmission really does execute it after finishing?


    Another thing, is it possible for this sh-script to set permissions on the extracted files? I get 644 after it extracts!

  • It does not run after Transmission completion. I can't make it run as cron either.
    But if I run it like "sh unrar.sh" it unrar's and works perfectly.


    But why can't I make it run from Transmission or Cron?
    I have permission 777 on the file, and it is executable.

  • It does not run after Transmission completion. I can't make it run as cron either.
    But if I run it like "sh unrar.sh" it unrar's and works perfectly.


    But why can't I make it run from Transmission or Cron?
    I have permission 777 on the file, and it is executable.


    The command section needs to execute the script so "sh /path/to/script.sh" and whichever user:group is executing the function needs to have write access to the folders & files.


    Here's my cron setup:

    Modpic.gif

    Dell Precision T3500
    Processor:
    Intel Core i7 960 @3.2ghz
    Memory:
    26GB RAM
    Kernel: Linux 5.10.0-0.bpo.9-amd64
    Version: 5.6.2-1 (Usul) Debian Buster [From Fresh Install of 5]


  • I tried the script, it does run well from Terminal. Thank you!
    Is there any way to check if Transmission really does execute it after finishing?


    Another thing, is it possible for this sh-script to set permissions on the extracted files? I get 644 after it extracts!


    Setting permissions would be a longer script (which I can provide if you want) and with my setup, changing permissions/owner script has to be run by root or admin priv (could be my settings stopping it but don't care).


    To check if transmission is firing the script check transmission's logs or just do a dummy test dl, lots of small legit torrents out and just toss a rar in the folder so when it finishes (if it's working properly) it will unrar it.


    My unrar, renamer, and permissions/owner scripts all run on cron because I never got it to work right with transmission, but that could easily have been because of my paranoid setup lol.

    Modpic.gif

    Dell Precision T3500
    Processor:
    Intel Core i7 960 @3.2ghz
    Memory:
    26GB RAM
    Kernel: Linux 5.10.0-0.bpo.9-amd64
    Version: 5.6.2-1 (Usul) Debian Buster [From Fresh Install of 5]

  • Setting permissions would be a longer script (which I can provide if you want) and with my setup, changing permissions/owner script has to be run by root or admin priv (could be my settings stopping it but don't care).


    To check if transmission is firing the script check transmission's logs or just do a dummy test dl, lots of small legit torrents out and just toss a rar in the folder so when it finishes (if it's working properly) it will unrar it.


    My unrar, renamer, and permissions/owner scripts all run on cron because I never got it to work right with transmission, but that could easily have been because of my paranoid setup lol.


    I think I got it working with cron now, by setting the permissions to the folder.
    Do you have a script that will set the file permissions after unrar?
    I'm having trouble with Couchpotato not liking the permissions after unrar. Sonarr works fine though.


    Thank you very much!

  • I was having the same issues, but I with the help of this post, I figure most of it out.


    I have done everything in the post, but when I run I try to run the script with cron, I get an error "too many levels of symbolic links".


    I am completely new to omv and linux, so please be gentle...


    Darren

  • So I tried following the guide for transmission I got this error:


    Code
    root@NAS:/media/7c303dda-2d41-4365-89cd-c38c5ac7884c/torrents# /media/7c303dda-2d41-4365-89cd-c38c5ac7884c/torrents/unrar.sh /media/7c303dda-2d41-4365-89cd-c38c5ac7884c/torrents/Sonarr/The.Blacklist.S03E10.INTERNAL.720p.HDTV.x264-KILLERS-bash: /media/7c303dda-2d41-4365-89cd-c38c5ac7884c/torrents/unrar.sh: Permission denied


    I set the permissions for unrar.sh to 777, but no luck.


    Do I need to edit the script that is in the guide, ie add my own folder path?


    Thanks Darren

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!