Skip to content

Commit 87aef78

Browse files
author
Meyn
committed
Full code Cleanup
1 parent 7b42132 commit 87aef78

File tree

153 files changed

+360
-242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+360
-242
lines changed

Tubifarry/Blocklisting/BaseBlocklist.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ public abstract class BaseBlocklist<TProtocol>(IBlocklistRepository blocklistRep
3131

3232
private static bool SameRelease(Blocklist item, ReleaseInfo release) => release.Guid.IsNotNullOrWhiteSpace() ? release.Guid.Equals(item.TorrentInfoHash) : item.Indexer.Equals(release.Indexer, StringComparison.InvariantCultureIgnoreCase);
3333
}
34-
}
34+
}

Tubifarry/Blocklisting/Blocklists.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ public class YoutubeBlocklist(IBlocklistRepository blocklistRepository) : BaseBl
88

99
public class SoulseekBlocklist(IBlocklistRepository blocklistRepository) : BaseBlocklist<SoulseekDownloadProtocol>(blocklistRepository)
1010
{ }
11-
}
11+
}

Tubifarry/Core/Model/AlbumData.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public partial class AlbumData(string name, string downloadProtocol)
1717

1818
// Properties from AlbumInfo
1919
public string AlbumName { get; set; } = string.Empty;
20+
2021
public string ArtistName { get; set; } = string.Empty;
2122
public string InfoUrl { get; set; } = string.Empty;
2223
public string ReleaseDate { get; set; } = string.Empty;
@@ -29,11 +30,13 @@ public partial class AlbumData(string name, string downloadProtocol)
2930

3031
// Properties from YoutubeSearchResults
3132
public int Bitrate { get; set; }
33+
3234
public int BitDepth { get; set; }
3335
public long Duration { get; set; }
3436

3537
// Soulseek
3638
public long? Size { get; set; }
39+
3740
public int Priotity { get; set; }
3841
public List<string>? ExtraInfo { get; set; }
3942

@@ -126,6 +129,7 @@ private static string NormalizeAlbumName(string albumName)
126129

127130
[GeneratedRegex(@"(?i)\b(feat\.|ft\.|featuring)\b", RegexOptions.IgnoreCase, "de-DE")]
128131
private static partial Regex FeatRegex();
132+
129133
[GeneratedRegex(@"\((?!feat\.)[^)]*\)")]
130134
private static partial Regex FeatReplaceRegex();
131135
}

Tubifarry/Core/Model/ApiCircuitBreaker.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ namespace Tubifarry.Core.Model
66
public interface ICircuitBreaker
77
{
88
bool IsOpen { get; }
9+
910
void RecordSuccess();
11+
1012
void RecordFailure();
13+
1114
void Reset();
1215
}
1316

Tubifarry/Core/Model/AudioMetadataHandler.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,10 @@ public AudioMetadataHandler(string originalPath)
100100
"-movflags +faststart"
101101
];
102102

103-
104103
private static readonly string[] VideoFormats =
105104
[
106105
"matroska", "webm", // Matroska/WebM containers
107-
"mov", "mp4", "m4a", // QuickTime/MP4 containers
106+
"mov", "mp4", "m4a", // QuickTime/MP4 containers
108107
"avi", // AVI containers
109108
"asf", "wmv", "wma", // Windows Media containers
110109
"flv", "f4v", // Flash containers
@@ -209,7 +208,6 @@ public async Task<bool> TryExtractAudioFromVideoAsync()
209208
if (!isVideo)
210209
return await EnsureFileExtAsync();
211210

212-
213211
_logger?.Trace($"Extracting audio from video file: {Path.GetFileName(TrackPath)}");
214212

215213
try
@@ -416,7 +414,6 @@ public bool TryEmbedMetadata(Album albumInfo, Track trackInfo)
416414
/// <returns>True if the format can be used as a conversion target, false otherwise</returns>
417415
public static bool IsTargetFormatSupportedForEncoding(AudioFormat format) => BaseConversionParameters.ContainsKey(format);
418416

419-
420417
///// <summary>
421418
///// Checks if a given audio format supports embedded metadata tags.
422419
///// </summary>

Tubifarry/Core/Model/FileCache.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ public void CheckDirectory()
136136
throw new InvalidOperationException($"Cache directory validation failed: {ex.Message}", ex);
137137
}
138138
}
139-
140139
}
141140

142141
public class CachedData<T>
@@ -145,4 +144,4 @@ public class CachedData<T>
145144
public DateTime CreatedAt { get; set; }
146145
public TimeSpan ExpirationDuration { get; set; }
147146
}
148-
}
147+
}

Tubifarry/Core/Model/TrustedSessionException.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@
55
/// </summary>
66
public class TrustedSessionException : Exception
77
{
8-
public TrustedSessionException(string message) : base(message) { }
9-
public TrustedSessionException(string message, Exception innerException) : base(message, innerException) { }
10-
public TrustedSessionException() { }
11-
}
8+
public TrustedSessionException(string message) : base(message)
9+
{
10+
}
11+
12+
public TrustedSessionException(string message, Exception innerException) : base(message, innerException)
13+
{
14+
}
1215

13-
}
16+
public TrustedSessionException()
17+
{ }
18+
}
19+
}

Tubifarry/Core/Records/Lyric.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ public static List<SyncLine> ParseSyncedLyrics(string syncedLyrics)
5858
[GeneratedRegex("\\[(\\d{2}:\\d{2}\\.\\d{2})\\](.*)")]
5959
private static partial Regex TagRegex();
6060
}
61-
}
61+
}

Tubifarry/Core/Records/MusicBrainzData.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public record MusicBrainzAlbumItem(string? AlbumId, string? Title, string? Type,
2121
if (releaseGroup == null)
2222
return null;
2323

24-
var secondaryTypes = new List<string>();
25-
var secondaryTypeList = releaseGroup.Element(ns + "secondary-type-list");
24+
List<string> secondaryTypes = new();
25+
XElement? secondaryTypeList = releaseGroup.Element(ns + "secondary-type-list");
2626
if (secondaryTypeList != null)
2727
{
2828
secondaryTypes = secondaryTypeList.Elements(ns + "secondary-type")
@@ -42,4 +42,4 @@ public record MusicBrainzAlbumItem(string? AlbumId, string? Title, string? Type,
4242
DateTime.TryParse(releaseGroup.Element(ns + "first-release-date")?.Value, out DateTime date) ? date : DateTime.MinValue);
4343
}
4444
}
45-
}
45+
}

Tubifarry/Core/Records/YouTubeSession.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,4 @@ private static bool CookiesAreEquivalent(Cookie[]? cookies1, Cookie[]? cookies2)
7676
pair.First.Value == pair.Second.Value);
7777
}
7878
}
79-
80-
}
79+
}

0 commit comments

Comments
 (0)