Check Gfycat transcode status less frequently

This commit is contained in:
Jaex 2019-03-12 11:33:55 +03:00
parent 36f4c327f7
commit 9bc1c0cbe0

View file

@ -72,10 +72,10 @@ public class GfycatUploader : FileUploader, IOAuth2
public OAuth2Info AuthInfo { get; set; }
public AccountType UploadMethod { get; set; }
public OAuth2Token AnonymousToken { get; set; }
public bool NoResize { get; set; }
public bool IgnoreExisting { get; set; }
public bool Private { get; set; }
public bool KeepAudio { get; set; }
public bool NoResize { get; set; } = true;
public bool IgnoreExisting { get; set; } = true;
public bool Private { get; set; } = true;
public bool KeepAudio { get; set; } = true;
private const string URL_AUTHORIZE = "https://gfycat.com/oauth/authorize";
private const string URL_UPLOAD = "https://filedrop.gfycat.com";
@ -87,9 +87,6 @@ public class GfycatUploader : FileUploader, IOAuth2
public GfycatUploader(OAuth2Info oauth)
{
AuthInfo = oauth;
NoResize = true;
IgnoreExisting = true;
KeepAudio = true;
}
public string GetAuthorizationURL()
@ -219,6 +216,7 @@ private void WaitForTranscode(string name, UploadResult result)
}
int iterations = 0;
while (!StopUploadRequested)
{
string statusJson = SendRequest(HttpMethod.GET, URL_API_STATUS + name);
@ -243,7 +241,7 @@ private void WaitForTranscode(string name, UploadResult result)
break;
}
else if ((response.Task.Equals("NotFoundo", StringComparison.InvariantCultureIgnoreCase) ||
response.Task.Equals("NotFound", StringComparison.InvariantCultureIgnoreCase)) && iterations > 10)
response.Task.Equals("NotFound", StringComparison.InvariantCultureIgnoreCase)) && iterations > 5)
{
Errors.Add("Gfy not found");
result.IsSuccess = false;
@ -255,7 +253,7 @@ private void WaitForTranscode(string name, UploadResult result)
OnProgressChanged(progress);
}
Thread.Sleep(100);
Thread.Sleep(500);
iterations++;
}
}