(self)
Disassemble string file path into components
Disassemble string file path into components
Disassemble string file path into components
def analyze_file_path(self):
        '''
        Disassemble string file path into components

        '''

        file_path = self.path

        # Detect TYPE
        if not self.type:
            self.detect_path_type()

        if self.type == 'path' or self.type == 'sequence':
            file_name = file_path.split('/')[-1]
            file_location = file_path.replace('/{}'.format(file_name), '')

            # Check if file path has a FOLDER VERSION
            folder_version = None
            folder_name = file_location.split('/')[-1]
            if len(folder_name) == 3:
                try:
                    int(folder_name)
                    folder_version = folder_name
                except:
                    pass

            self.name = file_name
            self.location = file_location
            self.folder_version = folder_version

            self.analyze_file_name()

        elif self.type == 'location':
            self.location = self.path[:-4]
            self.folder_version = self.path.split('/')[-1]

        else:
            print '>>>> ERROR! Unknown path type for path = {}'.format(self.path)
def analyze_file_path ( self ) : file_path = self . path # Detect TYPE if not self . type : self . detect_path_type ( ) if self . type == 'path' or self . type == 'sequence' : file_name = file_path . split ( '/' ) [ - 1 ] file_location = file_path . replace ( '/{}' . format ( file_name ) , '' ) # Check if file path has a FOLDER VERSION folder_version = None folder_name = file_location . split ( '/' ) [ - 1 ] if len ( folder_name ) == 3 : try : int ( folder_name ) folder_version = folder_name except : pass self . name = file_name self . location = file_location self . folder_version = folder_version self . analyze_file_name ( ) elif self . type == 'location' : self . location = self . path [ : - 4 ] self . folder_version = self . path . split ( '/' ) [ - 1 ] else : print '>>>> ERROR! Unknown path type for path = {}' . format ( self . path )