-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time-based Automated Conversion #342
base: master
Are you sure you want to change the base?
Conversation
@DrWarpMan thanks for having time to look at it and make this PR.. however it doesn't address the problem when the conversion starts e.g. 1 minute before the given slot for no conversion time slot.. Having this approached to be changed in a way we could pause the thread when we happen to enter no conversion time slot might be difficult so let me politely ask @jlesage to have a look and let us know if this PR can be rewritten in such a way..
Appreciate! |
I don't think it's worth pausing a conversion when we exit the specified range. I think we have to see that configured ranges define when conversions are allowed to start (and not when they are allowed to run). |
do | ||
eval "AC_$VAR=\"\${AUTOMATED_CONVERSION_${VAR}_${DIR#*/watch}:-\$AC_$VAR}\"" | ||
done | ||
fi | ||
|
||
if ! is_now_within_time_range "$AC_ALLOWED_TIME_RANGES"; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not the correct place to do the check. Doing it here means that the whole watch folder will be processed. The watch folder might contains a lot of videos and converting all of them might take multiple hours, going well over the defined range.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check should be done in process_watch_folder()
, in the "Process video files" loop.
@jlesage well that's the point.. some videos might take hours to convert and if they happen to start minutes before no conversion time slot they will affect the whole machine since converting videos is quite resourceful process.. I can have a look myself but I would like to get some suggestions from you if it is even possible to pause the conversion thread and where should it be done.. Thanks! |
Some comments about the range format:
Example for "everyday during night":
This would even be better (if day is not defined, we use the previous one):
Example for "Weekdays during night, weekend all the time":
|
If one has strict restrictions about their CPU usage, should it configure the ranges accordingly ? For example, the end hour could be reduced to account for cases where a conversion would be started just before. Also, note that setting
I think this could be achieved by sending |
I tried setting What I tried:
EDIT: I just tried to compare version: "3.7"
services:
handbrake:
container_name: general.handbrake.50129
image: jlesage/handbrake
restart: always
privileged: true
cap_add: [ 'SYS_NICE' ]
ports:
- 50129:5800
volumes:
# CONFIG
- $PWD/config:/config:rw
# LOGS
- /lvm/raid/private/media/.convert/.stats/conversion.log:/config/log/hb/conversion.log:rw
- /lvm/raid/private/media/.convert/.stats/failed_conversions:/config/failed_conversions:rw
- /lvm/raid/private/media/.convert/.stats/successful_conversions:/config/successful_conversions:rw
# STORAGE
- /lvm/raid/private/media:/storage/media:ro
- /lvm/raid/private/data:/storage/data:ro
# OUTPUT FOLDER
- /lvm/raid/private/media/.convert/@DONE:/output:rw
# WATCH FOLDERS
- /lvm/raid/private/media/.convert/${MKV_2160P_ULTRA}:/watch:rw
...
environment:
- PUID=${PUID}
- PGID=${PGID}
- TZ=${TZ}
- DARK_MODE=1
- APP_NICENESS=15
- DISPLAY_WIDTH=1600
- DISPLAY_HEIGHT=900
- AUTOMATED_CONVERSION_MAX_WATCH_FOLDERS=30
# WATCH 1: MKV_2160P_ULTRA
- AUTOMATED_CONVERSION_PRESET=Matroska/${MKV_2160P_ULTRA}
- AUTOMATED_CONVERSION_FORMAT=mkv
- AUTOMATED_CONVERSION_KEEP_SOURCE=1
- AUTOMATED_CONVERSION_OUTPUT_DIR=/output
...
networks:
default:
name: general.handbrake
|
Tested via CLI and works!! process will pause itself, and then will resume. For each conversion it spawns new HandBrake CLI process so it needs to track the process ID in order to pause it..
|
Trying to think of different approach here.. Would it be feasible to have a single function which will do a check every new minute if we happened to enter no conversion time slot and if so, just pause the thread.. and once out of the window resume it? |
Just found out the APP_NICENESS has no effect at all.. Tried many different values with the same performance impact.. However quite feasible solution would be a pause button on the popup here. Also withe the feature of automatic resume (user will input time in minutes/hours or some predefined drop-down values): docker-handbrake/rootfs/etc/services.d/autovideoconverter/run Lines 62 to 73 in f4e6990
@jlesage what do you think? Can you comment on different approach for the auto-convert schedule as well? Thanks! |
Can you try to run
This popup window is there only to report status of the conversion. In its current form, there is no way to add user interactions.
I guess this could be a possibility. We have to be careful with the provided feedback, otherwise the conversion would just appear to hang. |
Adds the ability to allow automated conversion to work only in certain time ranges via
AUTOMATED_CONVERSION_ALLOWED_TIME_RANGES
variable.Examples of how can you set the
AUTOMATED_CONVERSION_ALLOWED_TIME_RANGES
variable:Tue-14-18
: Convert videos only on Tuesday, between 14:00 and 17:59.Wed-9-17,Thu-9-17,Fri-9-17
: Convert videos only on Wednesday, Thursday and Friday, between 9:00 and 16:59.Sun-1-2
: Convert videos only on Sunday, between 1:00 and 1:59. Equivalent toSun-1
.Mon-0-24
: Convert videos only on Monday, at any hour. Equivalent toMon
.Fri-18-24,Sat,Sun,Mon-0-6
: Convert videos from Friday 18:00 to Monday 5:59.Detailed usage is documented in the README.
Closes #340