Skip to content

Commit

Permalink
Added URI encoding support
Browse files Browse the repository at this point in the history
Also fixed playback issues on server
  • Loading branch information
Codrax committed Mar 6, 2024
1 parent c34ec94 commit c6d0129
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions BroadcastAPI.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface
uses
// Required Units
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Classes,
Vcl.Graphics, IOUtils, System.Generics.Collections, IdSSLOpenSSL,
Vcl.Graphics, IOUtils, System.Generics.Collections, IdSSLOpenSSL, IdURI,
IdHTTP, IdGlobal, JSON, Vcl.Clipbrd, DateUtils, Cod.Types, Imaging.jpeg,
Cod.VarHelpers, Cod.Dialogs, Cod.SysUtils, Cod.Files, Cod.ArrayHelpers;

Expand Down Expand Up @@ -2046,15 +2046,17 @@ function TTrackItem.GetStreamingURL: string;
begin
Result := STREAMING_ENDPOINT+StreamLocations
+Format('?Signature=%S&file_id=%U&user_id=%U&platform=%S&version=%S',
[TOKEN, ID, USER_ID, CLIENT_NAME, MainUI.Version.ToString])
;
[TOKEN, ID, USER_ID, CLIENT_NAME, MainUI.Version.ToString]);
(*
Signature - user token - string
file_id - song ID - integer
user_id = user ID - integer
platform - app name - string
version - this app version - string
*)

// Encode result
Result := TIdUrI.URLEncode(Result);
end;

procedure TTrackItem.LoadFrom(JSONPair: TJSONPair);
Expand Down
5 changes: 3 additions & 2 deletions MainUI.pas
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ TUIForm = class(TForm)

const
// SYSTEM
Version: TVersionRec = (Major:1; Minor:8; Maintenance: 5);
Version: TVersionRec = (Major:1; Minor:8; Maintenance: 6);

API_APPNAME = 'ibroadcast';
API_ENDPOINT = 'https://api.codrutsoft.com/';
Expand Down Expand Up @@ -6437,11 +6437,12 @@ procedure TUIForm.SaveAs1Click(Sender: TObject);
LastThreadFileLocked := false;
end;
except
on E: Exception do
// Offline
TThread.Synchronize(nil,
procedure
begin
OfflineDialog('The song could not be downloaded');
OfflineDialog('The song could not be downloaded. Error:'#13+E.Message);
end);
end;

Expand Down
1 change: 0 additions & 1 deletion iBroadcast.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
<Icon_MainIcon>iBroadcast_Icon.ico</Icon_MainIcon>
<VerInfo_MinorVer>8</VerInfo_MinorVer>
<VerInfo_Keys>CompanyName=Codrut Software;FileDescription=Codrut&apos;s iBroadcast for Windows;FileVersion=1.8.4.0;InternalName=;LegalCopyright=Codrut Software;LegalTrademarks=Petculescu Codrut;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=Codrut&apos;s iBroadcast for Windows;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<Debugger_RunParams>-exportpost</Debugger_RunParams>
<VerInfo_Release>4</VerInfo_Release>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
Expand Down
Binary file modified iBroadcast.identcache
Binary file not shown.

0 comments on commit c6d0129

Please sign in to comment.