Commit Graph

156 Commits

Author SHA1 Message Date
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 Heinrich 6a8b130c6f TOOLS/lua/autoload: fix allow extending ext sets from script-opts
4eedb8710c 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
Guido Cella a08b75da2b TOOLS/autocrop.lua: simplify code
Refactor code that is no longer necessary after replacing vf=crop with
video-crop. There is no change in behavior.
2023-10-07 22:45:38 +00:00
Guido Cella eecba5131a TOOLS/autocrop.lua: update comment 2023-10-06 15:08:19 +00:00
Dudemanguy d147a06e60 TOOLS/lua/autoload: bump the msg-level of some logging
msg.info for when you're potentially adding hundreds of files is way
too spammy and not really useful (autoload loads files, what?). Bump it
up to msg.verbose. Also bump up the previously existing msg.verbose logs
up to msg.debug to keep the difference in log levels. Fixes #12551.
2023-10-03 23:39:42 +00:00
Guido Cella f4de509f01 TOOLS/autocrop.lua: switch to auto-copy hwdec during cropdetect
I didn't set file-local-options/hwdec because you have to store the
hwdec value to restore it after cropdetect anyway, and if the user
manually changes hwdec after cropdetect, the new value isn't reset when
changing file.
2023-09-21 13:50:21 +00:00
Guido Cella 252347731a TOOLS/autocrop.lua: cleanup timers correctly
If you change file while cropdetect is active and you try to crop the
next video, it fails with "Already cropdetecting!". This is because
timers.detect_crop wasn't cleared correctly, only the timer variable
local to the loop was being set to nil.
2023-09-21 13:50:21 +00:00
Kacper Michajłow 6b963857c0 TOOLS/autocrop.lua: use VO crop always
There is no reason not to and this significantly reduces script
complexity.
2023-09-20 19:08:19 +00:00
Kacper Michajłow 20e584f60b options: make video-crop validation more strict 2023-09-20 19:08:19 +00:00
Christoph Heinrich 3972fd1be4 TOOLS/lua/autoload: rename local variable to lowercase 2023-09-15 21:19:34 +00:00
Christoph Heinrich 43e960e1f6 TOOLS/lua/autoload: pass extensions to recursive call
Closes #12400
2023-09-15 21:19:34 +00:00
dyphire 24cedfec8b TOOLS/lua/autoload: change EXTENSIONS_TARGET to a local variable 2023-09-14 13:40:19 +00:00