Some bug fixes and styling changes

This commit is contained in:
rembo10
2014-04-04 21:06:07 -07:00
parent d79dc8f1ab
commit 91b596fb0f
3 changed files with 48 additions and 7 deletions

View File

@@ -108,7 +108,6 @@
<li>Duration: <span>${albumduration}</span></li>
</ul>
</div>
</div>
<div id="track_wrapper">
<table class="display" id="track_table">
@@ -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('<tr><td id="title"><a href="download_specific_release?AlbumID=${album['AlbumID']}&title='+data[i].title+'&size='+data[i].size+'&url='+data[i].url+'&provider='+data[i].provider+'&kind='+data[i].kind+'">'+data[i].title+'</a></td><td id="size"><span title='+data[i].size+'></span>'+(data[i].size / (1024*1024)).toFixed(2)+' MB</td><td id="provider">'+data[i].provider+'</td><td id="kind">'+data[i].kind+'</td></tr>');
$('#downloads_table_body').append('<tr><td id="title"><a href="#" onclick="downloadSpecificRelease('+i+')">'+data[i].title+'</a></td><td id="size"><span title='+data[i].size+'></span>'+(data[i].size / (1024*1024)).toFixed(2)+' MB</td><td id="provider">'+data[i].provider+'</td><td id="kind">'+data[i].kind+'</td></tr>');
}
$('#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 = $("<i class='fa fa-refresh fa-spin'></i>");
feedback.prepend(loader);
feedback.fadeIn();
}
$(document).ready(function() {
getAlbumInfo();
initThisPage();

View File

@@ -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)

View File

@@ -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)