From 7a01b05b3861a667eb32ce2e0fc88ff3bacb99ae Mon Sep 17 00:00:00 2001 From: mogguh Date: Tue, 2 Sep 2008 17:25:26 +0000 Subject: Moved: The folder classes has been renamed to base Updated: ultrastardx.dpr has been changed accordingly git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1339 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UFiles.pas | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 src/base/UFiles.pas (limited to 'src/base/UFiles.pas') diff --git a/src/base/UFiles.pas b/src/base/UFiles.pas new file mode 100644 index 00000000..ca43bb21 --- /dev/null +++ b/src/base/UFiles.pas @@ -0,0 +1,150 @@ +unit UFiles; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} +{$I switches.inc} + +uses SysUtils, + ULog, + UMusic, + USongs, + USong; + +procedure ResetSingTemp; +function SaveSong(Song: TSong; Lines: TLines; Name: string; Relative: boolean): boolean; + +var + SongFile: TextFile; // all procedures in this unit operates on this file + FileLineNo: integer; //Line which is readed at Last, for error reporting + + // variables available for all procedures + Base : array[0..1] of integer; + Rel : array[0..1] of integer; + Mult : integer = 1; + MultBPM : integer = 4; + +implementation + +uses TextGL, + UIni, + UPlatform, + UMain; + +//-------------------- +// Resets the temporary Sentence Arrays for each Player and some other Variables +//-------------------- +procedure ResetSingTemp; +var + Count: integer; +begin + SetLength(Lines, Length(Player)); + for Count := 0 to High(Player) do begin + SetLength(Lines[Count].Line, 1); + SetLength(Lines[Count].Line[0].Note, 0); + Lines[Count].Line[0].Lyric := ''; + Lines[Count].Line[0].LyricWidth := 0; + Player[Count].Score := 0; + Player[Count].LengthNote := 0; + Player[Count].HighNote := -1; + end; + + (* FIXME + //Reset Path and Filename Values to Prevent Errors in Editor + if assigned( CurrentSong ) then + begin + SetLength(CurrentSong.BPM, 0); + CurrentSong.Path := ''; + CurrentSong.FileName := ''; + end; + *) + +// CurrentSong := nil; +end; + + +//-------------------- +// Saves a Song +//-------------------- +function SaveSong(Song: TSong; Lines: TLines; Name: string; Relative: boolean): boolean; +var + C: integer; + N: integer; + S: string; + B: integer; + RelativeSubTime: integer; + NoteState: String; + +begin +// Relative := true; // override (idea - use shift+S to save with relative) + AssignFile(SongFile, Name); + Rewrite(SongFile); + + Writeln(SongFile, '#TITLE:' + Song.Title + ''); + Writeln(SongFile, '#ARTIST:' + Song.Artist); + + if Song.Creator <> '' then Writeln(SongFile, '#CREATOR:' + Song.Creator); + if Song.Edition <> 'Unknown' then Writeln(SongFile, '#EDITION:' + Song.Edition); + if Song.Genre <> 'Unknown' then Writeln(SongFile, '#GENRE:' + Song.Genre); + if Song.Language <> 'Unknown' then Writeln(SongFile, '#LANGUAGE:' + Song.Language); + + Writeln(SongFile, '#MP3:' + Song.Mp3); + + if Song.Cover <> '' then Writeln(SongFile, '#COVER:' + Song.Cover); + if Song.Background <> '' then Writeln(SongFile, '#BACKGROUND:' + Song.Background); + if Song.Video <> '' then Writeln(SongFile, '#VIDEO:' + Song.Video); + if Song.VideoGAP <> 0 then Writeln(SongFile, '#VIDEOGAP:' + FloatToStr(Song.VideoGAP)); + if Song.Resolution <> 4 then Writeln(SongFile, '#RESOLUTION:' + IntToStr(Song.Resolution)); + if Song.NotesGAP <> 0 then Writeln(SongFile, '#NOTESGAP:' + IntToStr(Song.NotesGAP)); + if Song.Start <> 0 then Writeln(SongFile, '#START:' + FloatToStr(Song.Start)); + if Song.Finish <> 0 then Writeln(SongFile, '#END:' + IntToStr(Song.Finish)); + if Relative then Writeln(SongFile, '#RELATIVE:yes'); + + Writeln(SongFile, '#BPM:' + FloatToStr(Song.BPM[0].BPM / 4)); + Writeln(SongFile, '#GAP:' + FloatToStr(Song.GAP)); + + RelativeSubTime := 0; + for B := 1 to High(CurrentSong.BPM) do + Writeln(SongFile, 'B ' + FloatToStr(CurrentSong.BPM[B].StartBeat) + ' ' + FloatToStr(CurrentSong.BPM[B].BPM/4)); + + for C := 0 to Lines.High do begin + for N := 0 to Lines.Line[C].HighNote do begin + with Lines.Line[C].Note[N] do begin + + + //Golden + Freestyle Note Patch + case Lines.Line[C].Note[N].NoteType of + ntFreestyle: NoteState := 'F '; + ntNormal: NoteState := ': '; + ntGolden: NoteState := '* '; + end; // case + S := NoteState + IntToStr(Start-RelativeSubTime) + ' ' + IntToStr(Length) + ' ' + IntToStr(Tone) + ' ' + Text; + + + Writeln(SongFile, S); + end; // with + end; // N + + if C < Lines.High then begin // don't write end of last sentence + if not Relative then + S := '- ' + IntToStr(Lines.Line[C+1].Start) + else begin + S := '- ' + IntToStr(Lines.Line[C+1].Start - RelativeSubTime) + + ' ' + IntToStr(Lines.Line[C+1].Start - RelativeSubTime); + RelativeSubTime := Lines.Line[C+1].Start; + end; + Writeln(SongFile, S); + end; + + end; // C + + + Writeln(SongFile, 'E'); + CloseFile(SongFile); + + Result := true; +end; + +end. -- cgit v1.2.3 From dbf39d5bfc56c24a67d481187c619dc84828221f Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Tue, 23 Sep 2008 21:17:22 +0000 Subject: gpl header added and property svn:header set to "HeadURL Id" git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1403 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UFiles.pas | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/base/UFiles.pas') diff --git a/src/base/UFiles.pas b/src/base/UFiles.pas index ca43bb21..eb7f2cad 100644 --- a/src/base/UFiles.pas +++ b/src/base/UFiles.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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 2 + * 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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UFiles; interface -- cgit v1.2.3 From 015b6c092b0779ee9b53ed1ee78044737f8dc592 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Tue, 23 Sep 2008 21:43:52 +0000 Subject: indentation unified, no code change. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1406 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UFiles.pas | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/base/UFiles.pas') diff --git a/src/base/UFiles.pas b/src/base/UFiles.pas index eb7f2cad..add81f23 100644 --- a/src/base/UFiles.pas +++ b/src/base/UFiles.pas @@ -32,13 +32,15 @@ interface {$ENDIF} {$I switches.inc} -uses SysUtils, - ULog, - UMusic, - USongs, - USong; +uses + SysUtils, + ULog, + UMusic, + USongs, + USong; procedure ResetSingTemp; + function SaveSong(Song: TSong; Lines: TLines; Name: string; Relative: boolean): boolean; var @@ -53,11 +55,12 @@ var implementation -uses TextGL, - UIni, - UPlatform, - UMain; - +uses + TextGL, + UIni, + UPlatform, + UMain; + //-------------------- // Resets the temporary Sentence Arrays for each Player and some other Variables //-------------------- -- cgit v1.2.3 From 8f2fc12d58f248a7b548c4919c640500c7a4524d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 28 Feb 2009 20:56:12 +0000 Subject: Some cleanup done moved ScoreFactor to UMusic removed unused field TLines.LyricWidth removed unused field TSong.Category removed some weird and useless code from songloading procedures songloading simplified, commented parts that are difficult to understand some changes to score calculation that assure not more nor less than 10000 Points are gainable. after many tests I could not find any bug in score calculation, at least after these changes. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1610 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UFiles.pas | 1 - 1 file changed, 1 deletion(-) (limited to 'src/base/UFiles.pas') diff --git a/src/base/UFiles.pas b/src/base/UFiles.pas index add81f23..d639c304 100644 --- a/src/base/UFiles.pas +++ b/src/base/UFiles.pas @@ -73,7 +73,6 @@ begin SetLength(Lines[Count].Line, 1); SetLength(Lines[Count].Line[0].Note, 0); Lines[Count].Line[0].Lyric := ''; - Lines[Count].Line[0].LyricWidth := 0; Player[Count].Score := 0; Player[Count].LengthNote := 0; Player[Count].HighNote := -1; -- cgit v1.2.3 From f469075a0335399c753ae5d2d362047dedf116b1 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 7 Mar 2009 21:14:14 +0000 Subject: final cleanup of Umain. Creation of UNote git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1627 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UFiles.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/base/UFiles.pas') diff --git a/src/base/UFiles.pas b/src/base/UFiles.pas index d639c304..0495dfbb 100644 --- a/src/base/UFiles.pas +++ b/src/base/UFiles.pas @@ -58,8 +58,8 @@ implementation uses TextGL, UIni, - UPlatform, - UMain; + UNote, + UPlatform; //-------------------- // Resets the temporary Sentence Arrays for each Player and some other Variables -- cgit v1.2.3 From 917901e8e33438c425aef50a0a7417f32d77b760 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Mon, 9 Nov 2009 00:27:55 +0000 Subject: merged unicode branch (r1931) into trunk git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1939 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UFiles.pas | 202 ++++++++++++++++++++++++++++------------------------ 1 file changed, 107 insertions(+), 95 deletions(-) (limited to 'src/base/UFiles.pas') diff --git a/src/base/UFiles.pas b/src/base/UFiles.pas index 0495dfbb..a46d4e0d 100644 --- a/src/base/UFiles.pas +++ b/src/base/UFiles.pas @@ -34,24 +34,23 @@ interface uses SysUtils, + Classes, ULog, UMusic, USongs, - USong; + USong, + UPath; procedure ResetSingTemp; -function SaveSong(Song: TSong; Lines: TLines; Name: string; Relative: boolean): boolean; +type + TSaveSongResult = (ssrOK, ssrFileError, ssrEncodingError); -var - SongFile: TextFile; // all procedures in this unit operates on this file - FileLineNo: integer; //Line which is readed at Last, for error reporting - - // variables available for all procedures - Base : array[0..1] of integer; - Rel : array[0..1] of integer; - Mult : integer = 1; - MultBPM : integer = 4; +{** + * Throws a TEncodingException if the song's fields cannot be encoded in the + * requested encoding. + *} +function SaveSong(const Song: TSong; const Lines: TLines; const Name: IPath; Relative: boolean): TSaveSongResult; implementation @@ -59,7 +58,9 @@ uses TextGL, UIni, UNote, - UPlatform; + UPlatform, + UUnicodeUtils, + UTextEncoding; //-------------------- // Resets the temporary Sentence Arrays for each Player and some other Variables @@ -77,101 +78,112 @@ begin Player[Count].LengthNote := 0; Player[Count].HighNote := -1; end; - - (* FIXME - //Reset Path and Filename Values to Prevent Errors in Editor - if assigned( CurrentSong ) then - begin - SetLength(CurrentSong.BPM, 0); - CurrentSong.Path := ''; - CurrentSong.FileName := ''; - end; - *) - -// CurrentSong := nil; end; - //-------------------- // Saves a Song //-------------------- -function SaveSong(Song: TSong; Lines: TLines; Name: string; Relative: boolean): boolean; +function SaveSong(const Song: TSong; const Lines: TLines; const Name: IPath; Relative: boolean): TSaveSongResult; var C: integer; N: integer; - S: string; + S: AnsiString; B: integer; - RelativeSubTime: integer; - NoteState: String; + RelativeSubTime: integer; + NoteState: AnsiString; + SongFile: TTextFileStream; + + function EncodeToken(const Str: UTF8String): RawByteString; + var + Success: boolean; + begin + Success := EncodeStringUTF8(Str, Result, Song.Encoding); + if (not Success) then + SaveSong := ssrEncodingError; + end; begin -// Relative := true; // override (idea - use shift+S to save with relative) - AssignFile(SongFile, Name); - Rewrite(SongFile); - - Writeln(SongFile, '#TITLE:' + Song.Title + ''); - Writeln(SongFile, '#ARTIST:' + Song.Artist); - - if Song.Creator <> '' then Writeln(SongFile, '#CREATOR:' + Song.Creator); - if Song.Edition <> 'Unknown' then Writeln(SongFile, '#EDITION:' + Song.Edition); - if Song.Genre <> 'Unknown' then Writeln(SongFile, '#GENRE:' + Song.Genre); - if Song.Language <> 'Unknown' then Writeln(SongFile, '#LANGUAGE:' + Song.Language); - - Writeln(SongFile, '#MP3:' + Song.Mp3); - - if Song.Cover <> '' then Writeln(SongFile, '#COVER:' + Song.Cover); - if Song.Background <> '' then Writeln(SongFile, '#BACKGROUND:' + Song.Background); - if Song.Video <> '' then Writeln(SongFile, '#VIDEO:' + Song.Video); - if Song.VideoGAP <> 0 then Writeln(SongFile, '#VIDEOGAP:' + FloatToStr(Song.VideoGAP)); - if Song.Resolution <> 4 then Writeln(SongFile, '#RESOLUTION:' + IntToStr(Song.Resolution)); - if Song.NotesGAP <> 0 then Writeln(SongFile, '#NOTESGAP:' + IntToStr(Song.NotesGAP)); - if Song.Start <> 0 then Writeln(SongFile, '#START:' + FloatToStr(Song.Start)); - if Song.Finish <> 0 then Writeln(SongFile, '#END:' + IntToStr(Song.Finish)); - if Relative then Writeln(SongFile, '#RELATIVE:yes'); - - Writeln(SongFile, '#BPM:' + FloatToStr(Song.BPM[0].BPM / 4)); - Writeln(SongFile, '#GAP:' + FloatToStr(Song.GAP)); - - RelativeSubTime := 0; - for B := 1 to High(CurrentSong.BPM) do - Writeln(SongFile, 'B ' + FloatToStr(CurrentSong.BPM[B].StartBeat) + ' ' + FloatToStr(CurrentSong.BPM[B].BPM/4)); - - for C := 0 to Lines.High do begin - for N := 0 to Lines.Line[C].HighNote do begin - with Lines.Line[C].Note[N] do begin - - - //Golden + Freestyle Note Patch - case Lines.Line[C].Note[N].NoteType of - ntFreestyle: NoteState := 'F '; - ntNormal: NoteState := ': '; - ntGolden: NoteState := '* '; - end; // case - S := NoteState + IntToStr(Start-RelativeSubTime) + ' ' + IntToStr(Length) + ' ' + IntToStr(Tone) + ' ' + Text; - - - Writeln(SongFile, S); - end; // with - end; // N - - if C < Lines.High then begin // don't write end of last sentence - if not Relative then - S := '- ' + IntToStr(Lines.Line[C+1].Start) - else begin - S := '- ' + IntToStr(Lines.Line[C+1].Start - RelativeSubTime) + - ' ' + IntToStr(Lines.Line[C+1].Start - RelativeSubTime); - RelativeSubTime := Lines.Line[C+1].Start; - end; - Writeln(SongFile, S); + // Relative := true; // override (idea - use shift+S to save with relative) + Result := ssrOK; + + try + SongFile := TMemTextFileStream.Create(Name, fmCreate); + try + if (Song.Encoding = encUTF8) then + SongFile.WriteString(UTF8_BOM); + + SongFile.WriteLine('#ENCODING:' + EncodingName(Song.Encoding)); + SongFile.WriteLine('#TITLE:' + EncodeToken(Song.Title)); + SongFile.WriteLine('#ARTIST:' + EncodeToken(Song.Artist)); + + if Song.Creator <> '' then SongFile.WriteLine('#CREATOR:' + EncodeToken(Song.Creator)); + if Song.Edition <> 'Unknown' then SongFile.WriteLine('#EDITION:' + EncodeToken(Song.Edition)); + if Song.Genre <> 'Unknown' then SongFile.WriteLine('#GENRE:' + EncodeToken(Song.Genre)); + if Song.Language <> 'Unknown' then SongFile.WriteLine('#LANGUAGE:' + EncodeToken(Song.Language)); + + SongFile.WriteLine('#MP3:' + EncodeToken(Song.Mp3.ToUTF8)); + if Song.Cover.IsSet then SongFile.WriteLine('#COVER:' + EncodeToken(Song.Cover.ToUTF8)); + if Song.Background.IsSet then SongFile.WriteLine('#BACKGROUND:' + EncodeToken(Song.Background.ToUTF8)); + if Song.Video.IsSet then SongFile.WriteLine('#VIDEO:' + EncodeToken(Song.Video.ToUTF8)); + + if Song.VideoGAP <> 0 then SongFile.WriteLine('#VIDEOGAP:' + FloatToStr(Song.VideoGAP)); + if Song.Resolution <> 4 then SongFile.WriteLine('#RESOLUTION:' + IntToStr(Song.Resolution)); + if Song.NotesGAP <> 0 then SongFile.WriteLine('#NOTESGAP:' + IntToStr(Song.NotesGAP)); + if Song.Start <> 0 then SongFile.WriteLine('#START:' + FloatToStr(Song.Start)); + if Song.Finish <> 0 then SongFile.WriteLine('#END:' + IntToStr(Song.Finish)); + if Relative then SongFile.WriteLine('#RELATIVE:yes'); + + SongFile.WriteLine('#BPM:' + FloatToStr(Song.BPM[0].BPM / 4)); + SongFile.WriteLine('#GAP:' + FloatToStr(Song.GAP)); + + RelativeSubTime := 0; + for B := 1 to High(Song.BPM) do + SongFile.WriteLine('B ' + FloatToStr(Song.BPM[B].StartBeat) + ' ' + + FloatToStr(Song.BPM[B].BPM/4)); + + for C := 0 to Lines.High do + begin + for N := 0 to Lines.Line[C].HighNote do + begin + with Lines.Line[C].Note[N] do + begin + //Golden + Freestyle Note Patch + case Lines.Line[C].Note[N].NoteType of + ntFreestyle: NoteState := 'F '; + ntNormal: NoteState := ': '; + ntGolden: NoteState := '* '; + end; // case + S := NoteState + IntToStr(Start-RelativeSubTime) + ' ' + + IntToStr(Length) + ' ' + + IntToStr(Tone) + ' ' + + EncodeToken(Text); + + SongFile.WriteLine(S); + end; // with + end; // N + + if C < Lines.High then // don't write end of last sentence + begin + if not Relative then + S := '- ' + IntToStr(Lines.Line[C+1].Start) + else + begin + S := '- ' + IntToStr(Lines.Line[C+1].Start - RelativeSubTime) + + ' ' + IntToStr(Lines.Line[C+1].Start - RelativeSubTime); + RelativeSubTime := Lines.Line[C+1].Start; + end; + SongFile.WriteLine(S); + end; + end; // C + + SongFile.WriteLine('E'); + finally + SongFile.Free; end; - - end; // C - - - Writeln(SongFile, 'E'); - CloseFile(SongFile); - - Result := true; + except + Result := ssrFileError; + end; end; end. + -- cgit v1.2.3 From ec75bc2b03e707c479f3605ffc1a8d9fe38c165b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 17 Nov 2009 15:25:54 +0000 Subject: header tags that are not supported are written to the end of the songheader when saving in editor fixed header reader ending in infinite loop when there is a header line w/o Colon git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1943 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UFiles.pas | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/base/UFiles.pas') diff --git a/src/base/UFiles.pas b/src/base/UFiles.pas index a46d4e0d..2820a08c 100644 --- a/src/base/UFiles.pas +++ b/src/base/UFiles.pas @@ -102,6 +102,22 @@ var SaveSong := ssrEncodingError; end; + procedure WriteCustomTags; + var + I: integer; + Line: RawByteString; + begin + for I := 0 to High(Song.CustomTags) do + begin + Line := EncodeToken(Song.CustomTags[I].Content); + if (Length(Song.CustomTags[I].Tag) > 0) then + Line := EncodeToken(Song.CustomTags[I].Tag) + ':' + Line; + + SongFile.WriteLine('#' + Line); + end; + + end; + begin // Relative := true; // override (idea - use shift+S to save with relative) Result := ssrOK; @@ -109,6 +125,9 @@ begin try SongFile := TMemTextFileStream.Create(Name, fmCreate); try + // to-do: should we really write the BOM? + // it causes problems w/ older versions + // e.g. usdx 1.0.1a or ultrastar < 0.7.0 if (Song.Encoding = encUTF8) then SongFile.WriteString(UTF8_BOM); @@ -136,6 +155,9 @@ begin SongFile.WriteLine('#BPM:' + FloatToStr(Song.BPM[0].BPM / 4)); SongFile.WriteLine('#GAP:' + FloatToStr(Song.GAP)); + // write custom header tags + WriteCustomTags; + RelativeSubTime := 0; for B := 1 to High(Song.BPM) do SongFile.WriteLine('B ' + FloatToStr(Song.BPM[B].StartBeat) + ' ' -- cgit v1.2.3 From 61eaa45ee2bf7fc1d91faae3d10f3e093e3bc42c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 17 Nov 2009 15:37:08 +0000 Subject: load and save year tag sorting by year still missing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1944 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UFiles.pas | 1 + 1 file changed, 1 insertion(+) (limited to 'src/base/UFiles.pas') diff --git a/src/base/UFiles.pas b/src/base/UFiles.pas index 2820a08c..5a258e3e 100644 --- a/src/base/UFiles.pas +++ b/src/base/UFiles.pas @@ -139,6 +139,7 @@ begin if Song.Edition <> 'Unknown' then SongFile.WriteLine('#EDITION:' + EncodeToken(Song.Edition)); if Song.Genre <> 'Unknown' then SongFile.WriteLine('#GENRE:' + EncodeToken(Song.Genre)); if Song.Language <> 'Unknown' then SongFile.WriteLine('#LANGUAGE:' + EncodeToken(Song.Language)); + if Song.Year <> 0 then SongFile.WriteLine('#YEAR:' + IntToStr(Song.Year)); SongFile.WriteLine('#MP3:' + EncodeToken(Song.Mp3.ToUTF8)); if Song.Cover.IsSet then SongFile.WriteLine('#COVER:' + EncodeToken(Song.Cover.ToUTF8)); -- cgit v1.2.3 From ca61aa0c12be9240881108e72bc6c3e928924f1c Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 13 Jun 2010 09:03:10 +0000 Subject: do not save "auto" encoding tag git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2510 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UFiles.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/base/UFiles.pas') diff --git a/src/base/UFiles.pas b/src/base/UFiles.pas index 5a258e3e..1a7ca8f8 100644 --- a/src/base/UFiles.pas +++ b/src/base/UFiles.pas @@ -131,7 +131,9 @@ begin if (Song.Encoding = encUTF8) then SongFile.WriteString(UTF8_BOM); - SongFile.WriteLine('#ENCODING:' + EncodingName(Song.Encoding)); + // do not save "auto" encoding tag + if (Song.Encoding <> encAuto) then + SongFile.WriteLine('#ENCODING:' + EncodingName(Song.Encoding)); SongFile.WriteLine('#TITLE:' + EncodeToken(Song.Title)); SongFile.WriteLine('#ARTIST:' + EncodeToken(Song.Artist)); -- cgit v1.2.3