Skip to content
Browse files

Move logger.log to display Rename to new_path + with extension

  • Loading branch information...
1 parent 0fd1344 commit 021077052328d79e4884f218ac80281a3d96291c @itofzo itofzo committed Sep 13, 2012
Showing with 10 additions and 10 deletions.
  1. +10 −10 sickbeard/helpers.py
View
20 sickbeard/helpers.py
@@ -469,37 +469,37 @@ def make_dirs(path):
return True
+
def rename_ep_file(cur_path, new_path):
"""
Creates all folders needed to move a file to its new location, renames it, then cleans up any folders
left that are now empty.
-
+
cur_path: The absolute path to the file you want to move/rename
new_path: The absolute path to the destination for the file WITHOUT THE EXTENSION
"""
-
- logger.log(u"Renaming file from "+cur_path+" to "+new_path)
-
+
new_dest_dir, new_dest_name = os.path.split(new_path) #@UnusedVariable
cur_file_name, cur_file_ext = os.path.splitext(cur_path) #@UnusedVariable
-
+
# put the extension on the incoming file
new_path += cur_file_ext
-
+
make_dirs(os.path.dirname(new_path))
-
+
# move the file
try:
+ logger.log(u"Renaming file from " + cur_path + " to " + new_path)
ek.ek(os.rename, cur_path, new_path)
except (OSError, IOError), e:
logger.log(u"Failed renaming " + cur_path + " to " + new_path + ": " + ex(e), logger.ERROR)
return False
-
+
# clean up any old folders that are empty
delete_empty_folders(ek.ek(os.path.dirname, cur_path))
-
+
return True
-
+
def delete_empty_folders(check_empty_dir):
"""

0 comments on commit 0210770

Please sign in to comment.
Something went wrong with that request. Please try again.