Skip to content

Commit

Permalink
upload v1.1.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
yaronzz committed Sep 21, 2019
1 parent c070a3a commit 3f40728
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 27 deletions.
11 changes: 9 additions & 2 deletions TIDALDL-UI/TIDALDL-UI/Else/DownloadItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Stylet;
using TagLib;
using System.IO;
using System.Collections.ObjectModel;

namespace TIDALDL_UI.Else
{
Expand Down Expand Up @@ -158,14 +159,20 @@ public void DownloadVideo()
#region DownloadTrack
public void DownloadTrack()
{
string Errlabel = "";

//GetStream
Progress.StatusMsg = "GetStream...";
string Errlabel = "";
StreamUrl TidalStream = TidalTool.getStreamUrl(TidalTrack.ID.ToString(), Quality, out Errlabel);
if (Errlabel.IsNotBlank())
goto ERR_RETURN;

//Get path
FilePath = TidalTool.getTrackPath(OutputDir, TidalAlbum, TidalTrack, TidalStream.Url, AddHyphen, TidalPlaylist);

//Get contributors
ObservableCollection<Contributor> pContributors = TidalTool.getTrackContributors(TidalTrack.ID.ToString(), out Errlabel);

//Download
Progress.StatusMsg = "Start...";
for (int i = 0; i < 100 && Progress.GetStatus() != ProgressHelper.STATUS.CANCLE; i++)
Expand Down Expand Up @@ -197,7 +204,7 @@ public void DownloadTrack()
string sErrcode = null;
TidalAlbum = TidalTool.getAlbum(TidalTrack.Album.ID.ToString(), out sErrcode);
}
string sLabel = TidalTool.SetMetaData(FilePath, TidalAlbum, TidalTrack, TidalTool.getAlbumCoverPath(OutputDir, TidalAlbum));
string sLabel = TidalTool.SetMetaData(FilePath, TidalAlbum, TidalTrack, TidalTool.getAlbumCoverPath(OutputDir, TidalAlbum), pContributors);
if (sLabel.IsNotBlank())
{
Errlabel = "Set metadata failed!";
Expand Down
6 changes: 3 additions & 3 deletions TIDALDL-UI/TIDALDL-UI/Pages/MainView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" materialDesign:RippleAssist.IsCentered="True">
<materialDesign:PackIcon Kind="MusicCircleOutline" Height="Auto" Width="30" HorizontalAlignment="Left" Padding="0,4" VerticalAlignment="Stretch"/>
<TextBlock Text="TIDAL-GUI" FontWeight="Bold" VerticalAlignment="Center" Margin="0 0 0 0" FontSize="18" Padding="4,0,0,0"/>
<materialDesign:ColorZone IsEnabled="{Binding Path=InSearch, Converter={StaticResource ConverterUnbool}}" Mode="Standard" Padding="4 0 4 0" Panel.ZIndex="1" Margin="16 0 0 0" materialDesign:ShadowAssist.ShadowDepth="Depth1" Width="488">
<materialDesign:ColorZone IsEnabled="{Binding Path=InSearch, Converter={StaticResource ConverterUnbool}}" Mode="Standard" Padding="4 0 4 0" Panel.ZIndex="1" Margin="16 0 0 0" materialDesign:ShadowAssist.ShadowDepth="Depth1" Width="673">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="26" />
Expand All @@ -65,10 +65,10 @@
BorderThickness="0"
MinWidth="200"
VerticalAlignment="Center" Grid.ColumnSpan="2" />
<Button Grid.Column="2" Command="{s:Action Search}" s:View.ActionTarget="{Binding}" Style="{DynamicResource MaterialDesignToolButton}" IsDefault="True" Margin="394,2,0,2" HorizontalAlignment="Left" Width="29">
<Button Grid.Column="2" Command="{s:Action Search}" s:View.ActionTarget="{Binding}" Style="{DynamicResource MaterialDesignToolButton}" IsDefault="True" Margin="0,2,31,2" HorizontalAlignment="Right" Width="29">
<materialDesign:PackIcon Kind="Magnify" Opacity=".56" />
</Button>
<Button Grid.Column="2" Command="{s:Action OpenDllist}" s:View.ActionTarget="{Binding}" Style="{DynamicResource MaterialDesignToolButton}" Margin="423,2,0,2" HorizontalAlignment="Left" Width="31">
<Button Grid.Column="2" Command="{s:Action OpenDllist}" s:View.ActionTarget="{Binding}" Style="{DynamicResource MaterialDesignToolButton}" Margin="0,2" HorizontalAlignment="Right" Width="31">
<materialDesign:PackIcon Kind="FileDocumentBoxOutline" Opacity=".56" />
</Button>
</Grid>
Expand Down
16 changes: 8 additions & 8 deletions TIDALDL-UI/TIDALDL-UI/Pages/SettingView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</Border>

<Grid Grid.Column="1" Visibility="{Binding CheckCommon, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<Label Content="OutputDir" FontSize="15" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="10,33,312,0" />
<Label Content="OutputDir" FontSize="15" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="10,33,312,0" />
<Button Style="{StaticResource MaterialDesignFlatButton}"
Name="m_CPath"
ToolTip="Choose Path"
Expand All @@ -50,7 +50,7 @@
Margin="107,32,22,0"
HorizontalContentAlignment="Left"
VerticalAlignment="Top" Height="30" Padding="0,4,16,4" BorderThickness="0,0,0,1" BorderBrush="#89000000"/>
<Label Content="ThreadNum" FontSize="15" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="10,67,307,0" Height="30" />
<Label Content="ThreadNum" FontSize="15" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="10,67,307,0" Height="30" />
<ComboBox SelectedIndex="{Binding ThreadNum, UpdateSourceTrigger=PropertyChanged}" Margin="107,67,22,168">
<ComboBoxItem>1</ComboBoxItem>
<ComboBoxItem>2</ComboBoxItem>
Expand All @@ -61,21 +61,21 @@
</Grid>

<Grid Grid.Column="1" Visibility="{Binding CheckTrack, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<Label Content="Quality" FontSize="15" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="10,33,312,0" />
<Label Content="Quality" FontSize="15" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="10,33,312,0" />
<ComboBox ItemsSource="{Binding QualityList}"
SelectedIndex="{Binding SelectQualityIndex , UpdateSourceTrigger=PropertyChanged}"
Margin="107,32,22,0" VerticalAlignment="Top" Height="30"/>
<Label Content="OnlyM4a" FontSize="15" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="10,67,312,0" Height="30" />
Margin="107,32,87,0" VerticalAlignment="Top" Height="30" Padding="6,6,0,6"/>
<Label Content="OnlyM4a" FontSize="15" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="10,67,312,0" Height="30" />
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding OnlyM4a, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Height="33" VerticalAlignment="Top" Margin="107,64,262,0"/>
<Label Content="AddHyphen" FontSize="15" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="10,97,312,0" Height="30" />
<Label Content="AddHyphen" FontSize="15" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="0,97,312,0" Height="30" />
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding AddHyphen, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Height="33" VerticalAlignment="Top" Margin="107,97,262,0"/>
</Grid>

<Grid Grid.Column="1" Visibility="{Binding CheckVideo, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<Label Content="Resolution" FontSize="15" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="10,33,312,0" />
<Label Content="Resolution" FontSize="15" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="10,33,312,0" />
<ComboBox ItemsSource="{Binding ResolutionList}"
SelectedIndex="{Binding SelectResolutionIndex , UpdateSourceTrigger=PropertyChanged}"
Margin="107,32,22,0" VerticalAlignment="Top" Height="28">
Margin="107,32,87,0" VerticalAlignment="Top" Height="30" Padding="6,6,0,6">
</ComboBox>
</Grid>
</Grid>
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.6")]
[assembly: AssemblyFileVersion("1.1.0.6")]
[assembly: AssemblyVersion("1.1.0.7")]
[assembly: AssemblyFileVersion("1.1.0.7")]
23 changes: 23 additions & 0 deletions TIDALDL-UI/TIDALDL-UI/Tidal/Enum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,27 @@ public enum eResolution
e720P = 720,
e1080P = 1080
}

public enum eContributorRole
{
PRODUCER,
COMPOSER,
LYRICIST,
ASSOCIATED_PERFORMER,
BACKGROUND_VOCAL,
BASS,
DRUMS,
GUITAR,
MASTERING_ENGINEER,
MIX_ENGINEER,
PERCUSSION,
SYNTHESIZER,
VOCAL,
PERFORMER,
REMIXER,
ENSEMBLE_ORCHESTRA,
CHOIR,
CONDUCTOR,
ELSE,
}
}
6 changes: 6 additions & 0 deletions TIDALDL-UI/TIDALDL-UI/Tidal/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ public class Video
public byte[] CoverData { get; set; }
}

