Skip to content

Commit

Permalink
Fixes of comments
Browse files Browse the repository at this point in the history
  • Loading branch information
r57zone committed Dec 18, 2020
1 parent 3220b95 commit 14053b4
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions Source/Unit1.pas
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function HTTPDownloadFile(const URL, Path: string; out DownloadedFileName: strin
FileSize, FileExistsCounter: int64;
CopySize: int64;
begin
FileSize:=HTTPGetSize(URL); //Ïîëó÷àåì ðàçìåð ôàéëà
FileSize:=HTTPGetSize(URL); // Ïîëó÷àåì ðàçìåð ôàéëà / Get file size

hSession:=InternetOpen('Mozilla/4.0 (MSIE 6.0; Windows NT 5.1)', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
if Assigned(hSession) then begin
Expand Down Expand Up @@ -236,7 +236,7 @@ function HTTPDownloadFile(const URL, Path: string; out DownloadedFileName: strin
BlockWrite(F, Buffer, BufferLen);
CopySize:=CopySize + SizeOf(Buffer);
Main.StatusBar.SimpleText:=' ' + Format(ID_DOWNLOAD_PODCASTS, [DownloadIndex, DownloadCount, Round( CopySize / (FileSize / 100) )]);
if StopDownload then // Ïî çàïðîñó îñòàíàâëèâàåì çàãðóçêó
if StopDownload then // Ïî çàïðîñó îñòàíàâëèâàåì çàãðóçêó / Stop download on request
break;
end else
Break;
Expand All @@ -252,9 +252,9 @@ function HTTPDownloadFile(const URL, Path: string; out DownloadedFileName: strin
InternetCloseHandle(hSession);
end;

//Ïðîâåðêà íà öåëîñòíîñòü ôàéëà / Checking file size
// Ïðîâåðêà íà öåëîñòíîñòü ôàéëà / Checking file size
if FileSize <> GetFileSize(Path + DownloadedFileName) then begin
//Óäàëÿåì íåïîëíûé ôàéë / Delete the incomplete file
// Óäàëÿåì íåïîëíûé ôàéë / Delete the incomplete file
DeleteFile(Path + DownloadedFileName);
Result:=false;
end else Result:=true;
Expand Down Expand Up @@ -285,17 +285,17 @@ procedure TMain.RefreshBtnClick(Sender: TObject);
GetRss:=TStringList.Create; // Ëåíòà / Rss
Downloaded:=TStringList.Create; // Ñïèñîê ññûëîê çàãðóæåííûõ ïîäêàñòîâ / List of links downloaded podcasts
Download:=TStringList.Create;
StopDownload:=false; // Äàòü âîçìîæíîñòü çàâåðøèòü çàãðóçêó
//Îòêëþ÷åíèå êíîïîê / Disable buttons
StopDownload:=false; // Äàòü âîçìîæíîñòü çàâåðøèòü çàãðóçêó / Allow abort download
// Îòêëþ÷åíèå êíîïîê / Disable buttons
RefreshBtn.Enabled:=false;
RssListMemo.ReadOnly:=true;
SettingsBtn.Enabled:=false;
Application.ProcessMessages; //Ìãíîâåííîå îòêëþ÷åíèå êíîïîê / Instant disable buttons
Application.ProcessMessages; // Ìãíîâåííîå îòêëþ÷åíèå êíîïîê / Instant disable buttons

if FileExists(ExtractFilePath(ParamStr(0)) + 'Downloaded.txt') then
Downloaded.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'Downloaded.txt');

//Ïðîâåðêà ëåíò íà íîâûå ïîäêàñòû / Check feed for new podcasts
// Ïðîâåðêà ëåíò íà íîâûå ïîäêàñòû / Check feed for new podcasts
for i:=0 to RssListMemo.Lines.Count - 1 do begin

if Trim(RssListMemo.Lines.Strings[i]) = '' then
Expand All @@ -307,36 +307,36 @@ procedure TMain.RefreshBtnClick(Sender: TObject);
if Trim(GetRss.Text) = '' then
Continue;

//Atom, óñòàðåâøèé ñòàíäàðò / old standard
// Atom, óñòàðåâøèé ñòàíäàðò / old standard
RegExp.Expression:='(?i)<content.*src="(.*(' + PodcastExt + '))"';

try
if RegExp.Exec(GetRss.Text) then
repeat
if (Pos(RegExp.Match[1], Download.Text) = 0) and //Ïðîâåðÿåì äîáàâëÿëàñü ëè ññûëêà â ñïèñîê çàãðóçêè / Checking if the link was added to the download list
(Pos(RegExp.Match[1], Downloaded.Text) = 0) and //Ïðîâåðÿåì áûëà ëè çàãðóæåíà ññûëêà ðàíåå / Checking if the link was previously downloaded
if (Pos(RegExp.Match[1], Download.Text) = 0) and // Ïðîâåðÿåì äîáàâëÿëàñü ëè ññûëêà â ñïèñîê çàãðóçêè / Checking if the link was added to the download list
(Pos(RegExp.Match[1], Downloaded.Text) = 0) and // Ïðîâåðÿåì áûëà ëè çàãðóæåíà ññûëêà ðàíåå / Checking if the link was previously downloaded
(HTTPCheck(RegExp.Match[1])) then begin
StatusBar.SimpleText:=' ' + ID_NEW_PODCAST + ' ' + Copy(RssListMemo.Lines.Strings[i], 1, 20) + '...';

//Äîáàâëåíèå ññûëêè â ñïèñîê äëÿ çàãðóçêè / Add link to download list
// Äîáàâëåíèå ññûëêè â ñïèñîê äëÿ çàãðóçêè / Add link to download list
Download.Add(RegExp.Match[1]);
end;
until not RegExp.ExecNext;
except
end;

//RSS 2.0
// RSS 2.0
RegExp.Expression:='(?i)<enclosure.*url="(.*(' + PodcastExt + '))"';

try
if RegExp.Exec(GetRss.Text) then
repeat
if (Pos(RegExp.Match[1], Download.Text) = 0) and //Ïðîâåðÿåì äîáàâëÿëàñü ëè ññûëêà â ñïèñîê çàãðóçêè / Checking if the link was added to the download list
(Pos(RegExp.Match[1], Downloaded.Text) = 0) and //Ïðîâåðÿåì áûëà ëè çàãðóæåíà ññûëêà ðàíåå / Checking if the link was previously downloaded
if (Pos(RegExp.Match[1], Download.Text) = 0) and // Ïðîâåðÿåì äîáàâëÿëàñü ëè ññûëêà â ñïèñîê çàãðóçêè / Checking if the link was added to the download list
(Pos(RegExp.Match[1], Downloaded.Text) = 0) and // Ïðîâåðÿåì áûëà ëè çàãðóæåíà ññûëêà ðàíåå / Checking if the link was previously downloaded
(HTTPCheck(RegExp.Match[1])) then begin
StatusBar.SimpleText:=' ' + ID_NEW_PODCAST + ' ' + Copy(RssListMemo.Lines.Strings[i], 1, 20) + '...';

//Äîáàâëåíèå ññûëêè â ñïèñîê äëÿ çàãðóçêè / Add link to download list
// Äîáàâëåíèå ññûëêè â ñïèñîê äëÿ çàãðóçêè / Add link to download list
Download.Add(RegExp.Match[1]);
end;
until not RegExp.ExecNext;
Expand All @@ -349,7 +349,7 @@ procedure TMain.RefreshBtnClick(Sender: TObject);
CancelBtn.Visible:=true;
Main.Refresh;

//Çàãðóçêà ôàéëîâ / Download files
// Çàãðóçêà ôàéëîâ / Download files
if Download.Count > 0 then begin

DownloadCount:=Download.Count;
Expand All @@ -358,9 +358,9 @@ procedure TMain.RefreshBtnClick(Sender: TObject);
for i:=Download.Count - 1 downto 0 do begin
Inc(DownloadIndex);

if DownloadPodcasts then //Ðàçðåøåíèå íà çàãðóçêó / Permission to download
if DownloadPodcasts then // Ðàçðåøåíèå íà çàãðóçêó / Permission to download
if HTTPDownloadFile(Download.Strings[i], DownloadPath, DownloadedFileName, DownloadIndex, DownloadCount) = false then begin // ñëó÷àå îøèáêè / If error
Download.Delete(i); //Óäàëÿåì èç ñïèñêà íà ñîõðàíåíèå ôàéë, êîòîðûé íå çàãðóçèëñÿ öåëèêîì / Remove from list to save the file, which is not fully downloaded
Download.Delete(i); // Óäàëÿåì èç ñïèñêà íà ñîõðàíåíèå ôàéë, êîòîðûé íå çàãðóçèëñÿ öåëèêîì / Remove from list to save the file, which is not fully downloaded
Error:=true;
Inc(ErrorCount);
end;
Expand All @@ -369,23 +369,23 @@ procedure TMain.RefreshBtnClick(Sender: TObject);
if Error = false then begin

if DownloadPodcasts then
StatusBar.SimpleText:=' ' + ID_PODCASTS_DOWNLOADED //Âñå ïîäêàñòû çàãðóæåíû // All Podcasts downloaded
StatusBar.SimpleText:=' ' + ID_PODCASTS_DOWNLOADED // Âñå ïîäêàñòû çàãðóæåíû // All Podcasts downloaded
else
StatusBar.SimpleText:=' ' + ID_PODCASTS_SKIPPED; //Âñå ïîäêàñòû ïðîïóùåíû // All Podcasts skipped
StatusBar.SimpleText:=' ' + ID_PODCASTS_SKIPPED; // Âñå ïîäêàñòû ïðîïóùåíû // All Podcasts skipped

end else
StatusBar.SimpleText:=' ' + Format(ID_DOWNLOAD_ERROR, [DownloadCount - ErrorCount, DownloadCount]); //Îøèáêà çàãðóçêè / Download error
StatusBar.SimpleText:=' ' + Format(ID_DOWNLOAD_ERROR, [DownloadCount - ErrorCount, DownloadCount]); // Îøèáêà çàãðóçêè / Download error

//Ñîõðàíåíèå ññûëîê íà çàãðóæåííûå ïîäêàñòû, ÷òîáû íå çàãðóæàòü èõ ñíîâà / Save links to downloaded podcasts to not download them again
// Ñîõðàíåíèå ññûëîê íà çàãðóæåííûå ïîäêàñòû, ÷òîáû íå çàãðóæàòü èõ ñíîâà / Save links to downloaded podcasts to not download them again
Downloaded.Add(Download.Text);

//Óäàëÿåì ïóñòûå ñòðîêè / Remove the blank lines
// Óäàëÿåì ïóñòûå ñòðîêè / Remove the blank lines
for i:=Downloaded.Count - 1 downto 0 do
if Length(Trim(Downloaded.Strings[i])) = 0 then Downloaded.Delete(i);
//Ñîõðàíåíèå ñïèñêà çàãðóæåííûõ ïîäêàñòîâ / Save list of podcasts downloaded links
// Ñîõðàíåíèå ñïèñêà çàãðóæåííûõ ïîäêàñòîâ / Save list of podcasts downloaded links
Downloaded.SaveToFile(ExtractFilePath(ParamStr(0)) + 'Downloaded.txt');

end else StatusBar.SimpleText:=' ' + ID_PODCASTS_NOT_FOUND; //Íîâûõ ïîäêàñòîâ íå íàéäåíî / Not found new podcasts
end else StatusBar.SimpleText:=' ' + ID_PODCASTS_NOT_FOUND; // Íîâûõ ïîäêàñòîâ íå íàéäåíî / Not found new podcasts

RefreshBtn.Visible:=true;
CancelBtn.Visible:=false;
Expand Down Expand Up @@ -420,7 +420,7 @@ procedure TMain.FormCreate(Sender: TObject);
RssListMemo.Lines.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'RSS.txt');
RssChanged:=false;

//Ïåðåâîä / Translate
// Ïåðåâîä / Translate
if FileExists(ExtractFilePath(ParamStr(0)) + 'Languages\' + GetLocaleInformation(LOCALE_SENGLANGUAGE) + '.ini') then
LangFile:=GetLocaleInformation(LOCALE_SENGLANGUAGE) + '.ini'
else
Expand Down Expand Up @@ -479,7 +479,7 @@ procedure TMain.CheckDownloadedLinks;
Downloaded.LoadFromFile('Downloaded.txt');
Settings.StatusLbl.Caption:=' ' + ID_STAGE_1;
Settings.ProgressBar.Max:=RSSListMemo.Lines.Count - 1;
//Ñîçäàíèå îáùåãî ñïèñêà / Creating a common list
// Ñîçäàíèå îáùåãî ñïèñêà / Creating a common list
for i:=RssListMemo.Lines.Count - 1 downto 0 do begin
if Trim(RssListMemo.Lines.Strings[i]) = '' then Continue;
if HTTPCheck(RssListMemo.Lines.Strings[i]) = false then begin
Expand All @@ -494,13 +494,13 @@ procedure TMain.CheckDownloadedLinks;
if Error = false then begin
Settings.StatusLbl.Caption:=' ' + ID_STAGE_2;
Settings.ProgressBar.Max:=Downloaded.Count - 1;
//Ñîçäàíèå íîâîãî ñïèñêà çàãðóæåííûõ ïîäêàñòîâ /Create a new list of downloaded podcasts
// Ñîçäàíèå íîâîãî ñïèñêà çàãðóæåííûõ ïîäêàñòîâ /Create a new list of downloaded podcasts
for j:=Downloaded.Count - 1 downto 0 do begin
if Pos(Downloaded.Strings[j], Source) > 0 then Links.Add(Downloaded.Strings[j]);
Application.ProcessMessages;
Settings.ProgressBar.Position:=Downloaded.Count - 1 - j;
end;
//Ñîðòèðîâêà / Sort
// Ñîðòèðîâêà / Sort
Links.Sort;
Links.SaveToFile('Downloaded.txt');

Expand All @@ -524,15 +524,15 @@ procedure TMain.RSSListMemoChange(Sender: TObject);
procedure TMain.RSSListMemoKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
//Óáèðàåì áàã ñêðûòèÿ êîíòðîëîâ
// Óáèðàåì áàã ñêðûòèÿ êîíòðîëîâ
if Key = VK_MENU then
Key:=0;
end;

procedure TMain.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
//Óáèðàåì áàã ñêðûòèÿ êîíòðîëîâ
// Óáèðàåì áàã ñêðûòèÿ êîíòðîëîâ
if Key = VK_MENU then
Key:=0;
end;
Expand Down

0 comments on commit 14053b4

Please sign in to comment.