Skip to content

File parts download is... hilariously wrong #44

@nanoscopic

Description

@nanoscopic

In workers/init.py, in the download_and_combine function, there is a severe problem.

Observe this code:

for i, url in enumerate(urls):
        part_number = i + 1
        file_part, err = download_file_part(path, url, part_number)

        if file_part:
            file_parts.append(file_part)
        else:
            # Skip to the next URL if there's an error downloading a part
            continue

    result = combine_file_parts(path, *file_parts)

You can see here that if there is any issue downloading a part, it... just continues onto the next part!

Here's the hilarious part. Observe combine_file_parts:

for file in file_parts:
        if not os.path.isfile(file):
            print('File part not found', file)
            return False

The only pieces in the file_parts array? The ones that worked.

There is also no clear way to detect this occurred besides a resulting failure to convert the mashed together m4a bits into flac.

Like ok... if it messes with the track length you could detect that by checking the time length in the DB against the FLAC time length. If not? Well you're in trouble.

Edit: It appears flac -t [file.flac] is able to detect flac files created this way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions