Skip to content

Commit

Permalink
fixed: moving radio stations to appdata folder failed at start
Browse files Browse the repository at this point in the history
fixed: lyrics downloaded from azlyrics contained extra data
added: position text is now in a tedit
  • Loading branch information
ozok committed Jan 17, 2016
1 parent 006b3a1 commit e5a41e2
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 83 deletions.
76 changes: 28 additions & 48 deletions Forms/UnitMain.dfm
Expand Up @@ -109,30 +109,10 @@ object MainForm: TMainForm
BevelOuter = bvNone
TabOrder = 0
OnMouseLeave = FuncPagesMouseLeave
object PositionLabel: TLabel
AlignWithMargins = True
Left = 1013
Top = 0
Width = 182
Height = 24
Margins.Left = 0
Margins.Top = 0
Margins.Bottom = 0
Align = alRight
Caption = '00:00:00/00:00:00/00:00:00'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
Layout = tlCenter
ExplicitHeight = 14
end
object PositionBar: TJvTrackBar
Left = 0
Top = 0
Width = 1013
Width = 998
Height = 24
Margins.Left = 0
Margins.Top = 0
Expand All @@ -148,6 +128,25 @@ object MainForm: TMainForm
TickMarks = tmBoth
TickStyle = tsNone
OnMouseDown = PositionBarMouseDown
ExplicitWidth = 1013
end
object PositionLabel: TEdit
Left = 998
Top = 0
Width = 200
Height = 24
Align = alRight
Alignment = taCenter
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
ReadOnly = True
TabOrder = 1
Text = '00:00:00/00:00:00/00:00:00'
ExplicitHeight = 21
end
end
object ControlsPanel: TPanel
Expand Down Expand Up @@ -482,7 +481,7 @@ object MainForm: TMainForm
Top = 78
Width = 616
Height = 602
ActivePage = TabSheet1
ActivePage = TabSheet2
Align = alClient
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Expand Down Expand Up @@ -741,7 +740,7 @@ object MainForm: TMainForm
Style = csDropDownList
Anchors = [akTop, akRight]
Font.Charset = DEFAULT_CHARSET
Font.Color = 12102048
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Expand Down Expand Up @@ -774,7 +773,7 @@ object MainForm: TMainForm
Style = csDropDownList
Anchors = [akTop, akRight]
Font.Charset = DEFAULT_CHARSET
Font.Color = 12102048
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Expand Down Expand Up @@ -842,8 +841,6 @@ object MainForm: TMainForm
Width = 344
Height = 13
Align = alBottom
ExplicitLeft = 4
ExplicitTop = 364
ExplicitWidth = 3
end
object CoverPanel: TPanel
Expand All @@ -853,9 +850,6 @@ object MainForm: TMainForm
Height = 217
Align = alBottom
TabOrder = 0
ExplicitLeft = 1
ExplicitTop = 384
ExplicitWidth = 348
object CoverImage: TJvImage
AlignWithMargins = True
Left = 3
Expand All @@ -882,7 +876,6 @@ object MainForm: TMainForm
Height = 30
Align = alBottom
TabOrder = 0
ExplicitWidth = 346
object CoverArtInfoLabel: TLabel
Left = 41
Top = 1
Expand All @@ -906,7 +899,6 @@ object MainForm: TMainForm
Images = BottomBtnImages
TabOrder = 0
OnClick = NextArtworkBtnClick
ExplicitLeft = 305
end
object PrevArtworkBtn: TButton
Left = 1
Expand All @@ -930,9 +922,6 @@ object MainForm: TMainForm
Align = alTop
BevelOuter = bvNone
TabOrder = 1
ExplicitLeft = 1
ExplicitTop = 1
ExplicitWidth = 348
DesignSize = (
350
112)
Expand All @@ -954,7 +943,6 @@ object MainForm: TMainForm
ParentFont = False
TabOrder = 0
OnKeyDown = LyricTitleEditKeyDown
ExplicitWidth = 258
end
object LyricArtistEdit: TLabeledEdit
Left = 5
Expand All @@ -968,7 +956,6 @@ object MainForm: TMainForm
Enabled = False
TabOrder = 1
OnKeyDown = LyricTitleEditKeyDown
ExplicitWidth = 260
end
object LyricSearchBtn: TButton
Left = 273
Expand All @@ -980,7 +967,6 @@ object MainForm: TMainForm
Enabled = False
TabOrder = 2
OnClick = LyricSearchBtnClick
ExplicitLeft = 271
end
object LyricSourceList: TComboBox
AlignWithMargins = True
Expand All @@ -1001,7 +987,6 @@ object MainForm: TMainForm
'azlyrics.com'
'batlyrics.net'
'metrolyrics.com')
ExplicitWidth = 342
end
object ReloadLyricTitleBtn: TButton
Left = 271
Expand All @@ -1013,7 +998,6 @@ object MainForm: TMainForm
Enabled = False
TabOrder = 4
OnClick = ReloadLyricTitleBtnClick
ExplicitLeft = 269
end
end
object LyricList: TListBox
Expand All @@ -1032,10 +1016,6 @@ object MainForm: TMainForm
TabOrder = 2
OnMouseEnter = LyricListMouseEnter
OnMouseLeave = LyricListMouseLeave
ExplicitLeft = 1
ExplicitTop = 113
ExplicitWidth = 348
ExplicitHeight = 248
end
end
object CategoryPages: TPageControl
Expand Down Expand Up @@ -1527,7 +1507,7 @@ object MainForm: TMainForm
Left = 456
Top = 448
Bitmap = {
494C010105000800280016001600FFFFFFFF2110FFFFFFFFFFFFFFFF424D3600
494C0101050008002C0016001600FFFFFFFF2110FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000580000002C0000000100200000000000803C
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000404040E171717492929297E3A3A3AB24B4B4BE54B4B
Expand Down Expand Up @@ -2347,7 +2327,7 @@ object MainForm: TMainForm
Left = 634
Top = 453
Bitmap = {
494C0101020008003C0016001600FFFFFFFF2110FFFFFFFFFFFFFFFF424D3600
494C010102000800400016001600FFFFFFFF2110FFFFFFFFFFFFFFFF424D3600
000000000000360000002800000058000000160000000100200000000000401E
0000000000000000000000000000000000000000000000000000000000020000
0004000000090000000E0000000E0000000B0000000800000008000000090000
Expand Down Expand Up @@ -2611,7 +2591,7 @@ object MainForm: TMainForm
Left = 536
Top = 456
Bitmap = {
494C010103003400540016001600FFFFFFFF2110FFFFFFFFFFFFFFFF424D3600
494C010103003400580016001600FFFFFFFF2110FFFFFFFFFFFFFFFF424D3600
000000000000360000002800000058000000160000000100200000000000401E
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000404040E171717492929297E3A3A3AB24B4B4BE54B4B
Expand Down Expand Up @@ -2875,7 +2855,7 @@ object MainForm: TMainForm
Left = 722
Top = 469
Bitmap = {
494C010109002800400020002000FFFFFFFF2110FFFFFFFFFFFFFFFF424D3600
494C010109002800440020002000FFFFFFFF2110FFFFFFFFFFFFFFFF424D3600
00000000000036000000280000008000000060000000010020000000000000C0
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000300000004000000040000000400000004000000040000
Expand Down Expand Up @@ -4473,7 +4453,7 @@ object MainForm: TMainForm
Left = 336
Top = 440
Bitmap = {
494C010106000800300016001600FFFFFFFF2110FFFFFFFFFFFFFFFF424D3600
494C010106000800340016001600FFFFFFFF2110FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000580000002C0000000100200000000000803C
0000000000000000000000000000000000000000000000000001000000010000
0001000000010000000100000001000000010000000100000001000000010000
Expand Down
37 changes: 22 additions & 15 deletions Forms/UnitMain.pas
Expand Up @@ -203,7 +203,6 @@ TMainForm = class(TForm)
VolumeBar: TJvTrackBar;
PlaybackPanel: TPanel;
PositionPanel: TPanel;
PositionLabel: TLabel;
ControlsPanel: TPanel;
InfoPanel: TPanel;
TitleLabel: TLabel;
Expand Down Expand Up @@ -255,6 +254,7 @@ TMainForm = class(TForm)
PlaybackImages: TImageList;
TopBtnImages: TImageList;
BottomBtnImages: TImageList;
PositionLabel: TEdit;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure MusicSearchProgress(Sender: TObject);
Expand Down Expand Up @@ -2035,8 +2035,8 @@ procedure TMainForm.FormShow(Sender: TObject);
LSF: TIniFile;
begin
LoadPlayList;
LoadSettings;
MoveRadioStations;
LoadSettings;
CreateUserRadioLists;
LoadRadioStations;
GenerateShuffleList;
Expand Down Expand Up @@ -2323,7 +2323,7 @@ procedure TMainForm.HandlePlaybackFromBassThread;
FSelfCaption := Self.Caption;
FArtistLabel := '';
FAlbumLabel := '';
PositionLabel.Caption := '00:00:00/00:00:00/00:00:00';
PositionLabel.Text := '00:00:00/00:00:00/00:00:00';
LyricList.Items.Clear;
if MainForm.Enabled and MainForm.Visible then
MainForm.FocusControl(VolumeBar);
Expand Down Expand Up @@ -2351,7 +2351,7 @@ procedure TMainForm.HandlePlaybackFromBassThread;
FSelfCaption := Self.Caption;
FArtistLabel := '';
FAlbumLabel := '';
PositionLabel.Caption := '00:00:00/00:00:00/00:00:00';
PositionLabel.Text := '00:00:00/00:00:00/00:00:00';
LyricList.Items.Clear;
if MainForm.Enabled and MainForm.Visible then
MainForm.FocusControl(VolumeBar);
Expand Down Expand Up @@ -2387,7 +2387,7 @@ procedure TMainForm.HandlePlaybackFromBassThread;
FSelfCaption := Self.Caption;
FArtistLabel := '';
FAlbumLabel := '';
PositionLabel.Caption := '00:00:00/00:00:00/00:00:00';
PositionLabel.Text := '00:00:00/00:00:00/00:00:00';
LyricList.Items.Clear;
if MainForm.Enabled and MainForm.Visible then
MainForm.FocusControl(VolumeBar);
Expand Down Expand Up @@ -2427,7 +2427,7 @@ procedure TMainForm.HandlePlaybackFromBassThread;
FSelfCaption := Self.Caption;
FArtistLabel := '';
FAlbumLabel := '';
PositionLabel.Caption := '00:00:00/00:00:00/00:00:00';
PositionLabel.Text := '00:00:00/00:00:00/00:00:00';
LyricList.Items.Clear;
if MainForm.Enabled and MainForm.Visible then
MainForm.FocusControl(VolumeBar);
Expand Down Expand Up @@ -3058,16 +3058,23 @@ procedure TMainForm.M1Click(Sender: TObject);
procedure TMainForm.MoveRadioStations;
var
I: Integer;
LRadios: TStringList;
begin
for I := 1 to RadiosView.Items.Count - 1 do
begin
LRadios := TStringList.Create;
try
LRadios.LoadFromFile(ExtractFileDir(Application.ExeName) + '\radios.txt');
if not Portable then
begin
if not FileExists(FAppDataFolder + '\' + RadiosView.Items[i].SubItems[0] + '.txt') then
for I := 0 to LRadios.Count - 1 do
begin
CopyFile(PWideChar(ExtractFileDir(Application.ExeName) + '\Radios\' + RadiosView.Items[i].SubItems[0] + '.txt'), PWideChar(FAppDataFolder + '\' + RadiosView.Items[i].SubItems[0] + '.txt'), True);
if not FileExists(FAppDataFolder + '\' + LRadios[i] + '.txt') then
begin
CopyFile(PWideChar(ExtractFileDir(Application.ExeName) + '\Radios\' + LRadios[i] + '.txt'), PWideChar(FAppDataFolder + '\' + LRadios[i] + '.txt'), True);
end;
end;
end;
finally
LRadios.Free;
end;
end;

Expand Down Expand Up @@ -4332,14 +4339,14 @@ procedure TMainForm.PlayRadio(const URL: Ansistring);
StopRadioRecording;
PositionBar.Position := 0;
Self.Caption := 'OooPlayer';
PositionLabel.Caption := '00:00:00/00:00:00/00:00:00';
PositionLabel.Text := '00:00:00/00:00:00/00:00:00';
CoverImage.Picture.LoadFromFile(ExtractFileDir(Application.ExeName) + '\logo.png');
TitleLabel.Caption := 'Trying to connect to the radio station...';
FTitleLabel := TitleLabel.Caption;
FSelfCaption := Self.Caption;
FArtistLabel := '';
FAlbumLabel := '';
PositionLabel.Caption := '00:00:00/00:00:00/00:00:00';
PositionLabel.Text := '00:00:00/00:00:00/00:00:00';
LyricList.Items.Clear;
Taskbar2.ProgressMaxValue := High(Int64);
Taskbar2.ProgressValue := 0;
Expand Down Expand Up @@ -4424,7 +4431,7 @@ procedure TMainForm.PositionBarMouseDown(Sender: TObject; Button: TMouseButton;
try
if FPlayer.SetPosition((FPlayer.TotalLength * NewTractBarPosition) div FCurrentItemInfo.DurationBass) then
begin
PositionBar.Position := NewTractBarPosition;
PositionBar.Position := NewTractBarPosition;
end;
finally
Sleep(50);
Expand Down Expand Up @@ -4568,7 +4575,7 @@ procedure TMainForm.ProgressTimerTimer(Sender: TObject);
begin
if FPlayer.PlayerStatus2 = psPlaying then
begin
PositionLabel.Caption := FPlayer.PositionStr + '/' + FPlayer.IntToTime(FCurrentItemInfo.DurationAsSecInt - FPlayer.PositionAsSec) + '/' + FPlayer.IntToTime(FCurrentItemInfo.DurationAsSecInt);
PositionLabel.Text := FPlayer.PositionStr + '/' + FPlayer.IntToTime(FCurrentItemInfo.DurationAsSecInt - FPlayer.PositionAsSec) + '/' + FPlayer.IntToTime(FCurrentItemInfo.DurationAsSecInt);
PositionBar.Hint := FPlayer.PositionStr;
end;
end;
Expand Down Expand Up @@ -5692,7 +5699,7 @@ procedure TMainForm.StopBtnClick(Sender: TObject);
FSelfCaption := Self.Caption;
FArtistLabel := '';
FAlbumLabel := '';
PositionLabel.Caption := '00:00:00/00:00:00/00:00:00';
PositionLabel.Text := '00:00:00/00:00:00/00:00:00';
InfoLabel.Caption := 'Stopped';
LyricList.Items.Clear;
Taskbar2.ProgressMaxValue := High(Int64);
Expand Down

0 comments on commit e5a41e2

Please sign in to comment.