Skip to content

Commit 31ceaf1

Browse files
committed
Merge branch 'development' of github.com:midgetspy/Sick-Beard
2 parents 4899745 + 6670e47 commit 31ceaf1

File tree

13 files changed

+109
-82
lines changed

13 files changed

+109
-82
lines changed

data/interfaces/default/home.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414

1515
#set $myDB = $db.DBConnection()
1616
#set $today = str($datetime.date.today().toordinal())
17-
#set status_quality = '(' + ','.join([str(x) for x in $Quality.SNATCHED + $Quality.SNATCHED_PROPER]) + ')'
17+
#set status_snatched = '(' + ','.join([str(x) for x in $Quality.SNATCHED + $Quality.SNATCHED_PROPER]) + ')'
1818
#set status_download = '(' + ','.join([str(x) for x in $Quality.DOWNLOADED + [$ARCHIVED]]) + ')'
1919

2020
#set $sql_statement = 'SELECT showid, '
2121

22-
#set $sql_statement += '(SELECT COUNT(*) FROM tv_episodes WHERE showid=tv_eps.showid AND season > 0 AND episode > 0 AND status IN ' + $status_quality + ') AS ep_snatched, '
22+
#set $sql_statement += '(SELECT COUNT(*) FROM tv_episodes WHERE showid=tv_eps.showid AND season > 0 AND episode > 0 AND status IN ' + $status_snatched + ') AS ep_snatched, '
2323
#set $sql_statement += '(SELECT COUNT(*) FROM tv_episodes WHERE showid=tv_eps.showid AND season > 0 AND episode > 0 AND status IN ' + $status_download + ') AS ep_downloaded, '
2424

2525
#set $sql_statement += '(SELECT COUNT(*) FROM tv_episodes WHERE showid=tv_eps.showid AND season > 0 AND episode > 0 '
2626
#set $sql_statement += ' AND ((airdate > 1 AND airdate <= ' + $today + ' AND (status = ' + str($SKIPPED) + ' OR status = ' + str($WANTED) + ')) '
27-
#set $sql_statement += ' OR (status IN ' + status_quality + ') OR (status IN ' + status_download + '))) AS ep_total, '
27+
#set $sql_statement += ' OR (status IN ' + status_snatched + ') OR (status IN ' + status_download + '))) AS ep_total, '
2828

2929
#set $sql_statement += ' (SELECT airdate FROM tv_episodes WHERE showid=tv_eps.showid AND airdate >= ' + $today + ' AND status = ' + str($UNAIRED) + ' ORDER BY airdate ASC LIMIT 1) AS ep_airs_next '
3030
#set $sql_statement += ' FROM tv_episodes tv_eps GROUP BY showid'
@@ -189,7 +189,7 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
189189
#end if
190190

191191
#if $cur_total != 0:
192-
#set $download_stat = str($cur_downloaded + $cur_snatched)
192+
#set $download_stat = str($cur_downloaded)
193193
#set $download_stat_tip = "Downloaded: " + str($cur_downloaded)
194194
#if $cur_snatched > 0:
195195
#set $download_stat_tip = download_stat_tip + "&#013;" + "Snatched: " + str($cur_snatched)

data/interfaces/default/inc_bottom.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
<div class="container footer">
1010
#set $myDB = $db.DBConnection()
1111
#set $today = str($datetime.date.today().toordinal())
12-
#set status_quality = '(' + ','.join([str(quality) for quality in $Quality.SNATCHED + $Quality.SNATCHED_PROPER]) + ')'
12+
#set status_snatched = '(' + ','.join([str(quality) for quality in $Quality.SNATCHED + $Quality.SNATCHED_PROPER]) + ')'
1313
#set status_download = '(' + ','.join([str(quality) for quality in $Quality.DOWNLOADED + [$ARCHIVED]]) + ')'
1414

1515
#set $sql_statement = 'SELECT '
1616

