Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

fix TypeError: season_folders_format = "" #478

Merged
merged 1 commit into from over 1 year ago

2 participants

Patrick Vos Nic Wolfe
Patrick Vos
Collaborator

_migrate_v1 throws an exception on season_folders_format = ""
TypeError: not all arguments converted during string formatting.

Nic Wolfe midgetspy merged commit 830b3b1 into from
Nic Wolfe midgetspy closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Sep 17, 2012
Patrick Vos fix TypeError: season_folders_format = "" 07ee34f
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 25 additions and 20 deletions. Show diff stats Hide diff stats

  1. 45  sickbeard/config.py
45  sickbeard/config.py
@@ -283,46 +283,51 @@ def _migrate_v1(self):
283 283
         """
284 284
         Reads in the old naming settings from your config and generates a new config template from them.
285 285
         """
286  
-        
  286
+
287 287
         sickbeard.NAMING_PATTERN = self._name_to_pattern()
288  
-        logger.log("Based on your old settings I'm setting your new naming pattern to: "+sickbeard.NAMING_PATTERN)
289  
-        
  288
+        logger.log("Based on your old settings I'm setting your new naming pattern to: " + sickbeard.NAMING_PATTERN)
  289
+
290 290
         sickbeard.NAMING_CUSTOM_ABD = bool(check_setting_int(self.config_obj, 'General', 'naming_dates', 0))
291  
-        
  291
+
292 292
         if sickbeard.NAMING_CUSTOM_ABD:
293 293
             sickbeard.NAMING_ABD_PATTERN = self._name_to_pattern(True)
294  
-            logger.log("Adding a custom air-by-date naming pattern to your config: "+sickbeard.NAMING_ABD_PATTERN)
  294
+            logger.log("Adding a custom air-by-date naming pattern to your config: " + sickbeard.NAMING_ABD_PATTERN)
295 295
         else:
296 296
             sickbeard.NAMING_ABD_PATTERN = naming.name_abd_presets[0]
297  
-        
  297
+
298 298
         sickbeard.NAMING_MULTI_EP = int(check_setting_int(self.config_obj, 'General', 'naming_multi_ep_type', 1))
299  
-        
  299
+
300 300
         # see if any of their shows used season folders
301 301
         myDB = db.DBConnection()
302 302
         season_folder_shows = myDB.select("SELECT * FROM tv_shows WHERE flatten_folders = 0")
303  
-        
  303
+
304 304
         # if any shows had season folders on then prepend season folder to the pattern
305 305
         if season_folder_shows:
306  
-        
  306
+
307 307
             old_season_format = check_setting_str(self.config_obj, 'General', 'season_folders_format', 'Season %02d')
308  
-            
309  
-            new_season_format = old_season_format % 9
310  
-            new_season_format = new_season_format.replace('09', '%0S')
311  
-            new_season_format = new_season_format.replace('9', '%S')
312  
-            logger.log(u"Changed season folder format from "+old_season_format+" to "+new_season_format+", prepending it to your naming config")
313  
-        
314  
-            sickbeard.NAMING_PATTERN = new_season_format + os.sep + sickbeard.NAMING_PATTERN
315  
-        
  308
+
  309
+            if old_season_format:
  310
+                try:
  311
+                    new_season_format = old_season_format % 9
  312
+                    new_season_format = new_season_format.replace('09', '%0S')
  313
+                    new_season_format = new_season_format.replace('9', '%S')
  314
+
  315
+                    logger.log(u"Changed season folder format from " + old_season_format + " to " + new_season_format + ", prepending it to your naming config")
  316
+                    sickbeard.NAMING_PATTERN = new_season_format + os.sep + sickbeard.NAMING_PATTERN
  317
+
  318
+                except (TypeError, ValueError):
  319
+                    logger.log(u"Can't change " + old_season_format + " to new season format", logger.ERROR)
  320
+
316 321
         # if no shows had it on then don't flatten any shows and don't put season folders in the config
317 322
         else:
318  
-        
  323
+
319 324
             logger.log(u"No shows were using season folders before so I'm disabling flattening on all shows")
320  
-        
  325
+
321 326
             # don't flatten any shows at all
322 327
             myDB.action("UPDATE tv_shows SET flatten_folders = 0")
323 328
 
324 329
         sickbeard.NAMING_FORCE_FOLDERS = naming.check_force_season_folders()
325  
-        
  330
+
326 331
     def _name_to_pattern(self, abd=False):
327 332
 
328 333
         # get the old settings from the file
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.