Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SiCKRAGE
sickrage
Commits
4956499a
Commit
4956499a
authored
Nov 18, 2018
by
echel0n
Browse files
Refactored TorrentBytes provider.
parent
8a0fd2b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
changelog.md
View file @
4956499a
# Changelog
# Changelog
-
*
31a7f64 - 2018-11-18: Release v9.4.40
-
*
e29a2d2 - 2018-11-18: Refactored TorrentBytes provider.
-
*
735245c - 2018-11-18: Release v9.4.40
-
*
b538435 - 2018-11-18: Refactored network timezone functions.
-
*
b538435 - 2018-11-18: Refactored network timezone functions.
-
*
79d9ea1 - 2018-11-18: Fixed issue with database integrity checks.
-
*
79d9ea1 - 2018-11-18: Fixed issue with database integrity checks.
-
*
b005c24 - 2018-11-18: Refactored app to use pip2 instead of pip. Fixed issues with source upgrading.
-
*
b005c24 - 2018-11-18: Refactored app to use pip2 instead of pip. Fixed issues with source upgrading.
...
...
sickrage/providers/torrent/torrentbytes.py
View file @
4956499a
...
@@ -63,9 +63,8 @@ class TorrentBytesProvider(TorrentProvider):
...
@@ -63,9 +63,8 @@ class TorrentBytesProvider(TorrentProvider):
sickrage
.
app
.
log
.
warning
(
"Unable to connect to provider"
)
sickrage
.
app
.
log
.
warning
(
"Unable to connect to provider"
)
return
False
return
False
if
re
.
search
(
'Username or password incorrect'
,
response
):
if
'username or password incorrect'
in
response
.
lower
():
sickrage
.
app
.
log
.
warning
(
sickrage
.
app
.
log
.
warning
(
"Invalid username or password. Check your settings"
)
"Invalid username or password. Check your settings"
)
return
False
return
False
return
True
return
True
...
@@ -76,7 +75,13 @@ class TorrentBytesProvider(TorrentProvider):
...
@@ -76,7 +75,13 @@ class TorrentBytesProvider(TorrentProvider):
if
not
self
.
login
():
if
not
self
.
login
():
return
results
return
results
search_params
=
{
"c33"
:
1
,
"c38"
:
1
,
"c32"
:
1
,
"c37"
:
1
,
"c41"
:
1
}
search_params
=
{
"c33"
:
1
,
"c38"
:
1
,
"c32"
:
1
,
"c37"
:
1
,
"c41"
:
1
}
for
mode
in
search_strings
:
for
mode
in
search_strings
:
sickrage
.
app
.
log
.
debug
(
"Search Mode: %s"
%
mode
)
sickrage
.
app
.
log
.
debug
(
"Search Mode: %s"
%
mode
)
...
@@ -114,11 +119,13 @@ class TorrentBytesProvider(TorrentProvider):
...
@@ -114,11 +119,13 @@ class TorrentBytesProvider(TorrentProvider):
return
results
return
results
# "Type", "Name", Files", "Comm.", "Added", "TTL", "Size", "Snatched", "Seeders", "Leechers"
# "Type", "Name", Files", "Comm.", "Added", "TTL", "Size", "Snatched", "Seeders", "Leechers"
labels
=
[
label
.
get_text
(
strip
=
True
)
for
label
in
torrent_rows
[
0
](
"
td
"
)]
labels
=
[
label
.
get_text
(
strip
=
True
)
for
label
in
torrent_rows
[
0
](
'
td
'
)]
for
result
in
torrent_rows
[
1
:]:
for
result
in
torrent_rows
[
1
:]:
try
:
try
:
cells
=
result
(
"td"
)
cells
=
result
(
'td'
)
if
len
(
cells
)
<
len
(
labels
):
continue
link
=
cells
[
labels
.
index
(
"Name"
)].
find
(
"a"
,
href
=
re
.
compile
(
r
"download.php\?id="
))[
"href"
]
link
=
cells
[
labels
.
index
(
"Name"
)].
find
(
"a"
,
href
=
re
.
compile
(
r
"download.php\?id="
))[
"href"
]
download_url
=
urljoin
(
self
.
urls
[
'base_url'
],
link
)
download_url
=
urljoin
(
self
.
urls
[
'base_url'
],
link
)
...
@@ -136,12 +143,17 @@ class TorrentBytesProvider(TorrentProvider):
...
@@ -136,12 +143,17 @@ class TorrentBytesProvider(TorrentProvider):
seeders
=
try_int
(
cells
[
labels
.
index
(
"Seeders"
)].
get_text
(
strip
=
True
))
seeders
=
try_int
(
cells
[
labels
.
index
(
"Seeders"
)].
get_text
(
strip
=
True
))
leechers
=
try_int
(
cells
[
labels
.
index
(
"Leechers"
)].
get_text
(
strip
=
True
))
leechers
=
try_int
(
cells
[
labels
.
index
(
"Leechers"
)].
get_text
(
strip
=
True
))
torrent_size
=
cells
[
labels
.
index
(
"Size"
)].
get_text
(
strip
=
True
)
torrent_size
=
cells
[
labels
.
index
(
"Size"
)].
get_text
(
strip
=
True
)
size
=
convert_size
(
torrent_size
,
-
1
)
size
=
convert_size
(
torrent_size
,
-
1
)
results
+=
[
results
+=
[{
{
'title'
:
title
,
'link'
:
download_url
,
'size'
:
size
,
'seeders'
:
seeders
,
'leechers'
:
leechers
}
'title'
:
title
,
]
'link'
:
download_url
,
'size'
:
size
,
'seeders'
:
seeders
,
'leechers'
:
leechers
}]
if
mode
!=
"RSS"
:
if
mode
!=
"RSS"
:
sickrage
.
app
.
log
.
debug
(
"Found result: {}"
.
format
(
title
))
sickrage
.
app
.
log
.
debug
(
"Found result: {}"
.
format
(
title
))
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment