Example #1
0
 def tmppath(self):
     if self._tmppath is None:
         self._tmppath = Path(str(pytest.ensuretemp('mgtest')))
     return self._tmppath
Example #2
0
        'firstletter': handle_firstletter,
    }
    namingmodel = namingmodel.replace('\\', '/')
    result = AutoResolve(None, '')
    if not case_sensitive:
        result.case_sensitive = False
    files = directory.allfiles
    parent_job.start_job(len(files))
    for song in files:
        new_path_str = process_tokens(namingmodel, handlers, song)
        if song.extension:
            new_path_str = "%s.%s" % (new_path_str, song.extension)
        if (not rename_empty_tag) and ('(none)' in new_path_str):
            new_path = (('(not renamed)', ) + song.path)
        else:
            new_path = Path(new_path_str)
        folder_path = new_path[:-1]
        folder = result.add_path(folder_path)
        folder.add_file_copy(song, new_path[-1])
        parent_job.add_progress()
    return result


def Split(refdir, naming_model, max_bytes, grouping_level=0):
    """Splits 'refdir' in chunks of 'max_bytes'.
    
    refdir: The directory to split
    naming_model: Naming model for the CDs ONLY
    max_bytes: the maximum number of bytes that can go in a CD
    grouping_level: 0 if you don't want to group. >0 if you want to group
                    The grouping level correspond to the level of directory