jonniek / mpv-filenavigator

Navigate and open your local files in mpv
The Unlicense
69 stars 9 forks source link

Navigator: Enhancements, fixes and macOS support #3

Closed ghost closed 7 years ago

ghost commented 7 years ago
ghost commented 7 years ago

Thanks for the file navigator. I did have to fix a ton of things, but now it's working perfectly. Of course I want to contribute the code back to you as thanks, and to help others! 🍰

By the way, I saw that you starred my mpv-tools repo. Well, I think you're going to love this new tool I just spent all day perfecting and releasing (it's totally nuts and replaces the need for scripts in a lot of cases):

https://github.com/SteveJobzniak/mpv-tools/blob/master/multi-command-if.lua

🎉

jonniek commented 7 years ago

Thanks for the pull request. I'm having some problems with the basename though. the script uses io.popen('basename '..search..'/* | sed "s/^\\*$//"') and produced a command like this: basename /home/anon/Pictures/dump//* | sed "s/^\*$//" which outputs basename: extra operand ‘/home/anon/Pictures/dump//1355837938164-w2x.jpg’ And doesn't show any resulting files or folders. I tried fiddling with it but can't seem to understand how to output files.

All keys can be overridden in input.conf even if they aren't nil in the lua. Even keys that are not yet registered by the script(dynamic).

ghost commented 7 years ago

@donmaiq Ahh then you have found a difference in Linux basename vs Mac basename. On Mac, basename takes unlimited parameters and outputs them all without their paths. Since you are seeing "extra operand" I am guessing the Linux one refuses multiple files... Damn all these cross-platform differences in standard utilities!

Well, I just had a great idea of how to do this without spawning basename or find or any other utilities that may not work the same on every platform. Let me work on it and update the pull request in a moment. :)

Edit: Oh and yes you are right about keys being overridable in input.conf. The problem was that the way you were registering the keys took precedence over built-in default mpv keys, so "fullscreen" (f) was overwritten by navigator. That is why I added the ability to set the main "open navigator" key to nil. And the other important key is the "favorite list" key, which should only be bound while the navigator is open, so instead of permanently binding that in input.conf I made that one bindable in the settings area too. Those two are the primary keys to rebind (the rest are just logical arrow keys and backspace, with dynamic binding), which is why I singled those out for the settings object.

ghost commented 7 years ago

I have an idea now that will not just solve this. It will also add a feature that makes navigation much better. And even better at handling folders with lots of files. :) No globbing will be needed anymore.

ghost commented 7 years ago

@donmaiq Hey, it took a few hours since I was busy doing other things as well.

Here we go. A ton of fun enhancements, and an even faster cross-platform way of scanning for files.

This is a big one!

Please let me know how it works on your system. :octocat:

ghost commented 7 years ago

Oh and whenever you merge this, you will have to edit outdated info in README.md regarding some of these new changes that affect it (such as now having macOS support, and we no longer rely on the slow "find", etc). And if you want to add a note about my big contribution, then a link back to my Github profile's mpv-tools repository to recommend my mpv scripts would be appreciated. I just want to help my fellow humans out, and there are some good, new tools in there that people have started to enjoy.

;-)

jonniek commented 7 years ago

Great it works very well! Thanks for the contribution. I will definitely credit you in the readme.

ghost commented 7 years ago

@donmaiq Fantastic, happy to hear it works on Linux! 👍 Thanks for everything and have a wonderful Christmas!