Add "View Changes" to tools menu.

This commit is contained in:
JackDandy 2015-12-22 03:06:33 +00:00
parent 2a762ae7db
commit 9444c49bda
7 changed files with 114 additions and 2 deletions

View file

@ -102,6 +102,7 @@
* Change to always display branch and commit hash on 'Help & Info' page
* Add option to create season search exceptions from editShow page
* Change sab to use requests library
* Add "View Changes" to tools menu
### 0.10.0 (2015-08-06 11:05:00 UTC)

View file

@ -528,6 +528,15 @@ h2.day, h2.network{
border-color:#8DBEEE
}
/* =======================================================================
viewchanges.tmpl
========================================================================== */
#changes{
color:rgb(255,255,255);
background-color:rgb(61,61,61);
border:1px solid rgb(17,17,17)
}
/* =======================================================================
config*.tmpl
========================================================================== */

View file

@ -510,6 +510,15 @@ h2.day, h2.network{
border-color:#C7DB40
}
/* =======================================================================
viewchanges.tmpl
========================================================================== */
#changes{
color:rgb(51,51,51);
background-color:rgb(245,245,245);
border:1px solid rgb(204,204,204)
}
/* =======================================================================
config*.tmpl
========================================================================== */

View file

@ -2103,6 +2103,36 @@ td.col-cache{
width:20px
}
/* =======================================================================
viewchanges.tmpl
========================================================================== */
#changes{
display:block;
padding:9.5px;
border-radius:4px 4px 4px 4px;
font:12px/13px "Open Sans",verdana,sans-serif
}
#changes .release{
margin:15px 5px 6px 0;
padding-bottom:3px;
border-bottom:1px solid gray
}
#changes .ver{font:16px/17px "Open Sans",verdana,sans-serif;margin-right:0.2em;}
#changes .old{padding-top:15px}
#changes div{margin:0 0 8px}
#changes .btn-text{width:5em;margin-right:0.2em;float:left}
#changes .change-text{display:block;margin-left:5.5em;padding-top:2px}
.change-add{background-color:rgb(63,127,0)}
.change-change{background-color:rgb(91,153,13)}
.change-fix{background-color:rgb(38,114,182)}
.change-port{background-color:rgb(102,102,102)}
.change-remove{}
.change-update{background-color:rgb(98,25,147)}
/* =======================================================================
config*.tmpl
@ -2630,6 +2660,7 @@ span.path{
line-height:18px
}
span.btn-text,
span.quality{
font:12px/13px "Open Sans", verdana, sans-serif;
background-image:-webkit-linear-gradient(top, rgba(255, 255, 255, 0.08),rgba(255, 255, 255, 0) 50%,rgba(0, 0, 0, 0) 50%,rgba(0, 0, 0, 0.25));

View file

@ -168,9 +168,11 @@
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-delay="0" tabindex="$tab#set $tab += 1#"><img src="$sbRoot/images/menu/system18-2.png" class="navbaricon hidden-xs" /><b class="caret hidden-xs"></b><span class="visible-xs">System <b class="caret"></b></span></a>
<ul class="dropdown-menu">
<li><a href="$sbRoot/manage/manageSearches/forceVersionCheck" tabindex="$tab#set $tab += 1#"><i class="sgicon-updatecheck"></i>Force Version Check</a></li>
<li><a href="$sbRoot/manage/manageSearches/forceVersionCheck" tabindex="$tab#set $tab += 1#"><i class="sgicon-updatecheck"></i>Check for Updates</a></li>
<li><a href="$sbRoot/home/viewchanges" tabindex="$tab#set $tab += 1#"><i class="sgicon-log"></i>View Changes</a></li>
<li class="divider"></li>
#if $sickbeard.WEB_USERNAME or $sickbeard.WEB_PASSWORD
<li><a href="$sbRoot/logout" class="confirm logout" tabindex="$tab#set $tab += 1#"><i class="sgicon-logout"></i>Logout</a></li>
<li><a href="$sbRoot/logout" class="confirm logout" tabindex="$tab#set $tab += 1#"><i class="sgicon-logout"></i>Logout</a></li>
#end if
<li><a href="$sbRoot/home/restart/?pid=$sbPID" class="confirm restart" tabindex="$tab#set $tab += 1#"><i class="sgicon-restart"></i>Restart</a></li>
<li><a href="$sbRoot/home/shutdown/?pid=$sbPID" class="confirm shutdown" tabindex="$tab#set $tab += 1#"><i class="sgicon-shutdown"></i>Shutdown</a></li>

View file

@ -0,0 +1,20 @@
#import sickbeard
##
#set global $header = 'Changes'
#set global $title = 'Changes'
#set global $topmenu = ''
##
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_top.tmpl')
<h1 class="header">$header</h1>
<div class="align-left" style="margin:30px 0">
<div id="changes">
#for $i, $change in $enumerate($changelist)##if 'rel' == $change['type']#
<div class="release#echo ('', ' old')[bool($i)]#"><span class="ver">$change['ver']</span> <span class="change-date grey-text">$change['date']</span></div>
#else# <div><span class="btn-text change-$change['type'].lower()">$change['type']</span> <span class="change-text">$change['text']</span></div>
#end if##end for#
</div>
</div>
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl')

View file

@ -968,6 +968,46 @@ class Home(MainHandler):
return notifiers.pushbullet_notifier.get_devices(accessToken)
def viewchanges(self):
t = PageTemplate(headers=self.request.headers, file='viewchanges.tmpl')
t.changelist = [{'type': 'rel', 'ver': '', 'date': 'Nothing to display at this time'}]
url = 'https://raw.githubusercontent.com/wiki/SickGear/SickGear/sickgear/CHANGES.md'
response = helpers.getURL(url)
if not response:
return t.respond()
data = response.replace('\xef\xbb\xbf', '').splitlines()
output, change, max_rel = [], {}, 5
for line in data:
if not line.strip():
continue
if line.startswith(' '):
change_parts = re.findall('^[\W]+(.*)$', line)
change['text'] += change_parts and (' %s' % change_parts[0].strip()) or ''
else:
if change:
output.append(change)
if line.startswith('* '):
change_parts = re.findall(r'^[\*\W]+(Add|Change|Fix|Port|Remove|Update)\W(.*)', line)
change = change_parts and {'type': change_parts[0][0], 'text': change_parts[0][1].strip()} or {}
elif line.startswith('### '):
rel_data = re.findall(r'(?im)^###\W*([^\s]+)\W\(([^\)]+)\)', line)
rel_data and output.append({'type': 'rel', 'ver': rel_data[0][0], 'date': rel_data[0][1]})
max_rel -= 1
elif line.startswith('# '):
max_data = re.findall(r'^#\W*([\d]+)\W*$', line)
max_rel = max_data and helpers.tryInt(max_data[0], None) or 5
if not max_rel:
break
if change:
output.append(change)
t.changelist = output
return t.respond()
def shutdown(self, pid=None):
if str(pid) != str(sickbeard.PID):