Exemple #1
0
    def move_log_file(self, rpd_file: Union[Photo, Video]) -> None:
        """
        Move (rename) the associate XMP file using the pre-generated
        name
        """

        try:
            if rpd_file.log_extension:
                ext = rpd_file.log_extension
            else:
                ext = '.LOG'
        except AttributeError:
            ext = '.LOG'

        try:
            rpd_file.download_log_full_name = self._move_associate_file(
                extension=ext,
                full_base_name=rpd_file.download_full_base_name,
                temp_associate_file=rpd_file.temp_log_full_name)
        except (OSError, FileNotFoundError) as e:
            self.problems.append(
                RenamingAssociateFileProblem(source=make_href(
                    name=os.path.basename(rpd_file.download_log_full_name),
                    uri=get_uri(full_file_name=rpd_file.download_log_full_name,
                                camera_details=rpd_file.camera_details)),
                                             exception=e))
            logging.error("Failed to move file's associated LOG file %s",
                          rpd_file.download_log_full_name)
Exemple #2
0
    def move_thm_file(self, rpd_file: Union[Photo, Video]) -> None:
        """
        Move (rename) the THM thumbnail file using the pre-generated name
        """

        try:
            if rpd_file.thm_extension:
                ext = rpd_file.thm_extension
            else:
                ext = ".THM"
        except AttributeError:
            ext = ".THM"

        try:
            rpd_file.download_thm_full_name = self._move_associate_file(
                extension=ext,
                full_base_name=rpd_file.download_full_base_name,
                temp_associate_file=rpd_file.temp_thm_full_name,
            )
        except (OSError, FileNotFoundError) as e:
            self.problems.append(
                RenamingAssociateFileProblem(
                    source=make_href(
                        name=os.path.basename(rpd_file.download_thm_full_name),
                        uri=get_uri(
                            full_file_name=rpd_file.download_thm_full_name,
                            camera_details=rpd_file.camera_details,
                        ),
                    ),
                    exception=e,
                )
            )

            logging.error(
                "Failed to move video THM file %s", rpd_file.download_thm_full_name
            )