diff --git a/applications/cactusjukebox/source/cactusjukebox.lpi b/applications/cactusjukebox/source/cactusjukebox.lpi
index ba4f51272..54bc64d45 100644
--- a/applications/cactusjukebox/source/cactusjukebox.lpi
+++ b/applications/cactusjukebox/source/cactusjukebox.lpi
@@ -18,7 +18,7 @@
-
+
@@ -276,7 +276,8 @@
-
+
+
diff --git a/applications/cactusjukebox/source/cddb.pas b/applications/cactusjukebox/source/cddb.pas
index 25b0b9425..648ef6718 100755
--- a/applications/cactusjukebox/source/cddb.pas
+++ b/applications/cactusjukebox/source/cddb.pas
@@ -18,7 +18,7 @@ interface
uses
Classes, SysUtils,
{$ifdef HAS_CDROM}cdrom, discid,{$endif}
- lnet, config;
+ lnet, config, debug;
type
@@ -127,7 +127,7 @@ begin
ErrorCode:=0;
s:='';
asocket.GetMessage(s);
- writeln('Socket message length: ', Length(s));
+ DebugOutLn(Format('Socket message length: %d', [Length(s)]), 1);
if s<>'' then begin
if length(s)>3 then begin
posi:=pos(#13, s);
diff --git a/applications/cactusjukebox/source/mainform.lfm b/applications/cactusjukebox/source/mainform.lfm
index 086d22e98..fe18ce6ae 100644
--- a/applications/cactusjukebox/source/mainform.lfm
+++ b/applications/cactusjukebox/source/mainform.lfm
@@ -5,7 +5,7 @@ object Main: TMain
Width = 893
ActiveControl = Panel4
Caption = 'titel'
- ClientHeight = 597
+ ClientHeight = 604
ClientWidth = 893
Icon.Data = {
3E42000000000100010040400000010020002842000016000000280000004000
@@ -548,7 +548,7 @@ object Main: TMain
object StatusBar1: TStatusBar
Left = 0
Height = 23
- Top = 574
+ Top = 581
Width = 893
Panels = <
item
@@ -562,7 +562,7 @@ object Main: TMain
end
object Splitter1: TSplitter
Left = 288
- Height = 574
+ Height = 581
Top = 0
Width = 8
AutoSnap = False
@@ -572,19 +572,19 @@ object Main: TMain
end
object Panel1: TPanel
Left = 296
- Height = 574
+ Height = 581
Top = 0
Width = 597
Align = alClient
BevelOuter = bvNone
- ClientHeight = 574
+ ClientHeight = 581
ClientWidth = 597
TabOrder = 0
OnClick = Panel1Click
OnResize = Panel1Resize
object TitleTree: TListView
Left = 0
- Height = 144
+ Height = 151
Top = 5
Width = 587
Align = alTop
@@ -599,27 +599,27 @@ object Main: TMain
item
AutoSize = True
Caption = 'Artist'
- Width = 44
+ Width = 567
end
item
AutoSize = True
Caption = 'Title'
- Width = 39
+ Width = 35
end
item
AutoSize = True
Caption = 'Album'
- Width = 52
- end
- item
- AutoSize = True
- Caption = 'Track'
Width = 44
end
+ item
+ AutoSize = True
+ Caption = 'Track'
+ Width = 41
+ end
item
AutoSize = True
Caption = 'Genre'
- Width = 49
+ Width = 44
end
item
AutoSize = True
@@ -631,7 +631,7 @@ object Main: TMain
AutoSize = True
Caption = 'Length'
MaxWidth = 60
- Width = 341
+ Width = 48
end>
PopupMenu = titlelistmenu
ReadOnly = True
@@ -654,7 +654,7 @@ object Main: TMain
Cursor = crVSplit
Left = 0
Height = 10
- Top = 149
+ Top = 156
Width = 597
Align = alTop
ResizeAnchor = akTop
@@ -662,7 +662,7 @@ object Main: TMain
object Panel3: TPanel
Left = 0
Height = 415
- Top = 159
+ Top = 166
Width = 597
Align = alClient
BevelOuter = bvNone
@@ -847,7 +847,7 @@ object Main: TMain
end
object current_title_edit: TEdit
Left = 12
- Height = 27
+ Height = 21
Top = 109
Width = 200
Color = clBtnFace
@@ -856,7 +856,7 @@ object Main: TMain
end
object current_title_edit1: TEdit
Left = 12
- Height = 27
+ Height = 21
Top = 141
Width = 200
Color = clBtnFace
@@ -865,9 +865,9 @@ object Main: TMain
end
object randomcheck: TCheckBox
Left = 135
- Height = 23
+ Height = 17
Top = 257
- Width = 76
+ Width = 57
Caption = 'Random'
OnChange = randomcheckChange
TabOrder = 3
@@ -919,7 +919,7 @@ object Main: TMain
item
AutoSize = True
Caption = 'Playlist'
- Width = 346
+ Width = 344
end>
PopupMenu = playlistmenu
ReadOnly = True
@@ -950,10 +950,10 @@ object Main: TMain
TabOrder = 2
object filetypebox: TComboBox
Left = 360
- Height = 27
+ Height = 21
Top = 8
Width = 90
- ItemHeight = 0
+ ItemHeight = 13
ItemIndex = 0
Items.Strings = (
'all types'
@@ -971,7 +971,7 @@ object Main: TMain
end
object searchstr: TEdit
Left = 120
- Height = 27
+ Height = 21
Top = 8
Width = 232
OnKeyUp = searchstrKeyUp
@@ -1013,11 +1013,11 @@ object Main: TMain
end
object clear_list: TBitBtn
AnchorSideBottom.Side = asrCenter
- Left = 517
+ Left = 509
Height = 30
Hint = 'Clear Playlist'
Top = 7
- Width = 66
+ Width = 74
Anchors = [akTop, akRight]
AutoSize = True
Caption = 'Clear'
@@ -1084,9 +1084,9 @@ object Main: TMain
end
object lblPath: TLabel
Left = 8
- Height = 20
+ Height = 14
Top = 56
- Width = 46
+ Width = 33
Caption = 'lblPath'
ParentColor = False
end
@@ -1094,19 +1094,19 @@ object Main: TMain
end
object Panel4: TPanel
Left = 0
- Height = 574
+ Height = 581
Top = 0
Width = 288
Align = alLeft
BorderSpacing.InnerBorder = 30
BevelOuter = bvNone
- ClientHeight = 574
+ ClientHeight = 581
ClientWidth = 288
TabOrder = 1
OnClick = Panel4Click
object ArtistTree: TTreeView
Left = 26
- Height = 564
+ Height = 571
Top = 5
Width = 259
Align = alClient
@@ -1116,7 +1116,7 @@ object Main: TMain
BorderSpacing.InnerBorder = 20
BorderSpacing.CellAlignHorizontal = ccaLeftTop
BorderSpacing.CellAlignVertical = ccaLeftTop
- DefaultItemHeight = 22
+ DefaultItemHeight = 16
DragMode = dmAutomatic
ExpandSignType = tvestArrow
Images = ImageList1
@@ -1147,9 +1147,9 @@ object Main: TMain
OnClick = ArtistSrchFieldClick
object Label2: TLabel
Left = 77
- Height = 20
+ Height = 14
Top = 8
- Width = 44
+ Width = 34
Caption = 'Search'
ParentColor = False
end
@@ -1200,7 +1200,7 @@ object Main: TMain
end
object artistsearch: TEdit
Left = 8
- Height = 27
+ Height = 21
Top = 32
Width = 110
OnKeyUp = ArtistTreeKeyUp
@@ -1210,7 +1210,7 @@ object Main: TMain
end
object ToolBar1: TToolBar
Left = 0
- Height = 569
+ Height = 576
Top = 5
Width = 26
Align = alLeft
diff --git a/applications/cactusjukebox/source/mainform.pas b/applications/cactusjukebox/source/mainform.pas
index a255d610f..ab1b0335c 100644
--- a/applications/cactusjukebox/source/mainform.pas
+++ b/applications/cactusjukebox/source/mainform.pas
@@ -903,6 +903,7 @@ procedure TMain.playClick(Sender: TObject);
var
err: integer;
begin
+ DebugOutLn('[TMain.playClick] START', 1);
if (not PlayerObj.paused) then
begin
playtimer.Enabled := False;
@@ -948,6 +949,7 @@ begin
//if player paused
pauseClick(nil);
end;
+ DebugOutLn('[TMain.playClick] END', 1);
end;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -975,6 +977,7 @@ var
tmppos: integer;
fileobj: TMediaFileClass;
begin
+ DebugOutLn('[TMain.playtimerTimer] START', 1);
try
// if PlayerObj.playing=false then stopClick(nil);
if PlayerObj.PlaybackMode = STREAMING_MODE then
@@ -984,11 +987,11 @@ begin
else
StatusBar1.Panels[0].Text := 'Buffering Stream...';
end;
- // writeln('ontimer');
+ DebugOutLn('[TMain.playtimerTimer] A', 1);
if (PlayerObj.playing) and (PlayerObj.PlaybackMode = FILE_MODE) and
(PlayerObj.paused = False) then
begin
- // writeln('player playing');
+ DebugOutLn('[TMain.playtimerTimer] player playing', 1);
if not bPnlPlaytimeNegated then
pnlPlaytime.Caption := PlayerObj.get_timestr
@@ -998,14 +1001,18 @@ begin
playwin.TimeImg.Canvas.Font.Color := ClNavy;
playwin.TimeImg.Canvas.TextOut(5, 3, pnlPlaytime.Caption);
+ DebugOutLn('[TMain.playtimerTimer] B', 1);
+
+ DebugOutLn(Format('[TMain.playtimerTimer] tmppos=%d', [tmppos]), 1);
tmppos := PlayerObj.Get_FilePosition;
trackbar.position := tmppos;
- // writeln(tmppos);
x2 := (trackbar.position * 2) - 3;
if x2 < 3 then
x2 := 3;
+ DebugOutLn('[TMain.playtimerTimer] D', 1);
if (tmppos = 100) then
begin
+ DebugOutLn('[TMain.playtimerTimer] E', 1);
// writeln('nexttrack');
// WriteLn(PlayerObj.CurrentTrack);
if (PlayerObj.CurrentTrack < PlayerObj.Playlist.ItemCount) then
@@ -1015,6 +1022,7 @@ begin
end;
if CactusConfig.CoverDownload and (CoverFound = False) and (LoopCount < 20) then
begin
+ DebugOutLn('[TMain.playtimerTimer] F', 1);
Inc(LoopCount);
if (assigned(LastFMAPI)) and (LastFMAPI.data_ready) then
begin
@@ -1025,7 +1033,7 @@ begin
CoverImage.Picture.LoadFromFile(fileobj.CoverPath);
playwin.AlbumCoverImg.Picture.LoadFromFile(fileobj.CoverPath);
except
- DebugOutLn('EXCEPTION', 3);
+ DebugOutLn('EXCEPTION', 1);
end;
end;
CoverFound := True;
@@ -1034,13 +1042,17 @@ begin
end
else if (LoopCount >= 20) and (CoverFound = False) then
CoverImage.Picture.Clear;
+ DebugOutLn('[TMain.playtimerTimer] G', 1);
end
else
+ begin
+ DebugOutLn('[TMain.playtimerTimer] H', 1);
{playtimer.Enabled:=false};
+ end;
except
- DebugOutLn('CAUGHT EXCEPTION IN PLAYTIMER!!!!', 3);
+ DebugOutLn('CAUGHT EXCEPTION IN PLAYTIMER!!!!', 1);
end;
-
+ DebugOutLn('[TMain.playtimerTimer] END', 1);
end;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -3292,12 +3304,11 @@ end;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
procedure TMain.checkmobileTimer(Sender: TObject);
-
var
PlayerScanThread: TScanThread;
tmps: string;
-
begin
+ DebugOutLn('[TMain.checkmobileTimer] START', 1);
if (player_connected = False) and FileExists(CactusConfig.DAPPath + 'cactuslib') then
begin
DebugOut('DAP detected...', 2);
@@ -3333,6 +3344,7 @@ begin
disconnectDAP;
StatusBar1.Panels[1].Text := 'Device disconnected';
end;
+ DebugOutLn('[TMain.checkmobileTimer] END', 1);
end;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/applications/cactusjukebox/source/mplayer.pas b/applications/cactusjukebox/source/mplayer.pas
index 723105f0c..895d1ad29 100644
--- a/applications/cactusjukebox/source/mplayer.pas
+++ b/applications/cactusjukebox/source/mplayer.pas
@@ -95,14 +95,15 @@ const MPLAYER_BINARY='mplayer.exe';
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
procedure TMPlayerClass.SendCommand(cmd: string);
begin
- // writeln('sendcommand');
- cmd:=cmd+#10; //MPLayer always needs #10 as Lineending, no matter if win32 or linux
- try
- // writeln('sendcommand2');
- if GetMPlayerPlaying then MPlayerProcess.Input.write(cmd[1], length(cmd));
- // writeln('sendcommand3');
- except writeln('EXCEPTION sending command to mplayer');
- end;
+ DebugOutLn('[TMPlayerClass.sendcommand] START cmd=' + cmd, 1);
+ cmd:=cmd+#13#10; //MPLayer always needs #10 as Lineending, no matter if win32 or linux
+ try
+ DebugOutLn('[TMPlayerClass.sendcommand] 2', 1);
+ if GetMPlayerPlaying then MPlayerProcess.Input.write(cmd[1], length(cmd));
+ DebugOutLn('[TMPlayerClass.sendcommand] 3', 1);
+ except
+ DebugOutLn('EXCEPTION sending command to mplayer', 1);
+ end;
end;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function TMPlayerClass.GetProcessOutput: string;
@@ -176,39 +177,55 @@ end;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function TMPlayerClass.play(index: integer): byte;
-var MPOptions: String;
+var
+ MPOptions: String;
begin
-if (index=0) then begin
- if (FileExists(playlist.items[index].path)) then begin
- if FPlaying then stop;
- MPlayerProcess:=TProcess.Create(nil);
+ DebugOutLn('[TMPlayerClass.play]', 1);
+ if (index=0) then
+ begin
+ if (FileExists(playlist.items[index].path)) then
+ begin
+ if FPlaying then stop;
- if not UseExternalConfig then begin
- MPOptions:='-slave -quiet -softvol';
- if OutputMode=ALSAOUT then MPOptions:=MPOptions+' -ao alsa';
- if OutputMode=OSSOUT then MPOptions:=MPOptions+' -ao oss';
- end else MPOptions:='-include '+ExternalConfigFile;
+ MPlayerProcess:=TProcess.Create(nil);
- MPOptions:=' -af volume=' + IntToStr(IntTodB(FVolume, 100)) +' '+ MPOptions;// -volume xx only supported with patched mplayer;
+ if not UseExternalConfig then
+ begin
+ MPOptions:='-slave -quiet -softvol';
+ if OutputMode=ALSAOUT then MPOptions:=MPOptions+' -ao alsa';
+ if OutputMode=OSSOUT then MPOptions:=MPOptions+' -ao oss';
+ end
+ else
+ MPOptions:='-include '+ExternalConfigFile;
- FPlaybackMode:=FILE_MODE;
- //DebugOutLn('playing -> '+playlist.items[index].path, 1);
- // writeln(StringReplace(playlist.items[index].path, '''', '''''', [rfReplaceAll]));
- MPlayerProcess.CommandLine:=FMplayerPath+' '+MPOptions+' "'+playlist.items[index].path+'"';
+ MPOptions:=' -af volume=' + IntToStr(IntTodB(FVolume, 100)) +' '+ MPOptions;// -volume xx only supported with patched mplayer;
- DebugOutLn(MPlayerProcess.CommandLine,5);
- FLastGet_Pos:=0;
- MPlayerProcess.Options:= MPlayerProcess.Options + [poUsePipes, poDefaultErrorMode, poStderrToOutPut, poNoConsole];
- MPlayerProcess.Execute;
+ FPlaybackMode:=FILE_MODE;
- if MPlayerProcess.Running then begin
- FCurrentTrack:=index;
- FPlaying:=true;
- Playlist.Items[index].Played:=true;
- result:=0;
- end;
- end else result:=1;
-end else DebugOutLn('File not found ->'+playlist.items[index].path,0);
+ DebugOutLn('playing -> '+playlist.items[index].path, 1);
+ DebugOutLn(StringReplace(playlist.items[index].path, '''', '''''', [rfReplaceAll]), 1);
+
+ MPlayerProcess.CommandLine:=FMplayerPath+' '+MPOptions+' "'+playlist.items[index].path+'"';
+
+ DebugOutLn(MPlayerProcess.CommandLine,5);
+ FLastGet_Pos:=0;
+ MPlayerProcess.Options:= MPlayerProcess.Options + [poUsePipes, poDefaultErrorMode, poStderrToOutPut, poNoConsole];
+ MPlayerProcess.Execute;
+
+ if MPlayerProcess.Running then
+ begin
+ DebugOutLn('MPlayerProcess is Running', 1);
+ FCurrentTrack:=index;
+ FPlaying:=true;
+ Playlist.Items[index].Played:=true;
+ result:=0;
+ end;
+ end
+ else
+ result:=1;
+ end
+ else
+ DebugOutLn('File not found ->'+playlist.items[index].path,0);
end;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function TMPlayerClass.play(url: string): byte;
@@ -364,27 +381,38 @@ end;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function TMPlayerClass.Get_FilePosition: longint;
-var tmps: string;
- i:integer;
+var
+ tmps: string;
+ i:integer;
begin
- if GetMPlayerPlaying then begin
- i:=0;
- repeat begin
- SendCommand('get_property percent_pos');
- sleep(8);
- tmps:=GetProcessOutput;
- inc(i);
- // writeln('jj');
- end;
- until (pos('percent_pos', tmps)>0) or (i>=5);
- // writeln('getpos');
- i:=LastDelimiter('=', tmps);
- if i > 0 then begin
- FLastGet_Pos:=round(StrToFloat(Copy(tmps, i+1, Length(tmps)-i)));
- result:=FLastGet_Pos;
- end else result:=-1;
- end else result:=-1;
- if (result=-1) and (FLastGet_Pos>0) then Result:=100;
+ DebugOutLn('[TMPlayerClass.Get_FilePosition] START', 1);
+ if GetMPlayerPlaying then
+ begin
+ DebugOutLn('[TMPlayerClass.Get_FilePosition] A', 1);
+ i:=0;
+ repeat
+ SendCommand('get_property percent_pos');
+ sleep(8);
+ tmps:=GetProcessOutput;
+ inc(i);
+ DebugOutLn('[TMPlayerClass.Get_FilePosition] ' + tmps, 1);
+ until (pos('percent_pos', tmps)>0) or (i>=5);
+
+ // writeln('getpos');
+ i:=LastDelimiter('=', tmps);
+ if i > 0 then
+ begin
+ FLastGet_Pos:=round(StrToFloat(Copy(tmps, i+1, Length(tmps)-i)));
+ result:=FLastGet_Pos;
+ end
+ else
+ result:=-1;
+ end
+ else
+ result:=-1;
+
+ if (result=-1) and (FLastGet_Pos>0) then Result:=100;
+ DebugOutLn('[TMPlayerClass.Get_FilePosition] END', 1);
end;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function TMPlayerClass.get_FileLength: longint;
diff --git a/applications/cactusjukebox/source/playerclass.pas b/applications/cactusjukebox/source/playerclass.pas
index 3d81ccbc0..dbdf82bfb 100644
--- a/applications/cactusjukebox/source/playerclass.pas
+++ b/applications/cactusjukebox/source/playerclass.pas
@@ -33,7 +33,7 @@ TAudioBackend=(MPLAYERBACK, FMODBACK);
{ TPlayerClass }
type
-TPlayerClass = class
+ TPlayerClass = class
Protected
fTotalLength: int64;
FPlaying, FPaused: Boolean;