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
89426d75
Commit
89426d75
authored
Sep 8, 2012
by
Ruud
Browse files
Options
Downloads
Patches
Plain Diff
Use multiple torrent sources to convert hash. fix #802
parent
89c295b4
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
+17
-7
17 additions, 7 deletions
couchpotato/core/downloaders/base.py
with
17 additions
and
7 deletions
couchpotato/core/downloaders/base.py
+
17
−
7
View file @
89426d75
...
@@ -5,15 +5,22 @@ from couchpotato.core.logger import CPLog
...
@@ -5,15 +5,22 @@ from couchpotato.core.logger import CPLog
from
couchpotato.core.plugins.base
import
Plugin
from
couchpotato.core.plugins.base
import
Plugin
from
couchpotato.environment
import
Env
from
couchpotato.environment
import
Env
import
os
import
os
import
random
import
re
import
re
import
traceback
log
=
CPLog
(
__name__
)
log
=
CPLog
(
__name__
)
class
Downloader
(
Plugin
):
class
Downloader
(
Plugin
):
type
=
[]
type
=
[]
torrent_sources
=
[
'
http://torrage.com/torrent/%s.torrent
'
,
'
http://torrage.ws/torrent/%s.torrent
'
,
'
http://torcache.net/torrent/%s.torrent
'
,
]
def
__init__
(
self
):
def
__init__
(
self
):
addEvent
(
'
download
'
,
self
.
download
)
addEvent
(
'
download
'
,
self
.
download
)
addEvent
(
'
download.status
'
,
self
.
getDownloadStatus
)
addEvent
(
'
download.status
'
,
self
.
getDownloadStatus
)
...
@@ -55,14 +62,17 @@ class Downloader(Plugin):
...
@@ -55,14 +62,17 @@ class Downloader(Plugin):
if
len
(
torrent_hash
)
==
32
:
if
len
(
torrent_hash
)
==
32
:
torrent_hash
=
b16encode
(
b32decode
(
torrent_hash
))
torrent_hash
=
b16encode
(
b32decode
(
torrent_hash
))
url
=
'
http://torrage.com/torrent/%s.torrent
'
%
torrent_hash
sources
=
self
.
torrent_sources
random
.
shuffle
(
sources
)
for
source
in
sources
:
try
:
try
:
filedata
=
self
.
urlopen
(
url
)
filedata
=
self
.
urlopen
(
source
%
torrent_hash
,
show_error
=
False
)
return
filedata
return
filedata
except
:
except
:
log
.
error
(
'
Failed converting magnet url to torrent: %s, %s
'
,
(
url
,
traceback
.
format_exc
()
))
log
.
debug
(
'
Torrent hash
"
%s
"
wasn
\'
t found on: %s
'
,
(
torrent_hash
,
source
))
log
.
error
(
'
Failed converting magnet url to torrent: %s
'
,
(
torrent_hash
))
return
False
return
False
def
isDisabled
(
self
,
manual
):
def
isDisabled
(
self
,
manual
):
...
...
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