Vladimir Smagin 2 years ago
commit
bb05f98245
100 changed files with 17802 additions and 0 deletions
  1. +7
    -0
      .aria2g.ini
  2. +3
    -0
      .aria2g.list
  3. +12
    -0
      .aria2g.list2
  4. +4
    -0
      .hgignore
  5. +99
    -0
      about.lfm
  6. +46
    -0
      about.pas
  7. +92
    -0
      aria2.pas
  8. BIN
     
  9. BIN
     
  10. BIN
     
  11. +154
    -0
      aria2g.lpi
  12. +25
    -0
      aria2g.lpr
  13. +318
    -0
      aria2g.lps
  14. BIN
     
  15. +99
    -0
      backup/about.lfm.bak
  16. +46
    -0
      backup/about.pas.bak
  17. +88
    -0
      backup/aria2.pas.bak
  18. +154
    -0
      backup/aria2g.lpi.bak
  19. +26
    -0
      backup/aria2g.lpr.bak
  20. +318
    -0
      backup/aria2g.lps.bak
  21. +6667
    -0
      backup/unit1.lfm.bak
  22. +700
    -0
      backup/unit1.pas.bak
  23. +163
    -0
      backup/unitadd.lfm.bak
  24. +95
    -0
      backup/unitadd.pas.bak
  25. +49
    -0
      backup/unitinfo.lfm.bak
  26. +33
    -0
      backup/unitinfo.pas.bak
  27. +158
    -0
      backup/unitservers.lfm.bak
  28. +56
    -0
      backup/unitservers.pas.bak
  29. +133
    -0
      backup/unitsettings.lfm.bak
  30. +72
    -0
      backup/unitsettings.pas.bak
  31. +232
    -0
      backup/verinfo.pas.bak
  32. BIN
     
  33. BIN
     
  34. +674
    -0
      gpl-3.0.txt
  35. BIN
     
  36. BIN
     
  37. BIN
     
  38. BIN
     
  39. BIN
     
  40. BIN
     
  41. +192
    -0
      html/index.html
  42. +192
    -0
      html/index.html~
  43. BIN
     
  44. BIN
     
  45. BIN
     
  46. BIN
     
  47. BIN
     
  48. BIN
     
  49. BIN
     
  50. BIN
     
  51. BIN
     
  52. BIN
     
  53. BIN
     
  54. BIN
     
  55. BIN
     
  56. BIN
     
  57. +7
    -0
      installer/.aria2g.ini
  58. +2
    -0
      installer/.aria2g.list
  59. BIN
     
  60. +91
    -0
      installer/aria2g.nsi
  61. BIN
     
  62. BIN
     
  63. BIN
     
  64. BIN
     
  65. BIN
     
  66. +4
    -0
      installer/prepare.bat
  67. +0
    -0
     
  68. +50
    -0
      json.pas
  69. +3
    -0
      last_changes.txt
  70. BIN
     
  71. +85
    -0
      lib/i386-linux/about.lfm
  72. BIN
     
  73. BIN
     
  74. BIN
     
  75. BIN
     
  76. +5
    -0
      lib/i386-linux/aria2g.compiled
  77. BIN
     
  78. BIN
     
  79. BIN
     
  80. BIN
     
  81. BIN
     
  82. BIN
     
  83. BIN
     
  84. BIN
     
  85. BIN
     
  86. BIN
     
  87. BIN
     
  88. BIN
     
  89. BIN
     
  90. BIN
     
  91. BIN
     
  92. BIN
     
  93. BIN
     
  94. BIN
     
  95. BIN
     
  96. +6485
    -0
      lib/i386-linux/unit1.lfm
  97. BIN
     
  98. BIN
     
  99. +163
    -0
      lib/i386-linux/unitadd.lfm
  100. BIN
     

+ 7
- 0
.aria2g.ini View File

@@ -0,0 +1,7 @@
[APP]
TRAY_ICON=1
CLOSE_TO_TRAY_ICON=1
NOTIFICATIONS=1
NOTIFICATION_DELAY_MS=2000
LIST_UPDATE_DELAY_MS=1000
THREADS_DEFAULT=5

+ 3
- 0
.aria2g.list View File

@@ -0,0 +1,3 @@
http://localhost:6800
http://192.168.99.9:6800
http://rpi.loc:6800

+ 12
- 0
.aria2g.list2 View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<grid version="3">
<saveoptions create="False" position="False" content="True"/>
<content>
<cells cellcount="2">
<cell1 column="0" row="0" text="Server"/>
<cell2 column="1" row="0" text="DL C"/>
</cells>
</content>
</grid>
</CONFIG>

+ 4
- 0
.hgignore View File

@@ -0,0 +1,4 @@
html
lib
backup
.exe

+ 99
- 0
about.lfm View File

@@ -0,0 +1,99 @@
object form_about: Tform_about
Left = 310
Height = 240
Top = 112
Width = 352
BorderStyle = bsDialog
Caption = 'About this program'
ClientHeight = 240
ClientWidth = 352
Color = clTeal
Font.Height = -11
Position = poOwnerFormCenter
LCLVersion = '1.2.4.0'
object Shape1: TShape
Left = 0
Height = 96
Top = 0
Width = 352
end
object Label1: TLabel
Left = 8
Height = 32
Top = 8
Width = 78
Caption = 'Aria2g'
Font.Height = -27
Font.Name = 'Sans'
ParentColor = False
ParentFont = False
end
object Label2: TLabel
Left = 8
Height = 13
Top = 40
Width = 216
Caption = 'Aria2g is a GUI for aria2c JSON-RPC server.'
ParentColor = False
end
object Label3: TLabel
Left = 8
Height = 13
Top = 56
Width = 210
Caption = 'Copyright by Vladimir Smagin, 2013-2014'
ParentColor = False
end
object Label4: TLabel
Left = 9
Height = 13
Top = 72
Width = 126
Caption = 'http://aria.blindage.org/'
ParentColor = False
end
object Button1: TButton
Left = 264
Height = 25
Top = 13
Width = 75
Caption = 'Nice'
OnClick = Button1Click
TabOrder = 0
end
object Memo1: TMemo
Left = 8
Height = 129
Top = 103
Width = 331
BorderStyle = bsNone
Color = clTeal
Font.Color = clWhite
Font.Height = -9
Lines.Strings = (
'This program is free software: you can redistribute it and/or modify it under the '
'terms of the GNU General Public License as published by the Free Software '
'Foundation, either version 3 of the License, or (at your option) any later version.'
''
'This program is distributed in the hope that it will be useful, but WITHOUT ANY '
'WARRANTY; without even the implied warranty of MERCHANTABILITY or '
'FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for '
'more details.'
''
'You should have received a copy of the GNU General Public License along with '
'this program. If not, see <http://www.gnu.org/licenses/>.'
)
ParentFont = False
ReadOnly = True
ScrollBars = ssVertical
TabOrder = 1
end
object Label5: TLabel
Left = 96
Height = 13
Top = 24
Width = 33
Caption = 'Label5'
ParentColor = False
end
end

+ 46
- 0
about.pas View File

@@ -0,0 +1,46 @@
unit about;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls;

type

{ Tform_about }

Tform_about = class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Memo1: TMemo;
Shape1: TShape;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;

var
form_about: Tform_about;

implementation

{$R *.lfm}

{ Tform_about }

procedure Tform_about.Button1Click(Sender: TObject);
begin
close;
end;

end.


+ 92
- 0
aria2.pas View File

@@ -0,0 +1,92 @@
unit aria2;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, HTTPSend, SynaUtil, XMLRead, DOM, XMLUtils;

type
TAria2 = class(TObject)
procedure addUri(params: TStringList);
private
{ private declarations }
public
{ public declarations }
end;

implementation

procedure TAria2.addUri(params: TStringList);
var
myHTTP: THTTPSend;
doc: TXMLDocument;
lParamList, download: TStringList;
begin
myHTTP := THTTPSend.Create;
lParamList := TStringList.Create;
try
{
lParamList.Add('<?xml version="1.0"?>');
lParamList.Add('<methodCall>');

//method
lParamList.Add(' <methodName>aria2.addUri</methodName>');
lParamList.Add(' <params>');
//method params
lParamList.Add(' <param>');
lParamList.Add(' <value>');
lParamList.Add(' <array>');
lParamList.Add(' <data>');
lParamList.Add(' <value><string>'+edit_uri.Text+'</string></value>');
lParamList.Add(' </data>');
lParamList.Add(' </array>');
lParamList.Add(' </value>');
lParamList.Add(' </param>');
//additional params
lParamList.Add(' <param>');
lParamList.Add(' <value>');
lParamList.Add(' <struct>');
lParamList.Add(' <member>');
lParamList.Add(' <name>dir</name>');
lParamList.Add(' <value>');
lParamList.Add(' <string>'+edit_dir.Text+'</string>');
lParamList.Add(' </value>');
lParamList.Add(' </member>');
lParamList.Add(' </struct>');
lParamList.Add(' </value>');
lParamList.Add(' </param>');

lParamList.Add(' </params>');
lParamList.Add('</methodCall>');
}
lParamList := params;
WriteStrToStream(myHTTP.Document, lParamList.Text);
myHTTP.MimeType := 'text/xml';
if myHTTP.HTTPMethod('POST', 'http://localhost:6800/rpc') then
begin
myHTTP.Document.Position := 0;
ReadXMLFile(doc, myHTTP.Document);
//ShowMessage(doc.DocumentElement.TextContent);
end;
//else
//ShowMessage('Cant connect to aria2c rpc server. Aria2c is installed?');


finally
myHTTP.Free;
lParamList.Free;
download := TStringList.Create;
{download.Add('Usual');
download.Add(edit_uri.Text);
download.Add(edit_dir.Text);
download.Add(edit_threads.Text);
download.Add('Active');}
download.Free;
//Close;
end;
end;

end.


BIN
View File


BIN
View File


BIN
View File


+ 154
- 0
aria2g.lpi View File

@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="aria2g"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<UseVersionInfo Value="True"/>
<AutoIncrementBuild Value="True"/>
<MinorVersionNr Value="3"/>
<RevisionNr Value="2"/>
<BuildNr Value="8"/>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="8">
<Unit0>
<Filename Value="aria2g.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="aria2g"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</Unit1>
<Unit2>
<Filename Value="unitsettings.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formSettings"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitSettings"/>
</Unit2>
<Unit3>
<Filename Value="unitservers.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formServers"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitservers"/>
</Unit3>
<Unit4>
<Filename Value="unitadd.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formAdd"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitadd"/>
</Unit4>
<Unit5>
<Filename Value="json.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="json"/>
</Unit5>
<Unit6>
<Filename Value="about.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="form_about"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="about"/>
</Unit6>
<Unit7>
<Filename Value="unitinfo.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formInfo"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitInfo"/>
</Unit7>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="aria2g"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="synalist-code-185-trunk"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerMessages>
<MsgFileName Value=""/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
<ExecuteAfter>
<Command Value="installer/prepare.bat"/>
<ShowAllMessages Value="True"/>
<CompileReasons Compile="False" Run="False"/>
</ExecuteAfter>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

+ 25
- 0
aria2g.lpr View File

@@ -0,0 +1,25 @@
program aria2g;

{$mode objfpc}{$H+}

uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1, unitSettings, unitservers, unitadd, json, about, unitInfo;

{$R *.res}

begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TformSettings, formSettings);
Application.CreateForm(TformServers, formServers);
Application.CreateForm(TformAdd, formAdd);
Application.CreateForm(Tform_about, form_about);
Application.CreateForm(TformInfo, formInfo);
Application.Run;
end.


+ 318
- 0
aria2g.lps View File

