Commit 99224190 authored by echel0n's avatar echel0n
Browse files

Fixed issue with episode status manage view

Fixed 'cannot unpack non-iterable NoneType object' caused when trying to get show object during name parsing
parent 474763eb
......@@ -235,11 +235,11 @@ class NameParser(object):
if not self.naming_pattern:
# try and create a show object for this result
result = self.get_show(best_result.series_name)
if result:
best_result.series_id, best_result.series_provider_id = self.get_show(best_result.series_name)
if result and len(result) == 2:
best_result.series_id, best_result.series_provider_id = result
show_obj = find_show(best_result.series_id,
best_result.series_provider_id) if best_result.series_id and best_result.series_provider_id else None
if best_result.series_id and best_result.series_provider_id:
show_obj = find_show(best_result.series_id, best_result.series_provider_id)
# if this is a naming pattern test or result doesn't have a show object then return best result
if not show_obj or self.naming_pattern:
......
......@@ -352,11 +352,14 @@ class EpisodeStatusesHandler(BaseHandler, ABC):
sorted_show_ids = []
status_list = []
if which_status:
which_status = EpisodeStatus[which_status]
# if we have no status then this is as far as we need to go
if len(status_list):
if which_status:
for show in sorted(get_show_list(), key=lambda d: d.name):
for episode in show.episodes:
if episode.season != 0 and episode.status == EpisodeStatus[which_status]:
if episode.season != 0 and episode.status == which_status:
if show.series_id not in ep_counts:
ep_counts[show.series_id] = 1
else:
......
......@@ -29,7 +29,7 @@
<select name="whichStatus" id="whichStatus" class="form-control shadow">
% for curStatus in flatten([EpisodeStatus.SKIPPED, EpisodeStatus.SNATCHED, EpisodeStatus.WANTED, EpisodeStatus.IGNORED, EpisodeStatus.FAILED, EpisodeStatus.composites(EpisodeStatus.DOWNLOADED), EpisodeStatus.composites(EpisodeStatus.ARCHIVED)]):
%if curStatus not in [EpisodeStatus.ARCHIVED, EpisodeStatus.DOWNLOADED]:
<option value="${curStatus}">
<option value="${curStatus.name}">
${curStatus.display_name}
</option>
%endif
......@@ -49,7 +49,7 @@
</div>
<br/>
<form action="${srWebRoot}/manage/changeEpisodeStatuses" method="post">
<input type="hidden" id="oldStatus" name="oldStatus" value="${whichStatus}"/>
<input type="hidden" id="oldStatus" name="oldStatus" value="${whichStatus.name}"/>
<div class="row">
<div class="col-md-12">
<h2>
......@@ -64,7 +64,7 @@
if whichStatus in flatten([EpisodeStatus.IGNORED, EpisodeStatus.SNATCHED, EpisodeStatus.composites(EpisodeStatus.DOWNLOADED), EpisodeStatus.composites(EpisodeStatus.ARCHIVED)]):
row_class = "good"
else:
row_class = Overview(whichStatus).display_name
row_class = Overview(whichStatus).css_name
%>
<input type="hidden" id="row_class" value="${row_class}"/>
......@@ -87,7 +87,7 @@
%>
% for curStatus in statusList:
<option value="${curStatus}">${curStatus.display_name}</option>
<option value="${curStatus.name}">${curStatus.display_name}</option>
% endfor
</select>
<div class="input-group-append">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment