tccoin / Jellyfin-Potplayer

Play with Potplayer
106 stars 26 forks source link

get errors when path contains non-English characters #14

Open Kigarin opened 1 year ago

Kigarin commented 1 year ago

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. 👍

leominor46 commented 1 year ago

这些代码不需要加 你检查下注册表 [HKEY_CLASSES_ROOT\potplayer\shell\open\command] 是不是没导入进去,可以手动把这个项改了