#import sickbeard #import datetime #from sickbeard.common import * #from sickbeard import db, sbdatetime, network_timezones #set global $title="Home" #set global $header="Show List" #set global $sbPath = ".." #set global $topmenu="home"# #import os.path #include $os.path.join($sickbeard.PROG_DIR, "gui/slick/interfaces/default/inc_top.tmpl") #set $myDB = $db.DBConnection() #set $today = str($datetime.date.today().toordinal()) #set $layout = $sickbeard.HOME_LAYOUT #set status_quality = '(' + ','.join([str(x) for x in $Quality.SNATCHED + $Quality.SNATCHED_PROPER]) + ')' #set status_download = '(' + ','.join([str(x) for x in $Quality.DOWNLOADED + [$ARCHIVED]]) + ')' #set $sql_statement = 'SELECT showid, ' #set $sql_statement += '(SELECT COUNT(*) FROM tv_episodes WHERE showid=tv_eps.showid AND season > 0 AND episode > 0 AND airdate > 1 AND status IN ' + $status_quality + ') AS ep_snatched, ' #set $sql_statement += '(SELECT COUNT(*) FROM tv_episodes WHERE showid=tv_eps.showid AND season > 0 AND episode > 0 AND airdate > 1 AND status IN ' + $status_download + ') AS ep_downloaded, ' #set $sql_statement += '(SELECT COUNT(*) FROM tv_episodes WHERE showid=tv_eps.showid AND season > 0 AND episode > 0 AND airdate > 1 ' #set $sql_statement += ' AND ((airdate <= ' + $today + ' AND (status = ' + str($SKIPPED) + ' OR status = ' + str($WANTED) + ' OR status = ' + str($FAILED) + ')) ' #set $sql_statement += ' OR (status IN ' + status_quality + ') OR (status IN ' + status_download + '))) AS ep_total, ' #set $sql_statement += ' (SELECT airdate FROM tv_episodes WHERE showid=tv_eps.showid AND airdate >= ' + $today + ' AND (status = ' + str($UNAIRED) + ' OR status = ' + str($WANTED) + ') ORDER BY airdate ASC LIMIT 1) AS ep_airs_next ' #set $sql_statement += ' FROM tv_episodes tv_eps GROUP BY showid' #set $sql_result = $myDB.select($sql_statement) #set $show_stat = {} #set $max_download_count = 1000 #for $cur_result in $sql_result: #set $show_stat[$cur_result['showid']] = $cur_result #if $cur_result['ep_total'] > $max_download_count: #set $max_download_count = $cur_result['ep_total'] #end if #end for #set $max_download_count = $max_download_count * 100 #if $varExists('header')

$header

#else

$title

#end if
Layout: Poster · Small Poster · Banner · Simple #if $layout == 'poster':  Flip #end if
#for $curShowlist in $showlists: #set $curListType = $curShowlist[0] #set $myShowList = $list($curShowlist[1]) #if $curListType == "Anime":

Anime List

#end if #if $layout == 'poster':
#for $curLoadingShow in $sickbeard.showQueueScheduler.action.loadingShowList: #if $curLoadingShow.show != None and $curLoadingShow.show in $sickbeard.showList: #continue #end if #if $curLoadingShow.show == None:
Loading... ($curLoadingShow.show_name)
#end if #end for $myShowList.sort(lambda x, y: cmp(x.name, y.name)) #for $curShow in $myShowList: #set $cur_airs_next = '' #set $cur_snatched = 0 #set $cur_downloaded = 0 #set $cur_total = 0 #set $download_stat_tip = '' #if $curShow.indexerid in $show_stat: #set $cur_airs_next = $show_stat[$curShow.indexerid]['ep_airs_next'] #set $cur_snatched = $show_stat[$curShow.indexerid]['ep_snatched'] #if not $cur_snatched: #set $cur_snatched = 0 #end if #set $cur_downloaded = $show_stat[$curShow.indexerid]['ep_downloaded'] #if not $cur_downloaded: #set $cur_downloaded = 0 #end if #set $cur_total = $show_stat[$curShow.indexerid]['ep_total'] #if not $cur_total: #set $cur_total = 0 #end if #end if #if $cur_total != 0: #set $download_stat = str($cur_downloaded) #set $download_stat_tip = "Downloaded: " + str($cur_downloaded) #if $cur_snatched > 0: #set $download_stat = download_stat #set $download_stat_tip = download_stat_tip + " " + "Snatched: " + str($cur_snatched) #end if #set $download_stat = download_stat + " / " + str($cur_total) #set $download_stat_tip = download_stat_tip + " " + "Total: " + str($cur_total) #else #set $download_stat = '?' #set $download_stat_tip = "no data" #end if #set $nom = $cur_downloaded #set $den = $cur_total #if $den == 0: #set $den = 1 #end if #set $progressbar_percent = $nom * 100 / $den #if "a" in sickbeard.DATE_PRESET: #set $showheight = "334px" #set $tableheight = "52px" #else if "B" in sickbeard.DATE_PRESET: #set $showheight = "374px" #set $tableheight = "92px" #else if "A" in sickbeard.DATE_PRESET: #set $showheight = "334px" #set $tableheight = "52px" #else #set $showheight = "323px" #set $tableheight = "42px" #end if

