Skip to content

Commit

Permalink
C# cloud token
Browse files Browse the repository at this point in the history
  • Loading branch information
yaronzz committed May 15, 2020
1 parent 57fd1c3 commit 6528e59
Show file tree
Hide file tree
Showing 10 changed files with 28,436 additions and 28,413 deletions.
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.17")]
[assembly: AssemblyFileVersion("1.1.0.17")]
[assembly: AssemblyVersion("1.1.0.18")]
[assembly: AssemblyFileVersion("1.1.0.18")]
26 changes: 23 additions & 3 deletions TIDALDL-UI/TIDALDL-UI/Tidal/TidalTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ public class TidalTool

#region Login

static bool tokenUpdateFlag = false;
private static void updateToken()
{
if (tokenUpdateFlag)
return;
try
{
string sReturn = NetHelper.DownloadString("https://raw.githubusercontent.com/yaronzz/Tidal-Media-Downloader/master/Else/tokens.json", 10000);
TOKEN = JsonHelper.GetValue(sReturn, "token");
TOKEN_PHONE = JsonHelper.GetValue(sReturn, "token_phone");
tokenUpdateFlag = true;
}
catch
{
}
}

public static void logout()
{
ISLOGIN = false;
Expand All @@ -60,6 +77,7 @@ public static bool login(string UserName, string Password)
if (ISLOGIN)
return true;

updateToken();
string Errmsg = null;
string SessID1 = null;
string SessID2 = null;
Expand Down Expand Up @@ -179,7 +197,7 @@ static string getString(string sUrl, out string Errmsg)
return sRet;
}

static ObservableCollection<T> getItems<T>(string Path, out string Errmsg, Dictionary<string, string> Paras = null, int RetryNum = 3)
static ObservableCollection<T> getItems<T>(string Path, out string Errmsg, Dictionary<string, string> Paras = null, int RetryNum = 3, int CountLimt = -1)
{
if (Paras == null)
Paras = new Dictionary<string, string>();
Expand All @@ -199,6 +217,8 @@ static ObservableCollection<T> getItems<T>(string Path, out string Errmsg, Dicti
pRet.Add(item);
if (pList.Count() < 50)
break;
if (CountLimt > 0 && pRet.Count() >= CountLimt)
break;
iOffset += pList.Count();
Paras["offset"] = iOffset.ToString();
}
Expand Down Expand Up @@ -355,10 +375,10 @@ public static Artist getArtist(string ID, out string Errmsg, bool GetItem = fals

if (GetItem)
{
ObservableCollection<Album> albums = getItems<Album>("artists/" + ID + "/albums", out Errmsg, null);
ObservableCollection<Album> albums = getItems<Album>("artists/" + ID + "/albums", out Errmsg, null, CountLimt:100);
if (IncludeEp)
{
ObservableCollection<Album> eps = getItems<Album>("artists/" + ID + "/albums", out Errmsg, new Dictionary<string, string>() { { "filter", "EPSANDSINGLES" } });
ObservableCollection<Album> eps = getItems<Album>("artists/" + ID + "/albums", out Errmsg, new Dictionary<string, string>() { { "filter", "EPSANDSINGLES" } }, CountLimt: 100);
for (int i = 0; i < eps.Count; i++)
{
albums.Add(eps[i]);
Expand Down
3 changes: 3 additions & 0 deletions TIDALDL-UI/TIDALDL-UI/updateLog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#### v1.1.0.17
- Use cloud token

#### v1.1.0.17
- Update token

#### v1.1.0.16
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6528e59

Please sign in to comment.