mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-18 12:28:31 +01:00
Calculate chunkcount with the real file size, not the size saved in the database (might be wrong and results in corrupted download).
This commit is contained in:
parent
d053039f80
commit
42d9a86ff0
@ -628,10 +628,6 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song,
|
||||
if (!(song.url().scheme() == "file"))
|
||||
return;
|
||||
|
||||
// Calculate the number of chunks
|
||||
int chunk_count = qRound((song.filesize() / kFileChunkSize) + 0.5);
|
||||
int chunk_number = 1;
|
||||
|
||||
// Open the file
|
||||
QFile file(song.url().toLocalFile());
|
||||
file.open(QIODevice::ReadOnly);
|
||||
@ -643,6 +639,10 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song,
|
||||
|
||||
QImage null_image;
|
||||
|
||||
// Calculate the number of chunks
|
||||
int chunk_count = qRound((file.size() / kFileChunkSize) + 0.5);
|
||||
int chunk_number = 1;
|
||||
|
||||
while (!file.atEnd()) {
|
||||
// Read file chunk
|
||||
data = file.read(kFileChunkSize);
|
||||
|
Loading…
Reference in New Issue
Block a user