@@ -0,0 +1,318 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="9"/>
<BuildModes Active="Default"/>
<Units Count="16">
<Unit0>
<Filename Value="aria2g.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="aria2g"/>
<EditorIndex Value="8"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="11" Y="19"/>
<UsageCount Value="258"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="4"/>
<WindowIndex Value="0"/>
<TopLine Value="596"/>
<CursorPos X="5" Y="622"/>
<UsageCount Value="258"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="unitsettings.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formSettings"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitSettings"/>
<EditorIndex Value="0"/>
<WindowIndex Value="0"/>
<TopLine Value="2"/>
<CursorPos X="48" Y="51"/>
<UsageCount Value="258"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit2>
<Unit3>
<Filename Value="unitservers.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formServers"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitservers"/>
<EditorIndex Value="1"/>
<WindowIndex Value="0"/>
<TopLine Value="24"/>
<CursorPos X="42" Y="42"/>
<UsageCount Value="258"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="unitadd.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formAdd"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitadd"/>
<EditorIndex Value="2"/>
<WindowIndex Value="0"/>
<TopLine Value="44"/>
<CursorPos X="3" Y="63"/>
<UsageCount Value="258"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit4>
<Unit5>
<Filename Value="json.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="json"/>
<EditorIndex Value="3"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="16" Y="19"/>
<UsageCount Value="258"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="about.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="form_about"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="about"/>
<EditorIndex Value="9"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="27" Y="35"/>
<UsageCount Value="258"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit6>
<Unit7>
<Filename Value="unitinfo.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formInfo"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitInfo"/>
<EditorIndex Value="6"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="35" Y="10"/>
<UsageCount Value="109"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit7>
<Unit8>
<Filename Value="unitadd.lfm"/>
<ComponentName Value="formAdd"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="1" Y="1"/>
<UsageCount Value="87"/>
<DefaultSyntaxHighlighter Value="LFM"/>
</Unit8>
<Unit9>
<Filename Value="vinfo.pas"/>
<UnitName Value="vinfo"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="61" Y="8"/>
<UsageCount Value="20"/>
</Unit9>
<Unit10>
<Filename Value="../../../../../../lazarus/fpc/2.6.2/source/packages/fcl-res/src/versiontypes.pp"/>
<UnitName Value="versiontypes"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="1" Y="1"/>
<UsageCount Value="10"/>
</Unit10>
<Unit11>
<Filename Value="../../../../../../lazarus/fpc/2.6.2/source/packages/fcl-res/src/versionresource.pp"/>
<UnitName Value="versionresource"/>
<WindowIndex Value="0"/>
<TopLine Value="183"/>
<CursorPos X="33" Y="202"/>
<UsageCount Value="10"/>
</Unit11>
<Unit12>
<Filename Value="../../../../../../lazarus/fpc/2.6.2/source/packages/fcl-res/src/resource.pp"/>
<UnitName Value="resource"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="68" Y="8"/>
<UsageCount Value="10"/>
</Unit12>
<Unit13>
<Filename Value="verinfo.pas"/>
<UnitName Value="VerInfo"/>
<WindowIndex Value="0"/>
<TopLine Value="25"/>
<CursorPos X="36" Y="50"/>
<UsageCount Value="20"/>
</Unit13>
<Unit14>
<Filename Value="../../../../../../lazarus/lcl/forms.pp"/>
<UnitName Value="Forms"/>
<EditorIndex Value="7"/>
<WindowIndex Value="0"/>
<TopLine Value="43"/>
<CursorPos X="37" Y="70"/>
<UsageCount Value="13"/>
<Loaded Value="True"/>
</Unit14>
<Unit15>
<Filename Value="unit1.lfm"/>
<EditorIndex Value="5"/>
<WindowIndex Value="0"/>
<TopLine Value="188"/>
<CursorPos X="7" Y="196"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
<DefaultSyntaxHighlighter Value="LFM"/>
</Unit15>
</Units>
<General>
<ActiveWindowIndexAtStart Value="0"/>
</General>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="unit1.pas"/>
<Caret Line="230" Column="61" TopLine="206"/>
</Position1>
<Position2>
<Filename Value="unit1.pas"/>
<Caret Line="229" Column="61" TopLine="205"/>
</Position2>
<Position3>
<Filename Value="unit1.pas"/>
<Caret Line="231" Column="61" TopLine="207"/>
</Position3>
<Position4>
<Filename Value="unit1.lfm"/>
<Caret Line="113" Column="37" TopLine="100"/>
</Position4>
<Position5>
<Filename Value="unit1.pas"/>
<Caret Line="682" Column="3" TopLine="646"/>
</Position5>
<Position6>
<Filename Value="unit1.pas"/>
<Caret Line="565" Column="3" TopLine="551"/>
</Position6>
<Position7>
<Filename Value="unit1.pas"/>
<Caret Line="525" Column="54" TopLine="519"/>
</Position7>
<Position8>
<Filename Value="unit1.pas"/>
<Caret Line="621" Column="1" TopLine="603"/>
</Position8>
<Position9>
<Filename Value="unit1.pas"/>
<Caret Line="620" Column="1" TopLine="602"/>
</Position9>
<Position10>
<Filename Value="unit1.pas"/>
<Caret Line="619" Column="1" TopLine="601"/>
</Position10>
<Position11>
<Filename Value="unitadd.pas"/>
<Caret Line="70" Column="12" TopLine="44"/>
</Position11>
<Position12>
<Filename Value="unitadd.pas"/>
<Caret Line="63" Column="41" TopLine="37"/>
</Position12>
<Position13>
<Filename Value="unitadd.pas"/>
<Caret Line="87" Column="12" TopLine="44"/>
</Position13>
<Position14>
<Filename Value="unit1.pas"/>
<Caret Line="619" Column="1" TopLine="601"/>
</Position14>
<Position15>
<Filename Value="unit1.pas"/>
<Caret Line="620" Column="1" TopLine="602"/>
</Position15>
<Position16>
<Filename Value="unit1.pas"/>
<Caret Line="619" Column="1" TopLine="601"/>
</Position16>
<Position17>
<Filename Value="unit1.pas"/>
<Caret Line="618" Column="1" TopLine="600"/>
</Position17>
<Position18>
<Filename Value="unit1.pas"/>
<Caret Line="617" Column="1" TopLine="599"/>
</Position18>
<Position19>
<Filename Value="unit1.pas"/>
<Caret Line="618" Column="1" TopLine="600"/>
</Position19>
<Position20>
<Filename Value="unit1.pas"/>
<Caret Line="574" Column="57" TopLine="550"/>
</Position20>
<Position21>
<Filename Value="unit1.pas"/>
<Caret Line="618" Column="47" TopLine="592"/>
</Position21>
<Position22>
<Filename Value="unit1.pas"/>
<Caret Line="619" Column="47" TopLine="593"/>
</Position22>
<Position23>
<Filename Value="unit1.pas"/>
<Caret Line="620" Column="47" TopLine="594"/>
</Position23>
<Position24>
<Filename Value="unit1.pas"/>
<Caret Line="619" Column="5" TopLine="593"/>
</Position24>
<Position25>
<Filename Value="unit1.pas"/>
<Caret Line="620" Column="5" TopLine="594"/>
</Position25>
<Position26>
<Filename Value="unit1.pas"/>
<Caret Line="621" Column="5" TopLine="595"/>
</Position26>
<Position27>
<Filename Value="unit1.pas"/>
<Caret Line="622" Column="5" TopLine="596"/>
</Position27>
<Position28>
<Filename Value="unit1.pas"/>
<Caret Line="621" Column="5" TopLine="595"/>
</Position28>
<Position29>
<Filename Value="unit1.pas"/>
<Caret Line="622" Column="5" TopLine="596"/>
</Position29>
<Position30>
<Filename Value="unit1.pas"/>
<Caret Line="621" Column="5" TopLine="595"/>
</Position30>
</JumpHistory>
</ProjectSession>
<EditorMacros Count="0"/>
</CONFIG>

