From 412686d3365091bada426d77f789ebd34350ed96 Mon Sep 17 00:00:00 2001
From: PHD <phd59fr@gmail.com>
Date: Thu, 9 Nov 2017 08:51:31 +0100
Subject: [PATCH] Add Yggtorrent, remove T411, fix Cpasbien (#4118)

* Add midgetspy back to copywrite, because echelon sent a DMCA. (#3938)

* Show information in poster view in seperate DIV (#4011)

Added a new DIV to hold the show information.
This way custom CSS is more dynamic. And if original CSS is used, there is no harm.

* Revert "Show information in poster view in seperate DIV (#4011)" (#4016)

This reverts commit 72f937b3667166801ff595ea674a7877dd8b67cd.

* Add Yggtorrent, remove T411, fix Cpasbien

* Update __init__.py
---
 sickbeard/providers/cpasbien.py   |  2 +-
 sickbeard/providers/yggtorrent.py | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/sickbeard/providers/cpasbien.py b/sickbeard/providers/cpasbien.py
index bae40652c..8a756eb50 100644
--- a/sickbeard/providers/cpasbien.py
+++ b/sickbeard/providers/cpasbien.py
@@ -37,7 +37,7 @@ class CpasbienProvider(TorrentProvider):
         self.public = True
         self.minseed = None
         self.minleech = None
-        self.url = "http://www.cpasbien.cm"
+        self.url = "http://www.cpasbien.cx"
 
         self.proper_strings = ['PROPER', 'REPACK']
         self.cache = tvcache.TVCache(self)
diff --git a/sickbeard/providers/yggtorrent.py b/sickbeard/providers/yggtorrent.py
index c76533bdc..2c23e9f4c 100644
--- a/sickbeard/providers/yggtorrent.py
+++ b/sickbeard/providers/yggtorrent.py
@@ -1,5 +1,6 @@
 # coding=utf-8
 # Author: adaur <adaur.underground@gmail.com>
+# Contributor: PHD <phd59fr@gmail.com>
 #
 # URL: https://sickrage.github.io
 #
@@ -69,7 +70,13 @@ class YggTorrentProvider(TorrentProvider):  # pylint: disable=too-many-instance-
         }
 
         response = self.get_url(self.urls['login'], post_data=login_params, returns='text')
-        if response: # Yggtorrent return empty response if user is logged, so ...
+        if not response: # When you call /login if it's OK, it's return 200 with no body, i retry in main if it's logged !
+            response = self.get_url(self.url, returns='text')
+            if not response: # The provider is dead !!!
+                logger.log('Unable to connect to provider', logger.WARNING)
+                return False
+
+        if 'logout' not in response:
             logger.log('Invalid username or password. Check your settings', logger.WARNING)
             return False
 
@@ -92,6 +99,8 @@ class YggTorrentProvider(TorrentProvider):  # pylint: disable=too-many-instance-
 
                 try:
                     search_params = {
+                        'category': "2145",
+                        'subcategory' : "2184",
                         'q': re.sub(r'[()]', '', search_string)
                     }
                     data = self.get_url(self.urls['search'], params=search_params, returns='text')
-- 
GitLab