#import sickgear #from sickgear.common import * #from sickgear.helpers import get_size, human ## #set global $title = 'Bulk Change' #set global $header = 'Bulk Change' #set global $sbPath = '../..' #set global $topmenu = 'manage' <% def sg_var(varname, default=False): return getattr(sickgear, varname, default) %>#slurp# <% def sg_str(varname, default=''): return getattr(sickgear, varname, default) %>#slurp# ## #import os.path #include $os.path.join($sickgear.PROG_DIR, 'gui/slick/interfaces/default/inc_top.tmpl') ## <script type="text/javascript" charset="utf-8"> <!-- ## an arbitrary high number greater than a media file size #set $high = 1000000000000 \$.SickGear.high = $high; \$.tablesorter.addParser({ id: 'showNames', is: function(s) { return !1; }, format: function(s) { return (s || '')#if not $sickgear.SORT_ARTICLE#.replace(/^(?:(?:A(?!\s+to)n?)|The)\s(\w)/i, '$1')#end if#; }, type: 'text' }); \$.tablesorter.addParser({ id: 'quality', is: function(s) { return !1; }, format: function(s) { return s.replace('hd1080p', 5).replace('hd720p', 4).replace('hd', 3).replace('sd', 2).replace('any', 1).replace('best', 0).replace('custom', 7); }, type: 'numeric' }); ## #set $enable_tvinfo = True #set $column_headers = [ ('!1', '!1', False), ("'showNames'", '!0', False), ("'size'", '!1', False), ('!1', '!1', False), ((None, "'tvinfo'")[$enable_tvinfo], '!1', False), ("'quality'", '!0', False), ((None, "'sports'")[$has_any_sports], '!1', True), ("'scene'", '!1', True), ((None, "'anime'")[$has_any_anime], '!1', True), ((None, "'flatfold'")[$has_any_flat_folders], '!1', True), ("'paused'", '!1', True), ("'status'", '!0', False), ('!1', '!1', False), ('!1', '!1', False), ('!1', '!1', False), ((None, '!1')[$sickgear.USE_SUBTITLES], '!1', False), ('!1', '!1', False), ('!1', '!1', False) ] #set $columns_total = $len($column_headers) - ((1, 0)[$has_any_sports] + (1, 0)[$has_any_anime] + (1, 0)[$has_any_flat_folders] + (1, 0)[$sickgear.USE_SUBTITLES]) #set $headers = [] #set $text_extract = [] #set $column = -1 #for $sort, $filter, $img_extract in $column_headers #if None is $sort #continue #end if #set $column += 1 #set void = $headers.append('\t\t\t%s: {sorter:%s, filter:%s}' % ($column, $sort, $filter)) #if $img_extract #set void = $text_extract.append('\t\t\t%s%s' % ($column, ": function(node) {return $(node).find('img').attr('alt')}")) #end if #end for \$(function() { \$('#bulk-change-table:has(tbody tr)').tablesorter({ widgets: ['zebra','stickyHeaders', 'filter'], sortList: [[1,0]], headers: { #echo ',\n'.join($headers)# }, textExtraction: { #raw 1: function(node) {return ((!!$(node).find('i.img-warning-16').length ? '1_' : '0_') + $(node).text().toLowerCase())}, 2: function(node) {return parseInt($(node).closest('[data-tvid_prodid]').attr('data-size') || -100, 10)}, #end raw #if $enable_tvinfo 4: function(node) {return \$(node).find('i').attr('data-tvid')}, #end if #echo ('5','4')[not $enable_tvinfo]#: function(node) {return \$(node).find('span').text().toLowerCase()}, #echo ',\n'.join($text_extract)# } }); }); //--> </script> <script type="text/javascript" src="$sbRoot/js/bulkChange.js?v=$sbPID"></script> #if $varExists('header') <h1 class="header">$header</h1> #else <h1 class="title">$title</h1> #end if <style> .tvShow{text-align:left} .tvShow i{margin-right:6px; margin-bottom:1px} .rotate-body span{float:left} @supports (transform:translateX(16px) rotate(-45deg)) and (transform-origin:bottom left){ .tablesorter.rotate th.tablesorter-header.sort-icon-left{background-position:center left; padding: 4px 4px 4px 18px} .tablesorter.rotate th.tablesorter-header.sort-icon-bottom{background-position:10px 54px /*28px 45px*/} .tablesorter.rotate th.tablesorter-header.sort-icon-status{background-position:30px 54px} .tablesorter.rotate th.tablesorter-header.sort-size{background-position:26px 54px; padding:4px 14px 4px 14px} .tablesorter.rotate th.tablesorter-header.sort-icon-quality{background-position:20px 54px} .rotate-holder{width:20px; margin-bottom:-16px} .rotate-holder2{width:20px; margin:22px 0 -22px} .rotate-body{width:25px; transform-origin:bottom left; transform:translateX(16px) rotate(-45deg)} .rotate-body2{width:25px; transform-origin:bottom left; transform:translateX(20px) rotate(-45deg)} .rotate-body span{float:none} .rotate th.col-legend, .rotate td.col-legend{width:40px} .rotate input[type="checkbox"].right-2px{margin:0 2px 0 0} .rotate .img-warning-16{cursor:help} } #bulk-change-table thead, #bulk-change-table-sticky thead, #tfoot{position:sticky} #bulk-change-table thead, #bulk-change-table-sticky thead{top:50px} #bulk-change-table-sticky,.tablesorter thead,.tablesorter thead tr,.tablesorter thead tr th, .tablesorter thead tr td{border-spacing:0} #tfoot{bottom:0; min-height:34px; line-height:26px} #tfoot input[disabled]{cursor:not-allowed} .tablesorter-sticky-wrapper{margin-top:50px} .tablesorter-filter-row input[disabled]{display:none} .tablesorter-filter-row input[type="search"]{background:rgba(255,255,255,0.2); padding:0 3px; border:0; border-radius:4px; color:inherit} .tablesorter .tablesorter-header.sort-size-type{padding:0; width:16px; cursor:pointer} th.sort-size-type{font-weight:normal} .average{border-top:1px solid white; width:9px; margin:0 auto} .average i{display:block; line-height:10px; margin-right:1px} #set $theme_suffix = ('', '-dark')['dark' == $sg_str('THEME_NAME', 'dark')] .tip,.tip-average{margin:0 2px} .tip-average{border-top:1px solid #echo ('#999', '#666')[not $theme_suffix]#} .tip-average,.tip-average i{display:inline-block; line-height:8px} .bfr{position:absolute;left:-999px;top:-999px}.bfr img,.spinner{display:inline-block;width:16px;height:16px}.spinner{background:url(${sbRoot}/images/loading16${theme_suffix}.gif) no-repeat 0 0} </style> <div class="bfr"><img src="$sbRoot/images/loading16${theme_suffix}.gif"></div> <form name="bulkChangeForm" method="post" action="bulk_change"> $xsrf_form_html <table id="bulk-change-table" class="sickbeardTable tablesorter rotate" cellspacing="1" border="0" cellpadding="0"> <thead> <tr style="height:70px"> <!-- must inline this css --> <th class="col-checkbox"><div>Edit</div><input type="checkbox" class="bulk-check" id="edit-check"></th> <th class="text-nowrap narrow sort-icon-left" style="text-align:left">Show Name</th> <th class="sort-size col-legend narrow dir-none"><div class="rotate-holder"><div class="rotate-body">Size</div></div></th> <th class="narrow sort-size-type" data-type="E" title="total"><div class="sort-size-type-body">Σ</div><span class="sort-size-type-image" style="display:none; margin-top:8px"><i class="spinner"></i></span></th> #if $enable_tvinfo <th class="col-legend narrow sort-icon-bottom"><div class="rotate-holder"><div class="rotate-body">TV Info</div></div></th> #end if <th class="col-legend narrow sort-icon-quality"><div class="rotate-holder"><div class="rotate-body">Quality</div></div></th> #if $has_any_sports <th class="col-legend narrow sort-icon-bottom"><div class="rotate-holder"><div class="rotate-body">Sports</div></div></th> #end if <th class="col-legend narrow sort-icon-bottom"><div class="rotate-holder"><div class="rotate-body2">Scene</div></div></th> #if $has_any_anime <th class="col-legend narrow sort-icon-bottom"><div class="rotate-holder"><div class="rotate-body2">Anime</div></div></th> #end if #if $has_any_flat_folders <th class="col-legend narrow sort-icon-bottom"><div class="rotate-holder"><div class="rotate-body2">Flat Folders</div></div></th> #end if <th class="col-legend narrow sort-icon-bottom"><div class="rotate-holder"><div class="rotate-body2">Paused</div></div></th> <th class="col-legend narrow sort-icon-status"><div class="rotate-holder"><div class="rotate-body2">Status</div></div></th> <th width="1%"><div class="rotate-holder2"><div class="rotate-body"><label><input type="checkbox" class="bulk-check right-2px" id="update-check"><span>Update</span></label></div></div></th> <th width="1%"><div class="rotate-holder2"><div class="rotate-body"><label><input type="checkbox" class="bulk-check right-2px" id="refresh-check"><span>Rescan</span></label></div></div></th> <th width="1%"><div class="rotate-holder2"><div class="rotate-body"><label><input type="checkbox" class="bulk-check right-2px" id="rename-check"><span>Rename</span></label></div></div></th> #if $sickgear.USE_SUBTITLES <th width="1%"><div class="rotate-holder2"><div class="rotate-body"><label><input type="checkbox" class="bulk-check right-2px" id="subtitleCheck"><span>Subtitle</span></label></div></div></th> #end if <th width="1%"><div class="rotate-holder2"><div class="rotate-body"><label><input type="checkbox" class="bulk-check right-2px" id="delete-check"><span>Delete</span></label></div></div></th> <th width="1%"><div class="rotate-holder2" style="margin-right:40px;"><div class="rotate-body"><label><input type="checkbox" class="bulk-check right-2px" id="remove-check"><span>Remove</span></label></div></div></th> </tr> </thead> <tbody> #set $disabled = ' disabled="disabled"' #set $disabled_inprogress_tip = ' action is currently in progress for this show' #set $disabled_subtitles_tip = ' title="Use edit to enable subtitle search for this show"' #set $no = 'no16.png" title="No" alt="No' #set $yes = 'yes16.png" title="Yes" alt="Yes' #set $max = $high + 100 #for $cur_show_obj in $shows + $shows_no_loc #set $show_loc = $cur_show_obj.path #set $show_size = $max if not $show_loc else $get_size($show_loc) #set $option_state = '<input type="checkbox"%s class="%s-check"%s>' ## #set $curUpdate_disabled = $sickgear.show_queue_scheduler.action.is_being_updated($cur_show_obj)\ or $sickgear.show_queue_scheduler.action.is_in_update_queue($cur_show_obj) #set $tip = ' title="Update%s"' % ('', $disabled_inprogress_tip)[$curUpdate_disabled] #set $curUpdate = ($tip, $option_state % (('', $disabled)[$curUpdate_disabled], 'update', $tip)) ## #set $curRefresh_disabled = $sickgear.show_queue_scheduler.action.is_being_refreshed($cur_show_obj)\ or $sickgear.show_queue_scheduler.action.is_in_refresh_queue($cur_show_obj) #set $tip = ' title="Rescan%s"' % ('', $disabled_inprogress_tip)[$curRefresh_disabled] #set $curRefresh = ($tip, $option_state % (('', $disabled)[$curRefresh_disabled], 'refresh', $tip)) ## #set $curRename_disabled = $sickgear.show_queue_scheduler.action.is_being_renamed($cur_show_obj)\ or $sickgear.show_queue_scheduler.action.is_in_rename_queue($cur_show_obj) #set $tip = ' title="Rename%s"' % ('', $disabled_inprogress_tip)[$curRename_disabled] #set $curRename = ($tip, $option_state % (('', $disabled)[$curRename_disabled], 'rename', $tip)) ## #set $subtitles_disabled = not $cur_show_obj.subtitles\ or $sickgear.show_queue_scheduler.action.is_being_subtitled($cur_show_obj)\ or $sickgear.show_queue_scheduler.action.is_in_subtitle_queue($cur_show_obj) #set $tip = (' title="Search subtitle"', (' title="Search subtitle%s"' % $disabled_inprogress_tip, $disabled_subtitles_tip)[not $cur_show_obj.subtitles])[$subtitles_disabled] #set $curSubtitle = ($tip, $option_state % (('', $disabled)[$subtitles_disabled], 'subtitle', $tip)) ## #set $curDelete_disabled = $sickgear.show_queue_scheduler.action.is_being_renamed($cur_show_obj)\ or $sickgear.show_queue_scheduler.action.is_in_rename_queue($cur_show_obj)\ or $sickgear.show_queue_scheduler.action.is_in_refresh_queue($cur_show_obj) #set $tip = ' title="Delete%s"' % ('', $disabled_inprogress_tip)[$curDelete_disabled] #set $curDelete = ($tip, $option_state % (('', $disabled)[$curDelete_disabled], 'delete', $tip)) ## #set $curRemove_disabled = $sickgear.show_queue_scheduler.action.is_being_renamed($cur_show_obj)\ or $sickgear.show_queue_scheduler.action.is_in_rename_queue($cur_show_obj)\ or $sickgear.show_queue_scheduler.action.is_in_refresh_queue($cur_show_obj) #set $tip = ' title="Remove%s"' % ('', $disabled_inprogress_tip)[$curRemove_disabled] #set $curRemove = ($tip, $option_state % (('', $disabled)[$curRemove_disabled], 'remove', $tip)) <tr data-tvid_prodid="$cur_show_obj.tvid_prodid" data-size="$show_size"> <td><input type="checkbox" class="edit-check"></td> #set $display_name = (re.sub(r'^((?:A(?!\s+to)n?)|The)\s(\w)', r'<span class="article">\1</span> \2', getattr($cur_show_obj, 'unique_name', $cur_show_obj.name)), getattr($cur_show_obj, 'unique_name', $cur_show_obj.name))[$sickgear.SORT_ARTICLE] <td class="tvShow">#if not $show_loc#<i class="img-warning-16" title="Location no longer exists"></i>#end if#<a href="$sbRoot/home/view-show?tvid_prodid=${cur_show_obj.tvid_prodid}">$display_name</a></td> <td colspan=2>#if 0 <= $show_size < $max#<span class="text-nowrap ui-size">$human($show_size)</span>#end if#</td> #if $enable_tvinfo <td><i class="icon16 $sickgear.TVInfoAPI($cur_show_obj.tvid).config['slug']" data-tvid="$cur_show_obj.tvid"></i></td> #end if #if $cur_show_obj.quality in $qualityPresets <td><span class="quality $qualityPresetStrings[$cur_show_obj.quality]">$qualityPresetStrings[$cur_show_obj.quality]</span></td> #else <td><span class="quality Custom">Custom</span></td> #end if #if $has_any_sports <td><img src="$sbRoot/images/#if 1 == int($cur_show_obj.is_sports) then $yes else $no#" width="16" height="16"></td> #end if <td><img src="$sbRoot/images/#if 1 == int($cur_show_obj.is_scene) then $yes else $no#" width="16" height="16"></td> #if $has_any_anime <td><img src="$sbRoot/images/#if 1 == int($cur_show_obj.is_anime) then $yes else $no#" width="16" height="16"></td> #end if #if $has_any_flat_folders <td><img src="$sbRoot/images/#if 1 == int($cur_show_obj.flatten_folders) then $yes else $no#" width="16" height="16"></td> #end if <td><img src="$sbRoot/images/#if 1 == int($cur_show_obj.paused) then $yes else $no#" width="16" height="16"></td> <td>$cur_show_obj.status</td> <td$curUpdate[0]>$curUpdate[1]</td> <td$curRefresh[0]>$curRefresh[1]</td> <td$curRename[0]>$curRename[1]</td> #if $sickgear.USE_SUBTITLES <td$curSubtitle[0]>$curSubtitle[1]</td> #end if <td$curDelete[0]>$curDelete[1]</td> <td$curRemove[0]><span style="margin-right: 40px">$curRemove[1]</span></td> </tr> #end for </tbody> </table> <div id="tfoot"> <span style="width:20%" class="pull-left"><input class="btn pull-left" type="button" value="Edit Selected" id="bulk-change-edit"></span> <span class="stats grey-text"></span> <span style="width:20%" class="pull-right"><input class="btn pull-right" type="button" value="Submit" id="bulk-change-submit"></span> </div> </form> #include $os.path.join($sickgear.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl')