Skip to content

Commit

Permalink
youtube async
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAndreiM committed Jul 28, 2024
1 parent cf91123 commit 3c066fc
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 156 deletions.
10 changes: 5 additions & 5 deletions src/Juka/GUI/Clicked.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static void ResumeVideo()
}
}

public static void itemclicked()
public static async void itemclicked()
{

if (keyboardOn == true)
Expand All @@ -92,8 +92,8 @@ public static void itemclicked()
if (Menus.MediaPlayer == currentscreen)
{
var apikey = "AIzaSyBzpZzE4nQVxr_EQLgWqTfREpvWON - gWu8";
var youtube = new YouTubeApiService(apikey);
var videos = youtube.GetTopVideosSync();
youtube = new YouTubeApiService(apikey);
var videos = await youtube.GetTopVideosAsync();

videoInfos = videos.Select(v => new VideoInfo
{
Expand Down Expand Up @@ -133,7 +133,7 @@ public static void itemclicked()
}
else if (menuOptions[Menus.MenuMain][i] == "Media Downloader")
{
Helper.GenerateMedia();
await Helper.GenerateMedia();
currentscreen = Menus.MediaPlayer;
}
else
Expand Down Expand Up @@ -176,7 +176,7 @@ public static void itemclicked()
{
if (menuOptions[Menus.MediaPlayer][i] == "Back")
{
YouTubeApiService.DeleteThumbnails(videoInfos);
youtube.DeleteThumbnails(videoInfos);
currentscreen = Menus.MenuMain;
}
else if(menuOptions[Menus.MediaPlayer][i] == "Search")
Expand Down
2 changes: 2 additions & 0 deletions src/Juka/GUI/Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public enum Menus
public static Process ffplayProcess;
public static StreamWriter ffplayInput;

public static YouTubeApiService youtube;

}

public class Descript<T>
Expand Down
4 changes: 2 additions & 2 deletions src/Juka/GUI/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ public static async Task GeneratePackages()
//packages
}

public static void GenerateMedia()
public static async Task GenerateMedia()
{
var apikey = "AIzaSyBzpZzE4nQVxr_EQLgWqTfREpvWON - gWu8";
var youtube = new YouTubeApiService(apikey);
var videos = youtube.GetTopVideosSync();
var videos = await youtube.GetTopVideosAsync();

videoInfos = videos.Select(v => new VideoInfo
{
Expand Down
Loading

0 comments on commit 3c066fc

Please sign in to comment.