Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] show source file in explorer #6560

Closed
AlexanderEvans opened this issue Mar 15, 2019 · 12 comments
Closed

[Feature Request] show source file in explorer #6560

AlexanderEvans opened this issue Mar 15, 2019 · 12 comments

Comments

@AlexanderEvans
Copy link

Current behavior:
So, currently, mpv shows the file name when you hit 'i', but there doesn't seem to be a way to show it in the explorer.

Request:
Add some way(hotkey or something?) to show that file in file explorer.

Use Cases:

  1. I have a folder of 1000+ music vids, some of them hours long. I have gotten tired of a few of them/some downloaded improperly(eg no audio in the file, or video got glitchy) and the issue is with the file, not mpv, and I want to remove this file. I listen on shuffle. The bad file is now somewhere among hundreds of hours of video, and I have no good way to quickly find and delete these.

  2. I am watching video and a friend wants a copy. Similar problem. Really annoying to find.

  3. I want to change the track(aka file) name.

It is really apparent when these handfuls of videos come up in my playlist, but tracking down around 200 videos among over 1000 is daunting. Would be really nice to have someway to easily access or delete the file from the folder directly in mpv.

I hope this is the right place to make a feature request, thanks for your time.

@avih
Copy link
Member

avih commented Mar 15, 2019

Add to your input.conf:

ctrl+e run explorer /select, ${path}

@AlexanderEvans
Copy link
Author

AlexanderEvans commented Mar 17, 2019

@avih

Add to your input.conf:

ctrl+e run explorer /select, ${path}

So, I added the line, and it now opens file explorer, but it just opens to the default, "This PC". Is there a way to get it to got to the path? Because ctrl+e run explorer /select, ${path} doesn't seem to do that on windows... Unless I'm missing something? Is there a doc file on it somewhere? Sorry if this is something really basic. I also tried ctrl+e run explorer /select, "${path}" but it still just opened the file explorer to "This PC"

@zc62
Copy link
Contributor

zc62 commented Mar 17, 2019

I can confirm that command works perfectly for me, windows 7 here. How did you open the file? Command line or open-file-dialog script? See what

ctrl+e show-text ${path}

shows when you press Ctrl+e.

@AlexanderEvans
Copy link
Author

@zc62 I used Auto Hot Key to open the folder like this:

	:*:_playmusic::
		send, {escape}
		run, "D:\Program Files Custom\MPV\mpv.exe" "D:\Users\Anonymous\Videos\Music videos" --shuffle --no-border --autofit=700x700 --geometry=3000:900
	return

I'm running in windows 10 pro if that makes a difference. Here's a screenshot of what displays when I use ctrl+e show-text ${path}
https://prnt.sc/mzag21

@zc62
Copy link
Contributor

zc62 commented Mar 18, 2019

I think it is because you opened a folder with mpv, and mpv mixes \ and /, but explorer.exe apparently does not support /.

@AlexanderEvans
Copy link
Author

AlexanderEvans commented Mar 18, 2019

So, I tried changing all the '\'s to '/'s and that does seem to have changed how it is listed with
ctrl+e show-text ${path}
however even with all them going the same direction it fails... Is there a way to make mpv use '\' for that last slash instead?

@zc62
Copy link
Contributor

zc62 commented Mar 18, 2019

It is not just the last separator. mpv will use / for all the separators following the path that it received, if sub-directories exist, something like D:\Users\Anonymous\Videos\Music videos/subdir/file1.mp4.

You need to file a new issue to request this. On Windows use \ only as the separator when printing paths.

@AlexanderEvans
Copy link
Author

It is not just the last separator. mpv will use / for all the separators following the path that it received, if sub-directories exist, something like D:\Users\Anonymous\Videos\Music videos/subdir/file1.mp4.

You need to file a new issue to request this. On Windows use \ only as the separator when printing paths.

Thanks for explaining, will do.

@CogentRedTester
Copy link
Contributor

CogentRedTester commented Jul 8, 2022

You can also use powershell to change the forward slashes to backslashes in input.conf:

ctrl+e run powershell.exe -command ``explorer.exe '/select,' ( "${path}" -replace '/', '\' )``

Note that this is using the custom quote syntax with the backtick ` character.

@stax76
Copy link
Contributor

stax76 commented Jul 8, 2022

The custom quotes feature is good to have and good to know. I was wondering if it would be doable without this feature, and found that it is:

ctrl+e run powershell -command "explorer.exe '/select,' ( '${path}' -replace '/', '\\' )"

edit:

needs more escaping to support file names that contain single quotes:

ctrl+e run powershell -command "explorer.exe '/select,' ( \"${path}\" -replace '/', '\\' )"

@stax76
Copy link
Contributor

stax76 commented Nov 15, 2023

The powershell solution works except when the file name has a dollar sign.

Maybe the task is better suited for a Lua script, there was a script in the wiki, unfortunately it's gone.

@Sneakpeakcss

mpvnet-player/mpv.net#580

@stax76
Copy link
Contributor

stax76 commented Nov 19, 2023

GitHub Gist with Lua code that supports rare filenames that do not work with the PowerShell one-liner, such as aa$aa.mkv and aa,aa.mkv. Code is also used by uosc.

https://gist.github.com/Sneakpeakcss/05a97d509b8be67a6f11400b0bee54ab

Extensive discussion:

mpvnet-player/mpv.net#580

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants