Example #1
0
def scan_missing_files(index, res_folder):
    num_files = len(index)
    missing = 0
    scanned = 0
    missing_files = []
    missing_bytes = 0
    missing_bytes_on_disk = 0
    for entry in index:
        scanned += 1
        progress.write(
            "%6.1d of %6.1d files (%6.1d missing - %10.10s - %10.10s on disk)\r"
            % (scanned, num_files, missing, format_memory(missing_bytes),
               format_memory(missing_bytes_on_disk)))
        filename = os.path.join(res_folder, entry.cached_name)
        if not os.path.exists(filename):
            missing += 1
            missing_files.append(entry)
            missing_bytes += entry.compressed_size
            missing_bytes_on_disk += entry.size_in_bytes

    progress.clear()
    print "%6.1d files missing - %10.10s - %10.10s on disk\r" % \
          (missing, format_memory(missing_bytes), format_memory(missing_bytes_on_disk))
    print

    return missing_files
Example #2
0
def diff_cache(index, res_folder):
    index_by_cached_names = {}
    for entry in index:
        index_by_cached_names[entry.cached_name] = entry

    extras, extra_bytes = scan_extra_files(index_by_cached_names, res_folder)
    missing, missing_bytes, missing_download_bytes = scan_missing_files(index, res_folder)

    if missing:
        print "%d files missing:" % missing
        print "%s to download (%s on disk)" % (format_memory(missing_download_bytes), format_memory(missing_bytes))
        print
    else:
        print "No missing files"

    if extras:
        print "%d extra files (%s)" % (extras, format_memory(extra_bytes))
    else:
        print "No extra files"
Example #3
0
def diff_cache(index, res_folder):
    index_by_cached_names = {}
    for entry in index:
        index_by_cached_names[entry.cached_name] = entry

    extras, extra_bytes = scan_extra_files(index_by_cached_names, res_folder)
    missing, missing_bytes, missing_download_bytes = scan_missing_files(
        index, res_folder)

    if missing:
        print "%d files missing:" % missing
        print "%s to download (%s on disk)" % (format_memory(
            missing_download_bytes), format_memory(missing_bytes))
        print
    else:
        print "No missing files"

    if extras:
        print "%d extra files (%s)" % (extras, format_memory(extra_bytes))
    else:
        print "No extra files"
Example #4
0
def scan_missing_files(index, res_folder):
    num_files = len(index)
    missing = 0
    scanned = 0
    missing_files = []
    missing_bytes = 0
    missing_bytes_on_disk = 0
    for entry in index:
        scanned += 1
        progress.write("%6.1d of %6.1d files (%6.1d missing - %10.10s - %10.10s on disk)\r" %
                       (scanned, num_files, missing, format_memory(missing_bytes), format_memory(missing_bytes_on_disk)))
        filename = os.path.join(res_folder, entry.cached_name)
        if not os.path.exists(filename):
            missing += 1
            missing_files.append(entry)
            missing_bytes += entry.compressed_size
            missing_bytes_on_disk += entry.size_in_bytes

    progress.clear()
    print "%6.1d files missing - %10.10s - %10.10s on disk\r" % \
          (missing, format_memory(missing_bytes), format_memory(missing_bytes_on_disk))
    print

    return missing_files