-
Posts
268 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Store
Gallery
Bug Reports
Documentation
Landing
Posts posted by Jorgen
-
-
1 hour ago, mbc0 said:
When in auto mode is there any way of telling which file is currently being encoded? If I open up the log I can see the progress but cannot scroll back far enough to see which file?
Enter this command in the unraid terminal and it will give you the last file Handbrake opened for processing:
grep Opening /mnt/cache/appdata/HandBrake/log/hb/conversion.log | tail -1
Adjust the path to wherever you have your Handbrake appdata
-
What’s your run command Sauso?
If you run in bridge mode with privileged=off, you also need --cap-add=NET_ADMIN
This was missing for me, probably because I’ve just been updating without problems for a long time and am using a very old template. It was causing all sorts of problems until I fixed it.
Just a thought, might not be your problem.
Sent from my iPhone using Tapatalk -
9 hours ago, IamSpartacus said:
Yes thank you that would be super helpful!
Here you go, just edit with your own watch folder path and set it up on a schedule with User Scripts.
The script will first check that the folder exists, then start Handbrake if the folder is not empty.
#!/bin/bash # Set the path to the Handbrake watch folder as seen from the Unraid command line WATCH="/mnt/user/Media/Handbrake_hotfolder/watch" if [ -d "$WATCH" ] && [ -n "$(ls -A "/$WATCH")" ]; then docker start HandBrake logger "HandBrake started by User Scripts" fi
And here's what I do to stop it once the watch folder is emptied again.
I only use the watch folder to process files. Not sure if this is safe to run if you are also processing files via the GUI at the same time.
I think it will shut down the container mid-processing in that case.
-
Does anyone have this setup on some sort of a schedule so the container is only encoding say overnight when one's server is more likely to be idle?
Yep, I do.
I have a script on a cron schedule in User Scripts that checks if the watch folder contains any files once every night. If it does, the script starts the container.
Then I use a hook script to shut down the container when the watch folder is empty. See a few posts up for that script.
End result is that Handbrake only runs at night, and only when there is work to be done.
I can post the start script when I get home tonight if you’re interested?
Sent from my iPhone using Tapatalk -
On 3/17/2019 at 4:00 AM, Djoss said:
Or it might be a good feature to add...
Can you add feature request at https://github.com/jlesage/docker-handbrake/issues ?
Hi @Djoss, saw the notification from github that you added the post_watch_folder_processing hook, thank you so much for that!
To test, I pulled down the latest image and added the following post-watch script:
#!/bin/sh # # This is an example of a post watch folder processing hook. This script is # always invoked with /bin/sh (shebang ignored). # # The argument of the script is the path to the watch folder. # WATCH_FOLDER=$1 echo "post-watch folder processing: Watch folder = $WATCH_FOLDER" if [ -d "/$WATCH_FOLDER" ] && [ -z "$(ls -A "$WATCH_FOLDER")" ]; then echo "watch folder empty, shutting down" killall -sigterm ghb fi
And it worked beautifully:
[autovideoconverter] Conversion ended successfully. [autovideoconverter] Removed /watch/movie.mp4'. [autovideoconverter] Watch folder '/watch' processing terminated. [autovideoconverter] Executing post watch folder processing hook... post-watch folder processing: Watch folder = /watch watch folder empty, shutting down [autovideoconverter] Post watch folder processing hook exited with 0 [autovideoconverter] Conversion ended successfully. [autovideoconverter] Removed /watch/movie.mp4'. [autovideoconverter] Watch folder '/watch' processing terminated. [autovideoconverter] Executing post watch folder processing hook... post-watch folder processing: Watch folder = /watch watch folder empty, shutting down [autovideoconverter] Post watch folder processing hook exited with 0 [services.d] stopping services [services.d] stopping app... [services.d] stopping x11vnc... caught signal: 15 26/03/2019 23:50:01 deleted 40 tile_row polling images. [services.d] stopping statusmonitor... [services.d] stopping openbox... [services.d] stopping logmonitor... [services.d] stopping xvfb... [services.d] stopping autovideoconverter... [services.d] stopping nginx... [services.d] stopping certsmonitor... [services.d] stopping s6-fdholderd... [cont-finish.d] executing container finish scripts... [cont-finish.d] done. [s6-finish] syncing disks. [s6-finish] sending all processes the TERM signal. [s6-finish] sending all processes the KILL signal and exiting.
So again, thank you!
-
-
9 hours ago, Djoss said:
Or it might be a good feature to add...
Can you add feature request at https://github.com/jlesage/docker-handbrake/issues ?
Done. Let me know if/when you need help with testing. Thanks for all your work on this container, it's very very useful.
-
15 hours ago, Jorgen said:
At the end of each conversion I want to check if the watch folder is empty and if it is, shut down the container.
I know I can do the first bit with a post processing hook, but is it possible to stop the container from the container shell? If it is, what’s the command?13 hours ago, Djoss said:The automatic video converter and hooks run under a non-privileged user, so killing process id 1 won't work. However, since exiting HandBrake also terminate the container, this should work:
killall -sigterm ghb
Ok, "killall -sigterm ghb" works well, at least when running manually in the container shell.
But I've run into another problem. The post-conversion hook runs before the watch folder is cleaned up, so I can't look for an empty folder.
[autovideoconverter] Executing post-conversion hook... post-conversion: Status = 0 post-conversion: Output File = /output/movie.mkv post-conversion: Source File = /watch/movie.mp4 post-conversion: Preset = Mathias_MKV_720p30_v2 [autovideoconverter] Post-conversion hook exited with 0 [autovideoconverter] Conversion ended successfully. [autovideoconverter] Removed /watch/movie.mp4
I could use the source file parameter to test if the watch folder only contains that file, but that has two problems:
1. Source files in sub folders will trip it up
2. Not sure if the watch folder purge have time to run before the container is shut down by the script
Hmm, might have to resort to a scheduled external script polling the watch folder.
-
The automatic video converter and hooks run under a non-privileged user, so killing process id 1 won't work. However, since exiting HandBrake also terminate the container, this should work:killall -sigterm ghb
Great, thanks to both of you!
Sent from my iPhone using Tapatalk -
Since hooks are all the rage at the moment, I’ll throw my question into the ring as well!
At the end of each conversion I want to check if the watch folder is empty and if it is, shut down the container.
I know I can do the first bit with a post processing hook, but is it possible to stop the container from the container shell? If it is, what’s the command?
Sent from my iPhone using Tapatalk -
On 3/2/2019 at 4:39 PM, IamSpartacus said:
Has anyone been able to get the WebAPI plugin installed in this container to enable Organizr V2 to talk to Deluge? When I go to install the plugin it never shows an option to check off and thus isn't working.
Try the steps in the post above to restart the daemon from within deluge UI after enabling the plugin
-
On 3/11/2019 at 10:32 PM, plantsandbinary said:
How do you restart deluge from within the container?
Yeah sorry about that, I wrote it from memory and deluge doesn't have a file menu...
To get the plugins to stick:
1. Enable the plugin in deluge preferences
2. Open connection manager
3. Select the host you're connected to
4. Stop the daemon (at this point you can check that the plugin has been added to core.conf)
5. Start the daemon
6. Connect to the now running daemon
7. Stop and start the container
8. Open deluge preferences and confirm plugin is now enabled
Please report back if this solves the problem for you
-
1
-
-
This is what the config looks like... any ideas why it cant find the VM?
Looks like your VM is named HassOI in unraid template, not HassIO.
Sent from my iPhone using Tapatalk -
Some questions about Deluge.
2. Turning on a plugin (e.g. blocklist) works fine, but as soon as the container is restarted the plugin is disabled and needs to be re-enabled again.
...
3. Is it not possible to select "labels" for torrents? It seems the only way you can sort them is by tracker, but the default view shows all of them. In my case a list of over 500 torrents with no way to sort them by label. I have some torrents from specific trackers that I wanted to separate into more than 1 group but it doesn't seem possible.
I had this problem and fixed it by installing the plugin, re-starting deluge from within the container, i.e. from the deluge file menu, and then restarting the container itself. Plugin has persisted all restarts since.
There is a label plugin you can just turn on that will give the sorting options.
Sent from my iPhone using Tapatalk-
1
-
-
brand new
Thanks for confirming.
I’m planning to migrate existing backups over to SMB when I eventually upgrade to 6.7 and was hoping someone had successfully blazed that trail already. Can’t see why it wouldn’t work though. -
I have been testing and have no problem.
Did you set up a brand new backup, or did you transfer an existing one from an AFP share?
Sent from my iPhone using Tapatalk -
Look into Wake On LAN.
I use Mocha WOL on my iOS devices, in combination with WOL unsaid plugin.
It’s really simple to use once configured: start the app, click on “wake up” and click on the VM name in the list (your daughter would just have one to select from)
Setting it up is straight forward to, just need to plug in the IP and MAC address of the VM.
Sent from my iPhone using Tapatalk -
Ok, the two find commands return identical lists, so that's not it.
The problem is this:
The $FILES list is using spaces as delimiters, which is also used in the "for in do" loop
This only works as long as none of the paths in the list contains spaces
If they do, you get the errors you are seeing.
Your original script have the same problem, so I guess you must have never run it over files containing spaces before?
One fix is to use find -exec instead of a "for in do" loop on the find result. I'm not skilled enough to write that though, but here are some hints if you want to give it a crack: https://stackoverflow.com/questions/301039/how-can-i-escape-white-space-in-a-bash-loop-list
Another way to achieve the same thing is to use rsync instead of find. The drawback is that this is actually a copy-then-delete operation, so will be slower than using mv.
This script should work for you:
#!/bin/bash FROM_DIR="/mnt/user/downloads/completed/Filme" TO_DIR="/mnt/user/downloads/DVDR" rsync -ar --include '*/' --include '*.iso' --include '*.img' --include '*.mkv' --exclude '*' --remove-source-files --prune-empty-dirs --progress "$FROM_DIR/" "$TO_DIR" find "$FROM_DIR/" -depth -empty -type d -delete # This removes empty directories in the source directory
Folder structure before running the script in my test (I used slightly different paths compared to you):
downloads/ ├── DVDR └── completed ├── movie with spaces │ └── movie with spaces.iso ├── movie1 │ └── movie1.iso ├── movie2 │ └── movie2.img ├── movie3 │ └── movie3.mkv ├── movie4 │ └── movie4.avi ├── movie5.avi └── movie6.mkv
And after running the script:
downloads/ ├── DVDR │ ├── movie with spaces │ │ └── movie with spaces.iso │ ├── movie1 │ │ └── movie1.iso │ ├── movie2 │ │ └── movie2.img │ ├── movie3 │ │ └── movie3.mkv │ └── movie6.mkv └── completed ├── movie4 │ └── movie4.avi └── movie5.avi
You can see that it has moved all .iso. img. and .mkv files, while leaving .avi in place, and retaining the folder sturcutre form the source directory.
Note that movie6.mkv was in the root of the source directory, and therefore ended up in the root of the destination DVDR folder. The script only retains existing parent folders, it doesn't create new ones. Hope that works for you.
-
4 hours ago, nuhll said:
.... could it be that the last find command didnt print out the exact directory.. and the new command does that? Because then, the whole basename thing and so on is complete useless and double
2Maybe, but I don't think so. To test, run these two commands and compare the output:
find "/mnt/user/downloads/completed/Filme" -iname '*.iso' -or -iname '*.img' find "/mnt/user/downloads/completed/Filme" \( -iname '*.iso' -or -iname '*.img' -or -iname '*.mkv' \)
-
Yeah, I’m out of my depth here, but I think you’re right that you need to enclose the path with double quotes somewhere. Although it looks like the script is doing that already.
Just to confirm I understood your use case correctly. You want the script to:
1. identify all files with a certain extension in the source directory
2. create a sub-directory in the source directory with the name of the found file
3. move the file into the new sub-directory
For step 1, are the files always in the root of the source directory? Or are they buried in multiple levels of sub folders?
If they are in sub-folders, you don’t want that folder structure replicated?
Sent from my iPhone using Tapatalk-
1
-
-
Just realised I have a need to start the VM on a schedule too. This super simple script will do the trick, scheduled from the Users Scripts plugin with a custom cron.
#!/bin/bash virsh start "<name-of-VM>"
Replace <name-of-VM> with the VM name as shown in the unraid UI
-
15 hours ago, planetwilson said:
No I didn't but might have another go now you've reminded me. Ideally there would be something I could do for OSX but I think that would need to be a sleep from inside the VM with restore from outside
Yeah, you can't sleep a Mac VM from the unraid side. In fact, I don't think you can use the Mac OS sleep function from within the VM either, from memory I was never able to wake it up again when I played around with that.
For my Mac VM I set a scheduled shutdown from the Mac System Preferences/Energy Saver/Schedule. Then I start it on-demand with the WOL plugin and a WOL app on my phone. But I'm sure you could also schedule a start via User Scripts.
The built-in Mac scheduler has an option for scheduling starts as well, but I doubt it would work in a VM.
-
On 12/7/2018 at 8:46 PM, nuhll said:
I dont know how i can extent the list with ".mkv", i guess -or only takes 2 values, but how to do multiple?
Find can do multiples, but you need to wrap it with escaped parentheses for more than two "-or" operators.
I haven't tried it with your script so don't know how it interacts with the other variables and parentheses. I think it should work though.
find /mnt/user/downloads/completed/Filme \( -iname '*.iso' -or -iname '*.img' -or -iname '*.mkv' \)
So the actual script would look like this (again, I haven't tested it, try it on a test directory/files first!):
#!/bin/bash FROM_DIR=/mnt/user/downloads/completed/Filme TO_DIR=/mnt/user/downloads/DVDR FILES="$(find "$FROM_DIR" \( -iname '*.iso' -or -iname '*.img' -or -iname '*.mkv' \))" for FILES in $FILES; do DIR="$(basename "$(dirname "$FILES")")" mkdir -p "$TO_DIR"/"$DIR" mv "$FILES" "$TO_DIR"/"$DIR" done
Alternatively, you could use find with regex instead of "-or" operators, might be easier if you have lots of extensions to add:
FILES="$(find "$FROM_DIR" -regextype posix-egrep -regex '.*\.(iso|img|mkv)$')"
-
What you really want is this though
unraid-autovmbackup: automate backup of virtual machines in unRAID - v0.4
in User Customizations
Posted
Script is case sensitive, you have the second letter “t” capitalized the wrong way round between the script and your utorrent VM names.
Sent from my iPhone using Tapatalk