Fix enclosure status

Enclosure wasn't checking if file existed on disk.  Hence, if the
enclosure was reporting a file size of 0 (which matches the non-existent
file size, then it would set the status incorrectly to Enclosure::Downloaded.
This commit is contained in:
Bart De Vries 2021-04-14 11:22:35 +02:00
parent 65c5a16dc8
commit 8c1295372a
1 changed files with 6 additions and 4 deletions

View File

@ -38,12 +38,14 @@ Enclosure::Enclosure(Entry *entry)
m_playposition_dbsave = m_playposition;
QFile file(path());
if(file.size() == m_size) {
m_status = Downloaded;
} else {
if(file.exists()) {
if (file.exists()) {
if(file.size() == m_size) {
m_status = Downloaded;
} else {
file.remove();
m_status = Downloadable;
}
} else {
m_status = Downloadable;
}
}