Private GIT

Skip to content
Snippets Groups Projects
Commit 80d46273 authored by Nic Wolfe's avatar Nic Wolfe
Browse files

Fix another post-processing issue

parent d5fe5356
Branches
Tags build-486
No related merge requests found
...@@ -143,6 +143,13 @@ class PostProcessor(object): ...@@ -143,6 +143,13 @@ class PostProcessor(object):
ek.ek(os.remove, cur_file) ek.ek(os.remove, cur_file)
def _combined_file_operation (self, file_path, new_path, new_base_name, associated_files=False, action=None): def _combined_file_operation (self, file_path, new_path, new_base_name, associated_files=False, action=None):
"""
file_path: The full path of the media file to copy
new_path: Destination path where we want to copy the file to
new_base_name: The base filename (no extension) to use during the copy. Use None to keep the same name.
associated_files: Boolean, whether we should copy similarly-named files too
action: function that takes an old path and new path and does an operation with them (move/copy)
"""
if not action: if not action:
self._log(u"Must provide an action for the combined file operation", logger.ERROR) self._log(u"Must provide an action for the combined file operation", logger.ERROR)
...@@ -179,6 +186,12 @@ class PostProcessor(object): ...@@ -179,6 +186,12 @@ class PostProcessor(object):
action(cur_file_path, new_file_path) action(cur_file_path, new_file_path)
def _move(self, file_path, new_path, new_base_name, associated_files=False): def _move(self, file_path, new_path, new_base_name, associated_files=False):
"""
file_path: The full path of the media file to move
new_path: Destination path where we want to move the file to
new_base_name: The base filename (no extension) to use during the move. Use None to keep the same name.
associated_files: Boolean, whether we should move similarly-named files too
"""
def _int_move(cur_file_path, new_file_path): def _int_move(cur_file_path, new_file_path):
...@@ -193,6 +206,12 @@ class PostProcessor(object): ...@@ -193,6 +206,12 @@ class PostProcessor(object):
self._combined_file_operation(file_path, new_path, new_base_name, associated_files, action=_int_move) self._combined_file_operation(file_path, new_path, new_base_name, associated_files, action=_int_move)
def _copy(self, file_path, new_path, new_base_name, associated_files=False): def _copy(self, file_path, new_path, new_base_name, associated_files=False):
"""
file_path: The full path of the media file to copy
new_path: Destination path where we want to copy the file to
new_base_name: The base filename (no extension) to use during the copy. Use None to keep the same name.
associated_files: Boolean, whether we should copy similarly-named files too
"""
def _int_copy (cur_file_path, new_file_path): def _int_copy (cur_file_path, new_file_path):
...@@ -649,7 +668,9 @@ class PostProcessor(object): ...@@ -649,7 +668,9 @@ class PostProcessor(object):
new_file_name = new_base_name + '.' + orig_extension new_file_name = new_base_name + '.' + orig_extension
else: else:
new_base_name = self.file_name # if we're not renaming then there's no new base name, we'll just use the existing name
new_base_name = None
new_file_name = self.file_name
try: try:
# move the episode and associated files to the show dir # move the episode and associated files to the show dir
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment