RicterZ / BGmi

BGmi is a cli tool for subscribed bangumi.
https://bgmi.ricterz.me
387 stars 72 forks source link

添加番剧下载信息时字符编码处理有问题 #103

Closed SilverBut closed 6 years ago

SilverBut commented 6 years ago

版本:2.0.1 配置:transmission-rpc lang: zh_cn 数据源:bangumi_moe 番剧存储位置:/mnt/bangumi (via NFS)

日志:

➜ user@rpi  ~  bgmi mark 我家有个鱼干妹R 0
[+] 我家有个鱼干妹R has been mark as episode: 0
➜ user@rpi  ~  bgmi update --download     
[*] marking bangumi status ...
[*] updating bangumi data ...
[*] updating subscriptions ...
[*] fetching 我家有个鱼干妹R ...
[+] 我家有个鱼干妹R updated, episode: 4
[*] fetching 调教咖啡厅 ...
[*] fetching Just Because! ...
[*] fetching 少女终末旅行 ...
[x] Error: 'ascii' codec can't encode characters in position 13-19: ordinal not in range(128)
[x] Error: 'ascii' codec can't encode characters in position 13-19: ordinal not in range(128)
[x] Error: 'ascii' codec can't encode characters in position 13-19: ordinal not in range(128)
[x] Error: 'ascii' codec can't encode characters in position 13-19: ordinal not in range(128)
[*] Re-downloading ...
[x] Error: 'ascii' codec can't encode characters in position 13-19: ordinal not in range(128)
[x] Error: 'ascii' codec can't encode characters in position 13-19: ordinal not in range(128)
[x] Error: 'ascii' codec can't encode characters in position 13-19: ordinal not in range(128)
[x] Error: 'ascii' codec can't encode characters in position 13-19: ordinal not in range(128)
[x] Error: 'ascii' codec can't encode characters in position 13-17: ordinal not in range(128)
[x] Error: 'ascii' codec can't encode characters in position 13-17: ordinal not in range(128)
[x] Error: 'ascii' codec can't encode characters in position 13-17: ordinal not in range(128)
[x] Error: 'ascii' codec can't encode characters in position 13-17: ordinal not in range(128)
[x] Error: 'ascii' codec can't encode characters in position 13-18: ordinal not in range(128)
[x] Error: 'ascii' codec can't encode characters in position 13-18: ordinal not in range(128)

Transmission中也并没有添加进去

SilverBut commented 6 years ago

过滤器设置:

➜ user@rpi  ~  bgmi fetch 我家有个鱼干妹R                                                                                                                                                                                                                              
[*] Followed subtitle group: None
[*] Include keywords: 720P,爱恋
[*] Exclude keywords: 繁體,BIG5
[*] Regular expression: None
[*] Fetch bangumi 我家有个鱼干妹R ...
[*] Fetch page 1 ...
[*] Fetch page 2 ...
[*] Fetch page 3 ...
[+] 【爱恋字幕社】Himouto! Umaru-chan R 干物妹! 小埋 R 04 GB 720P
[+] 【爱恋字幕社】Himouto! Umaru-chan R 干物妹! 小埋 R 03 GB 720P
[+] 【爱恋字幕社】Himouto! Umaru-chan R 干物妹! 小埋 R 02 GB 720P
[+] 【爱恋字幕社】Himouto! Umaru-chan R 干物妹! 小埋 R 01 GB 720P

此外Just Because就没有上面的问题。过滤器设置:

➜ user@rpi  ~  bgmi fetch "Just Because\!"
[*] Followed subtitle group: None
[*] Include keywords: 简体
[*] Exclude keywords: None
[*] Regular expression: None
[*] Fetch bangumi Just Because! ...
[*] Fetch page 1 ...
[*] Fetch page 2 ...
[*] Fetch page 3 ...
[+] 【动漫国字幕组】★10月新番[Just Because!][05][720P][简体][MP4]
[+] 【动漫国字幕组】★10月新番[Just Because!][04][720P][简体][MP4]
[+] 【动漫国字幕组】★10月新番[Just Because!][03][720P][简体][MP4]
[+] 【动漫国字幕组】★10月新番[Just Because!][02][720P][简体][MP4]
[+] 【动漫国字幕组】★10月新番[Just Because!][01][720P][简体][MP4]
SilverBut commented 6 years ago

有没有调试模式?目前连报错行号都定位不到

SilverBut commented 6 years ago

很dirty的动了动源码,找到了爆点:

