diff --git a/cli/ranger/commands.py b/cli/ranger/commands.py index 7246315..199c42e 100644 --- a/cli/ranger/commands.py +++ b/cli/ranger/commands.py @@ -170,3 +170,26 @@ class fzf_edit(Command): if fzf.returncode == 0: fzf_file = os.path.abspath(stdout.rstrip('\n')) 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) diff --git a/cli/ranger/rc.conf b/cli/ranger/rc.conf index 5e63213..c43876d 100644 --- a/cli/ranger/rc.conf +++ b/cli/ranger/rc.conf @@ -8,3 +8,4 @@ set vcs_aware true map \cg eval import subprocess;fm.cd(subprocess.getoutput('git rev-parse --show-toplevel')) map fzf_select map fzf_edit +map oo mediacut_open