17-
#set $sql_statement += '(SELECT COUNT(*) FROM tv_episodes WHERE season > 0 AND episode > 0 AND status IN ' + $status_quality + ') AS ep_snatched, '
17+
#set $sql_statement += '(SELECT COUNT(*) FROM tv_episodes WHERE season > 0 AND episode > 0 AND status IN ' + $status_snatched + ') AS ep_snatched, '
1818
#set $sql_statement += '(SELECT COUNT(*) FROM tv_episodes WHERE season > 0 AND episode > 0 AND status IN ' + $status_download + ') AS ep_downloaded, '
1919

2020
#set $sql_statement += '(SELECT COUNT(*) FROM tv_episodes WHERE season > 0 AND episode > 0 '
2121
#set $sql_statement += ' AND ((airdate > 1 AND airdate <= ' + $today + ' AND (status = ' + str($SKIPPED) + ' OR status = ' + str($WANTED) + ')) '
22-
#set $sql_statement += ' OR (status IN ' + status_quality + ') OR (status IN ' + status_download + '))) AS ep_total '
22+
#set $sql_statement += ' OR (status IN ' + status_snatched + ') OR (status IN ' + status_download + '))) AS ep_total '
2323

2424
#set $sql_statement += ' FROM tv_episodes tv_eps LIMIT 1'
2525

data/interfaces/default/manage_episodeStatuses.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Manage episodes with status <select name="whichStatus">
5454
<input type="hidden" id="oldStatus" name="oldStatus" value="$whichStatus" />
5555
<input type="hidden" id="opt_includeSpecials" name="opt_includeSpecials" value="$includeSpecials" />
5656
<input type="hidden" id="opt_excludeNoAirdate" name="opt_excludeNoAirdate" value="$excludeNoAirdate" />
57-
#if $whichStatus in ($common.SNATCHED, $common.ARCHIVED, $common.IGNORED):
57+
#if $whichStatus in ($common.UNKNOWN, $common.SNATCHED, $common.ARCHIVED, $common.IGNORED):
5858
#set $row_class = "good"
5959
#else
6060
#set $row_class = $common.Overview.overviewStrings[$whichStatus]

