{"id":13835103,"url":"https://github.com/TheAMM/mpv_sort_script","last_synced_at":"2025-07-10T07:31:18.284Z","repository":{"id":98241812,"uuid":"163622586","full_name":"TheAMM/mpv_sort_script","owner":"TheAMM","description":"A Lua script to sort directories and files in mpv, sans external dependencies","archived":false,"fork":false,"pushed_at":"2018-12-30T22:57:54.000Z","size":34,"stargazers_count":14,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-20T20:39:00.188Z","etag":null,"topics":["lua","mpv","mpv-script","sorting"],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheAMM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-12-30T22:44:12.000Z","updated_at":"2024-06-26T19:11:00.000Z","dependencies_parsed_at":"2023-05-18T22:00:23.792Z","dependency_job_id":null,"html_url":"https://github.com/TheAMM/mpv_sort_script","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/TheAMM/mpv_sort_script","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAMM%2Fmpv_sort_script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAMM%2Fmpv_sort_script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAMM%2Fmpv_sort_script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAMM%2Fmpv_sort_script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheAMM","download_url":"https://codeload.github.com/TheAMM/mpv_sort_script/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAMM%2Fmpv_sort_script/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264545167,"owners_count":23625404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lua","mpv","mpv-script","sorting"],"created_at":"2024-08-04T14:00:56.776Z","updated_at":"2025-07-10T07:31:13.276Z","avatar_url":"https://github.com/TheAMM.png","language":"Lua","readme":"# `mpv_sort_script.lua`\n\n## What is it?\n\n`mpv_sort_script.lua` is a script for sorting directory entries by name, age, size or randomly. An entire directory tree can be sorted at once, as well.  \nThe script hooks file loading to check if the given path is a directory, enumerates the entries and sorts them.  \n(The script does *not* allow sorting the playlist during playback, yet!)\n\n## How do I install it?\n\nGrab a release from the [releases page](https://github.com/TheAMM/mpv_sort_script/releases), an automatic build [from here](https://raw.githubusercontent.com/TheAMM/mpv_sort_script/build/mpv_sort_script.lua) or [see below](#development) how to \"build\" (concatenate) the script yourself.  \nPlace the `mpv_sort_script.lua` to your mpv's `scripts` directory.\n\nFor example:\n  * Linux/Unix/Mac: `~/.config/mpv/scripts/mpv_sort_script.lua`\n  * Windows: `%APPDATA%\\Roaming\\mpv\\scripts\\mpv_sort_script.lua`\n\nSee the [Files section](https://mpv.io/manual/master/#files) in mpv's manual for more info.\n\n## How do I use it?\n\nPrepend a directory path with `sort:` (or `rsort:` for recursive sorting), for example:\n\n```shell\n$ mpv sort:~/Videos\n$ mpv sort:/tmp/files\n$ mpv sort:.\n$ mpv rsort:~/Videos # recurse into all subdirectories and sort\n```\nThis will sort using the default sort options, see [Configuration](#configuration) below.\n\nRecursive sorting with `rsort:` means the script will find all files in the directory tree (up until `max_recurse_depth`) and sort them all in one go. Otherwise the script will sort each folder separately, when it comes across them.\n\nYou may specify the sorting method and order as well:\n```shell\n$ mpv sort-name:.   # sort by name, using default order (depends on config)\n$ mpv sort-size-:.  # sort by size, descending (biggest to smallest)\n$ mpv sort-date+:.  # sort by date, ascending (oldest to newest)\n$ mpv sort-random:. # sort files randomly\n```\n\n## Configuration\n\nCreate a file called `mpv_sort_script.conf` inside your mpv's `lua-settings` directory.\n\nFor example:\n  * Linux/Unix/Mac: `~/.config/mpv/lua-settings/mpv_sort_script.conf`\n  * Windows: `%APPDATA%\\Roaming\\mpv\\lua-settings\\mpv_sort_script.conf`\n\nSee the [Files section](https://mpv.io/manual/master/#files) in mpv's manual for more info.\n\nYou can grab an example config [from here](https://raw.githubusercontent.com/TheAMM/mpv_sort_script/build/mpv_sort_script.conf) or use mpv to save an example config:\n```shell\n$ mpv --idle --script-opts sort-example-config=example.conf\n```\nThe example configuration documents itself, so read that for all the options.\n\n## Development\n\nThis project uses git submodules. After cloning (or fetching updates), run `git submodule update --init` to update the `libs` submodule, which contains parts most of my scripts share and use.\n\nIncluded in the libs directory is `concat_tool.py` I use for automatically concatenating files upon their change, and also mapping changes to the output file back to the source files. It's really handy on stack traces when mpv gives you a line and column on the output file - no need to hunt down the right place in the source files!\n\nThe script requires Python 3, so install that. Nothing more, though. Call it with `libs/concat_tool.py concat.json`.\n\nYou may also, of course, just `cat` the files together yourself. See the [`concat.json`](concat.json) for the order.\n\n### Donation\n\nIf you *really* get a kick out of this (weirdo), you can [paypal me](https://www.paypal.me/TheAMM) or send bitcoins to `1K9FH7J3YuC9EnQjjDZJtM4EFUudHQr52d`. Just having the option there, is all.\n","funding_links":["https://www.paypal.me/TheAMM"],"categories":["Playback"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTheAMM%2Fmpv_sort_script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTheAMM%2Fmpv_sort_script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTheAMM%2Fmpv_sort_script/lists"}