- Made nova2dl.py more robust by downloading the torrent itself if the search plugin does not provide the download_torrent() method

This commit is contained in:
Christophe Dumez 2009-11-20 12:04:38 +00:00
commit 332a4121c8

View file

@ -25,7 +25,7 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
#VERSION: 1.00 #VERSION: 1.10
# Author: # Author:
# Christophe DUMEZ (chris@qbittorrent.org) # Christophe DUMEZ (chris@qbittorrent.org)
@ -33,6 +33,7 @@
import sys import sys
import os import os
import glob import glob
from helpers import download_file
supported_engines = dict() supported_engines = dict()
@ -56,5 +57,8 @@ if __name__ == '__main__':
if engine_url not in supported_engines.keys(): if engine_url not in supported_engines.keys():
raise SystemExit('./nova2dl.py: this engine_url was not recognized') raise SystemExit('./nova2dl.py: this engine_url was not recognized')
exec "engine = %s()"%supported_engines[engine_url] exec "engine = %s()"%supported_engines[engine_url]
if hasattr(engine, 'download_torrent'):
engine.download_torrent(download_param) engine.download_torrent(download_param)
else:
print download_file(download_param)
sys.exit(0) sys.exit(0)