Add Extra Buttons to UOSC Element Controls. #667
AziRizvi
started this conversation in
Show and tell
Replies: 3 comments 1 reply
-
There's show and tell section in discussions for this kind of posts. And controls option is documented in the default |
Beta Was this translation helpful? Give feedback.
1 reply
-
WOW that was great go-to GUIDE 👍 well doen |
Beta Was this translation helpful? Give feedback.
0 replies
-
Glad you liked it and that it helped you!! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This has a request for the author which will be mentioned at the end, this is not an issue per-se but more of a general information/tutorial in case someone was wondering how to add extra buttons to UOSC or change the icons for the buttons that are there, there wasn't anything in the official documentation so I had to scratch my head and figure it out, I will explain how, first here's what my MPV looks like.
Here's what all the buttons do, their functions.

Here's what my MPV looks like (completely)

So now how to add buttons?
Replacing the entire controls line with the one below in your UOSC.conf file in Script-Opts folder will make your controls exactly like mine.
controls=menu,command:info_outline:script-binding display-stats-toggle?OPEN STATS,command:fullscreen:cycle fullscreen?CYCLE FULLSCREEN,command:theaters:script-binding uosc/video?VIDEO TRACKS,command:graphic_eq:script-binding uosc/audio?AUDIO TRACKS,command:spellcheck:script-binding uosc/subtitles?SUBTITLE TRACKS,command:arrow_back:script-binding uosc/prev?PREVIOUS ITEM,command:arrow_forward:script-binding uosc/next?NEXT ITEM,command:download:run smplayer -actions "show_find_sub_dialog" ${path}?DOWNLOAD SUBTITLES,command:file_open:script-binding uosc/open-file?OPEN FILE,command:playlist_add_check:script-binding uosc/playlist?OPEN PLAYLIST,command:display_settings:cycle-values hwdec "nvdec-copy" "auto-copy" "no"?SWITCH HARDWARE DECODERS,command:bookmark_add:script-binding SimpleBookmark/bookmark-save?SAVE BOOKMARK,command:bookmark:script-binding SimpleBookmark/open-list?OPEN BOOKMARKS,command:terminal:script-binding webtorrent/toggle-info?WEBTORRENT STATS,command:exposure_plus_1:set speed 1.00?SET SPEED TO 1.00,command:electric_bolt:cycle-values speed 4 1?SET SPEED TO 4.00,command:exposure_plus_2:cycle-values speed 2.35 1?SET SPEED TO 2.35,command:all_inclusive:ab-loop?SET A-B LOOP,command:closed_caption:cycle sub?CYCLE BETWEEN ALL SUBTITLES,command:link:script-binding uosc/show-in-directory?OPEN CURRENT FILE'S DIRECTORY,command:settings:script-binding uosc/open-config-directory?OPEN CONFIG DIRECTORY,command:movie_filter:run Movies.exe?OPEN MOVIES DIRECTORY,command:tv:run Shows.exe?OPEN TV SHOWS DIRECTORY,command:hdr_auto:run Anime.exe?OPEN ANIME DIRECTORY,command:first_page:script-binding uosc/first-file?OPEN FIRST FILE IN DIRECTORY,command:last_page:script-binding uosc/last-file?OPEN LAST FILE IN DIRECTORY
How to add a single extra button or customize it to whatever you want? (I will explain how to customize the button
In the uosc.conf file you would put a comma at the end in the controls line and then add this.
command:all_inclusive:ab-loop?SET A-B LOOP
Command adds the button, the all_inclusive is the code for the UI icon, ab-loop is the MPV command and the text after the question mark sets the button text to whatever you want.
You can add anything instead of the ab-loop... ab-loop is an an MPV command, you can add in lines lo call other script commands for scripts that you have installed.
For example you can add command:terminal:script-binding webtorrent/toggle-info?WEBTORRENT STATS,
Command adds a button, terminal is the UI icon code, script-binding webtorrent/toggle-info calls the script command and the text after the question mark makes the button text to whatever you want.
Where to get UI icon codes?
Source 1:
https://mui.com/material-ui/material-icons/
Source 2:
https://fonts.google.com/icons?icon.style=Rounded%5D(https:%2F%2Ffonts.google.com%2Ficons%3Fselected%3DMaterial+Icons&icon.style=Rounded&selected=Material+Symbols+Outlined:terminal:FILL@0;wght@200;GRAD@-25;opsz@24&icon.platform=ios
Some icons will work when you put their codes in directly, others might require a DASH - or UNDERSCORE _
For example by default the icon for the Audio tracks that comes with UOSC, its icon code is GraphicEq but for some reason it does not work if you don't put an underscore between Graphic and Eq, when you put in the underscore, it would look like this.. graphic_eq
I've explained why I added what buttons and what they do in a screenshot of my player above, and I actually went a step further!
The download subtitles button when clicked opens SMPlayer, an MPV frontend and opens its find subtitle dialog box of the file that was currently playing.
The only good thing that MPV lacks is a proper way to download subtitles, this fixes it? Sort of? The MPV Auto Sub scripts that are floating around never worked for me since the subliminal tool to download them isn't that accurate plus I needed more control so this is what worked, here's what happens when you click the download subtitles button, it launches SMPlayer, launches the subtitle finder dialog box for the file that was playing allowing you to manually select and download subtitles.
If you want to use this option, make sure to add SMPlayer to your path environment variables.
The only thing I dislike about UOSC is its timeline, I figured out a way to hide UOSC's timeline so I can use the vanilla osc that comes with MPV, if you want to do the same thing, make the following changes in your UOSC's .conf file in script-opts.
Here's what UOSC's controls and my timeline looks like, the controls disappear when you scroll up and only show when you scroll down that's the default behaviour of the script.
What changes to make to hide UOSC's timeline? The following ones.
Also there's three more buttons in the screenshot that say Open Custom Directories.
By default, you cannot add in custom directories to open them with UOSC, so what I did was I implemented yet another solution for it, when clicking the button, it launches a .exe file that is in the directory that my MPV player is an, the file calls a function, there's a program called autohotkey that lets you create hotkeys and scripts and then compile them to .exe format so what I did was I added in the path to the directories that I wanted to open, created 3 .exe files and placed them into my MPV directory.
Here's the code for the Autohotkey script, you can add in whatever folder/file you may wish, technically this will even work with browsers and you could open a specific browser with a specific website, but this is not an Autohotkey tutorial, you can look more about that in AutoHotKey's official documentation on their website.
run, G:\
Now when I click the button, it opens this directory in windows explorer.
My request to the author is to add in support for adding in custom directories that you can open with the control buttons, add in some stuff about changing/adding/replacing the buttons in the official documentation so that people can experiment and change things to exactly how they want them, also if some level of official support could be added for using the Vanilla OSC that MPV comes with instead of using UOSC's OSC/timeline would be great, what I've done is implement a ghetto solution that well.. works? This is my request.
I just wanted to share my experiment and discoveries so that they benefit more people.
Beta Was this translation helpful? Give feedback.
All reactions