Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BiliBili Python 3 TypeError: can only concatenate str (not "bytes") to str #35

Open
Liqianyu opened this issue Nov 2, 2021 · 2 comments

Comments

@Liqianyu
Copy link

Liqianyu commented Nov 2, 2021

描述错误
@ArchieMeng 将BiliBili Add-On迁移到Python 3时似乎遗漏该处,导致部分内容会报错

2021-11-02 11:23:57.169 T:30480   ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
 - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'TypeError'>
Error Contents: can only concatenate str (not "bytes") to str
Traceback (most recent call last):
  File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.bilibili/addon.py", line 3031, in <module>
    plugin.run()
  File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.module.xbmcswift2/lib/xbmcswift2/plugin.py", line 338, in run
    items = self._dispatch(self.request.path)
  File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.module.xbmcswift2/lib/xbmcswift2/plugin.py", line 312, in _dispatch
    listitems = view_func(**items)
  File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.bilibili/addon.py", line 2283, in sources
    sources = get_sources(url)
  File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.bilibili/addon.py", line 1801, in get_sources
    ename = '正片 : ' + elist[index]['title'] + ' - ' + elist[index][
TypeError: can only concatenate str (not "bytes") to str
-->End of Python script error report<--

尝试修改为

                        ename = '正片 : ' + str(elist[index]['title']) + ' - ' + elist[index][
                            'longTitle'] + ' [COLOR pink][' + elist[index]['badge'] + '][/COLOR]'

可以正常工作

重现
重现行为的步骤:

  1. 去 '打开Kodi运行Bilibili Add-On'
  2. 点击 '电视剧分类'
  3. 划到 '第八号当铺 第一季'
  4. 点击,出错

预期行为
正常显示分集

屏幕截图
如果适用,请添加屏幕截图以帮助解释您的问题

设备信息

  • 设备: Shield TV 2019 Pro
  • 系统: Android 9
  • Kodi 版本: Kodi 20

其他
在此处添加有关该问题的任何其他上下文

@ArchieMeng
Copy link
Contributor

我看到了,晚点修。不过,你测试好了,也可以自己提交个PR也行?

@ArchieMeng
Copy link
Contributor

修这个Bug的时候还发现了其它问题:UP界面打不开。相关Issue
可能要点时间推上来。

ArchieMeng added a commit to ArchieMeng/xbmc-kodi-private-china-addons-forked that referenced this issue Nov 2, 2021
同时更新版本号到0.5.10

Signed-off-by: ArchieMeng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants