Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SickRage-1
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
SickRage-1
Commits
6d75a489
Commit
6d75a489
authored
Oct 23, 2015
by
Nick Sologoub
Browse files
Options
Downloads
Patches
Plain Diff
[*] Fixed no results detection for Torrentbytes
[*] Added torrent size parsing for Torrentbytes
parent
25b3bcf9
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
sickbeard/providers/torrentbytes.py
+30
-9
30 additions, 9 deletions
sickbeard/providers/torrentbytes.py
with
30 additions
and
9 deletions
sickbeard/providers/torrentbytes.py
+
30
−
9
View file @
6d75a489
# Author: Idan Gutman
# Author: Idan Gutman
# URL: http://code.google.com/p/sickbeard/
# URL: http://code.google.com/p/sickbeard/
#
#
# This file is part of SickRage.
# This file is part of SickRage.
...
@@ -98,17 +98,18 @@ class TorrentBytesProvider(generic.TorrentProvider):
...
@@ -98,17 +98,18 @@ class TorrentBytesProvider(generic.TorrentProvider):
try
:
try
:
with
BS4Parser
(
data
,
features
=
[
"
html5lib
"
,
"
permissive
"
])
as
html
:
with
BS4Parser
(
data
,
features
=
[
"
html5lib
"
,
"
permissive
"
])
as
html
:
torrent_table
=
html
.
find
(
'
table
'
,
attrs
=
{
'
border
'
:
'
1
'
})
torrent_rows
=
torrent_table
.
find_all
(
'
tr
'
)
if
torrent_table
else
[]
#Continue only if one Release is found
#Continue only if one Release is found
if
len
(
torrent_rows
)
<
2
:
empty
=
html
.
find
(
'
Nothing found!
'
)
if
empty
:
logger
.
log
(
u
"
Data returned from provider does not contain any torrents
"
,
logger
.
DEBUG
)
logger
.
log
(
u
"
Data returned from provider does not contain any torrents
"
,
logger
.
DEBUG
)
continue
continue
torrent_table
=
html
.
find
(
'
table
'
,
attrs
=
{
'
border
'
:
'
1
'
})
torrent_rows
=
torrent_table
.
find_all
(
'
tr
'
)
if
torrent_table
else
[]
for
result
in
torrent_rows
[
1
:]:
for
result
in
torrent_rows
[
1
:]:
cells
=
result
.
find_all
(
'
td
'
)
cells
=
result
.
find_all
(
'
td
'
)
size
=
None
link
=
cells
[
1
].
find
(
'
a
'
,
attrs
=
{
'
class
'
:
'
index
'
})
link
=
cells
[
1
].
find
(
'
a
'
,
attrs
=
{
'
class
'
:
'
index
'
})
full_id
=
link
[
'
href
'
].
replace
(
'
details.php?id=
'
,
''
)
full_id
=
link
[
'
href
'
].
replace
(
'
details.php?id=
'
,
''
)
...
@@ -122,8 +123,14 @@ class TorrentBytesProvider(generic.TorrentProvider):
...
@@ -122,8 +123,14 @@ class TorrentBytesProvider(generic.TorrentProvider):
download_url
=
self
.
urls
[
'
download
'
]
%
(
torrent_id
,
link
.
contents
[
0
])
download_url
=
self
.
urls
[
'
download
'
]
%
(
torrent_id
,
link
.
contents
[
0
])
seeders
=
int
(
cells
[
8
].
find
(
'
span
'
).
contents
[
0
])
seeders
=
int
(
cells
[
8
].
find
(
'
span
'
).
contents
[
0
])
leechers
=
int
(
cells
[
9
].
find
(
'
span
'
).
contents
[
0
])
leechers
=
int
(
cells
[
9
].
find
(
'
span
'
).
contents
[
0
])
#FIXME
# Need size for failed downloads handling
if
size
is
None
:
if
re
.
match
(
r
'
[0-9]+,?\.?[0-9]*[KkMmGg]+[Bb]+
'
,
cells
[
6
].
text
):
size
=
self
.
_convertSize
(
cells
[
6
].
text
)
if
not
size
:
size
=
-
1
size
=
-
1
except
(
AttributeError
,
TypeError
):
except
(
AttributeError
,
TypeError
):
continue
continue
...
@@ -155,6 +162,20 @@ class TorrentBytesProvider(generic.TorrentProvider):
...
@@ -155,6 +162,20 @@ class TorrentBytesProvider(generic.TorrentProvider):
def
seedRatio
(
self
):
def
seedRatio
(
self
):
return
self
.
ratio
return
self
.
ratio
def
_convertSize
(
self
,
sizeString
):
size
=
sizeString
[:
-
2
]
modifier
=
sizeString
[
-
2
:]
size
=
float
(
size
)
if
modifier
in
'
KB
'
:
size
=
size
*
1024
elif
modifier
in
'
MB
'
:
size
=
size
*
1024
**
2
elif
modifier
in
'
GB
'
:
size
=
size
*
1024
**
3
elif
modifier
in
'
TB
'
:
size
=
size
*
1024
**
4
return
int
(
size
)
class
TorrentBytesCache
(
tvcache
.
TVCache
):
class
TorrentBytesCache
(
tvcache
.
TVCache
):
def
__init__
(
self
,
provider_obj
):
def
__init__
(
self
,
provider_obj
):
...
...
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