$curShow.name

#if $cur_airs_next #set $ldatetime = $network_timezones.parse_date_time($cur_airs_next,$curShow.airs,$curShow.network)
Next Ep: $sbdatetime.sbdatetime.sbfdate($ldatetime)
#else if $curShow.status != "Ended" and int($curShow.paused) == 1:
Paused
#else if $curShow.status:
$curShow.status
#else
?
#end if
$download_stat
#if $curShow.quality in $qualityPresets: $qualityPresetStrings[$curShow.quality] #else: Custom #end if
#if $layout != 'simple': #if $curShow.network: $curShow.network #else: No Network #end if #else: $curShow.network #end if
#end for
#else #for $curLoadingShow in $sickbeard.showQueueScheduler.action.loadingShowList: #if $curLoadingShow.show != None and $curLoadingShow.show in $sickbeard.showList: #continue #end if #end for $myShowList.sort(lambda x, y: cmp(x.name, y.name)) #for $curShow in $myShowList: #set $cur_airs_next = '' #set $cur_snatched = 0 #set $cur_downloaded = 0 #set $cur_total = 0 #set $download_stat_tip = '' #if $curShow.indexerid in $show_stat: #set $cur_airs_next = $show_stat[$curShow.indexerid]['ep_airs_next'] #set $cur_snatched = $show_stat[$curShow.indexerid]['ep_snatched'] #if not $cur_snatched: #set $cur_snatched = 0 #end if #set $cur_downloaded = $show_stat[$curShow.indexerid]['ep_downloaded'] #if not $cur_downloaded: #set $cur_downloaded = 0 #end if #set $cur_total = $show_stat[$curShow.indexerid]['ep_total'] #if not $cur_total: #set $cur_total = 0 #end if #end if #if $cur_total != 0: #set $download_stat = str($cur_downloaded) #set $download_stat_tip = "Downloaded: " + str($cur_downloaded) #if $cur_snatched > 0: #set $download_stat = download_stat + "+" + str($cur_snatched) #set $download_stat_tip = download_stat_tip + " " + "Snatched: " + str($cur_snatched) #end if #set $download_stat = download_stat + " / " + str($cur_total) #set $download_stat_tip = download_stat_tip + " " + "Total: " + str($cur_total) #else #set $download_stat = '?' #set $download_stat_tip = "no data" #end if #set $nom = $cur_downloaded #set $den = $cur_total #if $den == 0: #set $den = 1 #end if #set $progressbar_percent = $nom * 100 / $den #if $cur_airs_next #set $ldatetime = $network_timezones.parse_date_time($cur_airs_next,$curShow.airs,$curShow.network) #else: #end if #if $layout == 'small': #else if $layout == 'banner': #else if $layout == 'simple': #end if #if $curShow.quality in $qualityPresets: #else: #end if #end for
Next Ep$curListTypeNetworkQualityDownloadsActiveStatus
  Add Show
(loading) #if $curLoadingShow.show == None: Loading... ($curLoadingShow.show_name) #else: $curLoadingShow.show.name #end if
$sbdatetime.sbdatetime.sbfdate($ldatetime)
$time.mktime($ldatetime.timetuple())
$curShow.name $curShow.name #if $layout != 'simple': #if $curShow.network: $curShow.network #else: No Network #end if #else: $curShow.network #end if $qualityPresetStrings[$curShow.quality]Custom$download_stat
\"Y\"" $curShow.status
#end if #end for #include $os.path.join($sickbeard.PROG_DIR,"gui/slick/interfaces/default/inc_bottom.tmpl")