Skip to content

Commit

Permalink
upload new version(gui)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaronzz committed Jul 3, 2020
1 parent 6ada0fb commit 7b56f50
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 39 deletions.
11 changes: 10 additions & 1 deletion TIDALDL-UI/TIDALDL-UI/Else/DownloadItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ public void DownloadVideo()
goto ERR_RETURN;
}
System.IO.File.Delete(TsFilePath);

//SetMetaData
string sLabel = TidalTool.SetMetaData(FilePath, null, null, null, null, TidalVideo);
if (sLabel.IsNotBlank())
{
Errlabel = "Set metadata failed!";
goto ERR_RETURN;
}

Progress.SetStatus(ProgressHelper.STATUS.COMPLETE);
return;

Expand Down Expand Up @@ -257,7 +266,7 @@ public void DownloadTrack()
string sLabel = TidalTool.SetMetaData(FilePath, TidalAlbum, TidalTrack, TidalTool.getAlbumCoverPath(OutputDir, TidalAlbum, AddYear), pContributors);
if (sLabel.IsNotBlank())
{
Errlabel = "Set metadata failed!";
Errlabel = "Set metadata failed!" + sLabel;
goto ERR_RETURN;
}

Expand Down
4 changes: 2 additions & 2 deletions TIDALDL-UI/TIDALDL-UI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.23")]
[assembly: AssemblyFileVersion("1.1.0.23")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
80 changes: 45 additions & 35 deletions TIDALDL-UI/TIDALDL-UI/Tidal/TidalTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ public static Artist getArtist(string ID, out string Errmsg, bool GetItem = fals

if (GetItem)
{
//albums
ObservableCollection<Album> albums = getItems<Album>("artists/" + ID + "/albums", out Errmsg, null, CountLimt:100);
if (IncludeEp)
{
Expand All @@ -559,22 +560,19 @@ public static Artist getArtist(string ID, out string Errmsg, bool GetItem = fals
}
oObj.Albums = albums;

//debug
//{
// string sTxt = "";
// for (int i = 0; i < oObj.Albums.Count(); i++)
// {
// sTxt += string.Format("id:{0} name:{1}\n", oObj.Albums[i].ID.ToString(), oObj.Albums[i].Title);
// }
// FileHelper.Write(sTxt, true, "e:\\plist.txt");
//}

for (int i = 0; i < oObj.Albums.Count(); i++)
{
Album item = oObj.Albums[i];
getAlbumData(ref item, item.ID.ToString(), out Errmsg, true);
oObj.Albums[i] = item;
}

//videos
//ObservableCollection<Video> videos = getItems<Video>("artists/" + ID + "/videos", out Errmsg, null, CountLimt: 100);
//for (int i = 0; i < videos.Count; i++)
//{

//}
}
return oObj;
}
Expand Down Expand Up @@ -844,34 +842,46 @@ private static string[] GetRoles(ObservableCollection<Contributor> pContributors
return pArrayStr.ToArray();
}

public static string SetMetaData(string filepath, Album TidalAlbum, Track TidalTrack, string CoverPath, ObservableCollection<Contributor> pContributors)
public static string SetMetaData(string filepath, Album TidalAlbum, Track TidalTrack, string CoverPath, ObservableCollection<Contributor> pContributors, Video TidalVideo = null)
{
try
{
var tfile = TagLib.File.Create(filepath);
tfile.Tag.Album = TidalAlbum.Title;
tfile.Tag.Track = (uint)TidalTrack.TrackNumber;
tfile.Tag.TrackCount = (uint)TidalAlbum.NumberOfTracks;
tfile.Tag.Title = TidalTrack.Title;
tfile.Tag.Disc = (uint)TidalTrack.VolumeNumber;
tfile.Tag.DiscCount = (uint)TidalAlbum.NumberOfVolumes;
tfile.Tag.Copyright = TidalTrack.Copyright;
tfile.Tag.AlbumArtists = GetArtistNames(TidalAlbum.Artists);
tfile.Tag.Performers = GetArtistNames(TidalTrack.Artists);
tfile.Tag.Composers = GetRoles(pContributors, eContributorRole.COMPOSER);

//ReleaseDate
if (TidalAlbum.ReleaseDate.IsNotBlank())
tfile.Tag.Year = (uint)AIGS.Common.Convert.ConverStringToInt(TidalAlbum.ReleaseDate.Split("-")[0]);

//Cover
var pictures = new Picture[1];
if (CoverPath.IsNotBlank() && System.IO.File.Exists(CoverPath))
pictures[0] = new Picture(CoverPath);
else if(TidalAlbum.CoverData != null)
pictures[0] = new Picture(TidalAlbum.CoverData);

tfile.Tag.Pictures = pictures;
var tfile = TagLib.File.Create(filepath);
if (TidalVideo != null)
{
tfile.Tag.Performers = GetArtistNames(TidalVideo.Artists);
tfile.Tag.Copyright = TidalVideo.Copyright;
tfile.Tag.Title = TidalVideo.Title;
//ReleaseDate
if (TidalAlbum.ReleaseDate.IsNotBlank())
tfile.Tag.Year = (uint)AIGS.Common.Convert.ConverStringToInt(TidalVideo.ReleaseDate.Split("-")[0]);
}
else
{
tfile.Tag.Album = TidalAlbum.Title;
tfile.Tag.Track = (uint)TidalTrack.TrackNumber;
tfile.Tag.TrackCount = (uint)TidalAlbum.NumberOfTracks;
tfile.Tag.Title = TidalTrack.Title;
tfile.Tag.Disc = (uint)TidalTrack.VolumeNumber;
tfile.Tag.DiscCount = (uint)TidalAlbum.NumberOfVolumes;
tfile.Tag.Copyright = TidalTrack.Copyright;
tfile.Tag.AlbumArtists = GetArtistNames(TidalAlbum.Artists);
tfile.Tag.Performers = GetArtistNames(TidalTrack.Artists);
tfile.Tag.Composers = GetRoles(pContributors, eContributorRole.COMPOSER);

//ReleaseDate
if (TidalAlbum.ReleaseDate.IsNotBlank())
tfile.Tag.Year = (uint)AIGS.Common.Convert.ConverStringToInt(TidalAlbum.ReleaseDate.Split("-")[0]);

//Cover
var pictures = new Picture[1];
if (CoverPath.IsNotBlank() && System.IO.File.Exists(CoverPath))
pictures[0] = new Picture(CoverPath);
else if (TidalAlbum.CoverData != null)
pictures[0] = new Picture(TidalAlbum.CoverData);

tfile.Tag.Pictures = pictures;
}

tfile.Save();
return null;
Expand Down
5 changes: 4 additions & 1 deletion TIDALDL-UI/TIDALDL-UI/updateLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
- Fix bug of login err
#### v1.1.1.0
- Fix bug of login err(url_encode)
- Show track-codec when downloading
- Show audioModes on info-page
- Video-SetMetaData:Performers\Copyright\Title\Year #197
- Today is purple

#### v1.1.0.22
- Fix bug of long-file-path (settings MaxFileName) #353
Expand Down

0 comments on commit 7b56f50

Please sign in to comment.