BIN
View File


+ 99
- 0
backup/about.lfm.bak View File

@@ -0,0 +1,99 @@
object form_about: Tform_about
Left = 310
Height = 240
Top = 112
Width = 352
BorderStyle = bsDialog
Caption = 'About this program'
ClientHeight = 240
ClientWidth = 352
Color = clTeal
Font.Height = -11
Position = poOwnerFormCenter
LCLVersion = '1.0.14.0'
object Shape1: TShape
Left = 0
Height = 96
Top = 0
Width = 352
end
object Label1: TLabel
Left = 8
Height = 33
Top = 8
Width = 79
Caption = 'Aria2g'
Font.Height = -27
Font.Name = 'Sans'
ParentColor = False
ParentFont = False
end
object Label2: TLabel
Left = 8
Height = 14
Top = 40
Width = 217
Caption = 'Aria2g is a GUI for aria2c JSON-RPC server.'
ParentColor = False
end
object Label3: TLabel
Left = 8
Height = 14
Top = 56
Width = 183
Caption = 'Copyright by Vladimir Smagin, 2013'
ParentColor = False
end
object Label4: TLabel
Left = 9
Height = 14
Top = 72
Width = 127
Caption = 'http://aria.blindage.org/'
ParentColor = False
end
object Button1: TButton
Left = 264
Height = 25
Top = 13
Width = 75
Caption = 'Nice'
OnClick = Button1Click
TabOrder = 0
end
object Memo1: TMemo
Left = 8
Height = 129
Top = 103
Width = 331
BorderStyle = bsNone
Color = clTeal
Font.Color = clWhite
Font.Height = -9
Lines.Strings = (
'This program is free software: you can redistribute it and/or modify it under the '
'terms of the GNU General Public License as published by the Free Software '
'Foundation, either version 3 of the License, or (at your option) any later version.'
''
'This program is distributed in the hope that it will be useful, but WITHOUT ANY '
'WARRANTY; without even the implied warranty of MERCHANTABILITY or '
'FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for '
'more details.'
''
'You should have received a copy of the GNU General Public License along with '
'this program. If not, see <http://www.gnu.org/licenses/>.'
)
ParentFont = False
ReadOnly = True
ScrollBars = ssVertical
TabOrder = 1
end
object Label5: TLabel
Left = 96
Height = 14
Top = 24
Width = 34
Caption = 'Label5'
ParentColor = False
end
end

+ 46
- 0
backup/about.pas.bak View File

@@ -0,0 +1,46 @@
unit about;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls;

type

{ Tform_about }

Tform_about = class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Memo1: TMemo;
Shape1: TShape;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;

var
form_about: Tform_about;

implementation

{$R *.lfm}

{ Tform_about }

procedure Tform_about.Button1Click(Sender: TObject);
begin
close;
end;

end.


+ 88
- 0
backup/aria2.pas.bak View File

@@ -0,0 +1,88 @@
unit aria2;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, HTTPSend, SynaUtil, XMLRead, DOM, XMLUtils;

type

TAddUri = procedure addUri(params: TStringList);


implementation

procedure addUri(params: TStringList);
var
myHTTP: THTTPSend;
doc: TXMLDocument;
lParamList, download: TStringList;
begin
myHTTP := THTTPSend.Create;
lParamList := TStringList.Create;
try
{
lParamList.Add('<?xml version="1.0"?>');
lParamList.Add('<methodCall>');

//method
lParamList.Add(' <methodName>aria2.addUri</methodName>');
lParamList.Add(' <params>');
//method params
lParamList.Add(' <param>');
lParamList.Add(' <value>');
lParamList.Add(' <array>');
lParamList.Add(' <data>');
lParamList.Add(' <value><string>'+edit_uri.Text+'</string></value>');
lParamList.Add(' </data>');
lParamList.Add(' </array>');
lParamList.Add(' </value>');
lParamList.Add(' </param>');
//additional params
lParamList.Add(' <param>');
lParamList.Add(' <value>');
lParamList.Add(' <struct>');
lParamList.Add(' <member>');
lParamList.Add(' <name>dir</name>');
lParamList.Add(' <value>');
lParamList.Add(' <string>'+edit_dir.Text+'</string>');
lParamList.Add(' </value>');
lParamList.Add(' </member>');
lParamList.Add(' </struct>');
lParamList.Add(' </value>');
lParamList.Add(' </param>');

lParamList.Add(' </params>');
lParamList.Add('</methodCall>');
}
lParamList := params;
WriteStrToStream(myHTTP.Document, lParamList.Text);
myHTTP.MimeType := 'text/xml';
if myHTTP.HTTPMethod('POST', 'http://localhost:6800/rpc') then
begin
myHTTP.Document.Position := 0;
ReadXMLFile(doc, myHTTP.Document);
//ShowMessage(doc.DocumentElement.TextContent);
end;
//else
//ShowMessage('Cant connect to aria2c rpc server. Aria2c is installed?');


finally
myHTTP.Free;
lParamList.Free;
download := TStringList.Create;
{download.Add('Usual');
download.Add(edit_uri.Text);
download.Add(edit_dir.Text);
download.Add(edit_threads.Text);
download.Add('Active');}
download.Free;
//Close;
end;
end;

end.


+ 154
- 0
backup/aria2g.lpi.bak View File

@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="aria2g"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<UseVersionInfo Value="True"/>
<AutoIncrementBuild Value="True"/>
<MinorVersionNr Value="3"/>
<RevisionNr Value="2"/>
<BuildNr Value="8"/>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="8">
<Unit0>
<Filename Value="aria2g.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="aria2g"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</Unit1>
<Unit2>
<Filename Value="unitsettings.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formSettings"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitSettings"/>
</Unit2>
<Unit3>
<Filename Value="unitservers.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formServers"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitservers"/>
</Unit3>
<Unit4>
<Filename Value="unitadd.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formAdd"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitadd"/>
</Unit4>
<Unit5>
<Filename Value="json.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="json"/>
</Unit5>
<Unit6>
<Filename Value="about.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="form_about"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="about"/>
</Unit6>
<Unit7>
<Filename Value="unitinfo.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formInfo"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitInfo"/>
</Unit7>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="aria2g"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="synalist-code-185-trunk"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerMessages>
<MsgFileName Value=""/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
<ExecuteAfter>
<Command Value="installer/prepare.bat"/>
<ShowAllMessages Value="True"/>
<CompileReasons Compile="False" Run="False"/>
</ExecuteAfter>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

+ 26
- 0
backup/aria2g.lpr.bak View File

