mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-17 14:55:07 -05:00
Fix for DownloadStation issues.
Added season and episode formatting options for XEM scene numbering.
This commit is contained in:
parent
4f049f4e7e
commit
abc6841eb3
@ -328,6 +328,16 @@
|
|||||||
<td>%0S</td>
|
<td>%0S</td>
|
||||||
<td>02</td>
|
<td>02</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td class="align-right"><b>XEM Season Number:</b></td>
|
||||||
|
<td>%XMS</td>
|
||||||
|
<td>2</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td>%0XMS</td>
|
||||||
|
<td>02</td>
|
||||||
|
</tr>
|
||||||
<tr class="even">
|
<tr class="even">
|
||||||
<td class="align-right"><b>Episode Number:</b></td>
|
<td class="align-right"><b>Episode Number:</b></td>
|
||||||
<td>%E</td>
|
<td>%E</td>
|
||||||
@ -338,6 +348,16 @@
|
|||||||
<td>%0E</td>
|
<td>%0E</td>
|
||||||
<td>03</td>
|
<td>03</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td class="align-right"><b>XEM Episode Number:</b></td>
|
||||||
|
<td>%XME</td>
|
||||||
|
<td>3</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td>%0XME</td>
|
||||||
|
<td>03</td>
|
||||||
|
</tr>
|
||||||
<tr class="even">
|
<tr class="even">
|
||||||
<td class="align-right"><b>Episode Name:</b></td>
|
<td class="align-right"><b>Episode Name:</b></td>
|
||||||
<td>%EN</td>
|
<td>%EN</td>
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
# Authors: Mr_Orange & Jens Timmerman <jens.timmerman@gmail.com>
|
# Authors:
|
||||||
|
# Pedro Jose Pereira Vieito <pvieito@gmail.com> (Twitter: @pvieito)
|
||||||
|
#
|
||||||
# URL: https://github.com/mr-orange/Sick-Beard
|
# URL: https://github.com/mr-orange/Sick-Beard
|
||||||
#
|
#
|
||||||
# This file is part of Sick Beard.
|
# This file is part of Sick Beard.
|
||||||
@ -15,12 +17,12 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# Uses the Synology Download Station API: http://download.synology.com/download/other/Synology_Download_Station_Official_API_V3.pdf.
|
||||||
|
|
||||||
import sickbeard
|
import sickbeard
|
||||||
from sickbeard import logger
|
|
||||||
from sickbeard.clients.generic import GenericClient
|
from sickbeard.clients.generic import GenericClient
|
||||||
|
|
||||||
|
|
||||||
class DownloadStationAPI(GenericClient):
|
class DownloadStationAPI(GenericClient):
|
||||||
|
|
||||||
def __init__(self, host=None, username=None, password=None):
|
def __init__(self, host=None, username=None, password=None):
|
||||||
@ -31,48 +33,39 @@ class DownloadStationAPI(GenericClient):
|
|||||||
|
|
||||||
def _get_auth(self):
|
def _get_auth(self):
|
||||||
|
|
||||||
params = {'api': 'SYNO.API.Auth',
|
auth_url = self.host + 'webapi/auth.cgi?api=SYNO.API.Auth&version=2&method=login&account=' + self.username + '&passwd=' + self.password + '&session=DownloadStation&format=sid'
|
||||||
'version': '2',
|
|
||||||
'method': 'login',
|
|
||||||
'account': self.username,
|
|
||||||
'passwd': self.password,
|
|
||||||
'session': 'SickBeard',
|
|
||||||
'format': 'sid',
|
|
||||||
}
|
|
||||||
|
|
||||||
self.response = self.session.get(self.host + 'webapi/auth.cgi', params=params)
|
try:
|
||||||
|
self.response = self.session.get(auth_url)
|
||||||
if not self.response.json["success"]:
|
self.auth = self.response.json()['data']['sid']
|
||||||
|
except:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
self.auth = self.response.json["data"]["sid"]
|
|
||||||
|
|
||||||
return self.auth
|
return self.auth
|
||||||
|
|
||||||
def _add_torrent_uri(self, result):
|
def _add_torrent_uri(self, result):
|
||||||
|
|
||||||
params = {'api': 'SYNO.DownloadStation.Task',
|
data = {'api':'SYNO.DownloadStation.Task',
|
||||||
'version': '1',
|
'version':'1', 'method':'create',
|
||||||
'method': 'create',
|
'session':'DownloadStation',
|
||||||
'_sid': self.auth,
|
'_sid':self.auth,
|
||||||
'uri': result.url,
|
'uri':result.url
|
||||||
}
|
}
|
||||||
|
self._request(method='post', data=data)
|
||||||
|
|
||||||
self._request(method='get', params=params)
|
return self.response.json()['success']
|
||||||
|
|
||||||
return self.response.json["success"]
|
|
||||||
|
|
||||||
def _add_torrent_file(self, result):
|
def _add_torrent_file(self, result):
|
||||||
|
|
||||||
params = {'api': 'SYNO.DownloadStation.Task',
|
data = {'api':'SYNO.DownloadStation.Task',
|
||||||
'version': '1',
|
'version':'1',
|
||||||
'method': 'create',
|
'method':'create',
|
||||||
'_sid': self.auth,
|
'session':'DownloadStation',
|
||||||
'file': 'tv.torrent',
|
'_sid':self.auth
|
||||||
}
|
}
|
||||||
|
files = {'file':(result.name + '.torrent', result.content)}
|
||||||
|
self._request(method='post', data=data, files=files)
|
||||||
|
|
||||||
self._request(method='get', params=params, files={'file': result.content})
|
return self.response.json()['success']
|
||||||
|
|
||||||
return self.response.json["success"]
|
|
||||||
|
|
||||||
api = DownloadStationAPI()
|
api = DownloadStationAPI()
|
Loading…
Reference in New Issue
Block a user