Stage new submodule locations

This commit is contained in:
2025-08-17 16:59:41 -07:00
parent e4afe79832
commit cfc6ac22e5
48 changed files with 12753 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
name: TestOnMacOs
on:
workflow_dispatch:
push:
pull_request:
schedule:
- cron: "37 10 * * 3"
jobs:
TestScript:
runs-on: macos-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Get latest ytdl_hook.lua
run: |
wget https://github.com/mpv-player/mpv/raw/master/player/lua/ytdl_hook.lua
- name: Install mpv
run: |
brew install ffmpeg luajit mujs uchardet vapoursynth
brew install --ignore-dependencies mpv
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
- name: Test mpv
run: |
mpv
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install yt-dlp from pip
run: |
pip install --upgrade yt-dlp
which yt-dlp
- name: Test yt-dlp
run: |
yt-dlp --version
- name: ⏯️ Run mpv with youtube-upnext userscript
run: |
ytloc=$(which yt-dlp)
output=$(mpv --ytdl=no --script-opts="ytdl_hook-ytdl_path=$ytloc,youtube-upnext-auto_add=no,youtube-upnext-fetch_on_start=yes,youtube-upnext-use_json_lua=yes" --scripts=ytdl_hook.lua:youtube-upnext.lua --msg-level=youtube_upnext=trace "https://www.youtube.com/watch?v=VpOLXXBcAl0" 2>&1)
echo $output
if [[ $output == *"downloaded and decoded json successfully"* ]]; then
exit 0
else
echo "Not found: downloaded and decoded json successfully"
exit 1
fi

View File

@@ -0,0 +1,9 @@
LICENSE
The software is provided "as is" and the author disclaims all warranties with
regard to this software including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any special, direct,
indirect, or consequential damages or any damages whatsoever resulting from
loss of use, data or profits, whether in an action of contract, negligence
or other tortious action, arising out of or in connection with the use or
performance of this software.

View File