sickbeard/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,13 @@ def _migrate_v1(self):
429429
"""
430430

431431
sickbeard.NAMING_PATTERN = self._name_to_pattern()
432-
logger.log("Based on your old settings I'm setting your new naming pattern to: " + sickbeard.NAMING_PATTERN)
432+
logger.log(u"Based on your old settings I'm setting your new naming pattern to: " + sickbeard.NAMING_PATTERN)
433433

434434
sickbeard.NAMING_CUSTOM_ABD = bool(check_setting_int(self.config_obj, 'General', 'naming_dates', 0))
435435

436436
if sickbeard.NAMING_CUSTOM_ABD:
437437
sickbeard.NAMING_ABD_PATTERN = self._name_to_pattern(True)
438-
logger.log("Adding a custom air-by-date naming pattern to your config: " + sickbeard.NAMING_ABD_PATTERN)
438+
logger.log(u"Adding a custom air-by-date naming pattern to your config: " + sickbeard.NAMING_ABD_PATTERN)
439439
else:
440440
sickbeard.NAMING_ABD_PATTERN = naming.name_abd_presets[0]
441441

sickbeard/databases/mainDB.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ def execute(self):
446446
self.incDBVersion()
447447

448448

449-
# included in build 507 (2014-0#-##)
449+
# included in build 507 (2014-11-16)
450450
class CleanupHistoryAndSpecials(AddRequireAndIgnoreWords):
451451
""" Cleanup older history entries and set specials from wanted to skipped """
452452

@@ -560,7 +560,7 @@ def execute(self):
560560
self.connection.action("VACUUM")
561561

562562

563-
# included in build 507 (2014-0#-##)
563+
# included in build 507 (2014-11-16)
564564
class AddSkipNotifications(CleanupHistoryAndSpecials):
565565
""" Adding column skip_notices to tv_shows """
566566

@@ -577,7 +577,7 @@ def execute(self):
577577
self.incDBVersion()
578578

579579

580-
# included in build 507 (2014-0#-##)
580+
# included in build 507 (2014-11-16)
581581
class AddHistorySource(AddSkipNotifications):
582582
""" Adding column source to history """
583583

sickbeard/naming.py

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@
4040
'%Y/%0M/%S.N.%A.D.%E.N-%RG'
4141
)
4242

43+
4344
class TVShow():
4445
def __init__(self):
4546
self.name = "Show Name"
4647
self.genre = "Comedy"
4748
self.air_by_date = 0
4849

50+
4951
class TVEpisode(tv.TVEpisode):
5052
def __init__(self, season, episode, name):
5153
self.relatedEps = []
@@ -57,51 +59,54 @@ def __init__(self, season, episode, name):
5759
self._status = Quality.compositeStatus(common.DOWNLOADED, common.Quality.SDTV)
5860
self._release_name = 'Show.Name.S02E03.HDTV.XviD-RLSGROUP'
5961

62+
6063
def check_force_season_folders(pattern=None, multi=None):
6164
"""
6265
Checks if the name can still be parsed if you strip off the folders to determine if we need to force season folders
6366
to be enabled or not.
64-
67+
6568
Returns true if season folders need to be forced on or false otherwise.
6669
"""
67-
if pattern == None:
70+
if pattern is None:
6871
pattern = sickbeard.NAMING_PATTERN
69-
70-
valid = not validate_name(pattern, None, file_only=True)
71-
72-
if multi != None:
72+
73+
valid = not validate_name(pattern, None, file_only=True)
74+
75+
if multi is not None:
7376
valid = valid or not validate_name(pattern, multi, file_only=True)
7477

7578
return valid
7679

80+
7781
def check_valid_naming(pattern=None, multi=None):
7882
"""
7983
Checks if the name is can be parsed back to its original form for both single and multi episodes.
80-
84+
8185
Returns true if the naming is valid, false if not.
8286
"""
83-
if pattern == None:
87+
if pattern is None:
8488
pattern = sickbeard.NAMING_PATTERN
85-
86-
logger.log(u"Checking whether the pattern "+pattern+" is valid for a single episode", logger.DEBUG)
89+
90+
logger.log(u"Checking whether the pattern " + pattern + " is valid for a single episode", logger.DEBUG)
8791
valid = validate_name(pattern, None)
8892

89-
if multi != None:
90-
logger.log(u"Checking whether the pattern "+pattern+" is valid for a multi episode", logger.DEBUG)
93+
if multi is not None:
94+
logger.log(u"Checking whether the pattern " + pattern + " is valid for a multi episode", logger.DEBUG)
9195
valid = valid and validate_name(pattern, multi)
9296

9397
return valid
9498

99+
95100
def check_valid_abd_naming(pattern=None):
96101
"""
97102
Checks if the name is can be parsed back to its original form for an air-by-date format.
98-
103+
99104
Returns true if the naming is valid, false if not.
100105
"""
101-
if pattern == None:
106+
if pattern is None:
102107
pattern = sickbeard.NAMING_PATTERN
103-
104-
logger.log(u"Checking whether the pattern "+pattern+" is valid for an air-by-date episode", logger.DEBUG)
108+
109+
logger.log(u"Checking whether the pattern " + pattern + " is valid for an air-by-date episode", logger.DEBUG)
105110
valid = validate_name(pattern, abd=True)
106111

107112
return valid
@@ -118,18 +123,18 @@ def validate_name(pattern, multi=None, file_only=False, abd=False):
118123
new_name = ek.ek(os.path.join, new_path, new_name)
119124

120125
if not new_name:
121-
logger.log(u"Unable to create a name out of "+pattern, logger.DEBUG)
126+
logger.log(u"Unable to create a name out of " + pattern, logger.DEBUG)
122127
return False
123128

124-
logger.log(u"Trying to parse "+new_name, logger.DEBUG)
129+
logger.log(u"Trying to parse " + new_name, logger.DEBUG)
125130

126131
try:
127132
result = parser.parse(new_name)
128133
except InvalidNameException:
129-
logger.log(u"Unable to parse "+new_name+", not valid", logger.DEBUG)
134+
logger.log(u"Unable to parse " + new_name + ", not valid", logger.DEBUG)
130135
return False
131-
132-
logger.log("The name "+new_name + " parsed into " + str(result), logger.DEBUG)
136+
137+
logger.log(u"The name " + new_name + " parsed into " + str(result), logger.DEBUG)
133138

134139
if abd:
135140
if result.air_date != ep.airdate:
@@ -145,25 +150,26 @@ def validate_name(pattern, multi=None, file_only=False, abd=False):
145150

146151
return True
147152

153+
148154
def _generate_sample_ep(multi=None, abd=False):
149155
# make a fake episode object
150-
ep = TVEpisode(2,3,"Ep Name")
156+
ep = TVEpisode(2, 3, "Ep Name")
151157
ep._status = Quality.compositeStatus(DOWNLOADED, Quality.HDTV)
152158
ep._airdate = datetime.date(2011, 3, 9)
153159
if abd:
154160
ep._release_name = 'Show.Name.2011.03.09.HDTV.XviD-RLSGROUP'
155161
else:
156162
ep._release_name = 'Show.Name.S02E03.HDTV.XviD-RLSGROUP'
157163

158-
if multi != None:
164+
if multi is not None:
159165
ep._name = "Ep Name (1)"
160166
ep._release_name = 'Show.Name.S02E03E04E05.HDTV.XviD-RLSGROUP'
161167

162-
secondEp = TVEpisode(2,4,"Ep Name (2)")
168+
secondEp = TVEpisode(2, 4, "Ep Name (2)")
163169
secondEp._status = Quality.compositeStatus(DOWNLOADED, Quality.HDTV)
164170
secondEp._release_name = ep._release_name
165171

166-
thirdEp = TVEpisode(2,5,"Ep Name (3)")
172+
thirdEp = TVEpisode(2, 5, "Ep Name (3)")
167173
thirdEp._status = Quality.compositeStatus(DOWNLOADED, Quality.HDTV)
168174
thirdEp._release_name = ep._release_name
169175

@@ -172,8 +178,9 @@ def _generate_sample_ep(multi=None, abd=False):
172178

173179
return ep
174180

181+
175182
def test_name(pattern, multi=None, abd=False):
176183

177184
ep = _generate_sample_ep(multi, abd)
178185

179-
return {'name': ep.formatted_filename(pattern, multi), 'dir': ep.formatted_dir(pattern, multi)}
186+
return {'name': ep.formatted_filename(pattern, multi), 'dir': ep.formatted_dir(pattern, multi)}

sickbeard/notifiers/pushalot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _notify(self, title, message, authtoken=None, silent=None, important=None, f
4343
if not silent:
4444
silent = bool(sickbeard.PUSHALOT_SILENT)
4545

46-
logger.log("PUSHALOT: Sending notice with details: title=\"%s\", message=\"%s\", silent=%s, important=%s, authtoken=%s" % (title, message, silent, important, authtoken), logger.DEBUG)
46+
logger.log(u"PUSHALOT: Sending notice with details: title=\"%s\", message=\"%s\", silent=%s, important=%s, authtoken=%s" % (title, message, silent, important, authtoken), logger.DEBUG)
4747

4848
try:
4949

sickbeard/nzbget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def sendNZB(nzb):
5252

5353
url = urlparse.urlunsplit((scheme, netloc, u"/xmlrpc", "", ""))
5454

55-
logger.log(u"Sending NZB to NZBGet")
55+
logger.log(u"Sending NZB to NZBGet: %s" % nzb.name)
5656
logger.log(u"NZBGet URL: " + url, logger.DEBUG)
5757

5858
nzbGetRPC = xmlrpclib.ServerProxy(url.encode("utf-8", 'ignore'))

0 commit comments

Comments
 (0)