-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
163 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,4 @@ jobs: | |
- uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "./es5/*.js" | ||
artifacts: "./es5/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- ==UserScript== | ||
-- @name open-file-dialog | ||
-- @version 0.1.0 | ||
-- @description open-file-dialog is a script for mpv that can launch a regular Windows file open dialog from a key binding (default: Ctrl+O.) | ||
-- @author mpv-easy | ||
-- @downloadURL https://raw.githubusercontent.com/rossy/mpv-open-file-dialog/master/open-file-dialog.lua | ||
-- @updateURL https://github.com/mpv-easy/mpsm-scripts/releases/latest/download/open-file-dialog.meta.lua | ||
-- ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,46 @@ | ||
{ | ||
"name": "@mpv-easy/mpsm-scripts", | ||
"private": true, | ||
"version": "0.1.4", | ||
"files": [ | ||
"bin", | ||
"dist", | ||
"es5", | ||
"bundle", | ||
"readme.md", | ||
"package.json" | ||
], | ||
"description": "@mpv-easy/mpsm-scripts", | ||
"main": "./dist/index.js", | ||
"bin": "./bin/cli", | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
"bundle": "esbuild ./src/*.ts --bundle --outdir=./bundle", | ||
"meta": "tsx ./build/meta.ts", | ||
"build": "pnpm run bundle && pnpm run es5 && pnpm run meta", | ||
"dev": "chokidar \"./src/*.(ts|tsx|json)\" -c \"pnpm run build && pnpm run copy\" -t 3000 --initial", | ||
"copy": "cp -r ./es5/*.js $MPV_SCRIPT_DIR/", | ||
"es5": "babel --presets @babel/preset-env ./bundle -d es5 --plugins ./babel/hack.js", | ||
"lint": "biome check --apply-unsafe ./", | ||
"format": "biome format --write ./" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@babel/cli": "^7.23.9", | ||
"@babel/core": "^7.23.9", | ||
"@babel/preset-env": "^7.23.9", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@biomejs/biome": "^1.5.3", | ||
"@mpv-easy/autoload": "0.1.6-alpha.7", | ||
"@mpv-easy/plugin": "^0.1.5", | ||
"@mpv-easy/tool": "^0.1.5", | ||
"@types/node": "^20.12.12", | ||
"chokidar": "^3.6.0", | ||
"chokidar-cli": "^3.0.0", | ||
"esbuild": "^0.21.3", | ||
"tsx": "^4.10.5", | ||
"typescript": "^5.3.3" | ||
}, | ||
"browserslist": [ | ||
"iOS >= 9", | ||
"Android >= 4.4", | ||
"last 2 versions", | ||
"> 0.2%", | ||
"not dead" | ||
] | ||
} | ||
"name": "@mpv-easy/mpsm-scripts", | ||
"private": true, | ||
"version": "0.1.5", | ||
"files": ["bin", "dist", "es5", "bundle", "readme.md", "package.json"], | ||
"description": "@mpv-easy/mpsm-scripts", | ||
"main": "./dist/index.js", | ||
"bin": "./bin/cli", | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
"bundle": "esbuild ./src/*.ts --bundle --outdir=./bundle", | ||
"meta": "tsx ./build/meta.ts", | ||
"build": "pnpm run bundle && pnpm run es5 && pnpm run meta", | ||
"dev": "chokidar \"./src/*.(ts|tsx|json)\" -c \"pnpm run build && pnpm run copy\" -t 3000 --initial", | ||
"copy": "cp -r ./es5/*.js $MPV_SCRIPT_DIR/", | ||
"es5": "babel --presets @babel/preset-env ./bundle -d es5 --plugins ./babel/hack.js", | ||
"lint": "biome check --apply-unsafe ./", | ||
"format": "biome format --write ./" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@babel/cli": "^7.23.9", | ||
"@babel/core": "^7.23.9", | ||
"@babel/preset-env": "^7.23.9", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@biomejs/biome": "^1.5.3", | ||
"@mpv-easy/autoload": "0.1.6-alpha.7", | ||
"@mpv-easy/plugin": "^0.1.5", | ||
"@mpv-easy/tool": "^0.1.5", | ||
"@types/node": "^20.12.12", | ||
"chokidar": "^3.6.0", | ||
"chokidar-cli": "^3.0.0", | ||
"esbuild": "^0.21.3", | ||
"tsx": "^4.10.5", | ||
"typescript": "^5.3.3" | ||
}, | ||
"browserslist": [ | ||
"iOS >= 9", | ||
"Android >= 4.4", | ||
"last 2 versions", | ||
"> 0.2%", | ||
"not dead" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"autoload": "https://github.com/mpv-easy/mpsm-scripts/releases/latest/download/autoload.js", | ||
"speed": "https://github.com/mpv-easy/mpsm-scripts/releases/latest/download/speed.js", | ||
"vlc-aspect-ratio": "https://github.com/mpv-easy/mpsm-scripts/releases/latest/download/vlc-aspect-ratio.js" | ||
} | ||
"autoload": "https://github.com/mpv-easy/mpsm-scripts/releases/latest/download/autoload.js", | ||
"speed": "https://github.com/mpv-easy/mpsm-scripts/releases/latest/download/speed.js", | ||
"open-file-dialog": "https://github.com/mpv-easy/mpsm-scripts/releases/latest/download/open-file-dialog.meta.lua", | ||
"vlc-aspect-ratio": "https://github.com/mpv-easy/mpsm-scripts/releases/latest/download/vlc-aspect-ratio.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { autoload } from "@mpv-easy/autoload" | ||
import { updatePlaylist, getMpvPlaylist, registerEvent } from "@mpv-easy/tool" | ||
import { autoload } from "@mpv-easy/autoload"; | ||
import { updatePlaylist, getMpvPlaylist, registerEvent } from "@mpv-easy/tool"; | ||
|
||
registerEvent("start-file", () => { | ||
autoload(updatePlaylist, getMpvPlaylist, { | ||
image: true, | ||
video: true, | ||
audio: true | ||
}) | ||
}) | ||
autoload(updatePlaylist, getMpvPlaylist, { | ||
image: true, | ||
video: true, | ||
audio: true, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,71 @@ | ||
import { print, addKeyBinding, getPropertyNative, info, osdMessage, setProperty, setPropertyString, registerEvent, } from '@mpv-easy/tool' | ||
import { | ||
print, | ||
addKeyBinding, | ||
getPropertyNative, | ||
info, | ||
osdMessage, | ||
setProperty, | ||
setPropertyString, | ||
registerEvent, | ||
} from "@mpv-easy/tool"; | ||
|
||
let arOption = 0; | ||
|
||
function hasVideo() { | ||
const trackList = getPropertyNative<{ type: string, selected: boolean, albumart: string }[]>("track-list"); | ||
for (const i of trackList) { | ||
if (i.type === 'video' && i.selected) { | ||
return !i.albumart | ||
} | ||
} | ||
return | ||
const trackList = | ||
getPropertyNative<{ type: string; selected: boolean; albumart: string }[]>( | ||
"track-list", | ||
); | ||
for (const i of trackList) { | ||
if (i.type === "video" && i.selected) { | ||
return !i.albumart; | ||
} | ||
} | ||
return; | ||
} | ||
|
||
function onPress() { | ||
if (!hasVideo()) { | ||
return | ||
} | ||
|
||
let arText = ''; | ||
arOption = (arOption + 1) % 10; | ||
|
||
const ar = [ | ||
-1, | ||
"16:9", | ||
"4:3", | ||
"1:1", | ||
"16:10", | ||
"2.21:1", | ||
"2.35:1", | ||
"2.39:1", | ||
"5:4", | ||
0 | ||
][arOption] | ||
|
||
if (typeof ar === 'number') { | ||
if (ar === 0) { | ||
arText = "Force PAR 1:1" | ||
} else if (ar === -1) { | ||
arText = "Default" | ||
} | ||
} else { | ||
arText = ar.toString() | ||
} | ||
|
||
|
||
info(`Aspect Ratio: ${arText}`) | ||
osdMessage(`Aspect Ratio: ${arText}`) | ||
setPropertyString("video-aspect-override", ar.toString()) | ||
if (!hasVideo()) { | ||
return; | ||
} | ||
|
||
let arText = ""; | ||
arOption = (arOption + 1) % 10; | ||
|
||
const ar = [ | ||
-1, | ||
"16:9", | ||
"4:3", | ||
"1:1", | ||
"16:10", | ||
"2.21:1", | ||
"2.35:1", | ||
"2.39:1", | ||
"5:4", | ||
0, | ||
][arOption]; | ||
|
||
if (typeof ar === "number") { | ||
if (ar === 0) { | ||
arText = "Force PAR 1:1"; | ||
} else if (ar === -1) { | ||
arText = "Default"; | ||
} | ||
} else { | ||
arText = ar.toString(); | ||
} | ||
|
||
info(`Aspect Ratio: ${arText}`); | ||
osdMessage(`Aspect Ratio: ${arText}`); | ||
setPropertyString("video-aspect-override", ar.toString()); | ||
} | ||
|
||
function cleanup() { | ||
print("Cleanup") | ||
arOption = 0 | ||
setPropertyString("video-aspect-override", '-1') | ||
return true | ||
print("Cleanup"); | ||
arOption = 0; | ||
setPropertyString("video-aspect-override", "-1"); | ||
return true; | ||
} | ||
|
||
addKeyBinding("a", "toggle_stretch", onPress) | ||
registerEvent("file-loaded", cleanup) | ||
addKeyBinding("a", "toggle_stretch", onPress); | ||
registerEvent("file-loaded", cleanup); |