From 19cc8f812c6d650bf3892b9dc4a26b6ddd0fd5fb Mon Sep 17 00:00:00 2001
From: Nic Wolfe <nic@wolfeden.ca>
Date: Sat, 24 Mar 2012 14:01:55 -0600
Subject: [PATCH] Fixed some merge bugs, added some logging to the migration

---
 sickbeard/__init__.py         | 2 +-
 sickbeard/config.py           | 5 +++--
 sickbeard/databases/mainDB.py | 2 ++
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py
index 44f5e3010..d005d427c 100755
--- a/sickbeard/__init__.py
+++ b/sickbeard/__init__.py
@@ -352,7 +352,7 @@ def initialize(consoleLogging=True):
         CheckSection(CFG, 'NMJ')
         CheckSection(CFG, 'Synology')
         CheckSection(CFG, 'pyTivo')
-        CheckSection('NMA')
+        CheckSection(CFG, 'NMA')
 
         LOG_DIR = check_setting_str(CFG, 'General', 'log_dir', 'Logs')
         if not helpers.makeDir(LOG_DIR):
diff --git a/sickbeard/config.py b/sickbeard/config.py
index 3c24f9fe8..2f24d79d7 100644
--- a/sickbeard/config.py
+++ b/sickbeard/config.py
@@ -247,8 +247,6 @@ def check_setting_str(config, cfg_name, item_name, def_val, log=True):
 
 class ConfigMigrator():
 
-    migration_names = {1: 'Custom naming'}
-
     def __init__(self, config_obj):
         """
         Initializes a config migrator that can take the config from the version indicated in the config
@@ -260,6 +258,9 @@ class ConfigMigrator():
         # check the version of the config
         self.config_version = check_setting_int(config_obj, 'General', 'config_version', 0)
 
+        self.migration_names = {1: 'Custom naming'}
+
+
     def migrate_config(self):
         """
         Calls each successive migration until the config is the same version as SB expects
diff --git a/sickbeard/databases/mainDB.py b/sickbeard/databases/mainDB.py
index 4a1a9e4e9..70f6eacf0 100644
--- a/sickbeard/databases/mainDB.py
+++ b/sickbeard/databases/mainDB.py
@@ -430,6 +430,7 @@ class AddSizeAndSceneNameFields(FixAirByDateSetting):
             download_results = self.connection.select("SELECT resource FROM history WHERE provider = -1 AND showid = ? AND season = ? AND episode = ? AND date > ?",
                                                     [cur_result["showid"], cur_result["season"], cur_result["episode"], cur_result["date"]])
             if not download_results:
+                logger.log(u"Found a snatch in the history for "+cur_result["resource"]+" but couldn't find the associated download, skipping it", logger.DEBUG)
                 continue
 
             nzb_name = cur_result["resource"]
@@ -443,6 +444,7 @@ class AddSizeAndSceneNameFields(FixAirByDateSetting):
             ep_results = self.connection.select("SELECT episode_id, status FROM tv_episodes WHERE showid = ? AND season = ? AND episode = ? AND location != ''",
                                                 [cur_result["showid"], cur_result["season"], cur_result["episode"]])
             if not ep_results:
+                logger.log(u"The episode "+nzb_name+" was found in history but doesn't exist on disk anymore, skipping", logger.DEBUG)
                 continue
 
             # get the status/quality of the existing ep and make sure it's what we expect 
-- 
GitLab