Repository: pymedusa/Medusa

Issue:
Manual Quality/Status has been Removed
I'm sure removing the ability to manually set the quality/status per episode was removed for a good reason but I know I'm not the only one missing that feature. Sure it's not a huge issue but it was helpful nonetheless.

First use case I've come across since it being removed.  I know there are more, some brought up in irc.
Medusa falsely is identifying a file as 720p web-dl. I would like to set it correctly to sdtv and archive it.
I think the above situation came about when medusa snatched a prefered quality (720p web-dl) to replace the existing sdtv. The snatched file failed and left the state in snatch 720p web-dl. I didn't want medusa to try an contine snatching that episode, so set it as archive. As archive sdtv now does not exist. Now the file is falsely labeled as 720p web-dl archived.


Discussion:

Resolving patch:
diff --git a/medusa/server/web/home/handler.py b/medusa/server/web/home/handler.py
--- a/medusa/server/web/home/handler.py
+++ b/medusa/server/web/home/handler.py
@@ -947,7 +947,7 @@ def displayShow(self, indexername=None, seriesid=None, ):
         for cur_result in sql_results:
             cur_ep_cat = series_obj.get_overview(cur_result[b'status'], cur_result[b'quality'], manually_searched=cur_result[b'manually_searched'])
             if cur_ep_cat:
-                ep_cats['{season}x{episode}'.format(season=cur_result[b'season'], episode=cur_result[b'episode'])] = cur_ep_cat
+                ep_cats['s{season}e{episode}'.format(season=cur_result[b'season'], episode=cur_result[b'episode'])] = cur_ep_cat
                 ep_counts[cur_ep_cat] += 1
 
         bwl = None
@@ -1351,8 +1351,8 @@ def snatchSelection(self, indexername, seriesid, season=None, episode=None, manu
             cur_ep_cat = series_obj.get_overview(cur_result[b'status'], cur_result[b'quality'],
                                                  manually_searched=cur_result[b'manually_searched'])
             if cur_ep_cat:
-                ep_cats['{season}x{episode}'.format(season=cur_result[b'season'],
-                                                    episode=cur_result[b'episode'])] = cur_ep_cat
+                ep_cats['s{season}e{episode}'.format(season=cur_result[b'season'],
+                                                     episode=cur_result[b'episode'])] = cur_ep_cat
                 ep_counts[cur_ep_cat] += 1
 
         return t.render(
@@ -1925,13 +1925,13 @@ def setStatus(self, indexername=None, seriesid=None, eps=None, status=None, dire
                 logger.log('Attempting to set status for episode {series} {episode} to {status}'.format(
                     series=series_obj.name, episode=cur_ep, status=status), logger.DEBUG)
 
-                ep_info = cur_ep.split('x')
-                if not all(ep_info):
+                season_no, episode_no = cur_ep.lstrip('s').split('e')
+                if not all([season_no, episode_no]):
                     logger.log('Something went wrong when trying to set status, season: {season}, episode: {episode}'.format
-                               (season=ep_info[0], episode=ep_info[1]), logger.DEBUG)
+                               (season=season_no, episode=episode_no), logger.DEBUG)
                     continue
 
-                ep_obj = series_obj.get_episode(ep_info[0], ep_info[1])
+                ep_obj = series_obj.get_episode(season_no, episode_no)
                 if not ep_obj:
                     return self._genericMessage('Error', 'Episode couldn\'t be retrieved')
 
@@ -2112,8 +2112,7 @@ def doRename(self, indexername=None, seriesid=None, eps=None):
 
         main_db_con = db.DBConnection()
         for cur_ep in eps.split('|'):
-
-            ep_info = cur_ep.split('x')
+            season_no, episode_no = cur_ep.lstrip('s').split('e')
 
             # this is probably the worst possible way to deal with double eps
             # but I've kinda painted myself into a corner here with this stupid database
@@ -2121,7 +2120,7 @@ def doRename(self, indexername=None, seriesid=None, eps=None):
                 b'SELECT location '
                 b'FROM tv_episodes '
                 b'WHERE indexer = ? AND showid = ? AND season = ? AND episode = ? AND 5=5',
-                [indexer_name_to_id(indexername), seriesid, ep_info[0], ep_info[1]])
+                [indexer_name_to_id(indexername), seriesid, season_no, episode_no])
             if not ep_result:
                 logger.log(u'Unable to find an episode for {episode}, skipping'.format
                            (episode=cur_ep), logger.WARNING)
@@ -2130,10 +2129,10 @@ def doRename(self, indexername=None, seriesid=None, eps=None):
                 b'SELECT season, episode '
                 b'FROM tv_episodes '
                 b'WHERE location = ? AND episode != ?',
-                [ep_result[0][b'location'], ep_info[1]]
+                [ep_result[0][b'location'], episode_no]
             )
 
-            root_ep_obj = series_obj.get_episode(ep_info[0], ep_info[1])
+            root_ep_obj = series_obj.get_episode(season_no, episode_no)
             root_ep_obj.related_episodes = []
 
             for cur_related_ep in related_eps_result:
diff --git a/medusa/server/web/manage/handler.py b/medusa/server/web/manage/handler.py
--- a/medusa/server/web/manage/handler.py
+++ b/medusa/server/web/manage/handler.py
@@ -294,10 +294,11 @@ def downloadSubtitleMissed(self, *args, **kwargs):
                     b"AND location != ''",
                     [DOWNLOADED, cur_indexer_id, cur_series_id]
                 )
-                to_download[(cur_indexer_id, cur_series_id)] = [str(x[b'season']) + 'x' + str(x[b'episode']) for x in all_eps_results]
+                to_download[(cur_indexer_id, cur_series_id)] = ['s' + str(x[b'season']) + 'e' + str(x[b'episode'])
+                                                                for x in all_eps_results]
 
             for epResult in to_download[(cur_indexer_id, cur_series_id)]:
-                season, episode = epResult.split('x')
+                season, episode = epResult.lstrip('s').split('e')
 
                 series_obj = Show.find_by_id(app.showList, cur_indexer_id, cur_series_id)
                 series_obj.get_episode(season, episode).download_subtitles()


Test patch: