cmdlet refactor
This commit is contained in:
+14
-14
@@ -2842,7 +2842,7 @@ local function _start_screenshot_store_save(store, out_path, tags)
|
||||
if screenshot_url == '' or not screenshot_url:match('^https?://') then
|
||||
screenshot_url = ''
|
||||
end
|
||||
local cmd = 'add-file -store ' .. quote_pipeline_arg(store)
|
||||
local cmd = 'file -add -store ' .. quote_pipeline_arg(store)
|
||||
.. ' -path ' .. quote_pipeline_arg(out_path)
|
||||
if screenshot_url ~= '' then
|
||||
cmd = cmd .. ' -url ' .. quote_pipeline_arg(screenshot_url)
|
||||
@@ -2854,7 +2854,7 @@ local function _start_screenshot_store_save(store, out_path, tags)
|
||||
local tag_suffix = (#tag_list > 0) and (' | tags: ' .. tostring(#tag_list)) or ''
|
||||
if #tag_list > 0 then
|
||||
local tag_string = table.concat(tag_list, ',')
|
||||
cmd = cmd .. ' | add-tag ' .. quote_pipeline_arg(tag_string)
|
||||
cmd = cmd .. ' | tag -add ' .. quote_pipeline_arg(tag_string)
|
||||
end
|
||||
|
||||
local queue_target = is_named_store and ('store ' .. store) or 'folder'
|
||||
@@ -5539,7 +5539,7 @@ local function _start_download_flow_for_current()
|
||||
end
|
||||
|
||||
ensure_mpv_ipc_server()
|
||||
local pipeline_cmd = 'get-file -store ' .. quote_pipeline_arg(store_hash.store) .. ' -query ' .. quote_pipeline_arg('hash:' .. store_hash.hash) .. ' -path ' .. quote_pipeline_arg(folder)
|
||||
local pipeline_cmd = 'file -get -store ' .. quote_pipeline_arg(store_hash.store) .. ' -query ' .. quote_pipeline_arg('hash:' .. store_hash.hash) .. ' -path ' .. quote_pipeline_arg(folder)
|
||||
_queue_pipeline_in_repl(
|
||||
pipeline_cmd,
|
||||
'Queued in REPL: store copy',
|
||||
@@ -5835,9 +5835,9 @@ mp.register_script_message('medios-download-pick-store', function(json)
|
||||
end
|
||||
local clip_suffix = clip_range ~= '' and (' [' .. clip_range .. ']') or ''
|
||||
|
||||
local pipeline_cmd = 'download-file -url ' .. quote_pipeline_arg(url)
|
||||
local pipeline_cmd = 'file -download -url ' .. quote_pipeline_arg(url)
|
||||
.. ' -query ' .. quote_pipeline_arg(query)
|
||||
.. ' | add-file -store ' .. quote_pipeline_arg(store)
|
||||
.. ' | file -add -store ' .. quote_pipeline_arg(store)
|
||||
|
||||
_set_selected_store(store)
|
||||
_queue_pipeline_in_repl(
|
||||
@@ -5901,9 +5901,9 @@ mp.register_script_message('medios-download-pick-path', function()
|
||||
end
|
||||
local clip_suffix = clip_range ~= '' and (' [' .. clip_range .. ']') or ''
|
||||
|
||||
local pipeline_cmd = 'download-file -url ' .. quote_pipeline_arg(url)
|
||||
local pipeline_cmd = 'file -download -url ' .. quote_pipeline_arg(url)
|
||||
.. ' -query ' .. quote_pipeline_arg(query)
|
||||
.. ' | add-file -path ' .. quote_pipeline_arg(folder)
|
||||
.. ' | file -add -path ' .. quote_pipeline_arg(folder)
|
||||
|
||||
_queue_pipeline_in_repl(
|
||||
pipeline_cmd,
|
||||
@@ -6137,7 +6137,7 @@ function M.delete_current_file()
|
||||
|
||||
local seed = {{path = path}}
|
||||
|
||||
M.run_pipeline('delete-file', seed, function(_, err)
|
||||
M.run_pipeline('file -delete', seed, function(_, err)
|
||||
if err then
|
||||
mp.osd_message('Delete failed: ' .. tostring(err), 3)
|
||||
return
|
||||
@@ -6302,17 +6302,17 @@ local function _start_trim_with_range(range)
|
||||
_lua_log('trim: building store file pipeline (original from store)')
|
||||
if selected_store then
|
||||
pipeline_cmd =
|
||||
'get-tag -emit -store ' .. quote_pipeline_arg(store_hash.store) ..
|
||||
'tag -get -emit -store ' .. quote_pipeline_arg(store_hash.store) ..
|
||||
' -query ' .. quote_pipeline_arg('hash:' .. store_hash.hash) ..
|
||||
' | add-file -path ' .. quote_pipeline_arg(output_path) ..
|
||||
' | file -add -path ' .. quote_pipeline_arg(output_path) ..
|
||||
' -store "' .. selected_store .. '"' ..
|
||||
' | add-relationship -store "' .. selected_store .. '"' ..
|
||||
' -to-hash ' .. quote_pipeline_arg(store_hash.hash)
|
||||
else
|
||||
pipeline_cmd =
|
||||
'get-tag -emit -store ' .. quote_pipeline_arg(store_hash.store) ..
|
||||
'tag -get -emit -store ' .. quote_pipeline_arg(store_hash.store) ..
|
||||
' -query ' .. quote_pipeline_arg('hash:' .. store_hash.hash) ..
|
||||
' | add-file -path ' .. quote_pipeline_arg(output_path) ..
|
||||
' | file -add -path ' .. quote_pipeline_arg(output_path) ..
|
||||
' -store "' .. store_hash.store .. '"' ..
|
||||
' | add-relationship -store "' .. store_hash.store .. '"' ..
|
||||
' -to-hash ' .. quote_pipeline_arg(store_hash.hash)
|
||||
@@ -6321,9 +6321,9 @@ local function _start_trim_with_range(range)
|
||||
-- Local file: save to selected store if available
|
||||
_lua_log('trim: local file pipeline (not from store)')
|
||||
if selected_store then
|
||||
_lua_log('trim: building add-file command to selected_store=' .. selected_store)
|
||||
_lua_log('trim: building file -add command to selected_store=' .. selected_store)
|
||||
-- Don't add title if empty - the file path will be used as title by default
|
||||
pipeline_cmd = 'add-file -path ' .. quote_pipeline_arg(output_path) ..
|
||||
pipeline_cmd = 'file -add -path ' .. quote_pipeline_arg(output_path) ..
|
||||
' -store "' .. selected_store .. '"'
|
||||
_lua_log('trim: pipeline_cmd=' .. pipeline_cmd)
|
||||
else
|
||||
|
||||
@@ -470,11 +470,11 @@ class MPV:
|
||||
def _q(s: str) -> str:
|
||||
return '"' + s.replace("\\", "\\\\").replace('"', '\\"') + '"'
|
||||
|
||||
pipeline = f"download-file -url {_q(url)} -query {_q(f'format:{fmt}')}"
|
||||
pipeline = f"file -download -url {_q(url)} -query {_q(f'format:{fmt}')}"
|
||||
if store:
|
||||
pipeline += f" | add-file -instance {_q(store)}"
|
||||
pipeline += f" | file -add -instance {_q(store)}"
|
||||
else:
|
||||
pipeline += f" | add-file -path {_q(path or '')}"
|
||||
pipeline += f" | file -add -path {_q(path or '')}"
|
||||
|
||||
try:
|
||||
from TUI.pipeline_runner import PipelineRunner # noqa: WPS433
|
||||
|
||||
Reference in New Issue
Block a user