Skip to content

Commit

Permalink
Episode Status Management List Display (#8680)
Browse files Browse the repository at this point in the history
* QueryList Display

* Ep Status changling

* Ep Status changling2

---------

Co-authored-by: miigotu <[email protected]>
  • Loading branch information
BKSteve and miigotu authored Feb 1, 2024
1 parent d3e270c commit 92d8774
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
11 changes: 8 additions & 3 deletions sickchill/views/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -1426,9 +1426,14 @@ def updateEMBY(self, show=None):
return self.redirect("/home/")

def setStatus(self, direct=False):
show = self.get_body_argument("show")
eps = self.get_body_arguments("eps[]")
status = self.get_body_argument("status")
if direct is True:
show = self.to_change_show
eps = self.to_change_eps
status = self.get_body_argument("newStatus")
else:
show = self.get_body_argument("show")
eps = self.get_body_arguments("eps[]")
status = self.get_body_argument("status")

if status not in statusStrings:
errMsg = _("Invalid status")
Expand Down
9 changes: 7 additions & 2 deletions sickchill/views/manage/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def showEpisodeStatuses(indexer_id, whichStatus):
return json.dumps(result)

def episodeStatuses(self):
which_status = self.get_body_argument("whichStatus", None)
which_status = self.get_query_argument("whichStatus", None)
if which_status:
status_list = [int(which_status)]
if status_list[0] == SNATCHED:
Expand Down Expand Up @@ -109,6 +109,8 @@ def changeEpisodeStatuses(self, oldStatus, newStatus, *args, **kwargs):
status_list = Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST

to_change = {}
self.to_change_show = []
self.to_change_eps = []

# make a list of all shows and their associated args
for arg in kwargs:
Expand All @@ -125,14 +127,17 @@ def changeEpisodeStatuses(self, oldStatus, newStatus, *args, **kwargs):

main_db_con = db.DBConnection()
for cur_indexer_id in to_change:
self.to_change_show = cur_indexer_id
# get a list of all the eps we want to change if they just said "all"
if "all" in to_change[cur_indexer_id]:
all_eps_results = main_db_con.select(
"SELECT season, episode FROM tv_episodes WHERE status IN ({0}) AND season != 0 AND showid = ?".format(",".join(["?"] * len(status_list))),
status_list + [cur_indexer_id],
)
all_eps = [str(x["season"]) + "x" + str(x["episode"]) for x in all_eps_results]
to_change[cur_indexer_id] = all_eps
self.to_change_eps = all_eps
else:
self.to_change_eps = to_change[cur_indexer_id]

self.setStatus(direct=True)

Expand Down

0 comments on commit 92d8774

Please sign in to comment.