-
Notifications
You must be signed in to change notification settings - Fork 3
unquote filename from magnet on % symbol #1
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
Conversation
|
It's been a while since I looked at this, can you summarise the differences in output, and give examples? |
|
Before fix:
python3 Magnet2Torrent.py -m
"magnet:?xt=urn:btih:6e6d4def0214208465435d42def8e073aa26b09c&dn=%5BHorribleSubs%5D%20Shingeki%20no%20Kyojin%20S2%20-%2032%20%5B720p%5D.mkv&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969%2Fannounce&tr=http%3A%2F%2Ftracker.internetwarriors.net%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=http%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.zer0day.to%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.pirateparty.gr%3A6969%2Fannounce&tr=http%3A%2F%2Fexplodie.org%3A6969%2Fannounce&tr=http%3A%2F%2Fp4p.arenabg.com%3A1337%2Fannounce&tr=http%3A%2F%2Fmgtracker.org%3A6969%2Fannounce"
_frozen_importlib:222: RuntimeWarning: to-Python converter for
boost::shared_ptralready registered; second conversion method ignored.
Downloading Metadata (this may take a while)
Done
Saving torrent file here :
/home/person/magnet2torrent_fix/%5BHorribleSubs%5D%20Shingeki%20no%20Kyojin%20S2%20-%2032%20%5B720p%5D.mkv.torrent
...
Saved! Cleaning up dir: /tmp/tmpp7euxh5k
After fix:
python3 Magnet2Torrent.py -m
"magnet:?xt=urn:btih:6e6d4def0214208465435d42def8e073aa26b09c&dn=%5BHorribleSubs%5D%20Shingeki%20no%20Kyojin%20S2%20-%2032%20%5B720p%5D.mkv&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969%2Fannounce&tr=http%3A%2F%2Ftracker.internetwarriors.net%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=http%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.zer0day.to%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.pirateparty.gr%3A6969%2Fannounce&tr=http%3A%2F%2Fexplodie.org%3A6969%2Fannounce&tr=http%3A%2F%2Fp4p.arenabg.com%3A1337%2Fannounce&tr=http%3A%2F%2Fmgtracker.org%3A6969%2Fannounce"
_frozen_importlib:222: RuntimeWarning: to-Python converter for
boost::shared_ptralready registered; second conversion method ignored.
Downloading Metadata (this may take a while)
Done
Saving torrent file here :
/home/person/magnet2torrent_fix/[HorribleSubs] Shingeki no Kyojin S2- 32
[720p].mkv.torrent ... Saved!
Cleaning up dir: /tmp/tmps1gmecte
…On 13/05/17 18:09, Charles Pigott wrote:
It's been a while since I looked at this, can you summarise the
differences in output?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APBPc2NTwPpQAtjkYA5h4l7EjMLLgJAiks5r5dWzgaJpZM4NaGE9>.
|
Magnet2Torrent.py
Outdated
| if '%' in output_name: | ||
| output_name = unquote(output_name) | ||
| output_name += '.torrent' | ||
| try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we will run the script as such:
Magnet2Torrent.py -m <our magnet without dn parameter>
The script will return with IndexError. I changed the program operation, to proceed if dn field is not present and set torrent name from torrent field.
| output = pt.abspath(self.output_name) | ||
| else: | ||
| output = pt.abspath(torinfo.name() + ".torrent") | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If self.output_name is None, set the torrent name from the torrent handle.
|
hi @szero i just realize that you have already create pull request for your fix. i add 2 little edit to it. after that @LordAro can merge it with upstream branch from @danfolkes. but, should i add pr to your branch first? |
|
@rachmadaniHaryono thanks for interest in this. I have some uncommitted changes because this PR wasn't merged yet. It adds better handling for cases with pluses in magnet. Here is my patch: |
|
@szero ok i will cancel my other pr, add the patch and my commits to your branch first so it can be merged on this pr. |
- use python3 interpreter - use unquote_plus instead of unquote
Feature/add fix
I noticed that program doesn't properly unquote filenames if we want to use filename contained in magnet itself. It won't unquote filenames that don't contain
+symbol. Since escape character for space is%20, I think it makes more sense to unquote if the filename contains%symbol.