Calculate chunkcount with the real file size, not the size saved in the database (might be wrong and results in corrupted download).
(cherry picked from commit 42d9a86ff0
)
This commit is contained in:
parent
313ecbc783
commit
3a8a88972f
|
@ -628,10 +628,6 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song,
|
||||||
if (!(song.url().scheme() == "file"))
|
if (!(song.url().scheme() == "file"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Calculate the number of chunks
|
|
||||||
int chunk_count = qRound((song.filesize() / kFileChunkSize) + 0.5);
|
|
||||||
int chunk_number = 1;
|
|
||||||
|
|
||||||
// Open the file
|
// Open the file
|
||||||
QFile file(song.url().toLocalFile());
|
QFile file(song.url().toLocalFile());
|
||||||
file.open(QIODevice::ReadOnly);
|
file.open(QIODevice::ReadOnly);
|
||||||
|
@ -643,6 +639,10 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song,
|
||||||
|
|
||||||
QImage null_image;
|
QImage null_image;
|
||||||
|
|
||||||
|
// Calculate the number of chunks
|
||||||
|
int chunk_count = qRound((file.size() / kFileChunkSize) + 0.5);
|
||||||
|
int chunk_number = 1;
|
||||||
|
|
||||||
while (!file.atEnd()) {
|
while (!file.atEnd()) {
|
||||||
// Read file chunk
|
// Read file chunk
|
||||||
data = file.read(kFileChunkSize);
|
data = file.read(kFileChunkSize);
|
||||||
|
|
Loading…
Reference in New Issue