We have both a satip client and server. However the nosatip flag, is for
the client. Make this more clear by renaming it to the internal variable
nosatipcli. Since we do not want to break the user facing API, we keep
the commandline argument nosatip, but add an alias for the future.
We can do better in the future with the rest of the satip reference, but
lets keep this to a minimum for now.
Michael Marley [Fri, 2 Feb 2024 16:42:16 +0000 (11:42 -0500)]
Clean up Debian postinst and postrm scripts
- Fix indentation
- Remove unnecessary {} around variables
- Double-quote all variables when assigned or used as arguments
- Simplify quotes and escaping in creation of the superuser file
- Remove needless variable assignments
- Use $() for command substitution instead of ``
Michael Marley [Fri, 2 Feb 2024 16:38:07 +0000 (11:38 -0500)]
Fix handling of legacy configuration directories in debian/postinst
Detect if the HTS user's home directory starts with "/home/", which
indicates the legacy configuration directory is in use, and use the
correct paths for the "recordings" directory and "superuser" file.
This prevents a useless files/directories from being created and
ensures that "dpkg-reconfigure tvheadend" still updates the
superuser credentials correctly.
Olliver Schinagl [Sun, 13 Aug 2023 08:45:56 +0000 (10:45 +0200)]
main: Warn about unexpected configuration location
When using the `--fork` flag, and no user or config arguments are
supplied, the configuration folder will end up with whatever the default
`daemon` user has set, which is often `/sbin` set as the homedir.
This is weird, but not 'wrong' per say. Lets warn the user that forking
can have an unexpected side effect.
Michael Marley [Wed, 31 Jan 2024 02:51:53 +0000 (21:51 -0500)]
Use sigaction() instead of signal()
The behavior of signal() is not consistent or defined when using it
to set signal handlers (see "Portability" in
https://man7.org/linux/man-pages/man2/signal.2.html). Previously
we got away with this, but starting with GCC 14, using signal()
apparently causes certain syscalls to be restarted after the signal
is caught. One of these is the read() currently on line 63 of
fsmonitor.c. The result is that read() doesn't return when the
fsmonitor thread receives a signal, resulting in the thread never
shutting down, resulting in TVHeadend hanging on any attempt to
terminate it.
Instead, use sigaction(), which has defined behavior when setting
signal handlers. Since invoking sigaction() requires several
lines, a helper was added to tvh_thread.c to avoid code
duplication.
Norm Raden [Thu, 14 Sep 2023 14:52:40 +0000 (10:52 -0400)]
Removed nested function 'appendPidRange' from within function 'tvhdhomerun_frontend_update_pids'
and converted it to a normal function 'tvhdhomerun_frontend_update_pids_appendPidRange'.
Nested functions are a non-standard extension to C that may only be supported by the gcc compiler.
Michael Marley [Sun, 24 Sep 2023 19:35:33 +0000 (15:35 -0400)]
Fix non-admin users not receiving any updates in web UI
All the way back in 54e63e3f9af8fdc0d23f61f3cda7fa7b246c1732, there
was a fix to stop non-admin users from receiving log messages with
potentially-sensitive data. However, this stopped non-admin webui
users from receiving almost any updates over the websocket
interface, which causes a bug where such users don't see newly-
created DVR entries, etc. until refreshing the page. This patch
allows for more granular control over what non-admin users
receive. Specifically, messages originating from subscriptions.c,
mpegts_input.c, and api_service.c, along with all log messages, are
still only sent to admins because they may contain sensitive data
and/or they are only relevant to administrative parts of the UI.
Other messages, such as idnode, DVR, and EPG-related messages, are
once again sent to all webui users to keep the UI up-to-date.
Ben K [Thu, 24 Aug 2023 08:54:38 +0000 (10:54 +0200)]
Fix htsstr_argsplit (treat quotes inside an argument correctly)
There seemed to be a flaw in the splitting logic when it comes to quotes, e.g.:
--output="filename" should be one argument, but htsstr_argsplit treated it as
['--output=', '"filename"] which I think is wrong.
I fixed this and added two tests for this scenario.
Bernd Kuhls [Sat, 5 Aug 2023 10:21:05 +0000 (12:21 +0200)]
support/mkbundle: switch from distutils to setuptools
Fixes build error with python-3.12:
Traceback (most recent call last):
File "support/mkbundle", line 48, in <module>
import distutils.spawn
ModuleNotFoundError: No module named 'distutils'
webui/dvr: Add age_rating in recording details dialogs
The details dialogs in the various recording tabs do not open anymore
with the error `Uncaught TypeError: params[25] is undefined` in the JS
console as the age_rating wasn't requested for those, only for the
overview columns.
While we are at it lets also display the value in the same way the
similar looking (but completely different implemented…) EPG dialog does.
While implementing the alternative/similar broadcast buttons it seems
like previous attempts remained in the final code but were either
unused (like `dvrAlternativeShowings` as the buttons are calling
`epgAlternativeShowingsDialog` instead) or duplicate functions which
already existed like `load`, `previousEvent` & `nextEvent`.
It looks like the compile check doesn't work properly on some
architectures, which appears to eat or ignore the -Werror flag.
Instead, be more specific in that we state that printf formatting errors
are to be triggered on, and treated as an error explicitly, which in the
end is exactly what we are after.
CI: Run the full build with cloudsmith only on master
Cloudsmith deployal should only be done on master, but we want to run
every other thing normally on each merge request. So lets rename this
script to indicate that this is about cloudsmith specifically.
The fix introduced in fe47ecb5504a ("Fix time for 32bit systems again")
made the incorrect assumption, that the macro _TIME_BITS=64 was always
available. It seems like that this is not the case for old systems,
causing 32bit builds to break there.
Lets completely rework 32bit time support, by actually detecting the
hosts size for the time.
This will break cross-compilation, as the configure script is run on the
host, but since we do not seem to support cross-builds anyway (all archs
are build on emulated or native targets), this should be acceptable.
Fixes fe47ecb5504a ("Fix time for 32bit systems again")
Olliver Schinagl [Fri, 16 Jun 2023 21:55:26 +0000 (23:55 +0200)]
Fix time for 32bit systems again
In issue #6257 an issue mentioning that time_t isn't properly supported
when printing on 32-bit systems, specifically on FreeBSD. However, intel
32-bit systems suffer from a similar fate:
src/rtsp.c:333:30: error: format '%ld' expects argument of type 'long int',
but argument 4 has type 'time_t' {aka 'long long int'} [-Werror=format=]
333 | snprintf(buf, sizeof(buf), "npt=%" PRItime_t "-", position);
| ^~~~~~~ ~~~~~~~~
| |
| time_t {aka long long int}
In commit 76a6263f1be4 ("fix for 64bit time_t on 32bit systems") was
attempted to be fixed by turning it into a PRId64, which was reverted
again in commit 9e1eb89be731 ("Revert "fix for 64bit time_t on 32bit
systems""), sadly without a reason as to why in the commit message.
We should however, migrate to 64bit timestamps on all platforms anyway,
due to the Y2038 problem. Debian is heavily working on this issue too.
This commit is just the first step, in that we ensure our time_t is
always 64bits.
The next steps would be to use difftime where possible instead of
subtractions, and ensure all stored timestamps have room for 64bit
time_t (htsmsg_get_u32_or_default for example breaks this presumption
already).
To keep this issue small, and tackle one problem at a time, lets just
fix time_t first. We do still have 15 years to fix the other issues.
Note, that this patch leaves out FreeBSD specifics, as it is unclear
what is specific about 32bit FreeBSD. It should be using the same glibc
headers after all. If not, we can always add if needed, but adding
usless code doesn't help anyone generally.
Michael Marley [Thu, 22 Jun 2023 21:02:40 +0000 (17:02 -0400)]
Update Debian packaging to use the new configuration directories
This updates the Debian packaging to use the new configuration
directories introduced by
https://github.com/tvheadend/tvheadend/pull/1535 and
https://github.com/tvheadend/tvheadend/pull/1538. Instead of being
in /home/hts/.hts/tvheadend, the configuration will now be stored in
/var/lib/tvheadend by default, which is consistent with how many
other "server"-style Debian packages handle their home directories
and configuration.
Michael Marley [Thu, 22 Jun 2023 20:55:38 +0000 (16:55 -0400)]
Fix configuration-loading logic to account for forking operation
Since config_get_dir() is executed before forking, the uid will
always be 0 at this point. Instead, use the uid of the user to
which we will fork if a fork will occur.
Olliver Schinagl [Fri, 16 Jun 2023 15:02:19 +0000 (17:02 +0200)]
dvr_storage: Also support server configurations for recordings
Like in commit e15c1abe9737 ("config: Support server configurations"),
dvr_recordings are probably best stored in a 'server known
configuration', as otherwise they can end up in `/Videos`. While the
user can always configure this nicely, having a server sensible default
is good.
Olliver Schinagl [Fri, 16 Jun 2023 13:25:36 +0000 (15:25 +0200)]
spawn: Do not close every possible file descriptor
When close is called with a non-existant file descriptor, it will happily
do so. Since we do not even check for the error code, trying to close a
non existant/not-open file descriptor does not even cause an error.
This in itself is not a problem at all, however, we try to close every
open file descriptor beyond stderr, upto whatever _SC_OPEN_MAX returns.
Some systems may have a very large ulimit set for `_SC_OPEN_MAX` and
thus `maxfd` may return something in the millions. This means that the
simple `for() close();` loop now has to iterate a million file
descriptors which may not even be open/exist.
Instead, we can use the power of `/proc/self/fd` to list our open
file descriptors, and only close open ones.
Olliver Schinagl [Sat, 10 Jun 2023 13:42:03 +0000 (15:42 +0200)]
dvr_storage: Use XDG spec directories
The XDG spec has a way to determine the users preferred Video directory.
This is important, because in different locales, this may be a different
directory, preventing annoyance for users who have a localized home dir.
With the newly added XDG helpers, this becomes a triviality.
This change does mean, that the behavior is slightly changed, as XDG
directories are probed first.
However since this only affects the startup, after which these
directories are stored in the config, the impact should be neglectable.
Olliver Schinagl [Tue, 13 Jun 2023 13:35:25 +0000 (15:35 +0200)]
config: Support server configurations
On server loads, it is not uncommon to have the config directory live in
`/var/lib/tvheadend`. While `/etc/tvheadend` is also common, it's more
for manually written configuration files, tvheadend is more a 'config
state'. Support both regardless.
This change shouldn't impact desktop users, presuming they do not have
these locations installed.
Olliver Schinagl [Sat, 10 Jun 2023 13:35:26 +0000 (15:35 +0200)]
config: Add support for XDG config
Over the last years, the freedesktop organization has promoted the use
of XDG_HOME_CONFIG for storing configuration data.
Since TVHeadend also wants to help declutter the home directory, lets
follow the spec for our own configuration. While here, reduce the path
from `hts/tvheaded` to just `hts`.
The implementation does not change behavior of existing installations!
If `.hts/tvheadend` exists, it will be used as before.
New installations, will try to use `.config/hts` instead, and
'migrating' is as easy as `mv .hts/tvheadend .config/hts`.
Olliver Schinagl [Sat, 10 Jun 2023 13:20:25 +0000 (15:20 +0200)]
config: Store config directory variable internally
Currently `config_boot` 'abuses' the path-pointer and stores its own
internal path if needed. While this is _technically_ fine, it prevents
us from a) making `path` a const argument, b) makes things a little
harder to read and maintain and c) makes it harder for future changes to
the configuration path.
Instead, lets store the configuration path internally in our
configuration structure, as is done with most things. This could even
allow us to technically get rid of `hts_settings_init` in the future,
and get this from the config struct instead.
Olliver Schinagl [Sat, 10 Jun 2023 15:16:06 +0000 (17:16 +0200)]
Add simple 'ping' endpoint for healthchecks
To determine if the server is online, we want to be able to 'ping' it
with as little configuration and access possibilities as possible. The
only available option for this today, is anonymous access.
Let us thus add a new endpoint, that replies with 'PONG' when queried.
This will need anonymous access enabled, but can be restricted to:
a) localhost
b) without any access permissions
Gene C [Mon, 17 Apr 2023 12:55:50 +0000 (08:55 -0400)]
- fixed bug with _lang3_to_lang2()
Typo made using lang instead of lang3 in lookup map
- clean by running through autopep8
- Add more exception handling to prevent it crashing
Still needs some improvements with exception types
- tidy up for pylint
- python 2 is deprecated - simplify for python 3
- remove deprecated FF_API_CODED_FRAME
- remove pict_type from AVPacket_SideData
- use AVFrame->pict_type (same like ffmpeg 5.1.2 - ffprobe.c line 2595)
- remove patch for vaapi_encode
- ffmpeg_static will always compile with ffmpeg 5.1.2
- Makefile.ffmpeg added to 5.1.2
- src/muxer/muxer_libav.c: update 'AVOutputFrmat' to 'const AVOutputFrmat'
- src/transcoding/transcode/hwaccels/vaapi.c --> incorporated the struct from libavcodec/vaapi.h
- src/transcoding/transcode/video.c: update type for qdata_size