Something like:
```python
    def album_artist_from_directory_structure(filename, album, artist):
        # Improve clustering from directory structure if no existing tags
        # Only used for grouping and to provide cluster title / artist - not added to file tags.
        if not album:
            dirs = os.path.dirname(filename).replace('\\','/').split('/')
            # Strip disc subdirectory from list
            if re.search(r'(^|\s)(CD|DVD|Disc)\s*\d+(\s|$)', dirs[-1], re.I):
                del dirs[-1]
            # For clustering assume %artist%/%album%/file and %artist% - %album%/file
            album = dirs[-1]
            if not artist:
                if ' - ' in album:
                    artist, album = album.split(' - ', 1)
                else:
                    artist = dirs[-2]
        return album, artist
```

This way we can add unit tests for it.