Traceback (most recent call last):
  File "/usr/local/bin/bgmi", line 11, in <module>
    load_entry_point('bgmi==2.0.1', 'console_scripts', 'bgmi')()
  File "/usr/local/lib/python2.7/dist-packages/bgmi/main.py", line 152, in main
    controllers(ret)
  File "/usr/local/lib/python2.7/dist-packages/bgmi/cli.py", line 202, in controllers
    return func(ret)
  File "/usr/local/lib/python2.7/dist-packages/bgmi/cli.py", line 155, in update_wrapper
    update(name=ret.name, download=ret.download, not_ignore=ret.not_ignore)
  File "/usr/local/lib/python2.7/dist-packages/bgmi/controllers.py", line 339, in update
    download_prepare(download_queue)
  File "/usr/local/lib/python2.7/dist-packages/bgmi/download.py", line 55, in download_prepare
    download_class.download()
  File "/usr/local/lib/python2.7/dist-packages/bgmi/services.py", line 115, in download
    tc.add_torrent(self.torrent, download_dir=self.save_path)
  File "/usr/local/lib/python2.7/dist-packages/transmissionrpc/client.py", line 414, in add_torrent
    (arg, val) = argument_value_convert('torrent-add', argument, value, self.rpc_version)
  File "/usr/local/lib/python2.7/dist-packages/transmissionrpc/utils.py", line 153, in argument_value_convert
    return (argument, TR_TYPE_MAP[info[0]](value))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 13-18: ordinal not in range(128)
RicterZ commented 6 years ago

我回深圳看看(x Silver Bullet notifications@github.com于2017年11月3日 周五下午11:13写道:

很dirty的动了动源码,找到了爆点:

Traceback (most recent call last): File "/usr/local/bin/bgmi", line 11, in load_entry_point('bgmi==2.0.1', 'console_scripts', 'bgmi')() File "/usr/local/lib/python2.7/dist-packages/bgmi/main.py", line 152, in main controllers(ret) File "/usr/local/lib/python2.7/dist-packages/bgmi/cli.py", line 202, in controllers return func(ret) File "/usr/local/lib/python2.7/dist-packages/bgmi/cli.py", line 155, in update_wrapper update(name=ret.name, download=ret.download, not_ignore=ret.not_ignore) File "/usr/local/lib/python2.7/dist-packages/bgmi/controllers.py", line 339, in update download_prepare(download_queue) File "/usr/local/lib/python2.7/dist-packages/bgmi/download.py", line 55, in download_prepare download_class.download() File "/usr/local/lib/python2.7/dist-packages/bgmi/services.py", line 115, in download tc.add_torrent(self.torrent, download_dir=self.save_path) File "/usr/local/lib/python2.7/dist-packages/transmissionrpc/client.py", line 414, in add_torrent (arg, val) = argument_value_convert('torrent-add', argument, value, self.rpc_version) File "/usr/local/lib/python2.7/dist-packages/transmissionrpc/utils.py", line 153, in argument_value_convert return (argument, TR_TYPE_MAPinfo[0]) UnicodeEncodeError: 'ascii' codec can't encode characters in position 13-18: ordinal not in range(128)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/RicterZ/BGmi/issues/103#issuecomment-341732294, or mute the thread https://github.com/notifications/unsubscribe-auth/AFCbxyQv8OjcS_KNN9fgn-P6dZ7EB6-uks5syy2qgaJpZM4QQx9t .

-- Ricter Z

SilverBut commented 6 years ago

我回深圳看看(x

@RicterZ 好,rtx联系(误

莫慌,我找找看

RicterZ commented 6 years ago

按理说都是unicode的,看 log 可能是 transmission 的锅,不过还是要具体看看 Silver Bullet notifications@github.com于2017年11月3日 周五下午11:15写道:

我回深圳看看(x

@RicterZ https://github.com/ricterz 好,rtx联系(误

莫慌,我找找看

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/RicterZ/BGmi/issues/103#issuecomment-341732904, or mute the thread https://github.com/notifications/unsubscribe-auth/AFCbx2WLFRoDNufAxuazjCrWTHJTu9X4ks5syy4ggaJpZM4QQx9t .

-- Ricter Z

SilverBut commented 6 years ago

和py版本是否有关系? 我这边是python2

RicterZ commented 6 years ago

应该无关的,但是有时候 3 就没问题(x

Silver Bullet notifications@github.com于2017年11月3日 周五下午11:19写道:

和py版本是否有关系? 我这边是python2

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/RicterZ/BGmi/issues/103#issuecomment-341734017, or mute the thread https://github.com/notifications/unsubscribe-auth/AFCbxytHQOoamrHpglKgXhXyTXoFvNPNks5syy78gaJpZM4QQx9t .

-- Ricter Z

SilverBut commented 6 years ago

暂时换用了python3,正常

RicterZ commented 6 years ago

传入 unicode 的时候, transmission-rpc 用 str(value) 这种导致报错,.encode('utf-8') 即可..