public class Contributor
{
public string Name { get; set; }
public string Role { get; set; }
}

public class Playlist
{
public string UUID { get; set; }
Expand Down
47 changes: 37 additions & 10 deletions TIDALDL-UI/TIDALDL-UI/Tidal/TidalTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ public static StreamUrl getStreamUrl(string ID, eSoundQuality eQuality, out stri
StreamUrl oObj = get<StreamUrl>("tracks/" + ID + "/streamUrl", out Errmsg, new Dictionary<string, string>() { { "soundQuality", sQua } }, 3);
return oObj;
}

public static ObservableCollection<Contributor> getTrackContributors(string ID, out string Errmsg)
{
ObservableCollection<Contributor> aObj = get<ObservableCollection<Contributor>>("tracks/" + ID + "/contributors", out Errmsg, null, 3, "items");
return aObj;
}
#endregion

#region Video
Expand Down Expand Up @@ -554,11 +560,24 @@ private static string[] GetArtistNames(ObservableCollection<Artist> Artists)
{
List<string> pArrayStr = new List<string>();
for(int i = 0; i < Artists.Count; i++)
pArrayStr.Add(Artists[i].Name);
pArrayStr.Add(Artists[i].Name);
return pArrayStr.ToArray();
}

private static string[] GetRoles(ObservableCollection<Contributor> pContributors, eContributorRole eRole)
{
string sName = AIGS.Common.Convert.ConverEnumToString((int)eRole, typeof(eContributorRole));

List<string> pArrayStr = new List<string>();
for (int i = 0; i < pContributors.Count; i++)
{
if (pContributors[i].Role.ToUpper().Replace(' ', '_') == sName)
pArrayStr.Add(pContributors[i].Name);
}
return pArrayStr.ToArray();
}

public static string SetMetaData(string filepath, Album TidalAlbum, Track TidalTrack, string CoverPath)
public static string SetMetaData(string filepath, Album TidalAlbum, Track TidalTrack, string CoverPath, ObservableCollection<Contributor> pContributors)
{
try
{
Expand All @@ -572,9 +591,13 @@ public static string SetMetaData(string filepath, Album TidalAlbum, Track TidalT
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
if (CoverPath.IsNotBlank())
{
var pictures = new Picture[1];
Expand All @@ -584,6 +607,7 @@ public static string SetMetaData(string filepath, Album TidalAlbum, Track TidalT
pictures[0] = new Picture(CoverPath);
tfile.Tag.Pictures = pictures;
}

tfile.Save();
return null;
}
Expand Down Expand Up @@ -719,15 +743,18 @@ private static bool parseLink(ref string insStr, ref eObjectType inType)
return false;

string sID = sArr[1];
if (AIGS.Common.Convert.ConverStringToInt(sID, -1) == -1)
return false;

eObjectType sType = eObjectType.None;
if (sArr[0] == "album") sType = eObjectType.ALBUM;
if (sArr[0] == "track") sType = eObjectType.TRACK;
if (sArr[0] == "video") sType = eObjectType.VIDEO;
if (sArr[0] == "artist") sType = eObjectType.ARTIST;
if (sArr[0] == "playlist") sType = eObjectType.PLAYLIST;
if (AIGS.Common.Convert.ConverStringToInt(sID, -1) == -1)
{
if (sArr[0] == "playlist") sType = eObjectType.PLAYLIST;
}
else
{
if (sArr[0] == "album") sType = eObjectType.ALBUM;
if (sArr[0] == "track") sType = eObjectType.TRACK;
if (sArr[0] == "video") sType = eObjectType.VIDEO;
if (sArr[0] == "artist") sType = eObjectType.ARTIST;
}
if (sType == eObjectType.None)
return false;

Expand Down
4 changes: 2 additions & 2 deletions TIDALDL-UI/TIDALDL-UI/updateLog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#### v1.1.0.7
- Add proxy-setting on login-page
- support http-proxy(login-page)
- Download playlist
- Use artist cover when no album cover
- Tag: add composer

#### v1.1.0.6
- Fix bug of search
Expand Down

0 comments on commit 3f40728

Please sign in to comment.