Fix random null issue - ratelimit
This commit is contained in:
parent
ae18eea463
commit
35629a3e13
3 changed files with 14 additions and 10 deletions
|
@ -38,23 +38,23 @@
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SpotifyAPI.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="SpotifyAPI.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\packages\SpotifyAPI.Web.4.1.0\lib\net46\SpotifyAPI.Web.dll</HintPath>
|
<HintPath>..\packages\SpotifyAPI.Web.4.2.0\lib\netstandard2.0\SpotifyAPI.Web.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SpotifyAPI.Web.Auth, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="SpotifyAPI.Web.Auth, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\packages\SpotifyAPI.Web.Auth.4.1.0\lib\net46\SpotifyAPI.Web.Auth.dll</HintPath>
|
<HintPath>..\packages\SpotifyAPI.Web.Auth.4.2.0\lib\netstandard2.0\SpotifyAPI.Web.Auth.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Unosquare.Labs.EmbedIO, Version=2.2.7.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="Unosquare.Labs.EmbedIO, Version=2.8.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\packages\EmbedIO.2.2.7\lib\net472\Unosquare.Labs.EmbedIO.dll</HintPath>
|
<HintPath>..\packages\EmbedIO.2.9.1\lib\netstandard2.0\Unosquare.Labs.EmbedIO.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Unosquare.Swan.Lite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="Unosquare.Swan.Lite, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>..\packages\Unosquare.Swan.Lite.0.38.1\lib\net452\Unosquare.Swan.Lite.dll</HintPath>
|
<HintPath>..\packages\Unosquare.Swan.Lite.1.3.0\lib\net461\Unosquare.Swan.Lite.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
@ -81,11 +82,14 @@ namespace HiddenUpdater
|
||||||
{
|
{
|
||||||
var artist = spotify.GetArtist((string) kv.Value["sid"]);
|
var artist = spotify.GetArtist((string) kv.Value["sid"]);
|
||||||
var artJson = kv.Value;
|
var artJson = kv.Value;
|
||||||
|
if (artist.HasError())
|
||||||
|
Console.WriteLine(artist.Name + " - Error: " + artist.Error.Status + " - " + artist.Error.Message);
|
||||||
artJson["followers"] = artist?.Followers?.Total;
|
artJson["followers"] = artist?.Followers?.Total;
|
||||||
artJson["popularity"] = artist?.Popularity;
|
artJson["popularity"] = artist?.Popularity;
|
||||||
artJson["genres"] = new JArray(artist?.Genres);
|
artJson["genres"] = new JArray(artist?.Genres);
|
||||||
C++;
|
C++;
|
||||||
if (C % 10 == 0) Console.Write("\r" + C + "/" + max + " - " + (C / (float) max) * 100 + "%");
|
if (C % 10 == 0) Console.Write("\r" + C + "/" + max + " - " + (C / (float) max) * 100 + "%");
|
||||||
|
if(C % 100 == 0) Thread.Sleep(2000); //It exceeded the ratelimit after 120-something
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("\r" + C + "/" + max + " - " + (C / (float) max) * 100 + "%");
|
Console.WriteLine("\r" + C + "/" + max + " - " + (C / (float) max) * 100 + "%");
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="EmbedIO" version="2.2.7" targetFramework="net472" />
|
<package id="EmbedIO" version="2.9.1" targetFramework="net472" />
|
||||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
|
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
|
||||||
<package id="SpotifyAPI.Web" version="4.1.0" targetFramework="net472" />
|
<package id="SpotifyAPI.Web" version="4.2.0" targetFramework="net472" />
|
||||||
<package id="SpotifyAPI.Web.Auth" version="4.1.0" targetFramework="net472" />
|
<package id="SpotifyAPI.Web.Auth" version="4.2.0" targetFramework="net472" />
|
||||||
<package id="Unosquare.Swan.Lite" version="0.38.1" targetFramework="net472" />
|
<package id="Unosquare.Swan.Lite" version="1.3.0" targetFramework="net472" />
|
||||||
</packages>
|
</packages>
|
Loading…
Reference in a new issue