[CHANGE] Reworked parsers/converters. Decipher operation from script do not work!
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
using Manager.App.Models.System;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using MudBlazor;
|
||||
|
||||
namespace Manager.App.Components.Application.Dev;
|
||||
|
||||
public partial class DevelopmentVideo : ComponentBase
|
||||
{
|
||||
private YouTubeClientItem? _selectedClient;
|
||||
private string _videoId = "";
|
||||
|
||||
private async Task<IEnumerable<YouTubeClientItem>> SearchClientsAsync(string? search, CancellationToken cancellationToken)
|
||||
{
|
||||
var searchResults = await ClientService.GetClientsAsync(search, cancellationToken: cancellationToken);
|
||||
return !searchResults.IsSuccess ? [] : searchResults.Value;
|
||||
}
|
||||
|
||||
private async Task GetDataAsync(MouseEventArgs obj)
|
||||
{
|
||||
if (_selectedClient == null)
|
||||
{
|
||||
Snackbar.Add("No client selected!", Severity.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(_videoId))
|
||||
{
|
||||
Snackbar.Add("No video ID set!", Severity.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_videoId.Length != 11)
|
||||
{
|
||||
Snackbar.Add("Video ID needs to have an length of 11 chars!", Severity.Warning);
|
||||
}
|
||||
|
||||
var clientResult = await ClientService.LoadClientByIdAsync(_selectedClient.Id);
|
||||
if (!clientResult.IsSuccess)
|
||||
{
|
||||
Snackbar.Add(clientResult.Error?.Description ?? $"Failed to get client with id: {_selectedClient.Id}", Severity.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var ytClient = clientResult.Value;
|
||||
var videoResult = await ytClient.GetVideoByIdAsync(_videoId);
|
||||
if (!videoResult.IsSuccess)
|
||||
{
|
||||
Snackbar.Add(videoResult.Error?.Description ?? $"Failed to load video: {_videoId}", Severity.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var ytVideo = videoResult.Value;
|
||||
Snackbar.Add($"Loaded video {ytVideo.Title}", Severity.Success);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user