166 Commits
Author SHA1 Message Date
nanahi b0f9279824 TOOLS/lua/command-test.lua: use _name key for mp.command_native 2026-04-06 18:33:20 +02:00
nanahi ba30c8c175 player/loadfile: add on_loaded hook
Currently, there is no hook which happens when the playback actually
starts. The on_preloaded hook is insufficient for many cases, as many
track information are unavailable at that stage. This makes it impossible
to act on certain track metadata before the media is shown to the user,
so the user will see the media before action for a brief moment before the
properties are notified and options are changed.

This adds the on_loaded hook which allows the mentioned information
available.
2026-03-08 13:07:05 +01:00
ckath 8364b122ee TOOLS/lua/autoload.lua: stop initial file from being added twice
this happened right after going to the next file
2025-11-04 20:53:35 +01:00
nanahi 8410f3157d TOOLS/lua/test-hooks.lua: drop sleep amount suffix
Not POSIX.
2025-10-27 20:00:59 +01:00
LordMZTE f9d4e19888 TOOLS/lua/gamma-auto: update on timer when on Linux
The Linux implementation of ambient-light is not observable.
2025-10-15 21:59:42 +02:00
Guido Cella efb70d7f27 TOOLS/lua/autocrop.lua: don't error if hwdec-current is nil
hwdec-current can be either "no" or nil.

Fixes #16739.
2025-08-29 19:08:29 +02:00
Kacper Michajłow 59d1dc43b9 various: fix typos 2025-01-04 15:59:49 +02:00
der richter e0f82b1a77 gamma-auto.lua: add this script as replacement for --gamma-auto
also mention this replacement for --gamma-auto.
2024-12-21 16:15:44 +01:00
Guido Cella 1b53793a4c various: convert tabs to spaces 2024-10-18 18:32:26 +02:00
Guido Cella 284293ceb5 TOOLS/cycle-deinterlace-pullup.lua: fix removing the filter
This has been broken since b56e63e2a9 removed vf del. Replace it with vf
remove. Fixes #14881.
2024-09-19 13:38:16 +00:00
Guido Cella 948faa5482 lua: don't pass nil as the second argument of mp.get_property_number
This doesn't do anything because nil is already the default value of
unavailable properties.
2024-06-08 23:10:37 +02:00
Kacper Michajłow e7630722d8 autoload.lua: always accept current file as a valid file
This allows loading other types of media from the current directory,
with same_type=no, regardless of whether the current type is enabled for
autoload.

Fixes: #14287
2024-06-04 15:39:18 +02:00
Kacper Michajłow a64a5c2222 autoload.lua: match also image extension
For clarity, it is already matched if extention is in EXTENSIONS if
pl_count == 1.
2024-06-04 15:39:18 +02:00
Kacper Michajłow 8dcd5ea288 autoload.lua: cosmetic changes 2024-06-04 15:39:18 +02:00
Kacper Michajłow 7d4719704e autoload.lua: fix options update
The extensions list needs to be cleared in this case. Also, add the
missing split_patterns().
2024-06-04 15:39:18 +02:00
Guido Cella e95af5b607 TOOLS/autoload.lua: fix directory_mode and ext options
Operations on option values need to be performed after they are read.

Fixes 843161d96e.
2024-06-03 15:25:51 +02:00
Guido Cella c5468ba5ff TOOLS/test-hooks.lua: fix lint warning 2024-06-02 22:26:00 +02:00
Guido Cella 3613070380 TOOLS/status-line.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella c28525ac9d TOOLS/osd-test.lua: fix lint warning 2024-06-02 22:26:00 +02:00
Guido Cella 1f356d6784 TOOLS/observe-all.lua: fix lint warning 2024-06-02 22:26:00 +02:00
Guido Cella 5977722adc TOOLS/nan-test.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella c12e437d43 TOOLS/cycle-deinterlace-pullup.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella f3f77353f2 TOOLS/command-test.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella 843161d96e TOOLS/autoload.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella 44d7100296 TOOLS/autodeint.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella 142b75a95f TOOLS/autocrop.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella ee514c6acf TOOLS/ao-null-reload.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Kacper Michajłow f220f0fb89 autocrop.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow c5c5a5a2ad test-hooks.lua: fix variable shadowing warning 2024-05-12 20:06:39 +02:00
Kacper Michajłow c431b532b8 status-line.lua: fix unused variable warning 2024-05-12 20:06:39 +02:00
Kacper Michajłow 0f7aab534a skip-logo.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow 885cc30596 pause-when-minimize.lua: fix unused variable warning 2024-05-12 20:06:39 +02:00
Kacper Michajłow b927857d03 ontop-playback.lua: fix unused variable warning 2024-05-12 20:06:39 +02:00
Kacper Michajłow 50c4b2cd4c observe-all.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow 16c19445bc cycle-deinterlace-pullup.lua: fix unused variable warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow e47d768d51 command-test.lua: fix some lint warnings
Fixes unused variable warnings.
2024-05-12 20:06:39 +02:00
Kacper Michajłow a1caa00187 autoload.lua: fix some lint warnings
Fixes:

