Exemple #1
0
    def set_destination_data(self):
        # Fetch the file's name without the file extension (this is going to be reset)
        file_name_without_extension = os.path.splitext(
            self.source['basename'])[0]

        # Get container extension
        container = containers.grab_module(self.settings.OUT_CONTAINER)
        container_extension = container.container_extension()

        # Set destination dict
        basename = "{}.{}".format(file_name_without_extension,
                                  container_extension)
        abspath = os.path.join(self.source['dirname'], basename)
        self.destination = {'basename': basename, 'abspath': abspath}
Exemple #2
0
 def test_ensure_we_can_grab_module_of_a_supported_container(self):
     supported_containers = containers.get_all_containers()
     # Ensure that a list of containers was returned
     assert supported_containers
     for supported_container in supported_containers.keys():
         container = containers.grab_module(supported_container)
         # Ensure the module's extension is retrieved by the base class's container_extension function
         assert container.extension == container.container_extension()
         # Ensure the module's description is retrieved by the base class's container_description function
         assert container.description == container.container_description()
         # If the module supports subtitles, ensure this is returned by the
         # base class's container_supports_subtitles function
         if container.supports_subtitles:
             assert container.container_supports_subtitles()
Exemple #3
0
    def set_cache_path(self):
        # Fetch the file's name without the file extension (this is going to be reset)
        file_name_without_extension = os.path.splitext(
            self.source['basename'])[0]

        # Get container extension
        container = containers.grab_module(self.settings.OUT_CONTAINER)
        container_extension = container.container_extension()

        # Parse an output cache path
        out_folder = "unmanic_file_conversion-{}".format(time.time())
        out_file = "{}-{}.{}".format(file_name_without_extension, time.time(),
                                     container_extension)
        self.cache_path = os.path.join(self.settings.CACHE_PATH, out_folder,
                                       out_file)