Giter Site home page Giter Site logo

jellyfin-potplayer's Introduction

jellyfin-potplayer's People

Contributors

mienjustsaystoher avatar tccoin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jellyfin-potplayer's Issues

potplayer cant't open the link

userscript.jshas correctly fetched the address , and potplayer has been opened correctly , but still can't open the movie properly.
my jellyfin File path like /video/xx/xxx (2021)/xxx (2021) 1080p AAC.mp4. and file name contains some spaces.
this is my userscript-docker.js , When I click through, the browser address bar gets the address I want , like potplayer:////192.168.123.9/video/xx/xxx (2021)/xxx (2021) 1080p AAC.mp4
But after potplayer.ps1, potplayer can be opened, but it will not open any video, and there is no address error prompt.
I checked the code several times and didn't find any errors, and I had success with the same code before, until I reinstalled jellyfin from docker and it didn't work anymore.
I did some testing, is it something to do with the spaces in my file path? plz help me! thank you!

踩的坑和解决办法

前提:我的jellyfin是10.8.0docker版本,装在群晖里添加路径的时候填写了共享的网络文件夹,像这样
image
电脑是WIN11 系统。EDGE浏览器。电脑要能直接访问源文件。
1、js脚本的两个位置更改成这样,其他位置不用改:
// @match */web/index.html
let path = r.Path.replace(/\/g, '\');
这样更改可以直接将共享文件路径传给potplayer,像打开共享文件一样。不用本地映射这么麻烦。
2、有一条斜杠导致Potplayer找不到文件这样解决:在PS1文件中添加:
$path=$path -replace "/" , " "
$path=$path -replace "potplayer: " , "potplayer://"
其实就是把斜杠替换成空格,但是又会把potplayer://更改成potplayer: 所以再改一次改回来,有一个问题就是如果路径中有/,那么文件就会打不开。
3、调用不了powershell或者powershell一闪而过。
检查reg文件的路径是否正确,系统是否禁用脚本功能,开启脚本方法请百度。
4、存在的问题:只能点击海报上的播放按钮才能调用potplayer,详情页的播放按钮没反应。

URL编码问题

potplayer打开地址失败,他打开的地址是K:/reol/Reol - %E3%82%A6%E3%83%86%E3%83%8A.mp4
本该打开的地址是K:/reol/Reol - ウテナ.mp4

I am having a problem with ConnectionManager is undefined and ApiClient is undefined.

Jellyfin 23 Apr download latest Firefox on Windows 10.

Same file errors on the JS file as others have previously reported

let userid = (await ApiClient.getCurrentUser()).Id;
ApiClient.getItem(userid, itemid).then(r => {

ApiClient.getItems(userid, itemid).then(r => openPotplayer(r.Items[0].Id));

Please help..... What am I doing wrong?

Doc included below

##########################################################

I am adapting it to run mpv.
I can launch the powershell script and it opens mpv properly.

registry entry is correct

potplayer.reg

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\potplayer]
@="URL:potplayer protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\potplayer\shell]
[HKEY_CLASSES_ROOT\potplayer\shell\open]
[HKEY_CLASSES_ROOT\potplayer\shell\open\command]
@="powershell -File D:\apps\Jellyfin-mpv-master\potplayer.ps1 %1"

potplayer.ps1

Add-Type -Assembly System.Web
$path=$args[0]
$path=$path -replace "potplayer://" , ""
$path= [System.Web.HttpUtility]::UrlDecode($path)
echo $path
& "D:\Apps\mpv_default\mpv.exe" $path

userscript.js

// ==UserScript==
// @name Jellyfin with Potplayer
// @Version 0.1
// @description play video with Potplayer
// @author Tccoin
// @match http://DLNAWebserver:8096/jellyfin/web/index.html
// ==/UserScript==

(function() {
'use strict';
let openPotplayer = async (itemid) => {
let userid = (await ApiClient.getCurrentUser()).Id;
ApiClient.getItem(userid, itemid).then(r => {
if (r.Path) {
let path = r.Path.replace(/\/g, '/');
path = path.replace('E:', 'Q:');
console.log(path);
window.open('potplayer://' + path)
} else {
ApiClient.getItems(userid, itemid).then(r => openPotplayer(r.Items[0].Id));
}
})
};

let bindEvent = async () => {
let buttons = [];
let retry = 6 + 1;
while (buttons.length == 0 && retry > 0) {
await new Promise(resolve => setTimeout(resolve, 500));
buttons = document.querySelectorAll('[data-mode=play],[data-mode=resume],[data-action=resume]');
retry -= 1;
}
for (let button of buttons) {
let nextElementSibling = button.nextElementSibling;
let parentElement = button.parentElement;
let outerHTML = button.outerHTML;
button.parentElement.removeChild(button);
let newButton = document.createElement('button');
if (nextElementSibling) {
parentElement.insertBefore(newButton, nextElementSibling);
} else {
parentElement.append(newButton);
}
newButton.outerHTML = outerHTML;
}
buttons = document.querySelectorAll('[data-mode=play],[data-mode=resume]');
for (let button of buttons) {
button.removeAttribute('data-mode');
button.addEventListener('click', e => {
e.stopPropagation();
let itemid = /id=(.*?)&serverId/.exec(window.location.hash)[1];
openPotplayer(itemid);
});
}
buttons = document.querySelectorAll('[data-action=resume]');
for (let button of buttons) {
button.removeAttribute('data-action');
button.addEventListener('click', e => {
e.stopPropagation();
let item = e.target;
while (!item.hasAttribute('data-id')) { item = item.parentNode }
let itemid = item.getAttribute('data-id');
openPotplayer(itemid);
});
}
};

let lazyload = () => {
let items = document.querySelectorAll('[data-src].lazy');
let y = document.scrollingElement.scrollTop;
let intersectinglist = [];
for (let item of items) {
let windowHeight = document.body.offsetHeight;
let itemTop = item.getBoundingClientRect().top;
let itemHeight = item.offsetHeight;
if (itemTop + itemHeight >= 0 && itemTop <= windowHeight) {
intersectinglist.push(item);
}
}
for (let item of intersectinglist) {
item.style.setProperty('background-image', url("${item.getAttribute('data-src')}"));
item.classList.remove('lazy');
item.removeAttribute('data-src');
};
};

window.addEventListener('scroll', lazyload);

window.addEventListener('viewshow', async() => {
bindEvent();
window.addEventListener('hashchange', bindEvent);
});
})();

ConnectionManager is undefined and ApiClient is undefined in userscript.js

As requested - opening a new issue for this:

I am having a problem with ConnectionManager is undefined and ApiClient is undefined.

image

The regedit successful added the potplayer:// protocol handling, and if I directly enter an address like:
potplayer://localhost:8096/Items/a0e731206375627cda2e34fad7589610/Download?api_key=d948b800b182411799c525225aa2bd18 into the browser, the powershell script successfully runs and the video content plays.

But if I simply click to play, nothing happens in the browser and in the browser console I see these errors:
image

I cannot tell from the thread above how the undefined errors were solved. Thanks for any help.

Originally posted by @hestenet in #1 (comment)

This is great!

Thanks for this! I've been struggling to get Jellyfin to use an external player in Windows and this solved it for me!

I saw that you don't use Jellyfin anymore. What do you use instead of Jellyfin?

Thanks!

(There's no discussion area here so I had to put my thanks as an issue)

get errors when path contains non-English characters

So, the whole thing is good, and works fine with English-only file/path.
But inevitably there are contents named in other language.

For example, I have this movie in :
E:/电影/Top.Gun.Maverick.2022.IMAX.2160p.BluRay.REMUX.HEVC.DTS-HD.MA.TrueHD.7.1.Atmos-FGT/Top.Gun.Maverick.2022.IMAX.2160p.BluRay.REMUX.HEVC.DTS-HD.MA.TrueHD.7.1.Atmos-FGT.mkv

And when js tries to pass it to potplayer, it actually becomes :
E:/%E7%94%B5%E5%BD%B1/Top.Gun.Maverick.2022.IMAX.2160p.BluRay.REMUX.HEVC.DTS-HD.MA.TrueHD.7.1.Atmos-FGT/Top.Gun.Maverick.2022.IMAX.2160p.BluRay.REMUX.HEVC.DTS-HD.MA.TrueHD.7.1.Atmos-FGT.mkv
console output is :
Launched external handler for 'potplayer://E:/%E7%94%B5%E5%BD%B1/Top.Gun.Maverick.2022.IMAX.2160p.BluRay.REMUX.HEVC.DTS-HD.MA.TrueHD.7.1.Atmos-FGT/Top.Gun.Maverick.2022.IMAX.2160p.BluRay.REMUX.HEVC.DTS-HD.MA.TrueHD.7.1.Atmos-FGT.mkv'.

so I tried to encode/decode the path, like:
(function() {
'use strict';
let openPotplayer = async (itemid) => {
let userid = (await ApiClient.getCurrentUser()).Id;
ApiClient.getItem(userid, itemid).then(r => {
if (r.Path) {
let path = encodeURI(r.Path.replace(/\/g, '/')); //encode path
console.log(path);
window.open('potplayer://' + decodeURI(path)); //decode path
} else {
ApiClient.getItems(userid, itemid).then(r => openPotplayer(r.Items[0].Id));
}
})
};

Though the converting seems to be correct if I log it to the console, it just won't pass the decoded path when open up window. Same output like before.
Hope I can hear from you soon. Thanks again for bringing us this project. 👍

[Suggestion] Potplayer.ps path in reg file

I had the issue when the potplayer.ps file is in a folder with spaces in its name the script does not work.

original did not work: @="powershell -File H:\To be Sorted\Scrape Utilities\potplayer.ps1 %1"
edited: @="powershell -File "H:\To be Sorted\Scrape Utilities\potplayer.ps1" %1"

I had to go to the registry editor and edit for it work again

Potplayer just won't start

Can't open any file with Potplayer, until I realize it might be some problem with Powershell Execution Policy
Run PowerShell as administrator
get-ExecutionPolicy
It's probably "Restricted" if you're having the same problem as mine, if so, just change it
set-ExecutionPolicy RemoteSigned
Voila, all set, enjoy

能回传播放进度不

能不能在potplayer停止播放或者关闭的时候,回传当前视频的播放进度呢?

Help with running the script

I am trying to get this to work. I am not a developer, just a user.
I am using the latest stable installer version of jellyfin on Windows Home.
1)
I downloaded your files and extracted them into folder, changed path to potplayer.ps1 in potplayer.reg and ran the reg file (I checked the registry, the new values are there).
2)
I installed Tampermonkey to Firefox (and tried Vivaldi, too), installed the script and changed the path to the jellyfin web-ui at the top.
There are three yellow exclamation marks. They say that ConnectionManager and ApiClient are not defined:
script_ex_01

I enabled the script and tried to play some videos but there is just a brief pop-up of blue (powershell) window, which closes immediately.

Will you please help? Can I do something to help troubleshoot this?
I would really like to get this running.
Thanks.

edit:
or do I have to put the script in the installation folder of jellyfin ?

JS里面match匹配需要更新了?

原本

// @match http://localhost:8096/jellyfin/web/index.html

现在用
// @match http://localhost:8096/web/index.html

才行。

不知道是不是哪个服务器版本的改动

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.