autoload.lua:201:1: setting undefined field filter of global table
autoload.lua:209:1: setting undefined field append of global table
autoload.lua:322:11: value assigned to variable extensions is unused
2024-05-12 20:06:39 +02:00
Kacper Michajłow b4fcf7d248 autodeint.lua: fix some lint warnings
Fixes:

autodeint.lua:90:1: right side of assignment has more values than left
side expects
2024-05-12 20:06:39 +02:00
Kacper Michajłow fabc92453f audio-hotplug-test.lua: fix some lint warnings
Fixes:

audio-hotplug-test.lua:1:7: unused variable utils
audio-hotplug-test.lua:3:61: unused argument name
audio-hotplug-test.lua:5:9: unused loop variable index
2024-05-12 20:06:39 +02:00
Kacper Michajłow 71d9c31394 acompressor.lua: break long lines 2024-05-12 20:06:39 +02:00
Kacper Michajłow 69d70148c7 TOOLS/lua/autoload: make ignore_patterns more generic 2024-04-27 03:14:31 +02:00
oficsu 3ca71b0c0e TOOLS/lua/autoload: allow multiple ignore_patterns 2024-04-27 03:14:31 +02:00
oficsu 96b34148f1 TOOLS/lua/autoload: add ignore_pattern option
Autoload script can now exclude certain files

Why? Sometimes you want to ignore thumbnails,
auto-generated backups or just unwanted files

A non-exhaustive list of real-world examples:
- user backup files: '%.bak%.mp4$' or '^bak-'
- telegram-desktop thumbnails: '_thumb%.jpg$'
- a krita graphics editor backup suffix: '^~'

See documentation here: lua.org/pil/20.2.html
2024-04-27 03:14:31 +02:00
Christoph Heinrichanddyphire 6a8b130c6f TOOLS/lua/autoload: fix allow extending ext sets from script-opts
https://github.com/mpv-player/mpv/commit/4eedb8710cccec719f393216f5f32b74025c7df9 has broken the normal work of this feature with --same_type=yes

Co-Authored-by: dyphire <qimoge@gmail.com>
2024-04-13 23:09:42 +02:00
Dudemanguy 45f822593f f_auto_filters: change fallback deinterlace to bwdif
I don't actually deinterlace ever but allegedly this is better than
yadif, and there's no real reason to not have this be the fallback
deinterlace when we're not using hw frames. Also change various mentions
of yadif to bwdif. Ref #12835.
2024-01-21 17:55:54 +00:00
llyyr f4a09fada9 TOOLS/autocrop.lua: drop Libav mention 2024-01-20 16:10:20 +00:00
Guido Cella de0849404b scripting: don't observe properties with type nil
mp.observe_property('foo', nil, ...) calls the handler at least 2 times
on each playlist change even when the property doesn't change. This is
dangerous because if you haven't read observe_property's documentation
in a long time this is easy to forget, and you can end up using it for
handlers that are computationally expensive or that cause unintended
side effects.

Therefore, this commit discourages its use more explicitly in the
documentation, and replaces its usages in scripts.

For console.lua, observing focused with type nil leads to calling
mp.osd_message('') when changing file while playing in the terminal with
the console disabled. I don't notice issues from this, but it's safer to
avoid it.

For playlist and track-list this doesn't really matter since they
trigger multiple changes on each new file anyway, but changing it can
avoid encouraging people to imitate the code.

One usage of none in stats.lua is kept because according to b9084dfd47
it is a hack to replicate the deprecated tick event.
2024-01-20 16:09:34 +00:00
sunpenghao b1491bed28 TOOLS/lua/autoload: skip loading when playback is aborted
Quickly going through a directory with too many loadable files causes the
autoload tasks to pile up and exiting the player will take forever. Avoid
this by skipping loading when playback is aborted.
2024-01-20 16:09:12 +00:00
Kacper Michajłow d305dc8d25 TOOLS/autocrop.lua: disable hwdec when needed instead using -copy one
This is more stable in practice. Avoids switching between possibly
different hwdecs and avoids unnecessary init. Software decoding should be
more stable and possibly faster overall for decoding this small portion
of video needed for cropdetect.
2023-10-18 15:21:34 +00:00
Kacper Michajłow 78719c14ca TOOLS/autocrop.lua: add support for detect_min_ratio
This was lost in 6b963857c0
2023-10-07 22:47:43 +00:00