#import sickgear
<% def sg_var(varname, default=False): return getattr(sickgear, varname, default) %>#slurp#
<% def sg_str(varname, default=''): return getattr(sickgear, varname, default) %>#slurp#
##
#set global $header = 'Process Media'
#set global $title = $header
#set global $topmenu = 'manage'
#set global $sbPath = '../..'
##
#import os.path
#include $os.path.join($sg_var('PROG_DIR'), 'gui/slick/interfaces/default/inc_top.tmpl')

#if $varExists('header')
	<h1 class="header">$header</h1>
#else
	<h1 class="title">$title</h1>
#end if

#set selected = ' selected="selected"'

	<form name="processForm" method="post" action="process-files">
		<input type="hidden" id="type" name="process_type" value="manual">
		$xsrf_form_html

		<div id="postProcess" class="stepDiv">

			<div class="field-pair">
				<label for="episodeDir">
					<span class="component-title input">Folder to process</span>
					<span class="component-desc">
						<input id="episodeDir" name="dir_name" type="text" value="$sg_str('PROCESS_LAST_DIR')" class="form-control form-control-inline input-sm input350">
						<p class="clear-left">select a folder containing episode files</p>
					</span>
				</label>
			</div>

			<div class="field-pair">
				<label for="process_method">
					<span class="component-title input">Process method to use</span>
					<span class="component-desc">
						<select id="process_method" name="process_method" class="form-control form-control-inline input-sm">
#set $process_methods = {'copy': 'Copy', 'move': 'Move', 'hardlink': 'Hard Link', 'symlink': 'Symbolic Link'}
#for $method in ('copy', 'move', 'hardlink', 'symlink'):
							<option value="$method"#echo ('', $selected)[$method == $sg_str('PROCESS_LAST_METHOD')]#>$process_methods[$method]</option>
#end for
						</select>
						<label for="cleanup">
							<span id="move-and-trash" style="display:#echo ('none', 'block')['move' == $sg_str('PROCESS_LAST_METHOD')]#">
								then trash left over subdirs/files<input id="cleanup" name="cleanup" type="checkbox" value="$sg_str('PROCESS_LAST_CLEANUP')" style="float:none;margin-left:10px">
							</span>
						</label>
					</span>
				</label>
			</div>

			<div class="field-pair">
				<label for="force">
					<span class="component-title">Force already processed</span>
					<span class="component-desc">
						<input id="force" name="force" type="checkbox">
						<span>allow known post processed dirs/files to be processed again</span>
					</span>
				</label>
			</div>

			<div class="field-pair">
				<label for="force_replace">
					<span class="component-title">Force replace existing</span>
					<span class="component-desc">
						<input id="force_replace" name="force_replace" type="checkbox">
						<span>replace existing files ignoring file size and video quality differences</span>
					</span>
				</label>
			</div>

#if $sg_var('USE_FAILED_DOWNLOADS'):
			<div class="field-pair">
				<label for="failed">
					<span class="component-title">Mark as failed</span>
					<span class="component-desc">
						<input id="failed" name="failed" type="checkbox">
						<span>queue a search to try find a different release for each processed item</span>
					</span>
				</label>
			</div>
#end if

			<div class="field-pair" style="margin-top:12px">
				<span class="component-title input">&nbsp;</span>
				<span class="component-desc">
					<input id="submit" class="btn" type="submit" value="Process">
				</span>
			</div>
		</div><!-- /postProcess -->
	</form>

<script type="text/javascript" charset="utf-8">
<!--
#raw
jQuery('#episodeDir').fileBrowser({title:'Select Unprocessed Episode Folder', key:'postprocessPath'});
$('#process_method').change(function(){
	$('#move-and-trash').css({'display':('move' == $(this).val() ? 'block' : 'none')})
});
#end raw
//-->
</script>

#include $os.path.join($sg_var('PROG_DIR'), 'gui/slick/interfaces/default/inc_bottom.tmpl')