@@ -0,0 +1,26 @@
program aria2g;

{$mode objfpc}{$H+}

uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1, unitSettings, unitservers, unitadd, json, about, unitInfo,
VerInfo;

{$R *.res}

begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TformSettings, formSettings);
Application.CreateForm(TformServers, formServers);
Application.CreateForm(TformAdd, formAdd);
Application.CreateForm(Tform_about, form_about);
Application.CreateForm(TformInfo, formInfo);
Application.Run;
end.


+ 318
- 0
backup/aria2g.lps.bak View File

@@ -0,0 +1,318 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="9"/>
<BuildModes Active="Default"/>
<Units Count="16">
<Unit0>
<Filename Value="aria2g.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="aria2g"/>
<EditorIndex Value="8"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="11" Y="19"/>
<UsageCount Value="258"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="4"/>
<WindowIndex Value="0"/>
<TopLine Value="594"/>
<CursorPos X="5" Y="620"/>
<UsageCount Value="258"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="unitsettings.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formSettings"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitSettings"/>
<EditorIndex Value="0"/>
<WindowIndex Value="0"/>
<TopLine Value="2"/>
<CursorPos X="48" Y="51"/>
<UsageCount Value="258"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit2>
<Unit3>
<Filename Value="unitservers.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formServers"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitservers"/>
<EditorIndex Value="1"/>
<WindowIndex Value="0"/>
<TopLine Value="24"/>
<CursorPos X="42" Y="42"/>
<UsageCount Value="258"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="unitadd.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formAdd"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitadd"/>
<EditorIndex Value="2"/>
<WindowIndex Value="0"/>
<TopLine Value="44"/>
<CursorPos X="3" Y="63"/>
<UsageCount Value="258"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit4>
<Unit5>
<Filename Value="json.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="json"/>
<EditorIndex Value="3"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="16" Y="19"/>
<UsageCount Value="258"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="about.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="form_about"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="about"/>
<EditorIndex Value="9"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="27" Y="35"/>
<UsageCount Value="258"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit6>
<Unit7>
<Filename Value="unitinfo.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="formInfo"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unitInfo"/>
<EditorIndex Value="6"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="35" Y="10"/>
<UsageCount Value="109"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit7>
<Unit8>
<Filename Value="unitadd.lfm"/>
<ComponentName Value="formAdd"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="1" Y="1"/>
<UsageCount Value="87"/>
<DefaultSyntaxHighlighter Value="LFM"/>
</Unit8>
<Unit9>
<Filename Value="vinfo.pas"/>
<UnitName Value="vinfo"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="61" Y="8"/>
<UsageCount Value="20"/>
</Unit9>
<Unit10>
<Filename Value="../../../../../../lazarus/fpc/2.6.2/source/packages/fcl-res/src/versiontypes.pp"/>
<UnitName Value="versiontypes"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="1" Y="1"/>
<UsageCount Value="10"/>
</Unit10>
<Unit11>
<Filename Value="../../../../../../lazarus/fpc/2.6.2/source/packages/fcl-res/src/versionresource.pp"/>
<UnitName Value="versionresource"/>
<WindowIndex Value="0"/>
<TopLine Value="183"/>
<CursorPos X="33" Y="202"/>
<UsageCount Value="10"/>
</Unit11>
<Unit12>
<Filename Value="../../../../../../lazarus/fpc/2.6.2/source/packages/fcl-res/src/resource.pp"/>
<UnitName Value="resource"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="68" Y="8"/>
<UsageCount Value="10"/>
</Unit12>
<Unit13>
<Filename Value="verinfo.pas"/>
<UnitName Value="VerInfo"/>
<WindowIndex Value="0"/>
<TopLine Value="25"/>
<CursorPos X="36" Y="50"/>
<UsageCount Value="20"/>
</Unit13>
<Unit14>
<Filename Value="../../../../../../lazarus/lcl/forms.pp"/>
<UnitName Value="Forms"/>
<EditorIndex Value="7"/>
<WindowIndex Value="0"/>
<TopLine Value="43"/>
<CursorPos X="37" Y="70"/>
<UsageCount Value="13"/>
<Loaded Value="True"/>
</Unit14>
<Unit15>
<Filename Value="unit1.lfm"/>
<EditorIndex Value="5"/>
<WindowIndex Value="0"/>
<TopLine Value="188"/>
<CursorPos X="7" Y="196"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
<DefaultSyntaxHighlighter Value="LFM"/>
</Unit15>
</Units>
<General>
<ActiveWindowIndexAtStart Value="0"/>
</General>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="unit1.pas"/>
<Caret Line="217" Column="17" TopLine="194"/>
</Position1>
<Position2>
<Filename Value="unit1.pas"/>
<Caret Line="218" Column="45" TopLine="194"/>
</Position2>
<Position3>
<Filename Value="unit1.pas"/>
<Caret Line="227" Column="61" TopLine="203"/>
</Position3>
<Position4>
<Filename Value="unit1.pas"/>
<Caret Line="226" Column="61" TopLine="202"/>
</Position4>
<Position5>
<Filename Value="unit1.pas"/>
<Caret Line="227" Column="61" TopLine="203"/>
</Position5>
<Position6>
<Filename Value="unit1.pas"/>
<Caret Line="228" Column="61" TopLine="204"/>
</Position6>
<Position7>
<Filename Value="unit1.pas"/>
<Caret Line="230" Column="61" TopLine="206"/>
</Position7>
<Position8>
<Filename Value="unit1.pas"/>
<Caret Line="229" Column="61" TopLine="205"/>
</Position8>
<Position9>
<Filename Value="unit1.pas"/>
<Caret Line="231" Column="61" TopLine="207"/>
</Position9>
<Position10>
<Filename Value="unit1.lfm"/>
<Caret Line="113" Column="37" TopLine="100"/>
</Position10>
<Position11>
<Filename Value="unit1.pas"/>
<Caret Line="682" Column="3" TopLine="646"/>
</Position11>
<Position12>
<Filename Value="unit1.pas"/>
<Caret Line="565" Column="3" TopLine="551"/>
</Position12>
<Position13>
<Filename Value="unit1.pas"/>
<Caret Line="525" Column="54" TopLine="519"/>
</Position13>
<Position14>
<Filename Value="unit1.pas"/>
<Caret Line="621" Column="1" TopLine="603"/>
</Position14>
<Position15>
<Filename Value="unit1.pas"/>
<Caret Line="620" Column="1" TopLine="602"/>
</Position15>
<Position16>
<Filename Value="unit1.pas"/>
<Caret Line="619" Column="1" TopLine="601"/>
</Position16>
<Position17>
<Filename Value="unitadd.pas"/>
<Caret Line="70" Column="12" TopLine="44"/>
</Position17>
<Position18>
<Filename Value="unitadd.pas"/>
<Caret Line="63" Column="41" TopLine="37"/>
</Position18>
<Position19>
<Filename Value="unitadd.pas"/>
<Caret Line="87" Column="12" TopLine="44"/>
</Position19>
<Position20>
<Filename Value="unit1.pas"/>
<Caret Line="619" Column="1" TopLine="601"/>
</Position20>
<Position21>
<Filename Value="unit1.pas"/>
<Caret Line="620" Column="1" TopLine="602"/>
</Position21>
<Position22>
<Filename Value="unit1.pas"/>
<Caret Line="619" Column="1" TopLine="601"/>
</Position22>
<Position23>
<Filename Value="unit1.pas"/>
<Caret Line="618" Column="1" TopLine="600"/>
</Position23>
<Position24>
<Filename Value="unit1.pas"/>
<Caret Line="617" Column="1" TopLine="599"/>
</Position24>
<Position25>
<Filename Value="unit1.pas"/>
<Caret Line="618" Column="1" TopLine="600"/>
</Position25>
<Position26>
<Filename Value="unit1.pas"/>
<Caret Line="574" Column="57" TopLine="550"/>
</Position26>
<Position27>
<Filename Value="unit1.pas"/>
<Caret Line="618" Column="47" TopLine="592"/>
</Position27>
<Position28>
<Filename Value="unit1.pas"/>
<Caret Line="619" Column="47" TopLine="593"/>
</Position28>
<Position29>
<Filename Value="unit1.pas"/>
<Caret Line="620" Column="47" TopLine="594"/>
</Position29>
<Position30>
<Filename Value="unit1.pas"/>
<Caret Line="619" Column="5" TopLine="593"/>
</Position30>
</JumpHistory>
</ProjectSession>
<EditorMacros Count="0"/>
</CONFIG>

