Filename too long with magnet and watchdir

Post any problems / bugs / issues that are Mylar-related in here.
Post Reply
TVS2021
Posts: 6
Joined: Sun Jun 20, 2021 12:20 pm

Filename too long with magnet and watchdir

Post by TVS2021 »

I've setup Mylar to save Torrents/Magnets it finds to a watchdir where another software picks it up and does its thing.

Unfortunately, it looks like Mylar wants to create a file named after the magnet url. Apparently, it's too long.

Code: Select all

INFO    :: mylar.searcher.3558 : SEARCH-QUEUE : Found DC Pride (2021) using LimeTorrents (torznab)
INFO    :: mylar.torsend2client.971 : SEARCH-QUEUE : matched on DC Pride
INFO    :: mylar.torsend2client.1135 : SEARCH-QUEUE : Got a magnet url from redirect.
ERROR   :: mylar.searchforissue.3202 : SEARCH-QUEUE : Traceback (most recent call last):
  File "/app/mylar3/mylar/search.py", line 3130, in searchforissue
    foundNZB, prov = search_init(
  File "/app/mylar3/mylar/search.py", line 520, in search_init
    findit = NZB_SEARCH(
  File "/app/mylar3/mylar/search.py", line 2440, in NZB_SEARCH
    searchresult = searcher(
  File "/app/mylar3/mylar/search.py", line 3936, in searcher
    rcheck = rsscheck.torsend2client(
  File "/app/mylar3/mylar/rsscheck.py", line 1300, in torsend2client
    torrent_info = helpers.get_the_hash(filepath)
  File "/app/mylar3/mylar/helpers.py", line 3440, in get_the_hash
    torrent_file = open(filepath, "rb")
OSError: [Errno 36] Filename too long: 'magnet:?xt=urn:btih:F3DD27229E83B84984969DC2FA7731C26E836EDC&dn=DC+Pride+001+%282021%29+%28digital%29+%28Son+of+Ultron-Empire%29+cbr&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fretracker.lanta-net.ru%3A2710%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.cyberia.is%3A6969%2Fannounce&tr=udp%3A%2F%2Fipv4.tracker.harry.lu%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce&tr=udp%3A%2F%2Fipv6.tracker.harry.lu%3A80%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2710%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.open-internet.nl%3A6969%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.si%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.pirateparty.gr%3A6969%2Fannounce&tr=udp%3A%2F%2Fdenis.stalker.upeer.me%3A6969%2Fannounce&tr=udp%3A%2F%2Fp4p.arenabg.com%3A1337%2Fannounce'
Traceback (most recent call last):
  File "/app/mylar3/mylar/search.py", line 3130, in searchforissue
    foundNZB, prov = search_init(
  File "/app/mylar3/mylar/search.py", line 520, in search_init
    findit = NZB_SEARCH(
  File "/app/mylar3/mylar/search.py", line 2440, in NZB_SEARCH
    searchresult = searcher(
  File "/app/mylar3/mylar/search.py", line 3936, in searcher
    rcheck = rsscheck.torsend2client(
  File "/app/mylar3/mylar/rsscheck.py", line 1300, in torsend2client
    torrent_info = helpers.get_the_hash(filepath)
  File "/app/mylar3/mylar/helpers.py", line 3440, in get_the_hash
    torrent_file = open(filepath, "rb")
OSError: [Errno 36] Filename too long: 'magnet:?xt=urn:btih:F3DD27229E83B84984969DC2FA7731C26E836EDC&dn=DC+Pride+001+%282021%29+%28digital%29+%28Son+of+Ultron-Empire%29+cbr&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fretracker.lanta-net.ru%3A2710%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.cyberia.is%3A6969%2Fannounce&tr=udp%3A%2F%2Fipv4.tracker.harry.lu%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce&tr=udp%3A%2F%2Fipv6.tracker.harry.lu%3A80%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2710%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.open-internet.nl%3A6969%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.si%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.pirateparty.gr%3A6969%2Fannounce&tr=udp%3A%2F%2Fdenis.stalker.upeer.me%3A6969%2Fannounce&tr=udp%3A%2F%2Fp4p.arenabg.com%3A1337%2Fannounce'
Besides the actual .torrent file, this watchdir also works with .magnet files which would be plain text file with the magnet url inside.
For testing purposes I created a file named

Code: Select all

magnet:?xt=urn:btih:F3DD27229E83B84984969DC2FA7731C26E836EDC&dn=DC+Pride+001+%282021%29+%28digital%29+%28Son+of+Ultron-Empire%29+cbr&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce
but my torrent watching software does not accept it.

So even if I found a way around the filename being too long it wouldn't help me.
Is there a way to configure Mylar to write .magnet files with the magnet url inside?

It's not a dealbreaking problem for me since I can always manually search for the files and add them from Jackett.
Mylar v0.5.3 running in a Docker on OpenMediaVault 4
User avatar
evilhero
Site Admin
Posts: 2883
Joined: Sat Apr 20, 2013 3:43 pm
Contact:

Re: Filename too long with magnet and watchdir

Post by evilhero »

The main problem is that Mylar doesn't handle magnet URL's at all. All the available options to send to the client (via api in Mylar) all rely on a torrent file, not the magnet link. So that's why Mylar needs to save the torrent as a file, so that it can send it to the client (or in this case to a watchdir I guess). There has never been a good conversion function / module /w/e that can convert a magent link into a .torrent file, so that's pretty much were the whole process stops unfortunately.

I've never heard of a .magnet file until just now. I still can't find much information on it other than it's the magnet url inside of a text file (which is what you've already said). We can probably make it so that it's able to write out a .magnet file - but I'm unsure as to how many torrent clients it would actually work for as I'm not sure how compatible it is vs. the magnet link itself.

What torrent client are you using that you're able to use magnet files in addition to links ?
TVS2021
Posts: 6
Joined: Sun Jun 20, 2021 12:20 pm

Re: Filename too long with magnet and watchdir

Post by TVS2021 »

evilhero wrote: Sun Jul 11, 2021 12:50 am I've never heard of a .magnet file until just now. I still can't find much information on it other than it's the magnet url inside of a text file (which is what you've already said).
I think, it's just that, nothing more. A workaround to share magnet links via files.
evilhero wrote: Sun Jul 11, 2021 12:50 am What torrent client are you using that you're able to use magnet files in addition to links ?
I don't use a torrent client, really. The watchdir is watched by another software that sends the torrent/magnet to an online service (and then once finished downloads it to the folder I specified in Mylar under “Folder location to monitor” under “Post-Processing”.) It's basically a Seedbox without the Seed part and it also doesn't provide an API as if it were a torrent client. I use the same setup for Sonarr and Radarr.
evilhero wrote: Sun Jul 11, 2021 12:50 am I'm unsure as to how many torrent clients it would actually work for as I'm not sure how compatible it is
Since Jackett does write a .magnet file to a blackhole directory, too, when set up, I would have thought it would be more common. :|
Mylar v0.5.3 running in a Docker on OpenMediaVault 4
Post Reply