Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added DailyTvTorrents support #312

Closed
wants to merge 9 commits into from

5 participants

Harm van Tilborg Nic Wolfe arogl arabuli thezoggy
Harm van Tilborg

I've added support for DailyTvTorrents [1]. I've found a preliminary patch by someone else here on Github, but I'm unable to find that repository again :S. If that somebody ever comes across, please let me know.

Furthermore, it's a real quick hack, that works for me, hopefully for someone else too.

[1] http://www.dailytvtorrents.org/

Nic Wolfe
Owner

Woah, a torrent provider that supports backlog, nice!

The providers' XML parser has recently been changed from elementTree to minidom which will probably break this provider if it is passing or expecting eTree objects anywhere. You can see some examples of how to change from etree to minidom here: 97b2df7

Harm van Tilborg

I'll be working on the minidom code sometime between now and next week :].

arogl

How does it handle exceptions e.g. "The River (2012)" has a feed of "the-river"?
Can we add such exceptions, or do we need to let DailyTvTorrents know?

arabuli

I don't know why but this is not working for me. When I try to launch it with python SickBeard.py it does nothing.

Harm van Tilborg
hvt commented

@arogl working on that, with some help :]

arogl

hvt, are you still working on this code?

Harm van Tilborg

No, most of my downloads are nzb based by now, so I haven't done any work on this anymore...

thezoggy

site is no longer, this can be closed:
2013-04-25: Sorry guys, our hosting provider kicked us out so we have to be offline for now. I’m very busy nowadays and I don’t have time to look for a new place. If you think you know a solution you can reach me here: richard@dailytvtorrents.org.

