Commit graph

237 commits

Author SHA1 Message Date
Joshua M. Boniface
7e6a27ac80 Ensure -filters is in the specials list too 2022-06-11 11:32:34 -04:00
Joshua M. Boniface
7a1caeffe0
Merge pull request #22 from Shadowghost/filter-fix
Fix filter check for Jellyfin 10.8
2022-06-11 11:05:17 -04:00
Shadowghost
35600f1286 Fix filter check for Jellyfin 10.8 2022-06-11 14:05:11 +02:00
Joshua M. Boniface
cecfd43564
Merge pull request #16 from robho/patch-1 2022-04-06 13:33:20 -04:00
Robert Högberg
fd831a5890
Fix path to ssh key
I guess you can have any path to the ssh keys, but this will make the sample file match the README, which I think would be good..
2022-01-18 22:39:53 +01:00
Joshua M. Boniface
cfb5907a2e
Merge pull request #13 from alexh-name/master
actually assign weight from config to hosts != localhost
2021-10-13 09:19:10 -04:00
alexh-name
3c2e48c16b
actually assign weight from config to hosts != localhost 2021-07-03 01:08:58 +02:00
Joshua M. Boniface
59c267c079 Fix repeating of bad hosts
We didn't skip bad hosts so it would loop forever.
2021-06-26 17:24:39 -04:00
Joshua M. Boniface
5f5c21d7ff Match single-quote in bad shell characters
Closes #11
2021-05-27 00:31:16 -04:00
Joshua M. Boniface
c49f63aa22 Correct bad reference to config value 2021-05-25 22:03:11 -04:00
Joshua M. Boniface
300f2c3c24 Correct name of config value 2021-05-25 22:02:33 -04:00
Joshua M. Boniface
cd468f2ccb Remove erroneous closing bracket 2021-05-25 22:02:03 -04:00
Joshua M. Boniface
efd6c0696c Support configurable SSH persistence directory 2021-05-25 22:00:51 -04:00
Joshua M. Boniface
de99bc6c32
Merge pull request #12 from dannytech/ssh-persist 2021-05-25 21:55:24 -04:00
Joshua M. Boniface
6b89ae369c Ensure persist value is an integer 2021-05-25 21:55:02 -04:00
Daniel Hellstern
3690e079d4 /run/shm* 2021-05-14 01:41:12 +00:00
Daniel Hellstern
8972232d79 Switched to /dev/shm for persistence 2021-05-14 01:40:35 +00:00
Daniel Hellstern
dafbe71e8e Moved persistence length to fallback configuration section 2021-05-13 21:12:32 +00:00
Daniel Hellstern
9b28a7b81b Increased default persistence length to 300 seconds 2021-05-13 21:10:09 +00:00
Daniel Hellstern
338d8e7d27 Enabled SSH multiplexing/persistence 2021-05-13 20:51:06 +00:00
Joshua Boniface
3945e1c514 Improve error for missing configs 2021-04-29 14:38:41 -04:00
Joshua Boniface
99dbcae966 Fix bug with list reference 2021-04-29 14:37:06 -04:00
Joshua Boniface
0231ee868e Move SSH command to fallback options
Avoids erroring out with existing configs.

Addresses #10
2021-04-29 14:30:53 -04:00
Joshua Boniface
1a0e9f0d2f Add support for full SSH paths
For cases where the SSH command on the $PATH might not be ideal, allow
the user to override this with a full path in the config.

Addresses #10
2021-04-29 14:29:38 -04:00
Joshua M. Boniface
107092d539 Mention caveat about host configs 2021-04-27 18:47:19 -04:00
Joshua M. Boniface
46b709880f Add some more details about weight 2021-04-27 18:45:09 -04:00
Joshua M. Boniface
e0e5e8a551 Make slight tweaks to README
Minor tweaks to spelling, grammar, example commands, and layout.
2021-04-27 18:40:41 -04:00
Joshua M. Boniface
a4da06af51 Add weight to README and rework localhost section 2021-04-27 18:26:41 -04:00
Joshua M. Boniface
386f179cf1 Add support for weighted hosts
Adds an optional new configuration format under the remote hosts
configuration segment, allowing the specification of a weight in
addition to the host name.

Weights are used to refactor the active "count" of a host in order to
bring it lower by the following logic:

1. If a host's weight is not specified, it is 1.

2. If a host's weight is 1, its "weighted_count" is equal to its
"count".

3. If a host's weight is greater than 1, its "weighted_count" is equal
to the floor division of its real "count" and its "weight".

So for example, if there are 2 hosts with weights 1 and 2, and there is
currently 1 process running against each, the "weighted_count"s would
be:
    host1: 1
    host2: 1//2 = 0
And thus host2 would be considered the "least loaded" host. Then, if
another process started:
    host1: 1
    host2: 2//2 = 1
