Skip to content

Commit 3a9735f

Browse files
Merge branch 'master' into new-defaults
2 parents a1392c8 + 9972e5b commit 3a9735f

File tree

2 files changed

+21
-36
lines changed

2 files changed

+21
-36
lines changed

.github/workflows/lint.yml

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
# This is a basic workflow to help you get started with Actions
2-
31
name: Lint
4-
5-
# Controls when the workflow will run
62
on:
7-
# Triggers the workflow on push or pull request events but only for the "master" branch
83
push:
94
branches: [ "master" ]
105
pull_request:
@@ -13,17 +8,11 @@ on:
138
# Allows you to run this workflow manually from the Actions tab
149
workflow_dispatch:
1510

16-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1711
jobs:
18-
# This workflow contains a single job called "build"
1912
Build_LuaLS:
20-
# The type of runner that the job will run on
2113
runs-on: ubuntu-latest
22-
2314
outputs:
2415
luals_version: ${{ steps.get-luaLS-version.outputs.version }}
25-
26-
# Steps represent a sequence of tasks that will be executed as part of the job
2716
steps:
2817
- name: Get LuaLS version
2918
id: get-luaLS-version
@@ -40,28 +29,20 @@ jobs:
4029
key: ${{ steps.get-luaLS-version.outputs.version }}
4130
path: ./luals
4231

43-
- uses: actions/checkout@v4
32+
- name: Download LuaLS
33+
uses: robinraju/release-downloader@v1
4434
if: steps.cache.outputs.cache-hit != 'true'
4535
with:
4636
repository: LuaLS/lua-language-server
47-
ref: ${{ steps.get-luaLS-version.outputs.version }}
48-
path: ./luals
49-
50-
# Runs a single command using the runners shell
51-
- name: Install Lua Language Server
52-
if: steps.cache.outputs.cache-hit != 'true'
53-
working-directory: ./luals
54-
run: |
55-
echo Running Lua Language Server build script
56-
sudo apt-get update
57-
sudo apt-get -y install ninja-build
58-
./make.sh
37+
tag: ${{ steps.get-luaLS-version.outputs.version }}
38+
fileName: '*-linux-x64.tar.gz'
39+
extract: true
40+
out-file-path: ./luals
5941

6042
Lint_LuaJit:
6143
needs: Build_LuaLS
6244
runs-on: ubuntu-latest
6345
steps:
64-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
6546
- uses: actions/checkout@v4
6647
with:
6748
path: ./file-browser
@@ -81,7 +62,6 @@ jobs:
8162
needs: Build_LuaLS
8263
runs-on: ubuntu-latest
8364
steps:
84-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
8565
- uses: actions/checkout@v4
8666
with:
8767
path: ./file-browser
@@ -101,7 +81,6 @@ jobs:
10181
needs: Build_LuaLS
10282
runs-on: ubuntu-latest
10383
steps:
104-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
10584
- uses: actions/checkout@v4
10685
with:
10786
path: ./file-browser

modules/playlist.lua

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ end
8888
---@diagnostic disable-next-line no-unknown
8989
local concurrent_loadlist_wrapper
9090

91-
---@alias ConcurrentRefMap table<List|Item,{directory: string, sublist: List}>
91+
---@alias ConcurrentRefMap table<List|Item,{directory: string?, sublist: List?, recurse: boolean?}>
9292

9393
---This function recursively loads directories concurrently in separate coroutines.
9494
---Results are saved in a tree of tables that allows asynchronous access.
@@ -100,6 +100,8 @@ local concurrent_loadlist_wrapper
100100
---@param refs ConcurrentRefMap
101101
---@return boolean?
102102
local function concurrent_loadlist_parse(directory, load_opts, prev_dirs, item_t, refs)
103+
if not refs[item_t] then refs[item_t] = {} end
104+
103105
--prevents infinite recursion from the item.path or opts.directory fields
104106
if prev_dirs[directory] then return end
105107
prev_dirs[directory] = true
@@ -110,22 +112,23 @@ local function concurrent_loadlist_parse(directory, load_opts, prev_dirs, item_t
110112
--if we can't parse the directory then append it and hope mpv fares better
111113
if list == nil then
112114
msg.warn("Could not parse", directory, "appending to playlist anyway")
113-
item_t.type = "file"
115+
refs[item_t].recurse = false
114116
return
115117
end
116118

117119
directory = list_opts.directory or directory
118-
if directory == "" then return end
119120

120121
--we must declare these before we start loading sublists otherwise the append thread will
121122
--need to wait until the whole list is loaded (when synchronous IO is used)
122123
refs[item_t].sublist = list or {}
123-
refs[list].directory = directory
124+
refs[list] = {directory = directory}
125+
126+
if directory == "" then return end
124127

125128
--launches new parse operations for directories, each in a different coroutine
126129
for _, item in ipairs(list) do
127130
if fb_utils.parseable_item(item) then
128-
fb_utils.coroutine.run(concurrent_loadlist_wrapper, fb_utils.get_new_directory(item, directory), load_opts, prev_dirs, item)
131+
fb_utils.coroutine.run(concurrent_loadlist_wrapper, fb_utils.get_new_directory(item, directory), load_opts, prev_dirs, item, refs)
129132
end
130133
end
131134
return true
@@ -167,11 +170,11 @@ local function concurrent_loadlist_append(list, load_opts, refs)
167170
if not g.sub_extensions[ fb_utils.get_extension(item.name, "") ]
168171
and not g.audio_extensions[ fb_utils.get_extension(item.name, "") ]
169172
then
170-
while (not refs[item].sublist and fb_utils.parseable_item(item)) do
173+
while fb_utils.parseable_item(item) and (not refs[item] or not refs[item].sublist) do
171174
coroutine.yield()
172175
end
173176

174-
if fb_utils.parseable_item(item) then
177+
if fb_utils.parseable_item(item) and refs[item] ~= false then
175178
concurrent_loadlist_append(refs[item].sublist, load_opts, refs)
176179
else
177180
loadfile(fb_utils.get_full_path(item, directory), load_opts, item.mpv_options)
@@ -233,12 +236,15 @@ local function loadlist(item, opts)
233236
opts.co = fb_utils.coroutine.assert()
234237
opts.concurrency = 0
235238

236-
local refs = setmetatable({}, {__mode = 'k'})
239+
---@type List
240+
local v_list = {item}
241+
---@type ConcurrentRefMap
242+
local refs = setmetatable({[v_list] = {directory = opts.directory}}, {__mode = 'k'})
237243

238244
--we need the current coroutine to suspend before we run the first parse operation, so
239245
--we schedule the coroutine to run on the mpv event queue
240246
fb_utils.coroutine.queue(concurrent_loadlist_wrapper, dir, opts, {}, item, refs)
241-
concurrent_loadlist_append({item, _directory = opts.directory}, opts, refs)
247+
concurrent_loadlist_append(v_list, opts, refs)
242248
else
243249
custom_loadlist_recursive(dir, opts, {})
244250
end

0 commit comments

Comments
 (0)