Nic Wolfe midgetspy closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
BIN  data/images/providers/dtt.gif
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 sickbeard/__init__.py
View
@@ -30,7 +30,7 @@
# apparently py2exe won't build these unless they're imported somewhere
from sickbeard import providers, metadata
-from providers import ezrss, tvtorrents, btn, nzbs_org, nzbmatrix, nzbsrus, newznab, womble, newzbin
+from providers import dtt, ezrss, tvtorrents, btn, nzbs_org, nzbmatrix, nzbsrus, newznab, womble, newzbin
from sickbeard import searchCurrent, searchBacklog, showUpdater, versionChecker, properFinder, autoPostProcesser
from sickbeard import helpers, db, exceptions, show_queue, search_queue, scheduler
@@ -150,6 +150,7 @@
DEFAULT_SEARCH_FREQUENCY = 60
+DTT = False
EZRSS = False
TVTORRENTS = False
TVTORRENTS_DIGEST = None
@@ -387,7 +388,7 @@ def initialize(consoleLogging=True):
USE_PLEX, PLEX_NOTIFY_ONSNATCH, PLEX_NOTIFY_ONDOWNLOAD, PLEX_UPDATE_LIBRARY, \
PLEX_SERVER_HOST, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, \
showUpdateScheduler, __INITIALIZED__, LAUNCH_BROWSER, showList, loadingShowList, \
- NZBS, NZBS_UID, NZBS_HASH, EZRSS, TVTORRENTS, TVTORRENTS_DIGEST, TVTORRENTS_HASH, BTN, BTN_USER_ID, BTN_AUTH_TOKEN, BTN_PASSKEY, BTN_AUTHKEY, TORRENT_DIR, USENET_RETENTION, SOCKET_TIMEOUT, \
+ NZBS, NZBS_UID, NZBS_HASH, DTT, EZRSS, TVTORRENTS, TVTORRENTS_DIGEST, TVTORRENTS_HASH, BTN, BTN_USER_ID, BTN_AUTH_TOKEN, BTN_PASSKEY, BTN_AUTHKEY, TORRENT_DIR, USENET_RETENTION, SOCKET_TIMEOUT, \
SEARCH_FREQUENCY, DEFAULT_SEARCH_FREQUENCY, BACKLOG_SEARCH_FREQUENCY, \
QUALITY_DEFAULT, SEASON_FOLDERS_FORMAT, SEASON_FOLDERS_DEFAULT, STATUS_DEFAULT, \
GROWL_NOTIFY_ONSNATCH, GROWL_NOTIFY_ONDOWNLOAD, TWITTER_NOTIFY_ONSNATCH, TWITTER_NOTIFY_ONDOWNLOAD, \
@@ -536,9 +537,11 @@ def initialize(consoleLogging=True):
KEEP_PROCESSED_DIR = check_setting_int(CFG, 'General', 'keep_processed_dir', 1)
MOVE_ASSOCIATED_FILES = check_setting_int(CFG, 'General', 'move_associated_files', 0)
- EZRSS = bool(check_setting_int(CFG, 'General', 'use_torrent', 0))
- if not EZRSS:
- EZRSS = bool(check_setting_int(CFG, 'EZRSS', 'ezrss', 0))
+ DTT = bool(check_setting_int(CFG, 'General', 'use_torrent', 0))
+ if not DTT:
+ DTT = bool(check_setting_int(CFG, 'DTT', 'dtt', 0))
+
+ EZRSS = bool(check_setting_int(CFG, 'EZRSS', 'ezrss', 0))
TVTORRENTS = bool(check_setting_int(CFG, 'TVTORRENTS', 'tvtorrents', 0))
TVTORRENTS_DIGEST = check_setting_str(CFG, 'TVTORRENTS', 'tvtorrents_digest', '')
@@ -1053,6 +1056,9 @@ def save_config():
new_config['Blackhole']['nzb_dir'] = NZB_DIR
new_config['Blackhole']['torrent_dir'] = TORRENT_DIR
+ new_config['DTT'] = {}
+ new_config['DTT']['dtt'] = int(DTT)
+
new_config['EZRSS'] = {}
new_config['EZRSS']['ezrss'] = int(EZRSS)
4 sickbeard/common.py
View
@@ -124,9 +124,9 @@ def nameQuality(name):
checkName = lambda list, func: func([re.search(x, name, re.I) for x in list])
- if checkName(["(pdtv|hdtv|dsr)\.(xvid|x264)"], all) and not checkName(["(720|1080)[pi]"], all):
+ if checkName(["(pdtv|hdtv|dsr).(xvid|x264)"], all) and not checkName(["(720|1080)[pi]"], all):
return Quality.SDTV
- elif checkName(["(dvdrip|bdrip)(\.ws)?\.(xvid|divx|x264)"], any) and not checkName(["(720|1080)[pi]"], all):
+ elif checkName(["(dvdrip|bdrip)(.ws)?.(xvid|divx|x264)"], any) and not checkName(["(720|1080)[pi]"], all):
return Quality.SDDVD
elif checkName(["720p", "hdtv", "x264"], all) or checkName(["hr.ws.pdtv.x264"], any):
return Quality.HDTV
3  sickbeard/databases/mainDB.py
View
@@ -102,7 +102,8 @@ def test(self):
4: 'eztv',
5: 'nzbmatrix',
6: 'tvnzb',
- 7: 'ezrss'}
+ 7: 'ezrss',
+ 8: 'dtt'}
def execute(self):
self.connection.action("ALTER TABLE history RENAME TO history_old")
3  sickbeard/notifiers/nma.py
View
@@ -1,6 +1,3 @@
-from httplib import HTTPSConnection
-from urllib import urlencode
-
import sickbeard
from sickbeard import logger, common
1  sickbeard/providers/__init__.py
View
@@ -24,6 +24,7 @@
'womble',
'newzbin',
'btn',
+ 'dtt',
]
import sickbeard
5 sickbeard/providers/btn.py
View
@@ -16,8 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
-import xml.etree.cElementTree as etree
-
import sickbeard
import generic
@@ -61,8 +59,7 @@ def _getRSSData(self):
def _parseItem(self, item):
- title = item.findtext('title')
- url = item.findtext('link')
+ (title, url) = self.provider._get_title_and_url(item)
if not title or not url:
logger.log(u"The XML returned from the BTN RSS feed is incomplete, this result is unusable", logger.ERROR)
133 sickbeard/providers/dtt.py
View
@@ -0,0 +1,133 @@
+# Author: Harm van Tilborg <harm@zeroxcool.net>
+# URL: https://github.com/hvt/Sick-Beard/tree/dtt
+#
+# This file is part of Sick Beard.
+#
+# Sick Beard is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Sick Beard is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
+
+import urllib
+import re
+
+from xml.dom.minidom import parseString
+
+import sickbeard
+import generic
+
+from sickbeard.common import Quality
+from sickbeard import logger
+from sickbeard import tvcache
+from sickbeard.helpers import sanitizeSceneName, get_xml_text
+from sickbeard.exceptions import ex
+
+class DTTProvider(generic.TorrentProvider):
+
+ def __init__(self):
+ generic.TorrentProvider.__init__(self, "DailyTvTorrents")
+ self.supportsBacklog = True
+ self.cache = DTTCache(self)
+ self.url = 'http://www.dailytvtorrents.org/rss/'
+
+ def isEnabled(self):
+ return sickbeard.DTT
+
+ def imageName(self):
+ return 'dtt.gif'
+
+ def getQuality(self, item):
+ url = item.getElementsByTagName('enclosure')[0].getAttribute('url')
+ quality = Quality.nameQuality(url)
+ return quality
+
+ def findSeasonResults(self, show, season):
+ if show.air_by_date:
+ logger.log(u"DTT doesn't support air-by-date backlog because of limitations on their RSS search.", logger.WARNING)
+ return {}
+
+ return generic.TorrentProvider.findSeasonResults(self, show, season)
+
+ def _dtt_show_id(self, show_name):
+ return sanitizeSceneName(show_name).replace('.','-').lower()
+
+ def _get_episode_search_strings(self, episode):
+ return self._get_season_search_strings(episode.show, episode.season)
+
+ def _get_season_search_strings(self, show, season):
+ seasons = show.episodes.keys()
+ if len(seasons) and season < max(seasons):
+ return [{'items': 'all'}]
+
+ return [{}]
+
+ def _doSearch(self, params, show=None):
+ show_id = self._dtt_show_id(show.name)
+
+ search_params = {"single": "yes"}
+
+ if params:
+ search_params.update(params)
+
+ searchURL = self.url + "show/" + show_id + "?" + urllib.urlencode(search_params)
+
+ logger.log(u"Search string: " + searchURL, logger.DEBUG)
+
+ data = self.getURL(searchURL)
+
+ if not data:
+ return []
+
+ try:
+ parsedXML = parseString(data)
+ items = parsedXML.getElementsByTagName('item')
+ except Exception, e:
+ logger.log(u"Error trying to load DTT RSS feed: "+ex(e), logger.ERROR)
+ logger.log(u"RSS data: "+data, logger.DEBUG)
+ return []
+
+ results = []
+
+ for curItem in items:
+ (title, url) = self._get_title_and_url(curItem)
+ results.append(curItem)
+
+ return results
+
+ def _get_title_and_url(self, item):
+ description_node = item.getElementsByTagName('description')[0]
+
+ title = get_xml_text(description_node).replace('_', '.').split(' (')[0]
+ url = item.getElementsByTagName('enclosure')[0].getAttribute('url')
+
+ return (title, url)
+
+class DTTCache(tvcache.TVCache):
+
+ def __init__(self, provider):
+ tvcache.TVCache.__init__(self, provider)
+
+ # only poll DTT every 30 minutes max
+ self.minTime = 30
+
+
+ def _getRSSData(self):
+ url = self.provider.url + 'allshows?single=yes'
+ logger.log(u"DTT cache update URL: "+ url, logger.DEBUG)
+ data = self.provider.getURL(url)
+ return data
+
+ def _parseItem(self, item):
+ title, url = self.provider._get_title_and_url(item)
+ logger.log(u"Adding item from RSS to cache: "+title, logger.DEBUG)
+ self._addCacheEntry(title, url)
+
+provider = DTTProvider()
4 sickbeard/providers/generic.py
View
@@ -191,7 +191,7 @@ def getQuality(self, item):
quality = Quality.nameQuality(title)
return quality
- def _doSearch(self):
+ def _doSearch(self, show=None):
return []
def _get_season_search_strings(self, show, season, episode=None):
@@ -281,7 +281,7 @@ def findSeasonResults(self, show, season):
results = {}
for curString in self._get_season_search_strings(show, season):
- itemList += self._doSearch(curString)
+ itemList += self._doSearch(curString, show=show)
for item in itemList:
2  sickbeard/tv.py
View
@@ -1269,7 +1269,7 @@ def __str__ (self):
def createMetaFiles(self, force=False):
- if not os.path.isdir(self.show._location):
+ if not ek.ek(os.path.isdir, self.show._location):
logger.log(str(self.show.tvdbid) + ": The show dir is missing, not bothering to try to create metadata")
return
2  sickbeard/webserve.py
View
@@ -1140,6 +1140,8 @@ def saveProviders(self, nzbs_org_uid=None, nzbs_org_hash=None,
sickbeard.WOMBLE = curEnabled
elif curProvider == 'ezrss':
sickbeard.EZRSS = curEnabled
+ elif curProvider == 'dailytvtorrents':
+ sickbeard.DTT = curEnabled
elif curProvider == 'tvtorrents':
sickbeard.TVTORRENTS = curEnabled
elif curProvider == 'btn':
Something went wrong with that request. Please try again.