You've already forked lazarus-ccr
Fixes the UTF8 bugs of MP3 detail.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1771 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -604,18 +604,22 @@ object Main: TMain
|
||||
item
|
||||
AutoSize = True
|
||||
Caption = 'Title'
|
||||
Width = 37
|
||||
end
|
||||
item
|
||||
AutoSize = True
|
||||
Caption = 'Album'
|
||||
Width = 52
|
||||
end
|
||||
item
|
||||
AutoSize = True
|
||||
Caption = 'Track'
|
||||
Width = 45
|
||||
end
|
||||
item
|
||||
AutoSize = True
|
||||
Caption = 'Genre'
|
||||
Width = 49
|
||||
end
|
||||
item
|
||||
AutoSize = True
|
||||
@ -627,7 +631,7 @@ object Main: TMain
|
||||
AutoSize = True
|
||||
Caption = 'Length'
|
||||
MaxWidth = 60
|
||||
Width = 57
|
||||
Width = 55
|
||||
end>
|
||||
PopupMenu = titlelistmenu
|
||||
ReadOnly = True
|
||||
@ -843,7 +847,7 @@ object Main: TMain
|
||||
end
|
||||
object current_title_edit: TEdit
|
||||
Left = 12
|
||||
Height = 21
|
||||
Height = 27
|
||||
Top = 109
|
||||
Width = 200
|
||||
Color = clBtnFace
|
||||
@ -852,7 +856,7 @@ object Main: TMain
|
||||
end
|
||||
object current_title_edit1: TEdit
|
||||
Left = 12
|
||||
Height = 21
|
||||
Height = 27
|
||||
Top = 141
|
||||
Width = 200
|
||||
Color = clBtnFace
|
||||
@ -861,9 +865,9 @@ object Main: TMain
|
||||
end
|
||||
object randomcheck: TCheckBox
|
||||
Left = 135
|
||||
Height = 19
|
||||
Height = 23
|
||||
Top = 257
|
||||
Width = 62
|
||||
Width = 75
|
||||
Caption = 'Random'
|
||||
OnChange = randomcheckChange
|
||||
TabOrder = 3
|
||||
@ -946,10 +950,10 @@ object Main: TMain
|
||||
TabOrder = 2
|
||||
object filetypebox: TComboBox
|
||||
Left = 360
|
||||
Height = 21
|
||||
Height = 27
|
||||
Top = 14
|
||||
Width = 90
|
||||
ItemHeight = 13
|
||||
ItemHeight = 19
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'all types'
|
||||
@ -967,7 +971,7 @@ object Main: TMain
|
||||
end
|
||||
object searchstr: TEdit
|
||||
Left = 120
|
||||
Height = 21
|
||||
Height = 27
|
||||
Top = 14
|
||||
Width = 232
|
||||
OnKeyUp = searchstrKeyUp
|
||||
@ -977,7 +981,7 @@ object Main: TMain
|
||||
Left = 16
|
||||
Height = 28
|
||||
Hint = 'Search the library'
|
||||
Top = 10
|
||||
Top = 12
|
||||
Width = 90
|
||||
BorderSpacing.InnerBorder = 4
|
||||
Caption = 'Search'
|
||||
@ -1012,7 +1016,7 @@ object Main: TMain
|
||||
Left = 501
|
||||
Height = 30
|
||||
Hint = 'Clear Playlist'
|
||||
Top = 12
|
||||
Top = 14
|
||||
Width = 84
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
@ -1196,7 +1200,7 @@ object Main: TMain
|
||||
end
|
||||
object artistsearch: TEdit
|
||||
Left = 8
|
||||
Height = 21
|
||||
Height = 27
|
||||
Top = 32
|
||||
Width = 110
|
||||
OnKeyUp = ArtistTreeKeyUp
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@
|
||||
<AutoIncrementBuild Value="True"/>
|
||||
<MinorVersionNr Value="3"/>
|
||||
<RevisionNr Value="5"/>
|
||||
<BuildNr Value="738"/>
|
||||
<BuildNr Value="739"/>
|
||||
<StringTable ProductVersion="0.3.5.737"/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
|
@ -10,46 +10,49 @@ uses
|
||||
|
||||
{ TPlaylistitemClass }
|
||||
type
|
||||
TPlaylistitemClass = class
|
||||
TPlaylistitemClass = class
|
||||
Artist, Title, Path, Album: string;
|
||||
LengthMS, id:longint;
|
||||
LengthMS, id: longint;
|
||||
Played: boolean;
|
||||
constructor create;
|
||||
destructor destroy;
|
||||
constructor Create;
|
||||
destructor Destroy;
|
||||
procedure update(MedFileObj: TMediaFileClass);
|
||||
end;
|
||||
|
||||
PPlaylistItemClass = ^TPlaylistitemClass;
|
||||
|
||||
type
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
{ TPlaylistClass }
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
{ TPlaylistClass }
|
||||
|
||||
TPlaylistClass = class(Tlist)
|
||||
TPlaylistClass = class(TList)
|
||||
private
|
||||
function GetItems(index: integer):TPlaylistitemClass;
|
||||
function GetItems(index: integer): TPlaylistitemClass;
|
||||
public
|
||||
CurrentTrack: integer;
|
||||
property Items[index: integer]: TPlaylistitemClass read GetItems;
|
||||
|
||||
constructor create;
|
||||
destructor destroy;
|
||||
constructor Create;
|
||||
destructor Destroy;
|
||||
function TotalPlayTime: int64;
|
||||
function TotalPlayTimeStr: string;
|
||||
procedure move(dest, target:integer);
|
||||
procedure move(dest, target: integer);
|
||||
procedure remove(index: integer);
|
||||
procedure clear; override;
|
||||
function add(filepath:string):integer; //Read track info out of file at path
|
||||
function add(MedFileObj: TMediaFileClass):integer; //Get track info from FileObj
|
||||
procedure insert(index:integer; MedFileObj: TMediaFileClass);
|
||||
procedure Clear; override;
|
||||
function add(filepath: string): integer; //Read track info out of file at path
|
||||
function add(MedFileObj: TMediaFileClass): integer; //Get track info from FileObj
|
||||
procedure insert(index: integer; MedFileObj: TMediaFileClass);
|
||||
|
||||
function update(index: integer; filepath:string):integer; //update track info out of file at path
|
||||
function update(index: integer; MedFileObj: TMediaFileClass):integer; //update track info from FileObj
|
||||
function RandomIndex:integer;
|
||||
function update(index: integer; filepath: string): integer;
|
||||
//update track info out of file at path
|
||||
function update(index: integer; MedFileObj: TMediaFileClass): integer;
|
||||
//update track info from FileObj
|
||||
function RandomIndex: integer;
|
||||
procedure reset_random;
|
||||
function ItemCount:integer;
|
||||
function LoadFromFile(path:string):byte;
|
||||
function SaveToFile(path:string):byte;
|
||||
function ItemCount: integer;
|
||||
function LoadFromFile(path: string): byte;
|
||||
function SaveToFile(path: string): byte;
|
||||
end;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
@ -60,14 +63,14 @@ implementation
|
||||
{ TPlaylistitemClass }
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
constructor TPlaylistitemClass.create;
|
||||
constructor TPlaylistitemClass.Create;
|
||||
begin
|
||||
played:=false;
|
||||
played := False;
|
||||
end;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
destructor TPlaylistitemClass.destroy;
|
||||
destructor TPlaylistitemClass.Destroy;
|
||||
begin
|
||||
end;
|
||||
|
||||
@ -76,12 +79,12 @@ end;
|
||||
procedure TPlaylistitemClass.update(MedFileObj: TMediaFileClass);
|
||||
begin
|
||||
|
||||
Artist:=MedFileObj.Artist;
|
||||
Title:=MedFileObj.Title;
|
||||
Album:=MedFileObj.Album;
|
||||
Artist := MedFileObj.Artist;
|
||||
Title := MedFileObj.Title;
|
||||
Album := MedFileObj.Album;
|
||||
|
||||
ID:=MedFileObj.ID;
|
||||
LengthMS:=MedFileObj.Playlength;
|
||||
ID := MedFileObj.ID;
|
||||
LengthMS := MedFileObj.Playlength;
|
||||
end;
|
||||
|
||||
|
||||
@ -91,67 +94,80 @@ end;
|
||||
|
||||
function TPlaylistClass.GetItems(index: integer): TPlaylistitemClass;
|
||||
begin
|
||||
if (index>=0) and (index < Count) then Result := (TPlaylistitemClass(Inherited Items [Index]));
|
||||
if (index >= 0) and (index < Count) then
|
||||
Result := (TPlaylistitemClass(inherited Items[Index]));
|
||||
end;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
constructor TPlaylistClass.create;
|
||||
constructor TPlaylistClass.Create;
|
||||
begin
|
||||
Inherited create;
|
||||
inherited Create;
|
||||
end;
|
||||
|
||||
destructor TPlaylistClass.destroy;
|
||||
destructor TPlaylistClass.Destroy;
|
||||
begin
|
||||
clear;
|
||||
Clear;
|
||||
end;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
function TPlaylistClass.TotalPlayTime: int64; // returns total playtime of playlist in milliseconds
|
||||
var i: integer;
|
||||
function TPlaylistClass.TotalPlayTime: int64;
|
||||
// returns total playtime of playlist in milliseconds
|
||||
var
|
||||
i: integer;
|
||||
PPlaylistItem: PPlaylistItemClass;
|
||||
begin
|
||||
result:=0;
|
||||
for i:= 0 to Count-1 do begin
|
||||
result:=result + Items[i].LengthMS;
|
||||
Result := 0;
|
||||
for i := 0 to Count - 1 do
|
||||
begin
|
||||
Result := Result + Items[i].LengthMS;
|
||||
end;
|
||||
end;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
function TPlaylistClass.TotalPlayTimeStr: string; // returns total playtime of playlist in string
|
||||
function TPlaylistClass.TotalPlayTimeStr: string;
|
||||
// returns total playtime of playlist in string
|
||||
// format. i.e. '2h 20min'
|
||||
var s1,s2: string;
|
||||
var
|
||||
s1, s2: string;
|
||||
i: int64;
|
||||
begin
|
||||
i:=TotalPlayTime;
|
||||
s2:=IntToStr((i div 60) mod 60 );
|
||||
s1:=IntToStr((i div 60) div 60 );
|
||||
result:=s1+'h '+s2+'min';
|
||||
i := TotalPlayTime;
|
||||
s2 := IntToStr((i div 60) mod 60);
|
||||
s1 := IntToStr((i div 60) div 60);
|
||||
Result := s1 + 'h ' + s2 + 'min';
|
||||
end;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
procedure TPlaylistClass.move(dest, target: integer);
|
||||
var current_track_tmp: integer;
|
||||
var
|
||||
current_track_tmp: integer;
|
||||
begin
|
||||
if (dest < ItemCount) and (target < ItemCount) and (dest >= 0) and (target >= 0 ) then
|
||||
if (dest < ItemCount) and (target < ItemCount) and (dest >= 0) and (target >= 0) then
|
||||
begin
|
||||
inherited Move(dest, target);
|
||||
current_track_tmp:= CurrentTrack;
|
||||
if (CurrentTrack>dest) and (CurrentTrack<=target+1) then dec(current_track_tmp);
|
||||
current_track_tmp := CurrentTrack;
|
||||
if (CurrentTrack > dest) and (CurrentTrack <= target + 1) then
|
||||
Dec(current_track_tmp);
|
||||
|
||||
if (CurrentTrack<dest) and (CurrentTrack>=target) then inc(current_track_tmp);
|
||||
if (CurrentTrack < dest) and (CurrentTrack >= target) then
|
||||
Inc(current_track_tmp);
|
||||
|
||||
if (CurrentTrack=dest) then begin
|
||||
current_track_tmp:=target;
|
||||
if (CurrentTrack = dest) then
|
||||
begin
|
||||
current_track_tmp := target;
|
||||
// if dest<target then current_track_tmp:=target+1 else current_track_tmp:=target;
|
||||
end;
|
||||
write('dest');writeln(dest);
|
||||
write('target');writeln(target);
|
||||
write('curtrack_before');writeln(CurrentTrack);
|
||||
CurrentTrack:=current_track_tmp;
|
||||
Write('dest');
|
||||
writeln(dest);
|
||||
Write('target');
|
||||
writeln(target);
|
||||
Write('curtrack_before');
|
||||
writeln(CurrentTrack);
|
||||
CurrentTrack := current_track_tmp;
|
||||
|
||||
writeln(CurrentTrack);
|
||||
end;
|
||||
@ -161,19 +177,22 @@ end;
|
||||
|
||||
procedure TPlaylistClass.remove(index: integer);
|
||||
begin
|
||||
if (index>=0) and (index < Count) then begin
|
||||
Items[index].free;
|
||||
if (index >= 0) and (index < Count) then
|
||||
begin
|
||||
Items[index].Free;
|
||||
inherited Delete(index);
|
||||
if CurrentTrack>index then dec(CurrentTrack);
|
||||
if CurrentTrack > index then
|
||||
Dec(CurrentTrack);
|
||||
end;
|
||||
end;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
procedure TPlaylistClass.clear;
|
||||
procedure TPlaylistClass.Clear;
|
||||
begin
|
||||
while count>0 do remove(0);
|
||||
CurrentTrack:=-1;
|
||||
while Count > 0 do
|
||||
remove(0);
|
||||
CurrentTrack := -1;
|
||||
end;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
@ -185,37 +204,39 @@ end;
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
function TPlaylistClass.add(MedFileObj: TMediaFileClass): integer;
|
||||
var Playlistitem: TPlaylistitemClass;
|
||||
var
|
||||
Playlistitem: TPlaylistitemClass;
|
||||
index: integer;
|
||||
begin
|
||||
|
||||
index:=(inherited Add(TPlaylistitemClass.create));
|
||||
index := (inherited Add(TPlaylistitemClass.Create));
|
||||
|
||||
|
||||
Items[index].Path:=MedFileObj.path;
|
||||
Items[index].Artist:=MedFileObj.Artist;
|
||||
Items[index].Title:=MedFileObj.Title;
|
||||
Items[index].Album:=MedFileObj.Album;
|
||||
Items[index].Path := MedFileObj.path;
|
||||
Items[index].Artist := MedFileObj.Artist;
|
||||
Items[index].Title := MedFileObj.Title;
|
||||
Items[index].Album := MedFileObj.Album;
|
||||
|
||||
Items[index].ID:=MedFileObj.ID;
|
||||
Items[index].LengthMS:=MedFileObj.Playlength;
|
||||
result:=index;
|
||||
Items[index].ID := MedFileObj.ID;
|
||||
Items[index].LengthMS := MedFileObj.Playlength;
|
||||
Result := index;
|
||||
end;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
procedure TPlaylistClass.insert(index: integer; MedFileObj: TMediaFileClass);
|
||||
begin
|
||||
inherited insert(index, TPlaylistitemClass.create);
|
||||
inherited insert(index, TPlaylistitemClass.Create);
|
||||
|
||||
Items[index].Path:=MedFileObj.path;
|
||||
Items[index].Artist:=MedFileObj.Artist;
|
||||
Items[index].Title:=MedFileObj.Title;
|
||||
Items[index].Album:=MedFileObj.Album;
|
||||
Items[index].Path := MedFileObj.path;
|
||||
Items[index].Artist := MedFileObj.Artist;
|
||||
Items[index].Title := MedFileObj.Title;
|
||||
Items[index].Album := MedFileObj.Album;
|
||||
|
||||
Items[index].ID:=MedFileObj.ID;
|
||||
Items[index].LengthMS:=MedFileObj.Playlength;
|
||||
if index<CurrentTrack then inc(CurrentTrack);
|
||||
Items[index].ID := MedFileObj.ID;
|
||||
Items[index].LengthMS := MedFileObj.Playlength;
|
||||
if index < CurrentTrack then
|
||||
Inc(CurrentTrack);
|
||||
|
||||
end;
|
||||
|
||||
@ -230,7 +251,8 @@ end;
|
||||
|
||||
function TPlaylistClass.update(index: integer; MedFileObj: TMediaFileClass): integer;
|
||||
begin
|
||||
if (index>=0) and (index<Count) then begin
|
||||
if (index >= 0) and (index < Count) then
|
||||
begin
|
||||
|
||||
Items[index].update(MedFileObj);
|
||||
end;
|
||||
@ -239,115 +261,136 @@ end;
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
function TPlaylistClass.RandomIndex: integer;
|
||||
// Returns a random index of playlist entry that has not been played yet. -1 if all has been played.
|
||||
// reset_random resets it
|
||||
var x, i:integer;
|
||||
// Returns a random index of playlist entry that has not been played yet. -1 if all has been played.
|
||||
// reset_random resets it
|
||||
var
|
||||
x, i: integer;
|
||||
s: boolean;
|
||||
begin
|
||||
s := false;
|
||||
for i := 0 to Count-1 do if Items[i].played=false then s:= true;
|
||||
s := False;
|
||||
for i := 0 to Count - 1 do
|
||||
if Items[i].played = False then
|
||||
s := True;
|
||||
randomize;
|
||||
if s then begin
|
||||
i:=0;
|
||||
repeat begin
|
||||
x:=random(Count-1);
|
||||
inc(i);
|
||||
if s then
|
||||
begin
|
||||
i := 0;
|
||||
repeat
|
||||
begin
|
||||
x := random(Count - 1);
|
||||
Inc(i);
|
||||
end;
|
||||
until (Items[x].played=false) or (i > 4096); // i is for timeout to prevent an endless loop
|
||||
until (Items[x].played = False) or (i > 4096);
|
||||
// i is for timeout to prevent an endless loop
|
||||
|
||||
if i>4096 then begin
|
||||
x:=-1;
|
||||
repeat inc(x) until Items[x].played=false;
|
||||
if i > 4096 then
|
||||
begin
|
||||
x := -1;
|
||||
repeat
|
||||
Inc(x)
|
||||
until Items[x].played = False;
|
||||
end;
|
||||
|
||||
result:=x;
|
||||
Result := x;
|
||||
end
|
||||
else begin
|
||||
result:=-1;
|
||||
else
|
||||
begin
|
||||
Result := -1;
|
||||
end;
|
||||
end;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
procedure TPlaylistClass.reset_random;
|
||||
var i: integer;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
for i:= 0 to Count-1 do Items[i].played:=false;
|
||||
for i := 0 to Count - 1 do
|
||||
Items[i].played := False;
|
||||
end;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
function TPlaylistClass.ItemCount: integer;
|
||||
begin
|
||||
result:=inherited Count;
|
||||
Result := inherited Count;
|
||||
end;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
function TPlaylistClass.LoadFromFile(path: string): byte; //Load .m3u Playlist
|
||||
var s, tmps, fpath, fartist, ftitle:string;
|
||||
pos1,pos2, i, lengthS:integer;
|
||||
var
|
||||
s, tmps, fpath, fartist, ftitle: string;
|
||||
pos1, pos2, i, lengthS: integer;
|
||||
PlaylistItem: TPlaylistItemClass;
|
||||
fileobj: TMediaFileClass;
|
||||
filehandle:text;
|
||||
filehandle: Text;
|
||||
begin
|
||||
try
|
||||
system.assign(Filehandle,path);
|
||||
system.Assign(Filehandle, path);
|
||||
Reset(filehandle);
|
||||
readln(filehandle, tmps);
|
||||
if pos('#EXTM3U',tmps)<>0 then begin
|
||||
repeat begin
|
||||
repeat readln(filehandle, tmps) until ((pos('#EXTINF', tmps)<>0) or eof(filehandle));
|
||||
pos1:=pos(':', tmps)+1;
|
||||
pos2:=pos(',', tmps);
|
||||
s:=copy(tmps,pos1,pos2-pos1);
|
||||
if pos('#EXTM3U', tmps) <> 0 then
|
||||
begin
|
||||
repeat
|
||||
begin
|
||||
repeat
|
||||
readln(filehandle, tmps)
|
||||
until ((pos('#EXTINF', tmps) <> 0) or EOF(filehandle));
|
||||
pos1 := pos(':', tmps) + 1;
|
||||
pos2 := pos(',', tmps);
|
||||
s := copy(tmps, pos1, pos2 - pos1);
|
||||
|
||||
val(s,LengthS);
|
||||
val(s, LengthS);
|
||||
|
||||
pos1:=pos2+1;
|
||||
pos2:=pos(' - ',tmps);
|
||||
pos1 := pos2 + 1;
|
||||
pos2 := pos(' - ', tmps);
|
||||
|
||||
fartist:=copy(tmps,pos1,pos2-pos1);
|
||||
pos2:=pos2+3;
|
||||
ftitle:=copy(tmps,pos2,(length(tmps))-pos2+1);
|
||||
fartist := copy(tmps, pos1, pos2 - pos1);
|
||||
pos2 := pos2 + 3;
|
||||
ftitle := copy(tmps, pos2, (length(tmps)) - pos2 + 1);
|
||||
readln(filehandle, fpath);
|
||||
|
||||
i:=(inherited Add(TPlaylistitemClass.create));
|
||||
Items[i].Title:=ftitle;
|
||||
Items[i].Artist:=fartist;
|
||||
Items[i].Path:=fpath;
|
||||
Items[i].LengthMS:=lengthS*1000;
|
||||
i := (inherited Add(TPlaylistitemClass.Create));
|
||||
Items[i].Title := ftitle;
|
||||
Items[i].Artist := fartist;
|
||||
Items[i].Path := fpath;
|
||||
Items[i].LengthMS := lengthS * 1000;
|
||||
|
||||
end;
|
||||
until eof(filehandle);
|
||||
end else debugoutln(path+' is not a valid m3u playlist',4);
|
||||
close(filehandle);
|
||||
result:=0;
|
||||
until EOF(filehandle);
|
||||
end
|
||||
else
|
||||
debugoutln(path + ' is not a valid m3u playlist', 4);
|
||||
Close(filehandle);
|
||||
Result := 0;
|
||||
except
|
||||
result:=1;
|
||||
Result := 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
function TPlaylistClass.SaveToFile(path: string): byte;
|
||||
var i:integer;
|
||||
var
|
||||
i: integer;
|
||||
temps: string;
|
||||
filehandle:text;
|
||||
filehandle: Text;
|
||||
begin
|
||||
try
|
||||
system.assign(Filehandle,path);
|
||||
system.Assign(Filehandle, path);
|
||||
Rewrite(filehandle);
|
||||
writeln(Filehandle,'#EXTM3U');
|
||||
for i:= 0 to Count-1 do begin
|
||||
writeln(Filehandle, '#EXTM3U');
|
||||
for i := 0 to Count - 1 do
|
||||
begin
|
||||
str(Items[i].LengthMS div 1000, temps);
|
||||
writeln(filehandle,'#EXTINF:'+temps+','+Items[i].artist+' - '+Items[i].title);
|
||||
writeln(filehandle, '#EXTINF:' + temps + ',' + Items[i].artist + ' - ' + Items[i].title);
|
||||
writeln(filehandle, Items[i].path);
|
||||
end;
|
||||
close(filehandle);
|
||||
result:=0;
|
||||
Close(filehandle);
|
||||
Result := 0;
|
||||
except
|
||||
result:=1;
|
||||
Result := 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -285,10 +285,24 @@ Begin
|
||||
ftrack := '';
|
||||
End; // else writeln('no id3v1 tag');
|
||||
except WriteLn(Filename+' -> exception while reading id3v1 tag... skipped!!'); end;
|
||||
If ((artistv2<>'')) And (CactusConfig.id3v2_prio Or (artist='')) Then Fartist := artistv2;
|
||||
{ If ((artistv2<>'')) And (CactusConfig.id3v2_prio Or (artist='')) Then Fartist := artistv2;
|
||||
If ((titlev2<>'')) And (CactusConfig.id3v2_prio Or (title='')) Then Ftitle := titlev2;
|
||||
If ((albumv2<>'')) And (CactusConfig.id3v2_prio Or (album='')) Then Falbum := albumv2;
|
||||
If ((commentv2<>'')) And (CactusConfig.id3v2_prio Or (comment='')) Then Fcomment := commentv2;
|
||||
If ((commentv2<>'')) And (CactusConfig.id3v2_prio Or (comment='')) Then Fcomment := commentv2; }
|
||||
{$IFDEF WINDOWS}
|
||||
if Length(Trim(fartist)) <> 0 then begin
|
||||
If ((artistv2<>'')) And (CactusConfig.id3v2_prio Or (artist='')) Then Fartist := UTF8Encode(artistv2);
|
||||
end else Fartist := artistv2;
|
||||
if Length(Trim(Ftitle)) <> 0 then begin
|
||||
If ((titlev2<>'')) And (CactusConfig.id3v2_prio Or (title='')) Then Ftitle := UTF8Encode(titlev2);
|
||||
end else Ftitle := titlev2;
|
||||
if Length(Trim(Falbum)) <> 0 then begin
|
||||
If ((albumv2<>'')) And (CactusConfig.id3v2_prio Or (album='')) Then Falbum := UTF8Encode(albumv2);
|
||||
end else Falbum := albumv2;
|
||||
if Length(Trim(Fcomment)) <> 0 then begin
|
||||
If ((commentv2<>'')) And (CactusConfig.id3v2_prio Or (comment='')) Then Fcomment := UTF8Encode(commentv2);
|
||||
end else Fcomment := commentv2;
|
||||
{$ENDIF}
|
||||
If ((yearv2<>'')) And (CactusConfig.id3v2_prio Or (year='')) Then Fyear := yearv2;
|
||||
If ((trackv2<>'')) And (CactusConfig.id3v2_prio Or (track='')) Then ftrack := trackv2;
|
||||
fileclose(mp3filehandle);
|
||||
|
Reference in New Issue
Block a user