mpv icon indicating copy to clipboard operation
mpv copied to clipboard

Can file size sorting be applyed instead file name in autoload.lua?

Open Ruslang opened this issue 3 years ago • 3 comments

I want play auto playlist based on files sizes in current directory, from the biggest to the slowest. How i can path autoload.lua for get it?

Ruslang avatar Oct 23 '22 20:10 Ruslang

autoload.lua doesn't have the ability to sort files by size. You can always do something like: ls -1ANS | xargs mpv

Traneptora avatar Oct 23 '22 22:10 Traneptora

With PowerShell:

pwsh -command '$files = gci <media-folder> | sort-object Size | select -ExpandProp fullname ; mpv @files'

stax76 avatar Oct 25 '22 10:10 stax76

With PowerShell:

pwsh -command '$files = gci <media-folder> | sort-object Size | select -ExpandProp fullname ; mpv @files'

C:\> dir /aa /o-s /b X:\Videos\{*.mp4|*.mkv|*.webm|...} | mpv -playlist -

For sanity. Can easily be made into a doskey macro.

garoto avatar Nov 08 '22 20:11 garoto

For sanity. Can easily be made into a doskey macro.

I'm clueless what it is, but will take a look.

People not using a lot of command line can use a file manager for sorting and copying and then paste into mpv using a script:

https://github.com/stax76/mpv-scripts/blob/main/misc.lua#L22

https://github.com/stax76/mpv-scripts/blob/main/misc.lua#L352

stax76 avatar Nov 24 '22 05:11 stax76

Aw I came here looking for file size sorting too. Im on windows and Im not using command line. Anyone have a fork or something of this script? :/

trollollol123 avatar Jan 18 '23 08:01 trollollol123

You could sort with File Explorer, copy the sorted files to the clipboard, and paste it into mpv with my script:

https://github.com/stax76/mpv-scripts

If that doesn't suit your use case, you can search for a sort script here:

https://github.com/mpv-player/mpv/wiki/User-Scripts

https://github.com/stax76/awesome-mpv

stax76 avatar Jan 18 '23 14:01 stax76