#import datetime #import re #import sickbeard #from sickbeard import history, providers, sbdatetime #from sickbeard.common import Quality, statusStrings, SNATCHED_ANY, SNATCHED_PROPER, DOWNLOADED, SUBTITLED, ARCHIVED, FAILED #from sickbeard.providers import generic <% def sg_var(varname, default=False): return getattr(sickbeard, varname, default) %>#slurp# <% def sg_str(varname, default=''): return getattr(sickbeard, varname, default) %>#slurp# ## #set global $title = 'History' #set global $header = 'History' #set global $sbPath = '..' #set global $topmenu = 'home' #set $layout = $sg_str('HISTORY_LAYOUT', 'detailed') ## #import os.path #include $os.path.join($sg_str('PROG_DIR'), 'gui/slick/interfaces/default/inc_top.tmpl') #if $varExists('header')

$header

#else

$title

#end if #set $html_selected = ' selected="selected"' ##
Limit: Layout:

#if 'detailed' == $layout #for $hItem in $historyResults #set $curStatus, $curQuality = $Quality.splitCompositeStatus(int($hItem['action'])) #set $data_name = (re.sub('^((?:A(?!\s+to)n?)|The)\s(\w)', r'\2', $hItem['show_name']), $hItem['show_name'])[$sg_var('SORT_ARTICLE')] #set $display_name = '%s - S%02iE%02i' % ( $data_name, (re.sub('^((?:A(?!\s+to)n?)|The)\s(\w)', r'\1 \2', $hItem['show_name']), $hItem['show_name'])[$sg_var('SORT_ARTICLE')], int(hItem['season']), int(hItem['episode'])) #set $curdatetime = $datetime.datetime.strptime(str($hItem['date']), $history.dateFormat) #if $SUBTITLED == $curStatus "> #end if $statusStrings[$curStatus] #end for #else #if $sg_var('USE_SUBTITLES') #end if #for $hItem in $compactResults #set $curdatetime = $datetime.datetime.strptime(str($hItem['actions'][0]['time']), $history.dateFormat) #set $data_name = (re.sub('^((?:A(?!\s+to)n?)|The)\s(\w)', r'\2', $hItem['show_name']), $hItem['show_name'])[$sg_var('SORT_ARTICLE')] #set $display_name = '%s - S%02iE%02i' % ( $data_name, (re.sub('^((?:A(?!\s+to)n?)|The)\s(\w)', r'\1 \2', $hItem['show_name']), $hItem['show_name'])[$sg_var('SORT_ARTICLE')], int(hItem['season']), int(hItem['episode'])) #set $prov_list = [] #set $down_list = [] #set $order = 1 #set $ordinal_indicators = {'1':'st', '2':'nd', '3':'rd'} #for $action in reversed($hItem['actions']) #set $curStatus, $curQuality = $Quality.splitCompositeStatus(int($action['action'])) #set $basename = $os.path.basename($action['resource']) #if $curStatus in $SNATCHED_ANY + [$FAILED] #set $provider = $providers.getProviderClass($generic.GenericProvider.make_id($action['provider'])) #if None is not $provider #set $prov_list += ['%s'\ % (('', ' class="fail"')[$FAILED == $curStatus], $sbRoot, $provider.image_name(), $provider.name, ('%s%s' % ($order, 'th' if $order in [11, 12, 13] or str($order)[-1] not in $ordinal_indicators else $ordinal_indicators[str($order)[-1]]), 'Snatch failed')[$FAILED == $curStatus], $provider.name, $basename)] #set $order += (0, 1)[$curStatus in $SNATCHED_ANY] #else #set $prov_list += ['missing provider'\ % $sbRoot] #end if #end if #if $curStatus in [$DOWNLOADED, $ARCHIVED] #set $match = $re.search('\-(\w+)\.\w{3}\Z', $basename) #set $non_scene_note = '' #if not $match ## This fallback is for when idiots add a space and word to a release group. The space is converted ## to '\' which makes the regex parsing the scene group name fail, therefore we arrive here. ## A better solution would be to find where such data is parsed and saved to the db and perhaps ## fix at that point. But, in the meantime... #set $non_scene_resource = re.sub(r'(\-\w+)([\\]\w+)?(\.\w{3})\Z', r'\1\3', $action['resource']) #if $non_scene_resource #set $non_scene_note = ' (Non scene name: %s)' % $action['resource'].partition('-')[-1] #set $basename = $os.path.basename($non_scene_resource) #set $match = $re.search('\-(\w+)\.\w{3}\Z', $basename) #end if #end if #if $match #if $match.group(1).upper() in ('X264', '720P') #set $match = $re.search('(\w+)\-.*\-' + $match.group(1) + '\.\w{3}\Z', $os.path.basename($hItem['resource']), re.I) #end if #if $match #set $down_list += ['%s'\ % ($basename, $non_scene_note, $match.group(1).upper())] #end if #end if #end if #end for #if $sg_var('USE_SUBTITLES') #end if #end for #end if
Time Episode Action Provider Quality
 
$sbdatetime.sbdatetime.sbfdatetime($curdatetime, show_seconds=True)
$time.mktime($curdatetime.timetuple())
$display_name#if $Quality.splitCompositeStatus($hItem['action'])[0] == $SNATCHED_PROPER then ' Proper' else ''# #if $DOWNLOADED == $curStatus #if '-1' != $hItem['provider'] $hItem['provider'] #end if #else #if 0 < $hItem['provider'] #if $curStatus in $SNATCHED_ANY + [$FAILED] #set $provider = $providers.getProviderClass($generic.GenericProvider.make_id($hItem['provider'])) #if None is not $provider $provider.name #else Missing Provider #end if #else <%= hItem['provider'].capitalize() %> #end if #end if #end if $curQuality$Quality.qualityStrings[$curQuality]
Time Episode Snatched DownloadedSubtitledQuality
 
$sbdatetime.sbdatetime.sbfdatetime($curdatetime, show_seconds=True)
$time.mktime($curdatetime.timetuple())
$display_name#if 'proper' in $hItem['resource'].lower or 'repack' in $hItem['resource'].lower then ' Proper' else ''# #echo ''.join($prov_list)# #echo ' '.join($down_list)# #for $action in reversed($hItem['actions']) #set $curStatus, $curQuality = $Quality.splitCompositeStatus(int($action['action'])) #if $SUBTITLED == $curStatus $action['provider'] /   #end if #end for $Quality.qualityStrings[$curQuality]
#include $os.path.join($sg_str('PROG_DIR'), 'gui/slick/interfaces/default/inc_bottom.tmpl')