mirror of
https://github.com/evilhero/mylar
synced 2025-03-11 22:42:47 +00:00
IMP: will now log proper newznab name during snatches instead of just referencing as 'newznab', IMP: re-strucutured provider stats so that it's either shown/hidden as desired, FIX: trying to get right provider stats from snatched table as opposed to just using nzblog (which might not cover all providers) - props to bbq for all of this ;)
This commit is contained in:
parent
f336e815a8
commit
9fe60b57af
3 changed files with 68 additions and 9 deletions
|
@ -101,8 +101,21 @@
|
|||
<div>${config['branch_history']}</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Provider Usage</legend>
|
||||
<div>${config['dlstats']}</div>
|
||||
<div class="row">
|
||||
<label style="font-size:16px;font-weight:bold;">Provider Usage (${config['dltotals']})</label>
|
||||
<a href="#" onclick="show_stats();"><span style="vertical-align:bottom;text-align:center;float:right;">Show Stats</span></a>
|
||||
</div>
|
||||
<div id="stats" style="display:none">
|
||||
</br>
|
||||
%for dl in config['dlstats']:
|
||||
<%
|
||||
dlline = '%s: %s snatches' % (dl[0], dl[1])
|
||||
if dl[0] == 'newznab':
|
||||
dlline += '<small> (*erroneous collection data)</small>'
|
||||
%>
|
||||
${dlline}</br>
|
||||
%endfor
|
||||
</div>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -341,7 +354,7 @@
|
|||
<label>SABnzbd Password:</label>
|
||||
<input type="password" name="sab_password" id="sab_password" value="${config['sab_pass']| h}" size="20">
|
||||
</div>
|
||||
<div Class="row">
|
||||
<div class="row">
|
||||
<div class="populatesab">
|
||||
<label>SABnzbd API:</label>
|
||||
<input type="text" name="sab_apikey" id="sab_apikey" value="${config['sab_api']}" size="28">
|
||||
|
@ -1485,6 +1498,15 @@
|
|||
document.getElementById("auth_options").style.display = "none";
|
||||
}
|
||||
}
|
||||
function show_stats()
|
||||
{
|
||||
var x = document.getElementById("stats");
|
||||
if (x.style.display === "none") {
|
||||
x.style.display = "block";
|
||||
} else {
|
||||
x.style.display = "none";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
function initThisPage()
|
||||
|
|
|
@ -367,7 +367,11 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueD
|
|||
prov_count+=1
|
||||
|
||||
if findit['status'] is True:
|
||||
srchloop = 4
|
||||
if searchprov == 'newznab':
|
||||
searchprov = newznab_host[0].rstrip() + ' (newznab)'
|
||||
elif searchprov == 'torznab':
|
||||
searchprov = torznab_host[0].rstrip() + ' (torznab)'
|
||||
srchloop = 4
|
||||
break
|
||||
elif srchloop == 2 and (cmloopit -1 >= 1):
|
||||
time.sleep(30) #pause for 30s to not hammmer api's
|
||||
|
|
|
@ -4455,10 +4455,42 @@ class WebInterface(object):
|
|||
"COUNT_HAVES": COUNT_HAVES,
|
||||
"COUNT_ISSUES": COUNT_ISSUES,
|
||||
"COUNT_SIZE": COUNT_SIZE}
|
||||
DLPROVSTATS = myDB.select("SELECT Provider, COUNT(Provider) AS Frequency FROM NZBLOG GROUP BY Provider ORDER BY Frequency DESC")
|
||||
dlprovstats = ''
|
||||
for row, val in enumerate(DLPROVSTATS):
|
||||
dlprovstats += ("%s: %s snatches</br>" % (DLPROVSTATS[row]['Provider'], DLPROVSTATS[row]['Frequency']))
|
||||
DLPROVSTATS = myDB.select("SELECT Provider, COUNT(Provider) AS Frequency FROM Snatched WHERE Status = 'Snatched' AND Provider is NOT NULL GROUP BY Provider ORDER BY Frequency DESC")
|
||||
freq = dict()
|
||||
freq_tot = 0
|
||||
for row in DLPROVSTATS:
|
||||
if any(['CBT' in row['Provider'], '32P' in row['Provider'], 'ComicBT' in row['Provider']]):
|
||||
try:
|
||||
tmpval = freq['32P']
|
||||
freq.update({'32P': tmpval + row['Frequency']})
|
||||
except:
|
||||
freq.update({'32P': row['Frequency']})
|
||||
elif 'KAT' in row['Provider']:
|
||||
try:
|
||||
tmpval = freq['KAT']
|
||||
freq.update({'KAT': tmpval + row['Frequency']})
|
||||
except:
|
||||
freq.update({'KAT': row['Frequency']})
|
||||
elif 'experimental' in row['Provider']:
|
||||
try:
|
||||
tmpval = freq['Experimental']
|
||||
freq.update({'Experimental': tmpval + row['Frequency']})
|
||||
except:
|
||||
freq.update({'Experimental': row['Frequency']})
|
||||
|
||||
|
||||
elif [True for x in freq if re.sub("\(newznab\)", "", str(row['Provider'])).strip() in x]:
|
||||
try:
|
||||
tmpval = freq[re.sub("\(newznab\)", "", row['Provider']).strip()]
|
||||
freq.update({re.sub("\(newznab\)", "", row['Provider']).strip(): tmpval + row['Frequency']})
|
||||
except:
|
||||
freq.update({re.sub("\(newznab\)", "", row['Provider']).strip(): row['Frequency']})
|
||||
else:
|
||||
freq.update({re.sub("\(newznab\)", "", row['Provider']).strip(): row['Frequency']})
|
||||
|
||||
freq_tot += row['Frequency']
|
||||
|
||||
dlprovstats = sorted(freq.iteritems(), key=itemgetter(1), reverse=True)
|
||||
|
||||
if mylar.SCHED_RSS_LAST is None:
|
||||
rss_sclast = 'Unknown'
|
||||
|
@ -4675,7 +4707,8 @@ class WebInterface(object):
|
|||
"opds_username": mylar.CONFIG.OPDS_USERNAME,
|
||||
"opds_password": mylar.CONFIG.OPDS_PASSWORD,
|
||||
"opds_metainfo": helpers.checked(mylar.CONFIG.OPDS_METAINFO),
|
||||
"dlstats": dlprovstats
|
||||
"dlstats": dlprovstats,
|
||||
"dltotals": freq_tot
|
||||
}
|
||||
return serve_template(templatename="config.html", title="Settings", config=config, comicinfo=comicinfo)
|
||||
config.exposed = True
|
||||
|
|
Loading…
Add table
Reference in a new issue