Skip to content

Commit 9f309a4

Browse files
author
Patrick Vos
committed
Merge branch 'change_postprocess_ignore_hidden_pass_nzb_delete' into development
* change_postprocess_ignore_hidden_pass_nzb_delete: closes midgetspygh-803 Change PostProcessing checks and rules + Change replace rules and inner workings closes midgetspygh-393 + Include PR-620-jayme-github Process files by size but reversed (biggest first) closes midgetspygh-620 + Add postProcessor checks: status, quality/filesize, already processed closes midgetspygh-629 + Change search for airdate in database instead of thetvdb + Add tv download dir as default manual post-process directory closes midgetspygh-722 + Add is_proper to nameparser + Change use quality from snatch history instead of status quality + PEP8 Add ignore hidden, pass nzb, delete empty to processTV Add ignore hidden subfolders (subfolder starts with .) Removing ignored_filestrings from postProcessor because subfolders with . are not being processed. Add pass (inherit) nzbName to subfolder When no videofiles are in the mainfolder and there is only one subfolder, pass nzbName to subfolder Add delete empty folder closes midgetspygh-777 For now only delete empty folders on scripts and automatic. Safety net, with manual it's easier to browse and select root folder + Change some logging and error messages closes midgetspygh-702 closes midgetspygh-664 closes
2 parents 8850034 + c4534cc commit 9f309a4

File tree

9 files changed

+362
-228
lines changed

9 files changed

+362
-228
lines changed

data/interfaces/default/config_postProcessing.tmpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@
4444
</label>
4545
<label class="nocheck clearfix">
4646
<span class="component-title">&nbsp;</span>
47-
<span class="component-desc"><b>NOTE:</b> Use only if not using SABnzbd+ post processing.</span>
48-
</label>
49-
<label class="nocheck clearfix">
50-
<span class="component-title">&nbsp;</span>
51-
<span class="component-desc">Or if SABnzbd+ and Sick Beard are on different PCs.</span>
47+
<span class="component-desc"><b>NOTE:</b> Used with option Scan an Process or Manual Post-Processing.</span>
5248
</label>
5349
</div>
5450

@@ -88,7 +84,11 @@
8884
</label>
8985
<label class="nocheck clearfix" for="process_automatically">
9086
<span class="component-title">&nbsp;</span>
91-
<span class="component-desc"><b>NOTE:</b> Do not use if you use sabToSickbeard w/ SABnzbd+!</span>
87+
<span class="component-desc"><b>NOTE:</b> Use if it's not possible to use a post-process script (like SABnzbd and Sick Beard are on different PCs).</span>
88+
</label>
89+
<label class="nocheck clearfix">
90+
<span class="component-title">&nbsp;</span>
91+
<span class="component-desc">Do not use if you use a post-process script like sabToSickbeard on the same <i>TV Download Dir</i>.</span>
9292
</label>
9393
</div>
9494

data/interfaces/default/home_postprocess.tmpl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#import sickbeard
2-
#set global $title="Post Processing"
2+
#set global $title="Manual Post-Processing"
33

44
#set global $sbPath="../.."
55

@@ -8,7 +8,12 @@
88
#include $os.path.join($sickbeard.PROG_DIR, "data/interfaces/default/inc_top.tmpl")
99

1010
<form name="processForm" method="post" action="processEpisode">
11-
Enter the folder containing the episode: <input type="text" name="dir" id="episodeDir" size="50" /> <input type="submit" class="btn" value="Process" />
11+
Enter the folder containing the episode: <input type="text" name="dir" id="episodeDir" #if $sickbeard.TV_DOWNLOAD_DIR then "value=\"" + $sickbeard.TV_DOWNLOAD_DIR + "\"" else ""# size="50" />
12+
<input type="hidden" name="method" value="Manual"> <input type="submit" class="btn" value="Process" />
13+
<br /><br />
14+
Force replace existing episodes:&nbsp;<input type="checkbox" name="force_replace" /><br />
15+
<b>Overwrite</b> existing episode, ignoring status downloaded (quality)<br />
16+
1217
</form>
1318
<br />
1419

sickbeard/autoPostProcesser.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@
2424
from sickbeard import encodingKludge as ek
2525
from sickbeard import processTV
2626

27+
2728
class PostProcesser():
2829

2930
def run(self):
3031
if not sickbeard.PROCESS_AUTOMATICALLY:
3132
return
3233