+ 6667
- 0
backup/unit1.lfm.bak
File diff suppressed because it is too large
View File


+ 700
- 0
backup/unit1.pas.bak View File

@@ -0,0 +1,700 @@
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
StdCtrls, Menus, ActnList, ExtCtrls, PopupNotifier, Buttons, ValEdit,
HTTPSend, SynaUtil, XMLRead, DOM, XMLUtils, fpjson, jsonparser, inifiles,
vinfo, versiontypes;

type

{ TForm1 }

TForm1 = class(TForm)
action_check_upgrade: TAction;
action_update_server_list: TAction;
action_settings: TAction;
action_about: TAction;
action_servers: TAction;
action_quit: TAction;
action_pauseselected: TAction;
action_startall: TAction;
action_pauseall: TAction;
action_startselected: TAction;
action_deleteselected: TAction;
action_newdownload: TAction;
ActionList1: TActionList;
allimages: TImageList;
BitBtn1: TBitBtn;
ComboBox1: TComboBox;
serv_images: TImageList;
items_images: TImageList;
Label1: TLabel;
ListView1: TListView;
ListView2: TListView;
MainMenu1: TMainMenu;
Memo1: TMemo;
MenuItem1: TMenuItem;
MenuItem10: TMenuItem;
MenuItem11: TMenuItem;
MenuItem12: TMenuItem;
MenuItem13: TMenuItem;
MenuItem14: TMenuItem;
MenuItem15: TMenuItem;
MenuItem16: TMenuItem;
MenuItem17: TMenuItem;
MenuItem18: TMenuItem;
MenuItem19: TMenuItem;
MenuItem2: TMenuItem;
MenuItem20: TMenuItem;
MenuItem3: TMenuItem;
MenuItem4: TMenuItem;
MenuItem5: TMenuItem;
MenuItem6: TMenuItem;
MenuItem7: TMenuItem;
MenuItem8: TMenuItem;
MenuItem9: TMenuItem;
Panel1: TPanel;
PopupMenu1: TPopupMenu;
PopupNotifier1: TPopupNotifier;
PopupNotifierTimer: TTimer;
Splitter1: TSplitter;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
ToolButton8: TToolButton;
UpdateListTimer: TTimer;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
TrayIcon1: TTrayIcon;
procedure action_check_upgradeExecute(Sender: TObject);
procedure action_update_server_listExecute(Sender: TObject);
procedure action_aboutExecute(Sender: TObject);
procedure action_deleteselectedExecute(Sender: TObject);
procedure action_newdownloadExecute(Sender: TObject);
procedure action_pauseselectedExecute(Sender: TObject);
procedure action_quitExecute(Sender: TObject);
procedure action_serversExecute(Sender: TObject);
procedure action_settingsExecute(Sender: TObject);
procedure action_startselectedExecute(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormHide(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure ListView1DblClick(Sender: TObject);
procedure PopupNotifierTimerTimer(Sender: TObject);
procedure TrayIcon1Click(Sender: TObject);
procedure UpdateListTimerTimer(Sender: TObject);
procedure show_baloon(bTitle, bText: string);
procedure UpdateAll;
function JSONQuery(query_array: TJSONObject): string;
procedure Minimize(Sender: TObject);
procedure ValueListEditor1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;

var
Form1: TForm1;
close_to_tray, minimized: boolean;

implementation

uses unitSettings, unitServers, unitAdd, json, about, unitInfo;

{$R *.lfm}

{ TForm1 }

procedure tform1.show_baloon(bTitle, bText: string);
begin
with Form1 do
begin
PopupNotifier1.Title := bTitle;
PopupNotifier1.Text := bText;
PopupNotifier1.Show;
PopupNotifierTimer.Enabled := True;
end;
end;

function download_update(download: TStringList): boolean;
var
ItemIndex: integer;
myitem_details: TStringList;
begin
Result := False;
myitem_details := TStringList.Create;
with form1 do
for ItemIndex := 0 to ListView1.Items.Count - 1 do
begin

if ListView1.Items.Item[ItemIndex].Caption = download.Strings[0] then
begin
ListView1.Items.Item[ItemIndex].SubItems.Clear;
myitem_details.Add(download.Strings[1]); //state
myitem_details.Add(download.Strings[2]); //uri
myitem_details.Add(download.Strings[3]); //dest
myitem_details.Add(download.Strings[4]); //%
myitem_details.Add(download.Strings[5]); //threads
myitem_details.Add(download.Strings[6]); //speed
if download.Strings[1] = 'error' then
begin
ListView1.Items.Item[ItemIndex].ImageIndex := 2;
Result := True;
end;
if download.Strings[1] = 'complete' then
begin
ListView1.Items.Item[ItemIndex].ImageIndex := 1;
Result := True;
end;

if download.Strings[1] = 'active' then
ListView1.Items.Item[ItemIndex].ImageIndex := 0;
ListView1.Items.Item[ItemIndex].SubItems.AddStrings(myitem_details);
end;

end;
end;

procedure download_add(download: TStringList);
var
myitem: TListItem;
myitem_details: TStringList;

begin
with Form1 do
begin

//ListView1.Items.Clear;
myitem_details := TStringList.Create;
myitem := TListItem.Create(ListView1.Items);

myitem_details.Add(download.Strings[1]); //state
myitem_details.Add(download.Strings[2]); //uri
myitem_details.Add(download.Strings[3]); //dest
myitem_details.Add(download.Strings[4]); //%
myitem_details.Add(download.Strings[5]); //threads
myitem_details.Add(download.Strings[6]); //speed

if download.Strings[1] = 'error' then
myitem.ImageIndex := 2;
if download.Strings[1] = 'complete' then
myitem.ImageIndex := 1;
if download.Strings[1] = 'active' then
myitem.ImageIndex := 0;
if download.Strings[1] = 'paused' then
myitem.ImageIndex := 3;
if download.Strings[1] = 'removed' then
myitem.ImageIndex := 4;
if download.Strings[1] = 'waiting' then
myitem.ImageIndex := 5;
myitem.Caption := download.Strings[0]; //gid
myitem.SubItems.AddStrings(myitem_details);

ListView1.Items.AddItem(myitem);
//show_baloon('Aria2G', 'URL Added to queue');

end;
end;

function TForm1.JSONQuery(query_array: TJSONObject): string;
var
myHTTP: THTTPSend;
doc: TStringList;
begin
myHTTP := THTTPSend.Create;
doc := TStringList.Create;
try
WriteStrToStream(myHTTP.Document, query_array.FormatJSON);
myHTTP.MimeType := 'application/json-rpc';
if ComboBox1.Items.Count > 0 then
if myHTTP.HTTPMethod('POST', ComboBox1.Text + '/jsonrpc') then
begin
myHTTP.Document.Position := 0;
doc.LoadFromStream(myHTTP.Document);
Result := doc.Text;
end
else
begin
Result := 'nil';
Memo1.Lines.Insert(0, 'Cant connect to ' + ComboBox1.Text +
'. Temporary deleted from server list');
if ComboBox1.Items.Count > 0 then
ComboBox1.Items.Delete(ComboBox1.ItemIndex);
if ComboBox1.Items.Count > 0 then
ComboBox1.ItemIndex := 0;
UpdateAll;
end
else
Result := 'nil';

finally
myHTTP.Free;
doc.Free;

end;
end;

procedure TForm1.PopupNotifierTimerTimer(Sender: TObject);
begin
PopupNotifierTimer.Enabled := False;
PopupNotifier1.Hide;
end;

procedure TForm1.UpdateAll;
var
O, DownloadsActive, DownloadsStopped, DownloadsWaiting: TJSONObject;
AllDownloads, A, F, U: TJSONArray;
JS: TJSON;
download: TStringList;
ItemIndex, ResultIndex, percent, speed: integer;
total: int64;
json_result: string;
begin
DownloadsStopped := TJSONObject.Create(['methodName', 'aria2.tellStopped',
'params', TJSONArray.Create(
[0, 100, TJSONArray.Create(['gid', 'status', 'connections', 'dir',
'files', 'downloadSpeed', 'totalLength', 'completedLength'])])]);
DownloadsWaiting := TJSONObject.Create(['methodName', 'aria2.tellWaiting',
'params', TJSONArray.Create(
[0, 100, TJSONArray.Create(['gid', 'status', 'connections', 'dir',
'files', 'downloadSpeed', 'totalLength', 'completedLength'])])]);
DownloadsActive := TJSONObject.Create(['methodName', 'aria2.tellActive',
'params', TJSONArray.Create([TJSONArray.Create(
['gid', 'status', 'connections', 'dir', 'files', 'downloadSpeed',
'totalLength', 'completedLength'])])]);

O := TJSONObject.Create(['jsonrpc', '2.0', 'id', 'qwer', 'method',
'system.multicall', 'params', TJSONArray.Create(
[TJSONArray.Create([DownloadsActive, DownloadsWaiting, DownloadsStopped])])]);

download := TStringList.Create;

JS := TJSON.Create;
json_result := JSONQuery(O);

if json_result = 'nil' then
Memo1.Lines.Insert(0, 'Cant update list. Server connection error.')
else
begin
JS.Parse(json_result);
//Memo1.Lines.Text:=json_result;
AllDownloads := JS.Arrays['result'];
form1.ListView1.Clear;

for ResultIndex := 0 to AllDownloads.Count - 1 do
begin
A := AllDownloads.Arrays[ResultIndex].Arrays[0];
for ItemIndex := 0 to A.Count - 1 do
begin
download.Clear;
download.Add(A.Objects[ItemIndex].Extract('gid').AsString); //gid
download.Add(A.Objects[ItemIndex].Extract('status').AsString); //status
download.Add(A.Objects[ItemIndex].Arrays['files'].Objects[0].Extract(
'path').AsString); //uri torrent have no uri! and metalink i think too
download.Add(A.Objects[ItemIndex].Extract('dir').AsString); //dest
//%
total := A.Objects[ItemIndex].Extract('totalLength').AsInt64;
if total > 0 then
percent := (A.Objects[ItemIndex].Extract('completedLength').AsInt64 *
100) div total
else
percent := 0;
download.Add(IntToStr(percent));
download.Add(A.Objects[ItemIndex].Extract('connections').AsString); //threads
//speed
speed := A.Objects[ItemIndex].Extract('downloadSpeed').AsInteger;
if speed > 0 then
download.Add(IntToStr(speed div 1024) + ' KB/s')
else
download.Add('0 KB/s');
download_add(download);
end;
end;
end;
O.Free;
end;

procedure TForm1.UpdateListTimerTimer(Sender: TObject);
var
O, ActiveUpdate: TJSONObject;
AllDownloads, A, F, U: TJSONArray;
JS: TJSON;
doc: TStringList;
download: TStringList;
ItemIndex, ResultIndex, percent, speed: integer;
total: int64;
item: TListItem;
gid_array_len: integer;
json_array: TJSONArray;
json_result: string;
need_update_all: boolean;
begin
need_update_all := False;
//search active
//form1.Memo1.Lines.Add('update');
json_array := TJSONArray.Create;
json_array.Clear;
for ItemIndex := 0 to ListView1.Items.Count - 1 do
begin
gid_array_len := 0;
if ListView1.Items.Item[ItemIndex].SubItems.Strings[0] = 'active' then
begin
//showmessage(IntToStr(ItemIndex));
Inc(gid_array_len);
json_array.Insert(gid_array_len - 1,
TJSONObject.Create(['methodName', 'aria2.tellStatus', 'params',
TJSONArray.Create([ListView1.Items.Item[ItemIndex].Caption,
TJSONArray.Create(['gid', 'status', 'connections', 'dir',
'files', 'downloadSpeed', 'totalLength', 'completedLength'])])])
);
end;
end;
O := TJSONObject.Create(['jsonrpc', '2.0', 'id', 'qwer', 'method',
'system.multicall', 'params', TJSONArray.Create([json_array])]);
download := TStringList.Create;

JS := TJSON.Create;
json_result := JSONQuery(O);
if json_result = 'nil' then
//Memo1.Lines.Insert(0, 'Cant update list by timer')
else
begin
JS.Parse(json_result);
//Memo1.Lines.Insert(0, json_result);
AllDownloads := JS.Arrays['result'];

for ResultIndex := 0 to AllDownloads.Count - 1 do
begin

A := AllDownloads.Arrays[ResultIndex];

for ItemIndex := 0 to A.Count - 1 do
begin
download.Clear;

download.Add(A.Objects[ItemIndex].Extract('gid').AsString); //gid

download.Add(A.Objects[ItemIndex].Extract('status').AsString); //status

F := A.Objects[ItemIndex].Arrays['files'].Objects[0].Arrays['uris'];
//download.Add(F.Objects[0].Extract('uri').AsString); //uri
download.Add(A.Objects[ItemIndex].Arrays['files'].Objects[0].Extract(
'path').AsString); //uri torrent have no uri! and metalink i think too

download.Add(A.Objects[ItemIndex].Extract('dir').AsString); //dest

//%
total := A.Objects[ItemIndex].Extract('totalLength').AsInt64;
if total > 0 then
percent := (A.Objects[ItemIndex].Extract('completedLength').AsInt64 *
100) div total
else
percent := 0;
download.Add(IntToStr(percent));

download.Add(A.Objects[ItemIndex].Extract('connections').AsString); //threads

//speed
speed := A.Objects[ItemIndex].Extract('downloadSpeed').AsInteger;
if speed > 0 then
download.Add(IntToStr(speed div 1024) + ' KB/s')
else
download.Add('0 KB/s');

if need_update_all then
download_update(download)
else
need_update_all := download_update(download);
end;
end;
end;
O.Free;
download.Free;
if need_update_all then
UpdateAll;
end;

procedure TForm1.action_newdownloadExecute(Sender: TObject);
begin

with formAdd do
begin
ShowModal;
end;

end;

procedure TForm1.action_pauseselectedExecute(Sender: TObject);
var
gid_array_len, ItemIndex: integer;
json_array: TJSONArray;
JSONQueryObject: TJSONObject;
begin
//search selected
json_array := TJSONArray.Create;
json_array.Clear;
for ItemIndex := 0 to ListView1.Items.Count - 1 do
begin
gid_array_len := 0;

if ListView1.Items.Item[ItemIndex].Checked then
begin
//showmessage(IntToStr(ItemIndex));
Inc(gid_array_len);
json_array.Insert(gid_array_len - 1,
TJSONObject.Create(['methodName', 'aria2.pause', 'params',
TJSONArray.Create([ListView1.Items.Item[ItemIndex].Caption])])
);

end;
end;
JSONQueryObject := TJSONObject.Create(['jsonrpc', '2.0', 'id',
'qwer', 'method', 'system.multicall', 'params', TJSONArray.Create([json_array])]);
JSONQuery(JSONQueryObject);
UpdateAll;
end;

procedure TForm1.action_quitExecute(Sender: TObject);
begin
Close;
end;

procedure TForm1.action_serversExecute(Sender: TObject);
begin
formServers.ShowModal;
ComboBox1.Items := unitservers.formServers.ListBox1.Items;
ComboBox1.ItemIndex := 0;
end;

procedure TForm1.action_settingsExecute(Sender: TObject);
begin
formSettings.ShowModal;
end;

procedure TForm1.action_startselectedExecute(Sender: TObject);
var
gid_array_len, ItemIndex: integer;
json_array: TJSONArray;
JSONQueryObject: TJSONObject;
begin
//search selected
json_array := TJSONArray.Create;
json_array.Clear;
for ItemIndex := 0 to ListView1.Items.Count - 1 do
begin
gid_array_len := 0;

if ListView1.Items.Item[ItemIndex].Checked then
begin
//showmessage(IntToStr(ItemIndex));
Inc(gid_array_len);
json_array.Insert(gid_array_len - 1,
TJSONObject.Create(['methodName', 'aria2.unpause', 'params',
TJSONArray.Create([ListView1.Items.Item[ItemIndex].Caption])])
);

end;
end;
JSONQueryObject := TJSONObject.Create(['jsonrpc', '2.0', 'id',
'qwer', 'method', 'system.multicall', 'params', TJSONArray.Create([json_array])]);
JSONQuery(JSONQueryObject);
UpdateAll;
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
UpdateListTimer.Enabled := False;
UpdateAll;
UpdateListTimer.Enabled := True;
end;

procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
formServers.ListBox1.Items.SaveToFile('.aria2g.list');
end;

procedure TForm1.action_deleteselectedExecute(Sender: TObject);
var
gid_array_len, ItemIndex: integer;
json_array: TJSONArray;
JSONQueryObject: TJSONObject;
begin
//search selected
json_array := TJSONArray.Create;
json_array.Clear;
for ItemIndex := 0 to ListView1.Items.Count - 1 do
begin
gid_array_len := 0;

if ListView1.Items.Item[ItemIndex].Checked then
begin
//showmessage(IntToStr(ItemIndex));
Inc(gid_array_len);
json_array.Insert(gid_array_len - 1,
TJSONObject.Create(['methodName', 'aria2.remove', 'params',
TJSONArray.Create([ListView1.Items.Item[ItemIndex].Caption])])
);

end;
end;
JSONQueryObject := TJSONObject.Create(['jsonrpc', '2.0', 'id',
'qwer', 'method', 'system.multicall', 'params', TJSONArray.Create([json_array])]);
JSONQuery(JSONQueryObject);
UpdateAll;
end;

procedure TForm1.action_aboutExecute(Sender: TObject);
<