Repository: pymedusa/Medusa

Issue:
Adding existing shows: duplicated Add Show page for each, bug if skipping show
Hi,

Medusa Info: | Branch: master
Commit: c65ca2607fae74405dcceaaf8c02f3d29d0313ea
Version: v0.2.5
Database: 44.11
-- | --
Python Version: | 2.7.14 (default, Dec 14 2017, 15:51:29)  [GCC 6.4.0]
SSL Version: | LibreSSL 2.6.4
OS: | Linux-4.15.0-20-generic-x86_64-with

**Problem**
While adding existing shows:
1 - Can't select more than 20-30 at a time. I can't select the hole /Show folder, I have to unselect all then click 1, 2, 3 etc
2 - Add show page appears twice for each show, (thye page relating this such an URL: https://medusa.domain.tld/addShows/addExistingShows?promptForSettings=off&shows_to_add=0%7C%2Ftv%2Funionfs%2FSeries%2FBaron%20Noir&shows_to_add=0%7C%2Ftv%2Funionfs%2FSeries%2FBerlin%20Station&shows_to_add=0%7C%2Ftv%2Funionfs%2FSeries%2FBetter%20Call%20Saul&shows_to_add=0%7C%2Ftv%2Funionfs%2FSeries%2FBig%20Little%20Lies)
3 - On this page, clicking Skip show results to an error: ![img](https://i.imgur.com/cUOIsoj.png)

**Logs:**
https://pastebin.com/8VyZNVRb


I think the duplicate Add show page might be linked to an indexer problem:
```
2018-06-11 19:42:40 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show Baron Noir, as it already is in your library. Error: The show Baron Noir has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
2018-06-11 19:42:29 WARNING  SEARCHQUEUE-BACKLOG-306246 :: [c65ca26] No NZB/Torrent providers found or enabled in the application config for backlog searches. Please check your settings
2018-06-11 19:27:24 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show Ballers, as it already is in your library. Error: The show Ballers has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
2018-06-11 19:26:42 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show Atlanta, as it already is in your library. Error: The show Atlanta has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
2018-06-11 19:25:29 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show Ascension, as it already is in your library. Error: The show Ascension has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
2018-06-11 19:24:57 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show Arrow, as it already is in your library. Error: The show Arrow has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
2018-06-11 19:22:47 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show Aquarius (2015), as it already is in your library. Error: The show Aquarius (2015) has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
2018-06-11 19:22:05 WARNING  SHOWQUEUE-ADD :: [c65ca26] The show in /tv/unionfs/Series/Anne is already in your show list, skipping
2018-06-11 19:21:35 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show American Horror Story, as it already is in your library. Error: The show American Horror Story has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
2018-06-11 19:20:17 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show American Gods, as it already is in your library. Error: The show American Gods has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
```

I use All indexers for each show.

Adding existing shows: duplicated Add Show page for each, bug if skipping show
Hi,

Medusa Info: | Branch: master
Commit: c65ca2607fae74405dcceaaf8c02f3d29d0313ea
Version: v0.2.5
Database: 44.11
-- | --
Python Version: | 2.7.14 (default, Dec 14 2017, 15:51:29)  [GCC 6.4.0]
SSL Version: | LibreSSL 2.6.4
OS: | Linux-4.15.0-20-generic-x86_64-with

**Problem**
While adding existing shows:
1 - Can't select more than 20-30 at a time. I can't select the hole /Show folder, I have to unselect all then click 1, 2, 3 etc
2 - Add show page appears twice for each show, (thye page relating this such an URL: https://medusa.domain.tld/addShows/addExistingShows?promptForSettings=off&shows_to_add=0%7C%2Ftv%2Funionfs%2FSeries%2FBaron%20Noir&shows_to_add=0%7C%2Ftv%2Funionfs%2FSeries%2FBerlin%20Station&shows_to_add=0%7C%2Ftv%2Funionfs%2FSeries%2FBetter%20Call%20Saul&shows_to_add=0%7C%2Ftv%2Funionfs%2FSeries%2FBig%20Little%20Lies)
3 - On this page, clicking Skip show results to an error: ![img](https://i.imgur.com/cUOIsoj.png)

**Logs:**
https://pastebin.com/8VyZNVRb


I think the duplicate Add show page might be linked to an indexer problem:
```
2018-06-11 19:42:40 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show Baron Noir, as it already is in your library. Error: The show Baron Noir has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
2018-06-11 19:42:29 WARNING  SEARCHQUEUE-BACKLOG-306246 :: [c65ca26] No NZB/Torrent providers found or enabled in the application config for backlog searches. Please check your settings
2018-06-11 19:27:24 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show Ballers, as it already is in your library. Error: The show Ballers has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
2018-06-11 19:26:42 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show Atlanta, as it already is in your library. Error: The show Atlanta has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
2018-06-11 19:25:29 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show Ascension, as it already is in your library. Error: The show Ascension has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
2018-06-11 19:24:57 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show Arrow, as it already is in your library. Error: The show Arrow has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
2018-06-11 19:22:47 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show Aquarius (2015), as it already is in your library. Error: The show Aquarius (2015) has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
2018-06-11 19:22:05 WARNING  SHOWQUEUE-ADD :: [c65ca26] The show in /tv/unionfs/Series/Anne is already in your show list, skipping
2018-06-11 19:21:35 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show American Horror Story, as it already is in your library. Error: The show American Horror Story has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
2018-06-11 19:20:17 WARNING  SHOWQUEUE-ADD :: [c65ca26] Could not add the show American Gods, as it already is in your library. Error: The show American Gods has already been added by the indexer TVDBv2. Please remove the show, before you can add it through TVDBv2.
```

I use All indexers for each show.



Discussion:

Resolving patch:
diff --git a/medusa/server/web/home/add_shows.py b/medusa/server/web/home/add_shows.py
--- a/medusa/server/web/home/add_shows.py
+++ b/medusa/server/web/home/add_shows.py
@@ -566,20 +566,21 @@ def addExistingShows(self, shows_to_add=None, promptForSettings=None):
         dirs_only = []
         # separate all the ones with Indexer IDs
         for cur_dir in shows_to_add:
-            if '|' in cur_dir:
-                split_vals = cur_dir.split('|')
-                if len(split_vals) < 3:
-                    dirs_only.append(cur_dir)
             if '|' not in cur_dir:
+                # 'series_dir'
                 dirs_only.append(cur_dir)
             else:
                 indexer, show_dir, indexer_id, show_name = self.split_extra_show(cur_dir)
                 if indexer and show_dir and not indexer_id:
+                    # 'indexer_id|show_dir' or 'indexer_id|show_dir|show_name'
                     dirs_only.append(cur_dir)
+                    continue
 
-                if not show_dir or not indexer_id or not show_name:
+                if not (show_dir and indexer_id and show_name):
+                    # 'indexer_id'
                     continue
 
+                # 'indexer_id|show_dir|series_id|series_name'
                 indexer_id_given.append((int(indexer), show_dir, int(indexer_id), show_name))
 
         # if they want me to prompt for settings then I will just carry on to the newShow page


Test patch: