Skip to content

Commit 346e9eb

Browse files
author
Meyn
committed
Fix LucidaRecords
1 parent f703f2c commit 346e9eb

File tree

4 files changed

+7
-32
lines changed

4 files changed

+7
-32
lines changed

Tubifarry/Download/Clients/Lucida/LucidaDownloadRequest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,9 @@ private void InitiateDownload(string url, string primaryToken, string fallbackTo
271271

272272
private async Task<bool> PollForCompletionAsync(string handoffId, string serverName, CancellationToken token)
273273
{
274-
const int baseAttempts = 10;
274+
const int baseAttempts = 15;
275275
int delayMs = 3000;
276-
int serviceUnavailableExtensions = 0;
276+
int serviceUnavailableExtensions = 1;
277277
const int maxServiceUnavailableExtensions = 20; // Up to 100 minutes total
278278

279279
await Task.Delay(delayMs * 2, token);

Tubifarry/Download/Clients/YouTube/TrustedSessionHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ private static bool IsNodeJsAvailable()
363363
catch (Exception ex)
364364
{
365365
_nodeJsAvailable = false;
366-
_logger.Warn(ex, "Node.js environment is not available for local token generation: {Message}", ex.Message);
366+
_logger.Trace(ex, "Node.js environment is not available for local token generation: {Message}", ex.Message);
367367
return false;
368368
}
369369
finally

Tubifarry/Indexers/Lucida/LucidaIndexerSettings.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,12 @@ public class LucidaIndexerSettings : IIndexerSettings
4747

4848
public LucidaIndexerSettings()
4949
{
50-
BaseUrl = "https://lucida.to";
5150
CountryCode = "US";
5251
RequestTimeout = 60;
5352
_servicePriorities = _defaultPriorities.ToList();
5453
}
5554

56-
[FieldDefinition(0, Label = "Base URL", Type = FieldType.Textbox, HelpText = "URL of the Lucida instance")]
55+
[FieldDefinition(0, Label = "Base URL", Type = FieldType.Textbox, HelpText = "URL of the Lucida instance", Placeholder = "https://lucida.to")]
5756
public string BaseUrl { get; set; }
5857

5958
[FieldDefinition(1, Label = "Country Code", Type = FieldType.Textbox, HelpText = "Two-letter country code for service regions separated by ;")]

Tubifarry/Indexers/Lucida/LucidaRecords.cs

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,6 @@ public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOp
2929
}
3030
}
3131

32-
/// <summary>
33-
/// Custom JSON converter that handles both string and numeric IDs, converting them to long
34-
/// </summary>
35-
public class FlexibleLongConverter : JsonConverter<long>
36-
{
37-
public override long Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
38-
{
39-
return reader.TokenType switch
40-
{
41-
JsonTokenType.Number => reader.GetInt64(),
42-
JsonTokenType.String => long.TryParse(reader.GetString(), out long result) ? result :
43-
throw new JsonException($"Cannot convert string '{reader.GetString()}' to long"),
44-
_ => throw new JsonException($"Cannot convert token type {reader.TokenType} to long")
45-
};
46-
}
47-
48-
public override void Write(Utf8JsonWriter writer, long value, JsonSerializerOptions options)
49-
{
50-
writer.WriteNumberValue(value);
51-
}
52-
}
53-
5432
/// <summary>
5533
/// Custom JSON converter for flexible float handling
5634
/// </summary>
@@ -242,7 +220,7 @@ public CountryResponse() : this(false) { }
242220
public record LucidaInfo(
243221
[property: JsonPropertyName("success")] bool Success,
244222
[property: JsonPropertyName("type")] string Type = "",
245-
[property: JsonPropertyName("id"), JsonConverter(typeof(FlexibleLongConverter))] long Id = 0,
223+
[property: JsonPropertyName("id"), JsonConverter(typeof(FlexibleStringConverter))] string Id = "",
246224
[property: JsonPropertyName("url")] string Url = "",
247225
[property: JsonPropertyName("title")] string Title = "",
248226
[property: JsonPropertyName("durationMs")] long DurationMs = 0,
@@ -305,23 +283,21 @@ public record LucidaArtworkInfo(
305283
/// Album reference within track info
306284
/// </summary>
307285
public record LucidaAlbumRef(
308-
[property: JsonPropertyName("id"), JsonConverter(typeof(FlexibleLongConverter))] long Id,
286+
[property: JsonPropertyName("id"), JsonConverter(typeof(FlexibleStringConverter))] string Id = "",
309287
[property: JsonPropertyName("url")] string Url = "",
310288
[property: JsonPropertyName("title")] string Title = "",
311289
[property: JsonPropertyName("releaseDate")] string? ReleaseDate = null)
312290
{
313291
[JsonPropertyName("coverArtwork")]
314292
public LucidaArtworkInfo[] CoverArtwork { get; init; } = Array.Empty<LucidaArtworkInfo>();
315-
316-
public LucidaAlbumRef() : this(0) { }
317293
};
318294

319295
/// <summary>
320296
/// Track info within album
321297
/// </summary>
322298
public record LucidaTrackInfo(
323299
[property: JsonPropertyName("url")] string Url = "",
324-
[property: JsonPropertyName("id"), JsonConverter(typeof(FlexibleLongConverter))] long Id = 0,
300+
[property: JsonPropertyName("id"), JsonConverter(typeof(FlexibleStringConverter))] string Id = "",
325301
[property: JsonPropertyName("title")] string Title = "",
326302
[property: JsonPropertyName("durationMs")] long DurationMs = 0,
327303
[property: JsonPropertyName("isrc")] string? Isrc = null,

0 commit comments

Comments
 (0)