mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
* Better tagging with CTDB metadata
* Removed old LAME encoder from plugins list * CUERipper: main window resizeable * taglib-sharp.dll removed, taglib-sharp source code imported
This commit is contained in:
@@ -162,8 +162,8 @@ namespace CUETools.Processor
|
||||
encoders.Add(new CUEToolsUDC("flake", "flac", true, "0 1 2 3 4 5 6 7 8 9 10 11 12", "8", "flake.exe", "-%M - -o %O -p %P"));
|
||||
encoders.Add(new CUEToolsUDC("takc", "tak", true, "0 1 2 2e 2m 3 3e 3m 4 4e 4m", "2", "takc.exe", "-e -p%M -overwrite - %O"));
|
||||
encoders.Add(new CUEToolsUDC("ffmpeg alac", "m4a", true, "", "", "ffmpeg.exe", "-i - -f ipod -acodec alac -y %O"));
|
||||
encoders.Add(new CUEToolsUDC("lame vbr", "mp3", false, "V9 V8 V7 V6 V5 V4 V3 V2 V1 V0", "V2", "lame.exe", "--vbr-new -%M - %O"));
|
||||
encoders.Add(new CUEToolsUDC("lame cbr", "mp3", false, "96 128 192 256 320", "256", "lame.exe", "-m s -q 0 -b %M --noreplaygain - %O"));
|
||||
encoders.Add(new CUEToolsUDC("VBR (lame.exe)", "mp3", false, "V9 V8 V7 V6 V5 V4 V3 V2 V1 V0", "V2", "lame.exe", "--vbr-new -%M - %O"));
|
||||
encoders.Add(new CUEToolsUDC("CBR (lame.exe)", "mp3", false, "96 128 192 256 320", "256", "lame.exe", "-m s -q 0 -b %M --noreplaygain - %O"));
|
||||
encoders.Add(new CUEToolsUDC("oggenc", "ogg", false, "-1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8", "3", "oggenc.exe", "-q %M - -o %O"));
|
||||
encoders.Add(new CUEToolsUDC("nero aac", "m4a", false, "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9", "0.4", "neroAacEnc.exe", "-q %M -if - -of %O"));
|
||||
encoders.Add(new CUEToolsUDC("qaac tvbr", "m4a", false, "10 20 30 40 50 60 70 80 90 100 110 127", "80", "qaac.exe", "-s -V %M -q 2 - -o %O"));
|
||||
@@ -539,9 +539,9 @@ return processor.Go();
|
||||
CUEToolsFormat format;
|
||||
CUEToolsUDC udcLossless, udcLossy;
|
||||
if (encoderLossless == "" || !encoders.TryGetValue(encoderLossless, out udcLossless))
|
||||
udcLossless = null;
|
||||
udcLossless = encoders.GetDefault(extension, true);
|
||||
if (encoderLossy == "" || !encoders.TryGetValue(encoderLossy, out udcLossy))
|
||||
udcLossy = null;
|
||||
udcLossy = encoders.GetDefault(extension, false);
|
||||
if (!formats.TryGetValue(extension, out format))
|
||||
formats.Add(extension, new CUEToolsFormat(extension, tagger, allowLossless, allowLossy, allowLossyWav, allowEmbed, false, udcLossless, udcLossy, decoder));
|
||||
else
|
||||
|
||||
@@ -81,5 +81,8 @@ namespace CUETools.Processor
|
||||
|
||||
[DefaultValue(CTDBCoversSearch.Small), Category("CTDB"), DisplayName("Album art search")]
|
||||
public CTDBCoversSearch coversSearch { get; set; }
|
||||
|
||||
[DefaultValue(false), Category("CTDB"), DisplayName("Detailed log")]
|
||||
public bool DetailedCTDBLog { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,15 @@ namespace CUETools.Processor
|
||||
TotalDiscs = "";
|
||||
DiscNumber = "";
|
||||
DiscName = "";
|
||||
Year = "";
|
||||
Comment = "";
|
||||
Year = "";
|
||||
Genre = "";
|
||||
Artist = "";
|
||||
Title = "";
|
||||
Barcode = "";
|
||||
ReleaseDate = "";
|
||||
Label = "";
|
||||
LabelNo = "";
|
||||
Country = "";
|
||||
AlbumArt = new List<CTDB.CTDBResponseMetaImage>();
|
||||
Tracks = new List<CUETrackMetadata>();
|
||||
@@ -62,7 +64,9 @@ namespace CUETools.Processor
|
||||
public string DiscNumber { get; set; }
|
||||
[DefaultValue("")]
|
||||
public string DiscName { get; set; }
|
||||
[DefaultValue("")]
|
||||
[DefaultValue("")]
|
||||
public string Comment { get; set; }
|
||||
[DefaultValue("")]
|
||||
public string Year { get; set; }
|
||||
[DefaultValue("")]
|
||||
public string Genre { get; set; }
|
||||
@@ -76,7 +80,9 @@ namespace CUETools.Processor
|
||||
public string ReleaseDate { get; set; }
|
||||
[DefaultValue("")]
|
||||
public string Label { get; set; }
|
||||
[DefaultValue("")]
|
||||
[DefaultValue("")]
|
||||
public string LabelNo { get; set; }
|
||||
[DefaultValue("")]
|
||||
public string Country { get; set; }
|
||||
public List<CUETrackMetadata> Tracks { get; set; }
|
||||
|
||||
@@ -103,15 +109,24 @@ namespace CUETools.Processor
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public string LabelAndNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return Label + (Label != "" && LabelNo != "" ? " " : "") + LabelNo;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public string ReleaseDateAndLabel
|
||||
{
|
||||
get
|
||||
{
|
||||
return Label == "" && ReleaseDate == "" && Country == "" ? ""
|
||||
: Country
|
||||
+ (Country != "" && Label != "" ? " - " : "") + Label
|
||||
+ (Label + Country != "" && ReleaseDate != "" ? " - " : "") + ReleaseDate;
|
||||
return LabelAndNumber == "" && ReleaseDate == "" && Country == "" ? ""
|
||||
: Country
|
||||
+ (Country != "" && LabelAndNumber != "" ? " - " : "") + LabelAndNumber
|
||||
+ (LabelAndNumber + Country != "" && ReleaseDate != "" ? " - " : "") + ReleaseDate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,19 +160,22 @@ namespace CUETools.Processor
|
||||
if ((overwrite || TotalDiscs == "") && metadata.TotalDiscs != "") TotalDiscs = metadata.TotalDiscs;
|
||||
if ((overwrite || DiscNumber == "") && metadata.DiscNumber != "") DiscNumber = metadata.DiscNumber;
|
||||
if ((overwrite || DiscName == "") && metadata.DiscName != "") DiscName = metadata.DiscName;
|
||||
if ((overwrite || Year == "") && metadata.Year != "") Year = metadata.Year;
|
||||
if ((overwrite || Comment == "") && metadata.Comment != "") Comment = metadata.Comment;
|
||||
if ((overwrite || Year == "") && metadata.Year != "") Year = metadata.Year;
|
||||
if ((overwrite || Genre == "") && metadata.Genre != "") Genre = metadata.Genre;
|
||||
if ((overwrite || Artist == "") && metadata.Artist != "") Artist = metadata.Artist;
|
||||
if ((overwrite || Title == "") && metadata.Title != "") Title = metadata.Title;
|
||||
if ((overwrite || Barcode == "") && metadata.Barcode != "") Barcode = metadata.Barcode;
|
||||
if ((overwrite || ReleaseDate == "") && metadata.ReleaseDate != "") ReleaseDate = metadata.ReleaseDate;
|
||||
if ((overwrite || Label == "") && metadata.Label != "") Label = metadata.Label;
|
||||
if ((overwrite || LabelNo == "") && metadata.LabelNo != "") LabelNo = metadata.LabelNo;
|
||||
if ((overwrite || Country == "") && metadata.Country != "") Country = metadata.Country;
|
||||
if ((overwrite || AlbumArt.Count == 0) && metadata.AlbumArt.Count != 0) AlbumArt = metadata.AlbumArt;
|
||||
for (int i = 0; i < Tracks.Count; i++)
|
||||
{
|
||||
if ((overwrite || Tracks[i].Title == "") && metadata.Tracks[i].Title != "") Tracks[i].Title = metadata.Tracks[i].Title;
|
||||
if ((overwrite || Tracks[i].Artist == "") && metadata.Tracks[i].Artist != "") Tracks[i].Artist = metadata.Tracks[i].Artist;
|
||||
if ((overwrite || Tracks[i].Comment == "") && metadata.Tracks[i].Artist != "") Tracks[i].Comment = metadata.Tracks[i].Comment;
|
||||
if ((overwrite || Tracks[i].ISRC == "") && metadata.Tracks[i].ISRC != "") Tracks[i].ISRC = metadata.Tracks[i].ISRC;
|
||||
}
|
||||
}
|
||||
@@ -175,6 +193,7 @@ namespace CUETools.Processor
|
||||
if (TotalDiscs != metadata.TotalDiscs ||
|
||||
DiscNumber != metadata.DiscNumber ||
|
||||
DiscName != metadata.DiscName ||
|
||||
Comment != metadata.Comment ||
|
||||
Year != metadata.Year ||
|
||||
Genre != metadata.Genre ||
|
||||
Artist != metadata.Artist ||
|
||||
@@ -182,6 +201,7 @@ namespace CUETools.Processor
|
||||
Barcode != metadata.Barcode ||
|
||||
ReleaseDate != metadata.ReleaseDate ||
|
||||
Label != metadata.Label ||
|
||||
LabelNo != metadata.LabelNo ||
|
||||
Country != metadata.Country ||
|
||||
Tracks.Count != metadata.Tracks.Count
|
||||
)
|
||||
@@ -189,6 +209,7 @@ namespace CUETools.Processor
|
||||
for (int i = 0; i < Tracks.Count; i++)
|
||||
if (Tracks[i].Title != metadata.Tracks[i].Title ||
|
||||
Tracks[i].Artist != metadata.Tracks[i].Artist ||
|
||||
Tracks[i].Comment != metadata.Tracks[i].Comment ||
|
||||
Tracks[i].ISRC != metadata.Tracks[i].ISRC)
|
||||
return false;
|
||||
return true;
|
||||
@@ -208,6 +229,7 @@ namespace CUETools.Processor
|
||||
TotalDiscs = metadata.TotalDiscs;
|
||||
DiscNumber = metadata.DiscNumber;
|
||||
DiscName = metadata.DiscName;
|
||||
Comment = metadata.Comment;
|
||||
Year = metadata.Year;
|
||||
Genre = metadata.Genre;
|
||||
Artist = metadata.Artist;
|
||||
@@ -216,11 +238,13 @@ namespace CUETools.Processor
|
||||
ReleaseDate = metadata.ReleaseDate;
|
||||
Country = metadata.Country;
|
||||
Label = metadata.Label;
|
||||
LabelNo = metadata.LabelNo;
|
||||
AlbumArt = metadata.AlbumArt;
|
||||
for (int i = 0; i < Tracks.Count; i++)
|
||||
{
|
||||
Tracks[i].Title = metadata.Tracks[i].Title;
|
||||
Tracks[i].Artist = metadata.Tracks[i].Artist;
|
||||
Tracks[i].Comment = metadata.Tracks[i].Comment;
|
||||
Tracks[i].ISRC = metadata.Tracks[i].ISRC;
|
||||
}
|
||||
}
|
||||
@@ -231,10 +255,12 @@ namespace CUETools.Processor
|
||||
Genre = cdEntry.Genre;
|
||||
Artist = cdEntry.Artist;
|
||||
Title = cdEntry.Title;
|
||||
Comment = cdEntry.ExtendedData;
|
||||
for (int i = 0; i < Tracks.Count; i++)
|
||||
{
|
||||
Tracks[i].Title = cdEntry.Tracks[i + firstAudio].Title;
|
||||
Tracks[i].Artist = cdEntry.Artist;
|
||||
Tracks[i].Comment = cdEntry.ExtendedData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,14 +273,32 @@ namespace CUETools.Processor
|
||||
this.DiscNumber = cdEntry.discnumber ?? "";
|
||||
this.TotalDiscs = cdEntry.disccount ?? "";
|
||||
this.DiscName = cdEntry.discname ?? "";
|
||||
this.Comment = cdEntry.extra ?? "";
|
||||
this.Barcode = cdEntry.barcode ?? "";
|
||||
this.ReleaseDate = cdEntry.releasedate ?? "";
|
||||
this.Country = cdEntry.country ?? "";
|
||||
this.Genre = cdEntry.genre ?? "";
|
||||
this.Label = "";
|
||||
if (cdEntry.label != null)
|
||||
this.LabelNo = "";
|
||||
if (cdEntry.label != null && cdEntry.label.Length > 0)
|
||||
{
|
||||
var listLabel = new List<string>();
|
||||
var listLabelNo = new List<string>();
|
||||
foreach (var l in cdEntry.label)
|
||||
this.Label = (this.Label == "" ? "" : this.Label + ": ") + (l.name ?? "") + (l.name != null && l.catno != null ? " " : "") + (l.catno ?? "");
|
||||
{
|
||||
listLabel.Add(l.name ?? "");
|
||||
listLabelNo.Add(l.catno?? "");
|
||||
}
|
||||
|
||||
if (listLabel.Find(s => s != listLabel[0]) == null)
|
||||
this.Label = listLabel[0];
|
||||
else
|
||||
this.Label = string.Join(";", listLabel.ToArray());
|
||||
if (listLabelNo.Find(s => s != listLabelNo[0]) == null)
|
||||
this.LabelNo = listLabelNo[0];
|
||||
else
|
||||
this.LabelNo = string.Join(";", listLabelNo.ToArray());
|
||||
}
|
||||
this.AlbumArt.Clear();
|
||||
if (cdEntry.coverart != null)
|
||||
this.AlbumArt.AddRange(cdEntry.coverart);
|
||||
@@ -266,6 +310,7 @@ namespace CUETools.Processor
|
||||
{
|
||||
this.Tracks[i].Title = cdEntry.track[i + firstAudio].name ?? "";
|
||||
this.Tracks[i].Artist = cdEntry.track[i + firstAudio].artist ?? cdEntry.artist ?? "";
|
||||
this.Tracks[i].Comment = cdEntry.track[i + firstAudio].extra ?? "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -293,10 +338,12 @@ namespace CUETools.Processor
|
||||
bool error = false;
|
||||
Artist = FreedbToEncoding(iso, def, ref different, ref error, Artist);
|
||||
Title = FreedbToEncoding(iso, def, ref different, ref error, Title);
|
||||
Comment = FreedbToEncoding(iso, def, ref different, ref error, Comment);
|
||||
for (int i = 0; i < Tracks.Count; i++)
|
||||
{
|
||||
Tracks[i].Artist = FreedbToEncoding(iso, def, ref different, ref error, Tracks[i].Artist);
|
||||
Tracks[i].Title = FreedbToEncoding(iso, def, ref different, ref error, Tracks[i].Title);
|
||||
Tracks[i].Comment = FreedbToEncoding(iso, def, ref different, ref error, Tracks[i].Comment);
|
||||
}
|
||||
return different && !error;
|
||||
}
|
||||
|
||||
@@ -1360,7 +1360,7 @@ namespace CUETools.Processor
|
||||
{
|
||||
if (line.Params.Count > 2 && !line.IsQuoted[1] &&
|
||||
(line.Params[0].ToUpper() == "TITLE" || line.Params[0].ToUpper() == "ARTIST" ||
|
||||
(line.Params[0].ToUpper() == "REM" && line.Params[1].ToUpper() == "GENRE" && line.Params.Count > 3 && !line.IsQuoted[2])))
|
||||
(line.Params[0].ToUpper() == "REM" && (line.Params[1].ToUpper() == "GENRE" || line.Params[1].ToUpper() == "COMMENT") && line.Params.Count > 3 && !line.IsQuoted[2])))
|
||||
{
|
||||
CUELine modline = new CUELine();
|
||||
int nParams = line.Params[0].ToUpper() == "REM" ? 2 : 1;
|
||||
@@ -1452,8 +1452,14 @@ namespace CUETools.Processor
|
||||
taglibMetadata.Title = GetCommonTag(file => file.Tag.Album) ?? "";
|
||||
taglibMetadata.Year = GetCommonTag(file => file.Tag.Year != 0 ? file.Tag.Year.ToString() : null) ?? "";
|
||||
taglibMetadata.Genre = GetCommonTag(file => file.Tag.JoinedGenres) ?? "";
|
||||
taglibMetadata.Comment = GetCommonTag(file => file.Tag.Comment) ?? "";
|
||||
taglibMetadata.TotalDiscs = GetCommonTag(file => file.Tag.DiscCount != 0 ? file.Tag.DiscCount.ToString() : null) ?? "";
|
||||
taglibMetadata.DiscNumber = GetCommonTag(file => file.Tag.Disc != 0 ? file.Tag.Disc.ToString() : null) ?? "";
|
||||
taglibMetadata.ReleaseDate = GetCommonTag(file => file.Tag.ReleaseDate) ?? "";
|
||||
taglibMetadata.Country = GetCommonTag(file => file.Tag.MusicBrainzReleaseCountry) ?? "";
|
||||
taglibMetadata.Label = GetCommonTag(file => file.Tag.Publisher) ?? "";
|
||||
taglibMetadata.LabelNo = GetCommonTag(file => file.Tag.CatalogNo) ?? "";
|
||||
taglibMetadata.DiscName = GetCommonTag(file => file.Tag.DiscSubtitle) ?? "";
|
||||
for (i = 0; i < TrackCount; i++)
|
||||
{
|
||||
TrackInfo track = _tracks[i];
|
||||
@@ -1463,7 +1469,10 @@ namespace CUETools.Processor
|
||||
taglibMetadata.Tracks[i].Title = (_hasTrackFilenames && track._fileInfo != null ? track._fileInfo.Tag.Title :
|
||||
_hasEmbeddedCUESheet && _fileInfo != null ? Tagging.TagListToSingleValue(Tagging.GetMiscTag(_fileInfo, String.Format("cue_track{0:00}_TITLE", i + 1))) :
|
||||
null) ?? "";
|
||||
}
|
||||
taglibMetadata.Tracks[i].Comment = (_hasTrackFilenames && track._fileInfo != null ? track._fileInfo.Tag.Title :
|
||||
_hasEmbeddedCUESheet && _fileInfo != null ? Tagging.TagListToSingleValue(Tagging.GetMiscTag(_fileInfo, String.Format("cue_track{0:00}_COMMENT", i + 1))) :
|
||||
null) ?? "";
|
||||
}
|
||||
|
||||
cueMetadata = new CUEMetadata(TOC.TOCID, (int)TOC.AudioTracks);
|
||||
cueMetadata.Artist = General.GetCUELine(_attributes, "PERFORMER");
|
||||
@@ -1473,6 +1482,12 @@ namespace CUETools.Processor
|
||||
cueMetadata.DiscNumber = General.GetCUELine(_attributes, "REM", "DISCNUMBER");
|
||||
cueMetadata.TotalDiscs = General.GetCUELine(_attributes, "REM", "TOTALDISCS");
|
||||
cueMetadata.Genre = General.GetCUELine(_attributes, "REM", "GENRE");
|
||||
cueMetadata.Comment = General.GetCUELine(_attributes, "REM", "COMMENT");
|
||||
cueMetadata.ReleaseDate = General.GetCUELine(_attributes, "REM", "RELEASEDATE");
|
||||
cueMetadata.Country = General.GetCUELine(_attributes, "REM", "COUNTRY");
|
||||
cueMetadata.Label = General.GetCUELine(_attributes, "REM", "LABEL");
|
||||
cueMetadata.LabelNo = General.GetCUELine(_attributes, "REM", "CATALOGNUMBER");
|
||||
cueMetadata.DiscName = General.GetCUELine(_attributes, "REM", "DISCSUBTITLE");
|
||||
for (i = 0; i < Tracks.Count; i++)
|
||||
{
|
||||
cueMetadata.Tracks[i].Artist = General.GetCUELine(Tracks[i].Attributes, "PERFORMER");
|
||||
@@ -1962,8 +1977,10 @@ namespace CUETools.Processor
|
||||
if (cueSheet != null)
|
||||
{
|
||||
vars.Add("year", General.EmptyStringToNull(_config.CleanseString(cueSheet.Metadata.Year)));
|
||||
vars.Add("catalog", General.EmptyStringToNull(_config.CleanseString(cueSheet.Metadata.Barcode)));
|
||||
vars.Add("barcode", General.EmptyStringToNull(_config.CleanseString(cueSheet.Metadata.Barcode)));
|
||||
vars.Add("label", General.EmptyStringToNull(_config.CleanseString(cueSheet.Metadata.Label)));
|
||||
vars.Add("labelno", General.EmptyStringToNull(_config.CleanseString(cueSheet.Metadata.LabelNo)));
|
||||
vars.Add("labelandnumber", General.EmptyStringToNull(_config.CleanseString(cueSheet.Metadata.LabelAndNumber)));
|
||||
vars.Add("country", General.EmptyStringToNull(_config.CleanseString(cueSheet.Metadata.Country)));
|
||||
vars.Add("releasedate", General.EmptyStringToNull(_config.CleanseString(cueSheet.Metadata.ReleaseDate)));
|
||||
vars.Add("discname", General.EmptyStringToNull(_config.CleanseString(cueSheet.Metadata.DiscName)));
|
||||
@@ -1985,14 +2002,14 @@ namespace CUETools.Processor
|
||||
vars.Add("unique", null);
|
||||
|
||||
string outputPath = "";
|
||||
for (int maxLen = 260; maxLen >= 16; maxLen--)
|
||||
for (int maxLen = 255; maxLen >= 8; maxLen--)
|
||||
{
|
||||
outputPath = General.ReplaceMultiple(format, vars, "unique", pathOut => File.Exists(Path.ChangeExtension(pathOut, ext)), maxLen);
|
||||
if (outputPath == "" || outputPath == null)
|
||||
return "";
|
||||
try { outputPath = Path.ChangeExtension(outputPath, ext); }
|
||||
catch { return ""; }
|
||||
if (outputPath.Length < 260)
|
||||
if (outputPath.Length < 255)
|
||||
return outputPath;
|
||||
}
|
||||
return outputPath;
|
||||
@@ -2035,8 +2052,18 @@ namespace CUETools.Processor
|
||||
extension = ".20bit" + extension;
|
||||
}
|
||||
|
||||
ArLogFileName = General.ReplaceMultiple(_config.ArLogFilenameFormat, vars, "unique", CheckIfFileExists, -1)
|
||||
?? vars["%filename%"] + ".accurip";
|
||||
for (int maxLen = 255; maxLen >= 8; maxLen--)
|
||||
{
|
||||
ArLogFileName = General.ReplaceMultiple(_config.ArLogFilenameFormat, vars, "unique", CheckIfFileExists, maxLen);
|
||||
if (ArLogFileName == "" || ArLogFileName == null)
|
||||
{
|
||||
ArLogFileName = "ar.log";
|
||||
break;
|
||||
}
|
||||
if (Path.Combine(OutputDir, ArLogFileName).Length < 255)
|
||||
break;
|
||||
}
|
||||
|
||||
AlArtFileName = General.ReplaceMultiple(_config.AlArtFilenameFormat, vars, "unique", CheckIfFileExists, -1)
|
||||
?? "folder.jpg";
|
||||
|
||||
@@ -2071,7 +2098,7 @@ namespace CUETools.Processor
|
||||
vars["title"] = General.EmptyStringToNull(_config.CleanseString(title));
|
||||
|
||||
filename = "";
|
||||
for (int maxLen = 260; maxLen >= 16; maxLen--)
|
||||
for (int maxLen = 255; maxLen >= 8; maxLen--)
|
||||
{
|
||||
filename = General.ReplaceMultiple(_config.trackFilenameFormat, vars, maxLen);
|
||||
if (filename == "" || filename == null)
|
||||
@@ -2287,6 +2314,7 @@ namespace CUETools.Processor
|
||||
General.SetCUELine(_attributes, "REM", "DISCNUMBER", Metadata.DiscNumber, false);
|
||||
General.SetCUELine(_attributes, "REM", "TOTALDISCS", Metadata.TotalDiscs, false);
|
||||
General.SetCUELine(_attributes, "REM", "GENRE", Metadata.Genre, true);
|
||||
General.SetCUELine(_attributes, "REM", "COMMENT", Metadata.Comment, true);
|
||||
for (i = 0; i < Tracks.Count; i++)
|
||||
{
|
||||
General.SetCUELine(Tracks[i].Attributes, "PERFORMER", Metadata.Tracks[i].Artist, true);
|
||||
@@ -2358,7 +2386,7 @@ namespace CUETools.Processor
|
||||
return;
|
||||
if (_CUEToolsDB.SubStatus != null)
|
||||
sw.WriteLine("CUETools DB: {0}.", _CUEToolsDB.SubStatus);
|
||||
_CUEToolsDB.GenerateLog(sw, true);
|
||||
_CUEToolsDB.GenerateLog(sw, _config.advanced.DetailedCTDBLog);
|
||||
}
|
||||
|
||||
public string GenerateAccurateRipStatus()
|
||||
@@ -2627,7 +2655,19 @@ namespace CUETools.Processor
|
||||
fileInfo.Tag.Disc = temp;
|
||||
if (fileInfo.Tag.Year == 0 && Metadata.Year != "" && uint.TryParse(Metadata.Year, out temp))
|
||||
fileInfo.Tag.Year = temp;
|
||||
}
|
||||
if (fileInfo.Tag.Comment == null && Metadata.Comment != "")
|
||||
fileInfo.Tag.Comment = Metadata.Comment;
|
||||
if (fileInfo.Tag.ReleaseDate == null && Metadata.ReleaseDate != "")
|
||||
fileInfo.Tag.ReleaseDate = Metadata.ReleaseDate;
|
||||
if (fileInfo.Tag.MusicBrainzReleaseCountry == null && Metadata.Country != "")
|
||||
fileInfo.Tag.MusicBrainzReleaseCountry = Metadata.Country;
|
||||
if (fileInfo.Tag.Publisher == null && Metadata.Label != "")
|
||||
fileInfo.Tag.Publisher = Metadata.Label;
|
||||
if (fileInfo.Tag.CatalogNo == null && Metadata.LabelNo != "")
|
||||
fileInfo.Tag.CatalogNo = Metadata.LabelNo;
|
||||
if (fileInfo.Tag.DiscSubtitle == null && Metadata.DiscName != "")
|
||||
fileInfo.Tag.DiscSubtitle = Metadata.DiscName;
|
||||
}
|
||||
|
||||
// fill up missing information from tags
|
||||
if (_config.copyBasicTags && sourceFileInfo != null)
|
||||
@@ -2647,7 +2687,19 @@ namespace CUETools.Processor
|
||||
fileInfo.Tag.Genres = sourceFileInfo.Tag.Genres;
|
||||
if (fileInfo.Tag.Year == 0)
|
||||
fileInfo.Tag.Year = sourceFileInfo.Tag.Year;
|
||||
}
|
||||
if (fileInfo.Tag.Comment == null)
|
||||
fileInfo.Tag.Comment = sourceFileInfo.Tag.Comment;
|
||||
if (fileInfo.Tag.ReleaseDate == null)
|
||||
fileInfo.Tag.ReleaseDate = sourceFileInfo.Tag.ReleaseDate;
|
||||
if (fileInfo.Tag.MusicBrainzReleaseCountry == null)
|
||||
fileInfo.Tag.MusicBrainzReleaseCountry = sourceFileInfo.Tag.MusicBrainzReleaseCountry;
|
||||
if (fileInfo.Tag.Publisher == null)
|
||||
fileInfo.Tag.Publisher = sourceFileInfo.Tag.Publisher;
|
||||
if (fileInfo.Tag.CatalogNo == null)
|
||||
fileInfo.Tag.CatalogNo = sourceFileInfo.Tag.CatalogNo;
|
||||
if (fileInfo.Tag.DiscSubtitle == null)
|
||||
fileInfo.Tag.DiscSubtitle = sourceFileInfo.Tag.DiscSubtitle;
|
||||
}
|
||||
|
||||
if ((_config.embedAlbumArt || _config.CopyAlbumArt) && _albumArt.Count > 0)
|
||||
fileInfo.Tag.Pictures = _albumArt.ToArray();
|
||||
@@ -2694,7 +2746,19 @@ namespace CUETools.Processor
|
||||
fileInfo.Tag.Disc = temp;
|
||||
if (fileInfo.Tag.Year == 0 && Metadata.Year != "" && uint.TryParse(Metadata.Year, out temp))
|
||||
fileInfo.Tag.Year = temp;
|
||||
}
|
||||
if (fileInfo.Tag.Comment == null && Metadata.Comment != "")
|
||||
fileInfo.Tag.Comment = Metadata.Comment;
|
||||
if (fileInfo.Tag.ReleaseDate == null && Metadata.ReleaseDate != "")
|
||||
fileInfo.Tag.ReleaseDate = Metadata.ReleaseDate;
|
||||
if (fileInfo.Tag.MusicBrainzReleaseCountry == null && Metadata.Country != "")
|
||||
fileInfo.Tag.MusicBrainzReleaseCountry = Metadata.Country;
|
||||
if (fileInfo.Tag.Publisher == null && Metadata.Label != "")
|
||||
fileInfo.Tag.Publisher = Metadata.Label;
|
||||
if (fileInfo.Tag.CatalogNo == null && Metadata.LabelNo != "")
|
||||
fileInfo.Tag.CatalogNo = Metadata.LabelNo;
|
||||
if (fileInfo.Tag.DiscSubtitle == null && Metadata.DiscName != "")
|
||||
fileInfo.Tag.DiscSubtitle = Metadata.DiscName;
|
||||
}
|
||||
|
||||
if (_config.copyBasicTags && sourceFileInfo != null)
|
||||
{
|
||||
@@ -2714,7 +2778,19 @@ namespace CUETools.Processor
|
||||
fileInfo.Tag.Year = sourceFileInfo.Tag.Year;
|
||||
if (fileInfo.Tag.Genres.Length == 0)
|
||||
fileInfo.Tag.Genres = sourceFileInfo.Tag.Genres;
|
||||
}
|
||||
if (fileInfo.Tag.Comment == null)
|
||||
fileInfo.Tag.Comment = sourceFileInfo.Tag.Comment;
|
||||
if (fileInfo.Tag.ReleaseDate == null)
|
||||
fileInfo.Tag.ReleaseDate = sourceFileInfo.Tag.ReleaseDate;
|
||||
if (fileInfo.Tag.MusicBrainzReleaseCountry == null)
|
||||
fileInfo.Tag.MusicBrainzReleaseCountry = sourceFileInfo.Tag.MusicBrainzReleaseCountry;
|
||||
if (fileInfo.Tag.Publisher == null)
|
||||
fileInfo.Tag.Publisher = sourceFileInfo.Tag.Publisher;
|
||||
if (fileInfo.Tag.CatalogNo == null)
|
||||
fileInfo.Tag.CatalogNo = sourceFileInfo.Tag.CatalogNo;
|
||||
if (fileInfo.Tag.DiscSubtitle == null)
|
||||
fileInfo.Tag.DiscSubtitle = sourceFileInfo.Tag.DiscSubtitle;
|
||||
}
|
||||
|
||||
if ((_config.embedAlbumArt || _config.CopyAlbumArt) && _albumArt.Count > 0)
|
||||
fileInfo.Tag.Pictures = _albumArt.ToArray();
|
||||
@@ -3003,6 +3079,7 @@ namespace CUETools.Processor
|
||||
destTags.Remove("ALBUM ARTIST");
|
||||
destTags.Remove("DATE");
|
||||
destTags.Remove("GENRE");
|
||||
destTags.Remove("COMMENT");
|
||||
destTags.Remove("TRACKNUMBER");
|
||||
destTags.Remove("TRACKTOTAL");
|
||||
destTags.Remove("TOTALTRACKS");
|
||||
@@ -3074,6 +3151,7 @@ namespace CUETools.Processor
|
||||
destTags.Remove("ALBUM ARTIST");
|
||||
destTags.Remove("DATE");
|
||||
destTags.Remove("GENRE");
|
||||
destTags.Remove("COMMENT");
|
||||
destTags.Remove("TRACKNUMBER");
|
||||
destTags.Remove("TRACKTOTAL");
|
||||
destTags.Remove("TOTALTRACKS");
|
||||
|
||||
@@ -66,10 +66,6 @@
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="taglib-sharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=db62eba44689b5b0, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\ThirdParty\taglib-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CUESheetLogWriter.cs" />
|
||||
@@ -148,6 +144,10 @@
|
||||
<Project>{8A0426FA-0BC2-4C49-A6E5-1F9A68156F19}</Project>
|
||||
<Name>CUETools.Codecs.LossyWAV</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\taglib-sharp\src\taglib-sharp.csproj">
|
||||
<Project>{6B143A39-C7B2-4743-9917-92262C60E9A6}</Project>
|
||||
<Name>taglib-sharp</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
|
||||
@@ -8,13 +8,16 @@ namespace CUETools.Processor
|
||||
public string Artist { get; set; }
|
||||
[DefaultValue("")]
|
||||
public string Title { get; set; }
|
||||
[DefaultValue("")]
|
||||
[DefaultValue("")]
|
||||
public string Comment { get; set; }
|
||||
[DefaultValue("")]
|
||||
public string ISRC { get; set; }
|
||||
|
||||
public CUETrackMetadata()
|
||||
{
|
||||
Artist = "";
|
||||
Title = "";
|
||||
Comment = "";
|
||||
ISRC = "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ namespace CUETools.Processor
|
||||
|
||||
public static string Shorten(string f, string s, int maxLen)
|
||||
{
|
||||
return maxLen <= 0 || maxLen >= s.Length || f == "music" || f == "path" || f == "filename" || f == "filename_ext" || f == "directoryname" ?
|
||||
return maxLen <= 0 || maxLen >= s.Length || f == "music" || f == "path" /*|| f == "filename"*/ || f == "filename_ext" || f == "directoryname" ?
|
||||
s : s.Substring(0, maxLen);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,187 +5,191 @@ using System.Text;
|
||||
|
||||
namespace CUETools.Processor
|
||||
{
|
||||
public class Tagging
|
||||
{
|
||||
public static bool UpdateTags(TagLib.File fileInfo, NameValueCollection tags, CUEConfig config)
|
||||
{
|
||||
if (fileInfo is TagLib.Riff.File)
|
||||
return false;
|
||||
TagLib.Ogg.XiphComment xiph = (TagLib.Ogg.XiphComment)fileInfo.GetTag(TagLib.TagTypes.Xiph);
|
||||
if (xiph != null)
|
||||
{
|
||||
foreach (string tag in tags.AllKeys)
|
||||
xiph.SetField(tag, tags.GetValues(tag));
|
||||
return true;
|
||||
}
|
||||
if (fileInfo is TagLib.Mpeg4.File)
|
||||
{
|
||||
// remove fb2k/nero nasty tags mess
|
||||
//if (((TagLib.Mpeg4.File)fileInfo).UserData.
|
||||
((TagLib.Mpeg4.File)fileInfo).UserData.RemoveChild("tags");
|
||||
TagLib.Mpeg4.AppleTag mpeg4 = (TagLib.Mpeg4.AppleTag)fileInfo.GetTag(TagLib.TagTypes.Apple, true);
|
||||
return true;
|
||||
}
|
||||
if (fileInfo is TagLib.UserDefined.File && (fileInfo as TagLib.UserDefined.File).Tagger != CUEToolsTagger.APEv2)
|
||||
{
|
||||
if ((fileInfo as TagLib.UserDefined.File).Tagger != CUEToolsTagger.ID3v2)
|
||||
return false;
|
||||
TagLib.Id3v2.Tag id3v2 = (TagLib.Id3v2.Tag)fileInfo.GetTag(TagLib.TagTypes.Id3v2, true);
|
||||
return true;
|
||||
}
|
||||
TagLib.Ape.Tag ape = (TagLib.Ape.Tag)fileInfo.GetTag(TagLib.TagTypes.Ape, true);
|
||||
foreach (string tag in tags.AllKeys)
|
||||
ape.SetValue(XiphTagNameToApe(tag), tags.GetValues(tag));
|
||||
return true;
|
||||
}
|
||||
public class Tagging
|
||||
{
|
||||
public static bool UpdateTags(TagLib.File fileInfo, NameValueCollection tags, CUEConfig config)
|
||||
{
|
||||
if (fileInfo is TagLib.Riff.File)
|
||||
return false;
|
||||
TagLib.Ogg.XiphComment xiph = (TagLib.Ogg.XiphComment)fileInfo.GetTag(TagLib.TagTypes.Xiph);
|
||||
if (xiph != null)
|
||||
{
|
||||
foreach (string tag in tags.AllKeys)
|
||||
xiph.SetField(tag, tags.GetValues(tag));
|
||||
return true;
|
||||
}
|
||||
if (fileInfo is TagLib.Mpeg4.File)
|
||||
{
|
||||
var mpeg4 = (TagLib.Mpeg4.AppleTag)fileInfo.GetTag(TagLib.TagTypes.Apple, true);
|
||||
foreach (string tag in tags.AllKeys)
|
||||
{
|
||||
mpeg4.SetDashBox("com.apple.iTunes", tag, string.Join(";", tags.GetValues(tag)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (fileInfo is TagLib.Mpeg.AudioFile || (fileInfo is TagLib.UserDefined.File && (fileInfo as TagLib.UserDefined.File).Tagger == CUEToolsTagger.ID3v2))
|
||||
{
|
||||
var id3v2 = (TagLib.Id3v2.Tag)fileInfo.GetTag(TagLib.TagTypes.Id3v2, true);
|
||||
foreach (string tag in tags.AllKeys)
|
||||
{
|
||||
var frame = TagLib.Id3v2.UserTextInformationFrame.Get(id3v2, tag, true);
|
||||
frame.Text = tags.GetValues(tag);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
TagLib.Ape.Tag ape = (TagLib.Ape.Tag)fileInfo.GetTag(TagLib.TagTypes.Ape, true);
|
||||
foreach (string tag in tags.AllKeys)
|
||||
ape.SetValue(XiphTagNameToApe(tag), tags.GetValues(tag));
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void UpdateTags(string path, NameValueCollection tags, CUEConfig config)
|
||||
{
|
||||
TagLib.UserDefined.AdditionalFileTypes.Config = config;
|
||||
TagLib.File fileInfo = TagLib.File.Create(new TagLib.File.LocalFileAbstraction(path));
|
||||
if (UpdateTags(fileInfo, tags, config))
|
||||
fileInfo.Save();
|
||||
//IAudioSource audioSource = AudioReadWrite.GetAudioSource(path, null, config);
|
||||
//audioSource.Tags = tags;
|
||||
//audioSource.UpdateTags(false);
|
||||
//audioSource.Close();
|
||||
//audioSource = null;
|
||||
}
|
||||
public static void UpdateTags(string path, NameValueCollection tags, CUEConfig config)
|
||||
{
|
||||
TagLib.UserDefined.AdditionalFileTypes.Config = config;
|
||||
TagLib.File fileInfo = TagLib.File.Create(new TagLib.File.LocalFileAbstraction(path));
|
||||
if (UpdateTags(fileInfo, tags, config))
|
||||
fileInfo.Save();
|
||||
//IAudioSource audioSource = AudioReadWrite.GetAudioSource(path, null, config);
|
||||
//audioSource.Tags = tags;
|
||||
//audioSource.UpdateTags(false);
|
||||
//audioSource.Close();
|
||||
//audioSource = null;
|
||||
}
|
||||
|
||||
public static string[] GetMiscTag(TagLib.File file, string name)
|
||||
{
|
||||
//TagLib.Mpeg4.AppleTag apple = (TagLib.Mpeg4.AppleTag)file.GetTag(TagLib.TagTypes.Apple);
|
||||
//TagLib.Id3v2.Tag id3v2 = (TagLib.Id3v2.Tag)file.GetTag(TagLib.TagTypes.Id3v2);
|
||||
TagLib.Ogg.XiphComment xiph = (TagLib.Ogg.XiphComment)file.GetTag(TagLib.TagTypes.Xiph);
|
||||
TagLib.Ape.Tag ape = (TagLib.Ape.Tag)file.GetTag(TagLib.TagTypes.Ape);
|
||||
public static string[] GetMiscTag(TagLib.File file, string name)
|
||||
{
|
||||
//TagLib.Mpeg4.AppleTag apple = (TagLib.Mpeg4.AppleTag)file.GetTag(TagLib.TagTypes.Apple);
|
||||
//TagLib.Id3v2.Tag id3v2 = (TagLib.Id3v2.Tag)file.GetTag(TagLib.TagTypes.Id3v2);
|
||||
TagLib.Ogg.XiphComment xiph = (TagLib.Ogg.XiphComment)file.GetTag(TagLib.TagTypes.Xiph);
|
||||
TagLib.Ape.Tag ape = (TagLib.Ape.Tag)file.GetTag(TagLib.TagTypes.Ape);
|
||||
|
||||
//if (apple != null)
|
||||
//{
|
||||
// string[] text = apple.GetText(name);
|
||||
// if (text.Length != 0)
|
||||
// return text;
|
||||
//}
|
||||
//if (apple != null)
|
||||
//{
|
||||
// string[] text = apple.GetText(name);
|
||||
// if (text.Length != 0)
|
||||
// return text;
|
||||
//}
|
||||
|
||||
//if (id3v2 != null)
|
||||
// foreach (TagLib.Id3v2.Frame f in id3v2.GetFrames())
|
||||
// if (f is TagLib.Id3v2.TextInformationFrame && ((TagLib.Id3v2.TextInformationFrame)f).Text != null)
|
||||
// return ((TagLib.Id3v2.TextInformationFrame)f).Text;
|
||||
//if (id3v2 != null)
|
||||
// foreach (TagLib.Id3v2.Frame f in id3v2.GetFrames())
|
||||
// if (f is TagLib.Id3v2.TextInformationFrame && ((TagLib.Id3v2.TextInformationFrame)f).Text != null)
|
||||
// return ((TagLib.Id3v2.TextInformationFrame)f).Text;
|
||||
|
||||
if (xiph != null)
|
||||
{
|
||||
string[] l = xiph.GetField(name);
|
||||
if (l != null && l.Length != 0)
|
||||
return l;
|
||||
}
|
||||
if (xiph != null)
|
||||
{
|
||||
string[] l = xiph.GetField(name);
|
||||
if (l != null && l.Length != 0)
|
||||
return l;
|
||||
}
|
||||
|
||||
if (ape != null)
|
||||
{
|
||||
TagLib.Ape.Item item = ape.GetItem(name);
|
||||
if (item != null)
|
||||
return item.ToStringArray();
|
||||
}
|
||||
if (ape != null)
|
||||
{
|
||||
TagLib.Ape.Item item = ape.GetItem(name);
|
||||
if (item != null)
|
||||
return item.ToStringArray();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string TagListToSingleValue(string[] list)
|
||||
{
|
||||
return list == null ? null :
|
||||
list.Length == 0 ? null :
|
||||
list.Length == 1 ? list[0] :
|
||||
null; // TODO: merge them?
|
||||
}
|
||||
public static string TagListToSingleValue(string[] list)
|
||||
{
|
||||
return list == null ? null :
|
||||
list.Length == 0 ? null :
|
||||
list.Length == 1 ? list[0] :
|
||||
null; // TODO: merge them?
|
||||
}
|
||||
|
||||
public static string ApeTagNameToXiph(string tag)
|
||||
{
|
||||
if (tag.ToUpper() == "YEAR")
|
||||
return "DATE";
|
||||
if (tag.ToUpper() == "TRACK")
|
||||
return "TRACKNUMBER";
|
||||
if (tag.ToUpper() == "DISC")
|
||||
return "DISCNUMBER";
|
||||
return tag;
|
||||
}
|
||||
public static string ApeTagNameToXiph(string tag)
|
||||
{
|
||||
if (tag.ToUpper() == "YEAR")
|
||||
return "DATE";
|
||||
if (tag.ToUpper() == "TRACK")
|
||||
return "TRACKNUMBER";
|
||||
if (tag.ToUpper() == "DISC")
|
||||
return "DISCNUMBER";
|
||||
return tag;
|
||||
}
|
||||
|
||||
public static string XiphTagNameToApe(string tag)
|
||||
{
|
||||
if (tag.ToUpper() == "DATE")
|
||||
return "Year";
|
||||
if (tag.ToUpper() == "TRACKNUMBER")
|
||||
return "Track";
|
||||
if (tag.ToUpper() == "DISCNUMBER")
|
||||
return "Disc";
|
||||
return tag;
|
||||
}
|
||||
public static string XiphTagNameToApe(string tag)
|
||||
{
|
||||
if (tag.ToUpper() == "DATE")
|
||||
return "Year";
|
||||
if (tag.ToUpper() == "TRACKNUMBER")
|
||||
return "Track";
|
||||
if (tag.ToUpper() == "DISCNUMBER")
|
||||
return "Disc";
|
||||
return tag;
|
||||
}
|
||||
|
||||
public static NameValueCollection Analyze(string path)
|
||||
{
|
||||
return Analyze(new TagLib.File.LocalFileAbstraction(path));
|
||||
}
|
||||
public static NameValueCollection Analyze(string path)
|
||||
{
|
||||
return Analyze(new TagLib.File.LocalFileAbstraction(path));
|
||||
}
|
||||
|
||||
public static NameValueCollection Analyze(TagLib.File.IFileAbstraction file)
|
||||
{
|
||||
return Analyze(TagLib.File.Create(file));
|
||||
}
|
||||
public static NameValueCollection Analyze(TagLib.File.IFileAbstraction file)
|
||||
{
|
||||
return Analyze(TagLib.File.Create(file));
|
||||
}
|
||||
|
||||
public static NameValueCollection Analyze(TagLib.File fileInfo)
|
||||
{
|
||||
NameValueCollection tags = new NameValueCollection();
|
||||
|
||||
TagLib.Ogg.XiphComment xiph = (TagLib.Ogg.XiphComment)fileInfo.GetTag(TagLib.TagTypes.Xiph);
|
||||
TagLib.Ape.Tag ape = (TagLib.Ape.Tag)fileInfo.GetTag(TagLib.TagTypes.Ape);
|
||||
public static NameValueCollection Analyze(TagLib.File fileInfo)
|
||||
{
|
||||
NameValueCollection tags = new NameValueCollection();
|
||||
|
||||
if (xiph != null)
|
||||
{
|
||||
foreach (string tag in xiph)
|
||||
foreach (string value in xiph.GetField(tag))
|
||||
tags.Add(tag, value);
|
||||
}
|
||||
else if (ape != null)
|
||||
{
|
||||
foreach (string tag in ape)
|
||||
foreach (string value in ape.GetItem(tag).ToStringArray())
|
||||
tags.Add(ApeTagNameToXiph(tag), value);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (audioSource is CUETools.Codecs.ALAC.ALACReader)
|
||||
//tags = (audioSource as CUETools.Codecs.ALAC.ALACReader).Tags;
|
||||
}
|
||||
TagLib.Ogg.XiphComment xiph = (TagLib.Ogg.XiphComment)fileInfo.GetTag(TagLib.TagTypes.Xiph);
|
||||
TagLib.Ape.Tag ape = (TagLib.Ape.Tag)fileInfo.GetTag(TagLib.TagTypes.Ape);
|
||||
|
||||
// TODO: enumerate dash atoms somehow?
|
||||
//TagLib.Mpeg4.AppleTag apple = (TagLib.Mpeg4.AppleTag)fileInfo.GetTag(TagLib.TagTypes.Apple);
|
||||
//if (apple != null)
|
||||
//{
|
||||
// tags = new NameValueCollection();
|
||||
// foreach (TagLib.Mpeg4.Box tag in apple)
|
||||
// if (tag.BoxType == "----")
|
||||
// foreach (string value in apple.GetDashBox(tag.)
|
||||
// tags.Add(tag, value);
|
||||
//}
|
||||
return tags;
|
||||
}
|
||||
if (xiph != null)
|
||||
{
|
||||
foreach (string tag in xiph)
|
||||
foreach (string value in xiph.GetField(tag))
|
||||
tags.Add(tag, value);
|
||||
}
|
||||
else if (ape != null)
|
||||
{
|
||||
foreach (string tag in ape)
|
||||
foreach (string value in ape.GetItem(tag).ToStringArray())
|
||||
tags.Add(ApeTagNameToXiph(tag), value);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (audioSource is CUETools.Codecs.ALAC.ALACReader)
|
||||
//tags = (audioSource as CUETools.Codecs.ALAC.ALACReader).Tags;
|
||||
}
|
||||
|
||||
//public void SetTextField(TagLib.File file,
|
||||
// TagLib.ByteVector apple_name, TagLib.ByteVector id3v2_name,
|
||||
// string xiph_name, string ape_name, string[] values)
|
||||
//{
|
||||
// TagLib.Mpeg4.AppleTag apple = (TagLib.Mpeg4.AppleTag)file.GetTag(TagLib.TagTypes.Apple, true);
|
||||
// TagLib.Id3v2.Tag id3v2 = (TagLib.Id3v2.Tag)file.GetTag(TagLib.TagTypes.Id3v2, true);
|
||||
// TagLib.Ogg.XiphComment xiph = (TagLib.Ogg.XiphComment)file.GetTag(TagLib.TagTypes.Xiph, true);
|
||||
// TagLib.Ape.Tag ape = (TagLib.Ape.Tag)file.GetTag(TagLib.TagTypes.Ape, (file is TagLib.Mpc.File));
|
||||
// TODO: enumerate dash atoms somehow?
|
||||
//TagLib.Mpeg4.AppleTag apple = (TagLib.Mpeg4.AppleTag)fileInfo.GetTag(TagLib.TagTypes.Apple);
|
||||
//if (apple != null)
|
||||
//{
|
||||
// tags = new NameValueCollection();
|
||||
// foreach (TagLib.Mpeg4.Box tag in apple)
|
||||
// if (tag.BoxType == "----")
|
||||
// foreach (string value in apple.GetDashBox(tag.)
|
||||
// tags.Add(tag, value);
|
||||
//}
|
||||
return tags;
|
||||
}
|
||||
|
||||
// if (apple != null)
|
||||
// apple.SetText(apple_name, values);
|
||||
//public void SetTextField(TagLib.File file,
|
||||
// TagLib.ByteVector apple_name, TagLib.ByteVector id3v2_name,
|
||||
// string xiph_name, string ape_name, string[] values)
|
||||
//{
|
||||
// TagLib.Mpeg4.AppleTag apple = (TagLib.Mpeg4.AppleTag)file.GetTag(TagLib.TagTypes.Apple, true);
|
||||
// TagLib.Id3v2.Tag id3v2 = (TagLib.Id3v2.Tag)file.GetTag(TagLib.TagTypes.Id3v2, true);
|
||||
// TagLib.Ogg.XiphComment xiph = (TagLib.Ogg.XiphComment)file.GetTag(TagLib.TagTypes.Xiph, true);
|
||||
// TagLib.Ape.Tag ape = (TagLib.Ape.Tag)file.GetTag(TagLib.TagTypes.Ape, (file is TagLib.Mpc.File));
|
||||
|
||||
// if (id3v2 != null)
|
||||
// id3v2.SetTextFrame(id3v2_name, new TagLib.StringList(values));
|
||||
// if (apple != null)
|
||||
// apple.SetText(apple_name, values);
|
||||
|
||||
// if (xiph != null)
|
||||
// xiph.AddFields(xiph_name, values);
|
||||
// if (id3v2 != null)
|
||||
// id3v2.SetTextFrame(id3v2_name, new TagLib.StringList(values));
|
||||
|
||||
// if (ape != null)
|
||||
// ape.AddValues(ape_name, values, true);
|
||||
//}
|
||||
}
|
||||
// if (xiph != null)
|
||||
// xiph.AddFields(xiph_name, values);
|
||||
|
||||
// if (ape != null)
|
||||
// ape.AddValues(ape_name, values, true);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user