mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -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>02</td>
|
||||
</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">
|
||||
<td class="align-right"><b>Episode Number:</b></td>
|
||||
<td>%E</td>
|
||||
@ -338,6 +348,16 @@
|
||||
<td>%0E</td>
|
||||
<td>03</td>
|
||||
</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">
|
||||
<td class="align-right"><b>Episode Name:</b></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
|
||||
#
|
||||
# This file is part of Sick Beard.
|
||||
@ -15,64 +17,55 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# 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
|
||||
from sickbeard import logger
|
||||
from sickbeard.clients.generic import GenericClient
|
||||
|
||||
|
||||
class DownloadStationAPI(GenericClient):
|
||||
|
||||
|
||||
def __init__(self, host=None, username=None, password=None):
|
||||
|
||||
|
||||
super(DownloadStationAPI, self).__init__('DownloadStation', host, username, password)
|
||||
|
||||
|
||||
self.url = self.host + 'webapi/DownloadStation/task.cgi'
|
||||
|
||||
def _get_auth(self):
|
||||
|
||||
params = {'api': 'SYNO.API.Auth',
|
||||
'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)
|
||||
|
||||
if not self.response.json["success"]:
|
||||
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'
|
||||
|
||||
try:
|
||||
self.response = self.session.get(auth_url)
|
||||
self.auth = self.response.json()['data']['sid']
|
||||
except:
|
||||
return None
|
||||
|
||||
self.auth = self.response.json["data"]["sid"]
|
||||
|
||||
return self.auth
|
||||
|
||||
def _add_torrent_uri(self, result):
|
||||
|
||||
params = {'api': 'SYNO.DownloadStation.Task',
|
||||
'version': '1',
|
||||
'method': 'create',
|
||||
'_sid': self.auth,
|
||||
'uri': result.url,
|
||||
}
|
||||
|
||||
self._request(method='get', params=params)
|
||||
|
||||
return self.response.json["success"]
|
||||
|
||||
data = {'api':'SYNO.DownloadStation.Task',
|
||||
'version':'1', 'method':'create',
|
||||
'session':'DownloadStation',
|
||||
'_sid':self.auth,
|
||||
'uri':result.url
|
||||
}
|
||||
self._request(method='post', data=data)
|
||||
|
||||
return self.response.json()['success']
|
||||
|
||||
def _add_torrent_file(self, result):
|
||||
|
||||
params = {'api': 'SYNO.DownloadStation.Task',
|
||||
'version': '1',
|
||||
'method': 'create',
|
||||
'_sid': self.auth,
|
||||
'file': 'tv.torrent',
|
||||
}
|
||||
|
||||
self._request(method='get', params=params, files={'file': result.content})
|
||||
|
||||
return self.response.json["success"]
|
||||
|
||||
data = {'api':'SYNO.DownloadStation.Task',
|
||||
'version':'1',
|
||||
'method':'create',
|
||||
'session':'DownloadStation',
|
||||
'_sid':self.auth
|
||||
}
|
||||
files = {'file':(result.name + '.torrent', result.content)}
|
||||
self._request(method='post', data=data, files=files)
|
||||
|
||||
return self.response.json()['success']
|
||||
|
||||
api = DownloadStationAPI()
|
Loading…
Reference in New Issue
Block a user