Skip to content

Commit

Permalink
lua modules updater, fix new status, and some typo
Browse files Browse the repository at this point in the history
  • Loading branch information
riderkick committed Feb 11, 2018
1 parent 1cf6ae0 commit 3533a53
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions mangadownloader/forms/frmLuaModulesUpdater.pas
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,12 @@ procedure TLuaModulesRepos.LoadFromFile(const AFilename: String);
m := Add(o.Get('name', ''));
m.sha := o.Get('sha', '');
m.download_url := o.Get('download_url', '');
m.size := o.Get('asize', 0);
m.size := o.Get('size', 0);
m.last_modified := JSONToDateTime(o.Get('last_modified', ''));
m.last_message := o.Get('last_message', '');
m.flag := TLuaModuleRepoFlag(o.Get('flag', 0));
if not FileExists(LUA_WEBSITEMODULE_FOLDER + m.name) then
if (m.flag <> fFailedDownload) and
(not FileExists(LUA_WEBSITEMODULE_FOLDER + m.name)) then
m.flag := fFailedDownload;
end;
finally
Expand Down Expand Up @@ -703,27 +704,21 @@ procedure TCheckUpdateThread.Execute;
FRepos := FOwner.Repos.Clone;
foundupdate := SyncRepos(FRepos, FReposUp);

// look for missing local files
// look for missing local files and previously failed download
for i := 0 to FRepos.Items.Count - 1 do
begin
m := FRepos[i];
if not FileExists(LUA_WEBSITEMODULE_FOLDER + m.name) then
if m.flag = fFailedDownload then
foundupdate := True
else
if (not (m.flag in [fNew, fUpdate])) and
(not FileExists(LUA_WEBSITEMODULE_FOLDER + m.name)) then
begin
m.flag := fFailedDownload;
if foundupdate <> True then
foundupdate := True;
foundupdate := True;
end;
end;

// look for previously failed download
if not foundupdate then
for i := 0 to FRepos.Items.Count - 1 do
if FRepos[i].flag = fFailedDownload then
begin
foundupdate := True;
break;
end;

Synchronize(@SyncFinishChecking);

if foundupdate and (not Terminated) then
Expand Down

0 comments on commit 3533a53

Please sign in to comment.