Skip to content

Commit 0d0bb2a

Browse files
authored
put target URL into fragment
2 parents c2bcc51 + dd490ca commit 0d0bb2a

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ browser = browser || chrome;
88
const menus = browser.menus || browser.contextMenus;
99

1010
function openInMpv(url) {
11-
const mpvUrl = `mpv://${url}`;
11+
const mpvUrl = `mpv://watch#${url}`;
1212

1313
browser.tabs.update({ url: mpvUrl }).then(() => {
1414
console.debug("navigating to:", mpvUrl);

manifest-chrome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "__MSG_extensionName__",
33
"short_name": "__MSG_extensionShortName__",
44
"description": "__MSG_extensionDescription__",
5-
"version": "1.0.3",
5+
"version": "2.0.0",
66
"manifest_version": 3,
77
"default_locale": "en",
88
"icons": {

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "__MSG_extensionName__",
33
"short_name": "__MSG_extensionShortName__",
44
"description": "__MSG_extensionDescription__",
5-
"version": "1.0.5",
5+
"version": "2.0.0",
66
"manifest_version": 3,
77
"default_locale": "en",
88
"icons": {

mpv-scheme-handler.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Desktop Entry]
22
Version=1.0
33
Type=Application
4-
Exec=sh -c 'URL="%u"; URL=${URL#mpv://}; mpv --keep-open --player-operation-mode=pseudo-gui "${URL}" || notify-send -i mpv -w -A Close -A Open=Open "Opening ${URL} failed" | { [ "$(head -n1)" = "Open" ] && xdg-open "${URL}";}'
4+
Exec=sh -c 'URL="%u"; URL=${URL#mpv://watch#}; mpv --keep-open --player-operation-mode=pseudo-gui "${URL}" || notify-send -i mpv -w -A Close -A Open=Open "Opening ${URL} failed" | { [ "$(head -n1)" = "Open" ] && xdg-open "${URL}";}'
55
Icon=mpv
66
StartupNotify=true
77
Terminal=false

open-in-mpv.plugin.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
* @name open in mpv
33
* @author binarynoise
44
* @description Use the context menu to open a video in mpv.
5-
* @version 1.1.3
5+
* @version 2.0.0
66
*/
77

88
'use strict';
99

1010
const settings = { showAgain: true };
1111

12+
const MPVSchemePrefix = "mpv://watch#";
13+
1214
function contextMenuPatch(tree, context) {
1315
const href = context.target.href || context.target.parentNode.href
1416

@@ -21,7 +23,7 @@ function contextMenuPatch(tree, context) {
2123
console.log("link is " + href);
2224
const electron = require('electron');
2325

24-
electron.shell.openExternal('mpv://' + href).then(() => {
26+
electron.shell.openExternal(MPVSchemePrefix + href).then(() => {
2527
if (settings.showAgain !== false) {
2628
BdApi.UI.showConfirmationModal("Open in mpv",
2729
"Successfully opened " + href + " in mpv. Did nothing happen? Download and run setup.sh",
@@ -40,10 +42,10 @@ function contextMenuPatch(tree, context) {
4042
}
4143
console.log("success");
4244
}, (error) => {
43-
console.log("failed to open mpv://" + href);
45+
console.log(`failed to open ${MPVSchemePrefix}href`);
4446
console.log(error);
4547
}).catch((error) => {
46-
console.log("failed to open mpv://" + href);
48+
console.log(`failed to open ${MPVSchemePrefix}href`);
4749
console.log(error);
4850
})
4951
},

0 commit comments

Comments
 (0)