@@ -0,0 +1,101 @@
# youtube-upnext
A userscript for MPV that allows you to load the up next/recommened youtube video on the fly, as though you were using the web player.
![screenshot](screenshot_menu.png)
Toggle the menu with `ctrl+u` (configurable). Select from the list with the arrow keys (configurable), and press `Enter` (configurable) to select. Menu times out after 10 seconds (configurable).
Press `Space` to append to the playlist. Close menu with `Escape` or `ctrl+u`.
## Installation
Copy youtube-upnext.lua into your scripts directory, e.g.:
cp youtube-upnext.lua ~/.config/mpv/scripts/
optional, copy the config file:
cp youtube-upnext.conf ~/.config/mpv/script-opts/
Make sure you have cURL or GNU Wget installed.
cURL is included in Windows 10+, macOS, Android and many Linux distributions.
### Windows:
The location of the scripts directory on Windows is `%APPDATA%\mpv\scripts` e.g. `C:\Users\cvzi\AppData\Roaming\mpv\scripts`
$\textcolor{#D00000}{\textsf{Microsoft ships an old version of cURL with known vulnerabilities.}}$
You are encouraged to install a newer version of cURL:
* Official cURL releases https://curl.se/windows/
* [Chocolatey package](https://community.chocolatey.org/packages/curl)
* [git for windows](https://git-scm.com/) includes a version of cURL
If you downloaded/installed the curl/wget executable, you have to [add the directory of the curl.exe/wget.exe to your machine's
%PATH%](https://stackoverflow.com/a/41895179/10367381).
### [uosc](https://github.com/tomasklaen/uosc) menu integration
If you want to add the upnext menu to **uosc**, you need to add one of the following line to your `input.conf`.
If you use the line starting with `#` it just creates an entry in the uosc menu.
If you use the second line, it also creates a keyboard shortcut to open the menu.
Replace `u` with the key of your choice:
```
# script-message-to youtube_upnext menu #! Youtube Recommendations
OR
u script-message-to youtube_upnext menu #! Youtube Recommendations
```
If you want it to appear in a submenu, replace `Youtube Recommendations` with e.g. `Utils > Youtube Recommendations`
<ins>Note:</ins> If you're using the default menu of uosc and you don't have the uosc menu defined in `input.conf`, you first need to create
a menu configuration. You can find an example at https://github.com/tomasklaen/uosc#examples
If you want an entry in the controls bar of uosc, you can add the following to the `controls=` entry in your `uosc.conf`:
```
<stream>command:queue_play_next:script-message-to youtube_upnext menu?Up Next
```
* Pick your desired title instead of `Up Next`
* Pick another icon instead of `queue_play_next` from [Google Material Icons](https://fonts.google.com/icons?selected=Material+Icons)
![screenshot of uosc](screenshot_uosc.webp)
### mpv.net:
The script folder for mpv.net is:
`%APPDATA%\mpv.net\scripts`
The .conf files belong into:
`%APPDATA%\mpv.net\script-opts`
The keyboard shortcut in the script and the .conf-file doesn't work with mpv.net.
You need to set the keyboard shortcut yourself in your `input.conf`. Default location is `%APPDATA%\mpv.net\input.conf`.
Add the following line to the end of your `input.conf` (change the key if it's already used):
```
Ctrl+u script-message-to youtube_upnext upnext-menu
```
### SVP
Installation is the same as for normal mpv. You need to install yt-dlp. On Windows you have to
[add the directory of the yt-dlp.exe to your machine's %PATH%](https://stackoverflow.com/a/41895179/10367381)
or put yt-dlp.exe into `%APPDATA%\mpv\` e.g. `C:\Users\cvzi\AppData\Roaming\mpv\yt-dlp.exe`.
You need to update yt-dlp occasionally when it stops working.
Unfortunately SVP does not make the quality available to scripts. That means the quality settings that were
selected in SVP are not preserved when the next video is loaded.
## Credit
- I pretty much copied the [mpv-youtube-quality](https://github.com/jgreco/mpv-youtube-quality) script and added wget
## [youtube-quality](https://github.com/jgreco/mpv-youtube-quality)'s Credit
- [reload.lua](https://github.com/4e6/mpv-reload/), for the function to reload a video while preserving the playlist.
- [mpv-playlistmanager](https://github.com/jonniek/mpv-playlistmanager), from which I ripped off much of the menu formatting config.
- ytdl_hook.lua, from which I ripped off much of the youtube-dl code to fetch the format list
- somebody on /mpv/ for the idea

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

View File

@@ -0,0 +1,90 @@
# KEY BINDINGS
# invoke or dismiss the quality menu
toggle_menu_binding=ctrl+u
# move the menu cursor up
up_binding=UP
# move the menu cursor down
down_binding=DOWN
# select menu entry
select_binding=ENTER
# auto fetch recommended videos when opening a url
fetch_on_start=no
# auto load and add the "upnext" video to the playlist
auto_add=yes
# formatting / cursors
cursor_selected=●
cursor_unselected=○
cursor_appended=▷
cursor_appended_selected=▶
# font size scales by window, if false requires larger font and padding sizes
scale_playlist_by_window=no
# playlist ass style overrides inside curly brackets, \keyvalue is one field, extra \ for escape in lua
# example {\\fnUbuntu\\fs10\\b0\\bord1} equals: font=Ubuntu, size=10, bold=no, border=1
# read http://docs.aegisub.org/3.2/ASS_Tags/ for reference of tags
# undeclared tags will use default osd settings
# these styles will be used for the whole playlist. More specific styling will need to be hacked in
#
# (a monospaced font is recommended but not required)
style_ass_tags={\\fnmonospace\\fs25}
# paddings for top left corner
text_padding_x=5
text_padding_y=5
# Screen dim when menu is open 0.0 - 1.0 (0 is no dim, 1 is black)
curtain_opacity=0.7
# how many seconds until the quality menu times out
menu_timeout=10
# base url for loading new urls, %s will be replaced with video id
youtube_url=https://www.youtube.com/watch?v=%s
# Fallback Invidious instance. Used if "upnext" could not be retrieved from the normal youtube website
# See https://api.invidious.io/ for alternatives
invidious_instance=https://inv.tux.pizza
# Keep the width of the window the same when the next video is played
restore_window_width=no
# On Windows wget.exe may not be able to check SSL certificates for HTTPS, so you can disable it here
check_certificate=yes
# Use a cookies file
# Same as youtube-dl --cookies or wget --load-cookies
# If you don't set this, the script may create a cookie file for you
# For example "C:\\Users\\Username\\cookies.txt"
# Or "C:/Users/Username/cookies.txt"
#cookies=cookies.txt
# When a video is selected from the menu, the new video can be appended to the playlist
# or the playlist can be cleared and replaced with only the selected video.
# If yes, the video will be appended to the playlist. If no, the playlist will be cleared.
keep_playlist_on_select=yes
# What should happen if a video recommendation in uosc menu is clicked? Options are:
# submenu --> show a submenu with play/upnext/append option
# append --> append the video to the playlist
# insert --> play the video after the current video
# play --> append the video to the playlist and play it
# replace --> play the video and clear the playlist
uosc_entry_action=submenu
# Should the uosc menu stay open after clicking a video recommendation?
uosc_keep_menu_open=no
# Don't play/append videos that are shorter than this time. Format is "HH:MM:SS" or "MM:SS"
#skip_shorter_than=00:30
# Don't play/append videos that are longer than this time. Format is "HH:MM:SS" or "MM:SS"
#skip_longer_than=07:00
# Also don't show the videos in the menu that are too short or too long
#hide_skipped_videos=yes

File diff suppressed because it is too large Load Diff