3334
if not ek.ek(os.path.isdir, sickbeard.TV_DOWNLOAD_DIR):
34-
logger.log(u"Automatic post-processing attempted but dir "+sickbeard.TV_DOWNLOAD_DIR+" doesn't exist", logger.ERROR)
35+
logger.log(u"Automatic post-processing attempted but dir " + sickbeard.TV_DOWNLOAD_DIR + " doesn't exist", logger.ERROR)
3536
return
3637

3738
if not ek.ek(os.path.isabs, sickbeard.TV_DOWNLOAD_DIR):
38-
logger.log(u"Automatic post-processing attempted but dir "+sickbeard.TV_DOWNLOAD_DIR+" is relative (and probably not what you really want to process)", logger.ERROR)
39+
logger.log(u"Automatic post-processing attempted but dir " + sickbeard.TV_DOWNLOAD_DIR + " is relative (and probably not what you really want to process)", logger.ERROR)
3940
return
4041

41-
processTV.processDir(sickbeard.TV_DOWNLOAD_DIR)
42+
processTV.processDir(sickbeard.TV_DOWNLOAD_DIR, method='Automatic')

sickbeard/helpers.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,19 @@ def getURL(url, post_data=None, headers=[]):
195195
return result
196196

197197

198+
def is_hidden_folder(folder):
199+
"""
200+
Returns True if folder is hidden.
201+
On Linux based systems hidden folders start with . (dot)
202+
folder: Full path of folder to check
203+
"""
204+
if ek.ek(os.path.isdir, folder):
205+
if ek.ek(os.path.basename, folder).startswith('.'):
206+
return True
207+
208+
return False
209+
210+
198211
def findCertainShow(showList, tvdbid):
199212
results = filter(lambda x: x.tvdbid == tvdbid, showList)
200213
if len(results) == 0:
@@ -512,6 +525,13 @@ def fixSetGroupID(childPath):
512525
logger.log(u"Failed to respect the set-group-ID bit on the parent directory for %s (setting group ID %i)" % (childPath, parentGID), logger.ERROR)
513526

514527

528+
def real_path(path):
529+
"""
530+
Returns: the canonicalized absolute pathname. The resulting path will have no symbolic link, '/./' or '/../' components.
531+
"""
532+
return ek.ek(os.path.normpath, ek.ek(os.path.normcase, ek.ek(os.path.realpath, path)))
533+
534+
515535
def sanitizeSceneName(name, ezrss=False):
516536
"""
517537
Takes a show name and returns the "scenified" version of it.

sickbeard/name_parser/parser.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,26 @@ def _parse_string(self, name):
115115
except ValueError, e:
116116
raise InvalidNameException(e.message)
117117

118+
result.is_proper = False
119+
118120
if 'extra_info' in named_groups:
121+
119122
tmp_extra_info = match.group('extra_info')
120-
123+
124+
# Check if it's a proper
125+
if tmp_extra_info:
126+
result.is_proper = re.search('(^|[\. _-])(proper|repack)([\. _-]|$)', tmp_extra_info, re.I) is not None
127+
121128
# Show.S04.Special is almost certainly not every episode in the season
122129
if tmp_extra_info and cur_regex_name == 'season_only' and re.match(r'([. _-]|^)(special|extra)\w*([. _-]|$)', tmp_extra_info, re.I):
123130
continue
124131
result.extra_info = tmp_extra_info
125-
132+
126133
if 'release_group' in named_groups:
127134
result.release_group = match.group('release_group')
128135

129136
return result
130-
137+
131138
return None
132139

133140
def _combine_results(self, first, second, attr):
@@ -229,7 +236,9 @@ def parse(self, name):
229236
if not final_result.air_date:
230237
final_result.season_number = self._combine_results(file_name_result, dir_name_result, 'season_number')
231238
final_result.episode_numbers = self._combine_results(file_name_result, dir_name_result, 'episode_numbers')
232-
239+
240+
final_result.is_proper = self._combine_results(file_name_result, dir_name_result, 'is_proper')
241+
233242
# if the dirname has a release group/show name I believe it over the filename
234243
final_result.series_name = self._combine_results(dir_name_result, file_name_result, 'series_name')
235244
final_result.extra_info = self._combine_results(dir_name_result, file_name_result, 'extra_info')

0 commit comments

Comments
 (0)