Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CouchPotatoServer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
CouchPotatoServer
Commits
c65e31cf
Commit
c65e31cf
authored
Aug 28, 2012
by
Ruud
Browse files
Options
Downloads
Patches
Plain Diff
PublicHD magnet link returns base32 encode. fix #766
parent
2d5481b8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
couchpotato/core/downloaders/base.py
+7
-1
7 additions, 1 deletion
couchpotato/core/downloaders/base.py
with
7 additions
and
1 deletion
couchpotato/core/downloaders/base.py
+
7
−
1
View file @
c65e31cf
from
base64
import
b32decode
,
b16encode
from
couchpotato.core.event
import
addEvent
from
couchpotato.core.event
import
addEvent
from
couchpotato.core.helpers.encoding
import
toSafeString
from
couchpotato.core.helpers.encoding
import
toSafeString
from
couchpotato.core.logger
import
CPLog
from
couchpotato.core.logger
import
CPLog
...
@@ -48,7 +49,12 @@ class Downloader(Plugin):
...
@@ -48,7 +49,12 @@ class Downloader(Plugin):
return
is_correct
return
is_correct
def
magnetToTorrent
(
self
,
magnet_link
):
def
magnetToTorrent
(
self
,
magnet_link
):
torrent_hash
=
re
.
findall
(
'
urn:btih:([\w]{40})
'
,
magnet_link
)[
0
]
torrent_hash
=
re
.
findall
(
'
urn:btih:([\w]{32,40})
'
,
magnet_link
)[
0
]
# Convert base 32 to hex
if
len
(
torrent_hash
)
==
32
:
torrent_hash
=
b16encode
(
b32decode
(
torrent_hash
))
url
=
'
http://torrage.com/torrent/%s.torrent
'
%
torrent_hash
url
=
'
http://torrage.com/torrent/%s.torrent
'
%
torrent_hash
try
:
try
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment