diff --git a/data/interfaces/default/album.html b/data/interfaces/default/album.html
index e1c5ba8e..98dc51ba 100644
--- a/data/interfaces/default/album.html
+++ b/data/interfaces/default/album.html
@@ -108,7 +108,6 @@
Duration: ${albumduration}
-
@@ -220,9 +219,13 @@
};
function getAvailableDownloads() {
+ ShowSpinner();
$.getJSON("choose_specific_download?AlbumID=${album['AlbumID']}", function(data) {
+ loader.remove();
+ feedback.fadeOut();
+ search_results = data
for( var i = 0, len = data.length; i < len; i++ ) {
- $('#downloads_table_body').append('| '+data[i].title+' | '+(data[i].size / (1024*1024)).toFixed(2)+' MB | '+data[i].provider+' | '+data[i].kind+' |
');
+ $('#downloads_table_body').append('| '+data[i].title+' | '+(data[i].size / (1024*1024)).toFixed(2)+' MB | '+data[i].provider+' | '+data[i].kind+' |
');
}
$('#downloads_table').dataTable({
"aoColumns": [
@@ -235,14 +238,43 @@
"bFilter": false,
"bInfo": false,
"bPaginate": false,
- "bDestroy": true
});
$("#choose_specific_download_dialog").dialog({ width: "1000px" });
return false;
});
}
-
+ function downloadSpecificRelease(i){
+
+ title = search_results[i].title
+ size = search_results[i].size
+ url = search_results[i].url
+ provider = search_results[i].provider
+ kind = search_results[i].kind
+
+ ShowSpinner();
+ $.getJSON("download_specific_release?AlbumID=${album['AlbumID']}&title="+title+"&size="+size+"&url="+url+"&provider="+provider+"&kind=" + kind, function(data) {
+ loader.remove();
+ feedback.fadeOut();
+ refreshSubmenu();
+ $("#choose_specific_download_dialog").dialog("close");
+ });
+ }
+
+ function ShowSpinner() {
+ feedback = $("#ajaxMsg");
+ update = $("#updatebar");
+ if ( update.is(":visible") ) {
+ var height = update.height() + 35;
+ feedback.css("bottom",height + "px");
+ } else {
+ feedback.removeAttr("style");
+ }
+ loader = $("");
+ feedback.prepend(loader);
+ feedback.fadeIn();
+ }
+
$(document).ready(function() {
getAlbumInfo();
initThisPage();
diff --git a/headphones/searcher.py b/headphones/searcher.py
index de680155..f1361e1d 100644
--- a/headphones/searcher.py
+++ b/headphones/searcher.py
@@ -145,7 +145,7 @@ def searchforalbum(albumid=None, new=False, losslessOnly=False, choose_specific_
logger.info('Search for Wanted albums complete')
-def do_sorted_search(album, new, losslessOnly, choose_specific_download):
+def do_sorted_search(album, new, losslessOnly, choose_specific_download=False):
NZB_PROVIDERS = (headphones.HEADPHONES_INDEXER or headphones.NEWZNAB or headphones.NZBSORG or headphones.NZBSRUS or headphones.OMGWTFNZBS)
NZB_DOWNLOADERS = (headphones.SAB_HOST or headphones.BLACKHOLE_DIR or headphones.NZBGET_HOST)
diff --git a/headphones/webserve.py b/headphones/webserve.py
index 3411fce1..a7fdd8ca 100644
--- a/headphones/webserve.py
+++ b/headphones/webserve.py
@@ -326,9 +326,18 @@ class WebInterface(object):
choose_specific_download.exposed = True
- def download_specific_release(self, AlbumID, title, size, url, provider, kind):
+ def download_specific_release(self, AlbumID, title, size, url, provider, kind, **kwargs):
+
+ # Handle situations where the torrent url contains arguments that are parsed
+ if kwargs:
+ import urllib, urllib2
+ url = urllib2.quote(url, safe=":?/=&") + '&' + urllib.urlencode(kwargs)
+
+ try:
+ result = [(title,int(size),url,provider,kind)]
+ except ValueError:
+ result = [(title,float(size),url,provider,kind)]
- result = [(title,int(size),url,provider,kind)]
logger.info(u"Making sure we can download the chosen result")
(data, bestqual) = searcher.preprocess(result)