Resulting in the last host on the list (the first to run a process)
getting the next one, and so on.

This logic should make sense, but I cannot extensively test it.

Closes #8 aspect 1 (aspect 2 is out-of-scope)
2021-04-27 18:17:02 -04:00
Joshua M. Boniface
41ae3190f8 Add logging of running processes on startup 2021-04-27 17:47:06 -04:00
Joshua M. Boniface
711bf6d3b5 Improve command handling, organization, and logs
1. Split the command string into an "rffmpeg_ssh_command" and
"rffmpeg_ffmpeg_command". The first contains the SSH arguments, the
second contains anything run on the remote system. For consistency,
also rename the local command string to "rffmpeg_ffmpeg_command". Join
these commands  commands together as rffmpeg_command before executing on
the remote host.

2. The split is done so that the output log can properly quote the SSH
remote portion with single-quotes, thus avoiding BASH syntax errors on
parenthesis characters which do not seem to cause a problem for
subprocess itself, when manually running the printed command. Helps
address confusion in #10.

3. Reorganize the functions to better reflect their order.

4. Improve logging by removing some superfluous messages and making
others clearer.
2021-04-27 17:32:00 -04:00
Joshua M. Boniface
8c1f63d2d9 Fix stray print statement
This breaks ffprobe's JSON mode
2021-02-11 01:53:01 -05:00
Joshua M. Boniface
d0fd57309f
Merge pull request #9 from crisidev/master 2021-02-10 12:47:28 -05:00
Bigo
e199b5ad68
Remove leftover in config example 2021-02-06 14:55:36 +00:00
Bigo
8fba9d5a7f
Modernize code and logging, simplify localhost handling 2021-02-06 14:53:13 +00:00
Joshua M. Boniface
3ece634417
Merge pull request #7 from markv9401/master
Update rffmpeg.py
2020-11-20 16:55:50 -05:00
markv9401
7e16cb8d65
Update rffmpeg.py
Fixed absent '-hwaccels' special parameter
2020-11-20 20:39:34 +01:00
Joshua M. Boniface
b5ea20e079 Clean up properly on unclean termination 2020-11-20 12:04:31 -05:00
Joshua M. Boniface
a74806722a Include square brackets in quote handler 2020-08-16 20:13:45 -04:00
Joshua M. Boniface
e5f351f5b4 Correct typo in command path 2020-08-12 09:28:22 -04:00
Joshua M. Boniface
dcd08f6713 Support independent fallback commands
Allow specifying separate fallback commands. Not required, and will use
the main commands if not specified.

Closes #2
2020-08-11 23:23:27 -04:00
Joshua M. Boniface
a0cda2755e
Merge pull request #1 from mothlyme/master
Fix a bug where pipe symbols break execution
2020-08-11 23:15:26 -04:00
Joshua M. Boniface
18b7acf562 Fix ordering of statefile and its removal 2020-08-11 20:24:07 -04:00
Joshua M. Boniface
d61a6c5bf3 Clean up filenotfound error and log retcode 2020-08-11 20:20:38 -04:00
52462
9bd28ea079 Fix a bug where pipe symbols break execution
When a pipe symbol is introduced in any ffmpeg flag bash tries to pipe
the output to the second half of the command instead of passing it to
ffmpeg. Therefore it is necessary to escape
2020-07-11 01:42:24 +02:00
Joshua M. Boniface
bd277855e8 Mention hardware accel in local fallback 2020-06-30 18:35:51 -04:00
Joshua M. Boniface
4cc50686ea Add local fallback mode
Fall back to using the local ffmpeg binary (at the same path as the
remote system) if we are unable to reach a remote server. Prevents
rffmpeg from getting stuck if it can find no valid remote servers.
2020-06-30 18:16:39 -04:00
Joshua M. Boniface
1e51fccba4 Refactor rffmpeg to support bad host checking
Allow rffmpeg to determine if a host is "bad", i.e. if the SSH
connection times out or fails, for instance due to an unreachable host
down for maintenance. In such a case, instead of exiting abruptly, we
will mark the host as "bad" in the current state file, and then retry
the whole process, skipping the bad hosts. If other rffmpeg processes
start while the current one is still running, they will also treat the
host as "bad", until the original process ends at which point the
statefile marking it bad will be removed and it will be retried by
future processes. This helps ensure that redundancy of transcode hosts
can actually be achieved, as before if the first host was down, the
process would simply fail, retry, and then fail again if the down host
was first in the list.

This required some major refactoring of the code, including
functionalizing various elements of the process as well as adding an
infinite loop to the main execution in order to keep looping through
hosts after marking one as bad.
2020-06-30 15:22:06 -04:00
Joshua M. Boniface
ded1d6304a Mention redundancy in README 2020-06-30 14:29:59 -04:00
Joshua M. Boniface
28b72c922a Add connection timeout to SSH command 2020-06-30 13:28:09 -04:00