Skip to content

Incompatibility with Libtorrent version 1.1.3 and above #1983

@andocromn

Description

@andocromn

Actual behaviour:

flexget crashes when converting magnet URI to a torrent file with libtorrent versions 1.1.3 and higher

Steps to reproduce:

upgrade libtorrent to 1.1.3 or higher (I'm using 1.1.4 but the change occurred in 1.1.3)
download torrent with convert_magnet plugin

Config:

tasks:
  stage:
    convert_magnet: yes
    rss: http://xxx.xxx/rss
    accept_all: yes
    download:
      path: /home/flexget/test/

Log:

2017-10-09 15:36 VERBOSE  task_queue                    There are 1 tasks to execute. Shutdown will commence when they have completed.
2017-10-09 15:36 VERBOSE  details       stage           Produced 74 entries.
2017-10-09 15:36 INFO     series        stage           identified_by has locked in to type `ep` for Lucifer
2017-10-09 15:36 VERBOSE  task          stage           ACCEPTED: `Lucifer S03E02 1080p HDTV X264 DIMENSION` by series plugin because choosing best available quality
2017-10-09 15:36 VERBOSE  task          stage           ACCEPTED: `Lucifer S03E01 1080p HDTV X264 DIMENSION` by series plugin because choosing best available quality
2017-10-09 15:36 INFO     convert_magnet stage           Converting entry Lucifer S03E02 1080p HDTV X264 DIMENSION magnet URI to a torrent file
2017-10-09 15:36 INFO     convert_magnet stage           lt_ver caught
2017-10-09 15:36 CRITICAL task          stage           BUG: Unhandled error in plugin convert_magnet: 'str' object has no attribute 'to_bytes'
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flexget/task.py", line 486, in __run_plugin
    return method(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flexget/event.py", line 23, in __call__
    return self.func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flexget/plugins/modify/convert_magnet.py", line 93, in on_task_download
    torrent_file = self.magnet_to_torrent(entry['url'], converted_path, timeout)
  File "/usr/local/lib/python2.7/dist-packages/flexget/plugins/modify/convert_magnet.py", line 41, in magnet_to_torrent
    params['info_hash'] = params['info_hash'].to_bytes()
AttributeError: 'str' object has no attribute 'to_bytes'

Additional information:

  • FlexGet version: 2.10.97
  • Python version: 2.7.13
  • Installation method: pip
  • Using daemon (yes/no): no
  • OS and version: Debian Stretch 9.1
  • Link to crash log: see above

flexget/plugins/modify/convert_magnet.py line 40 converts the info_hash to bytes if the libtorrent version is above 0.16.13. The comments seem to indicate this was done as a work around because the info_hash value did not comply with the defined structure. according to the release notes on libtorrent v1.1.3 this has been corrected, info_hash is now a string value which does not contain the attribute to_bytes, this causes the crash. Since the underlying issue in libtorrent has been corrected, the info_hash value can be used as is without converting to_bytes if the libtorrent versions above 1.1.3. Standby for PR

References:

https://github.com/arvidn/libtorrent/releases/tag/libtorrent-1_1_3
arvidn/libtorrent@2e367ea

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions