@@ -319,7 +319,7 @@ end
|
|||||||
-- Check if path is a protocol, such as `http://...`.
|
-- Check if path is a protocol, such as `http://...`.
|
||||||
---@param path string
|
---@param path string
|
||||||
function is_protocol(path)
|
function is_protocol(path)
|
||||||
return type(path) == 'string' and (path:find('^%a[%a%d-_]+://') ~= nil or path:find('^%a[%a%d-_]+:%?') ~= nil)
|
return type(path) == 'string' and (path:find('^%a[%w.+-]-://') ~= nil or path:find('^%a[%w.+-]-:%?') ~= nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param path string
|
---@param path string
|
||||||
|
@@ -969,7 +969,7 @@ bind_command('playlist', create_self_updating_menu_opener({
|
|||||||
serializer = function(playlist)
|
serializer = function(playlist)
|
||||||
local items = {}
|
local items = {}
|
||||||
for index, item in ipairs(playlist) do
|
for index, item in ipairs(playlist) do
|
||||||
local is_url = item.filename:find('://')
|
local is_url = is_protocol(item.filename)
|
||||||
local item_title = type(item.title) == 'string' and #item.title > 0 and item.title or false
|
local item_title = type(item.title) == 'string' and #item.title > 0 and item.title or false
|
||||||
items[index] = {
|
items[index] = {
|
||||||
title = item_title or (is_url and item.filename or serialize_path(item.filename).basename),
|
title = item_title or (is_url and item.filename or serialize_path(item.filename).basename),
|
||||||
|
Reference in New Issue
Block a user