[feature] open with mpv for media cutting

This commit is contained in:
Klesh Wong 2020-12-07 17:12:36 +08:00
parent 531e02be1e
commit 114e18180d
2 changed files with 24 additions and 0 deletions

View File

@ -170,3 +170,26 @@ class fzf_edit(Command):
if fzf.returncode == 0: if fzf.returncode == 0:
fzf_file = os.path.abspath(stdout.rstrip('\n')) fzf_file = os.path.abspath(stdout.rstrip('\n'))
self.fm.edit_file(fzf_file) self.fm.edit_file(fzf_file)
class mediacut_open(Command):
def execute(self):
""" play all files in current dir """
thisfile = self.fm.thisfile
if thisfile.filetype.startswith('inode/directory'):
files = [file.path for file in thisfile.files if file.filetype.startswith('video')]
else:
files = [thisfile.path]
descr = "mediacut open"
obj = CommandLoader(
args=[
'mpv',
'--no-resume-playback',
'--start=0',
'--osd-fractions',
'--osd-level=3'
] + files,
descr=descr,
read=False,
)
self.fm.loader.add(obj)

View File

@ -8,3 +8,4 @@ set vcs_aware true
map \cg eval import subprocess;fm.cd(subprocess.getoutput('git rev-parse --show-toplevel')) map \cg eval import subprocess;fm.cd(subprocess.getoutput('git rev-parse --show-toplevel'))
map <C-t> fzf_select map <C-t> fzf_select
map <C-p> fzf_edit map <C-p> fzf_edit
map oo mediacut_open