Skip to content

Commit

Permalink
bump
Browse files Browse the repository at this point in the history
  • Loading branch information
kcrg committed Jan 22, 2025
1 parent 6e38353 commit ab92938
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Binary file modified external/YoutubeExplode.dll
Binary file not shown.
9 changes: 9 additions & 0 deletions src/Helpers/DataFormattingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,13 @@ public static string ToTimestampString(this double totalSeconds)
? $"{viewCount / 1_000_000D:0.#}M"
: viewCount >= 1_000 ? $"{viewCount / 1_000D:0.#}K" : viewCount.ToString();
}

public static string? ToCompactNumberString(this long? viewCount)
{
return viewCount >= 1_000_000_000
? $"{viewCount / 1_000_000_000D:0.#}B"
: viewCount >= 1_000_000
? $"{viewCount / 1_000_000D:0.#}M"
: viewCount >= 1_000 ? $"{viewCount / 1_000D:0.#}K" : viewCount.ToString();
}
}
4 changes: 2 additions & 2 deletions src/Services/SearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public async Task<List<SearchResult>> SearchAsync(string query)
Title = video.Title,
Timestamp = video.Duration!.Value.TotalSeconds.ToTimestampString(),
Author = video.Author.ChannelTitle,
Ago = "No upload date", //video.SimpleUploadDate ?? "No upload date",
Views = "No view count", //video.ViewCount.ToCompactNumberString(),
Ago = video.SimpleUploadDate ?? "No upload date",

Check failure on line 40 in src/Services/SearchService.cs

View workflow job for this annotation

GitHub Actions / build

'VideoSearchResult' does not contain a definition for 'SimpleUploadDate' and no accessible extension method 'SimpleUploadDate' accepting a first argument of type 'VideoSearchResult' could be found (are you missing a using directive or an assembly reference?)
Views = video.ViewCount.ToCompactNumberString(),

Check failure on line 41 in src/Services/SearchService.cs

View workflow job for this annotation

GitHub Actions / build

'VideoSearchResult' does not contain a definition for 'ViewCount' and no accessible extension method 'ViewCount' accepting a first argument of type 'VideoSearchResult' could be found (are you missing a using directive or an assembly reference?)
Seconds = (int?)video.Duration.Value.TotalSeconds
};
searchResults.Add(result);
Expand Down

0 comments on commit ab92938

Please sign in to comment.