diff --git a/BUILDS/net5.0/MusicCommands.deps.json b/BUILDS/net5.0/MusicCommands.deps.json
index 51ae4ed..ab767ba 100644
--- a/BUILDS/net5.0/MusicCommands.deps.json
+++ b/BUILDS/net5.0/MusicCommands.deps.json
@@ -14,28 +14,28 @@
"MusicCommands.dll": {}
}
},
- "Discord.Net/3.1.0": {
+ "Discord.Net/3.5.0": {
"dependencies": {
- "Discord.Net.Commands": "3.1.0",
- "Discord.Net.Core": "3.1.0",
- "Discord.Net.Interactions": "3.1.0",
- "Discord.Net.Rest": "3.1.0",
- "Discord.Net.WebSocket": "3.1.0",
- "Discord.Net.Webhook": "3.1.0"
+ "Discord.Net.Commands": "3.5.0",
+ "Discord.Net.Core": "3.5.0",
+ "Discord.Net.Interactions": "3.5.0",
+ "Discord.Net.Rest": "3.5.0",
+ "Discord.Net.WebSocket": "3.5.0",
+ "Discord.Net.Webhook": "3.5.0"
}
},
- "Discord.Net.Commands/3.1.0": {
+ "Discord.Net.Commands/3.5.0": {
"dependencies": {
- "Discord.Net.Core": "3.1.0"
+ "Discord.Net.Core": "3.5.0"
},
"runtime": {
"lib/net5.0/Discord.Net.Commands.dll": {
- "assemblyVersion": "3.1.0.0",
- "fileVersion": "3.1.0.0"
+ "assemblyVersion": "3.5.0.0",
+ "fileVersion": "3.5.0.0"
}
}
},
- "Discord.Net.Core/3.1.0": {
+ "Discord.Net.Core/3.5.0": {
"dependencies": {
"Newtonsoft.Json": "13.0.1",
"System.Collections.Immutable": "5.0.0",
@@ -44,59 +44,59 @@
},
"runtime": {
"lib/net5.0/Discord.Net.Core.dll": {
- "assemblyVersion": "3.1.0.0",
- "fileVersion": "3.1.0.0"
+ "assemblyVersion": "3.5.0.0",
+ "fileVersion": "3.5.0.0"
}
}
},
- "Discord.Net.Interactions/3.1.0": {
+ "Discord.Net.Interactions/3.5.0": {
"dependencies": {
- "Discord.Net.Core": "3.1.0",
- "Discord.Net.Rest": "3.1.0",
- "Discord.Net.WebSocket": "3.1.0",
+ "Discord.Net.Core": "3.5.0",
+ "Discord.Net.Rest": "3.5.0",
+ "Discord.Net.WebSocket": "3.5.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "5.0.0",
"System.Collections.Immutable": "5.0.0",
"System.Reactive": "5.0.0"
},
"runtime": {
"lib/net5.0/Discord.Net.Interactions.dll": {
- "assemblyVersion": "3.1.0.0",
- "fileVersion": "3.1.0.0"
+ "assemblyVersion": "3.5.0.0",
+ "fileVersion": "3.5.0.0"
}
}
},
- "Discord.Net.Rest/3.1.0": {
+ "Discord.Net.Rest/3.5.0": {
"dependencies": {
- "Discord.Net.Core": "3.1.0"
+ "Discord.Net.Core": "3.5.0"
},
"runtime": {
"lib/net5.0/Discord.Net.Rest.dll": {
- "assemblyVersion": "3.1.0.0",
- "fileVersion": "3.1.0.0"
+ "assemblyVersion": "3.5.0.0",
+ "fileVersion": "3.5.0.0"
}
}
},
- "Discord.Net.Webhook/3.1.0": {
+ "Discord.Net.Webhook/3.5.0": {
"dependencies": {
- "Discord.Net.Core": "3.1.0",
- "Discord.Net.Rest": "3.1.0"
+ "Discord.Net.Core": "3.5.0",
+ "Discord.Net.Rest": "3.5.0"
},
"runtime": {
"lib/net5.0/Discord.Net.Webhook.dll": {
- "assemblyVersion": "3.1.0.0",
- "fileVersion": "3.1.0.0"
+ "assemblyVersion": "3.5.0.0",
+ "fileVersion": "3.5.0.0"
}
}
},
- "Discord.Net.WebSocket/3.1.0": {
+ "Discord.Net.WebSocket/3.5.0": {
"dependencies": {
- "Discord.Net.Core": "3.1.0",
- "Discord.Net.Rest": "3.1.0"
+ "Discord.Net.Core": "3.5.0",
+ "Discord.Net.Rest": "3.5.0"
},
"runtime": {
"lib/net5.0/Discord.Net.WebSocket.dll": {
- "assemblyVersion": "3.1.0.0",
- "fileVersion": "3.1.0.0"
+ "assemblyVersion": "3.5.0.0",
+ "fileVersion": "3.5.0.0"
}
}
},
@@ -147,7 +147,7 @@
"System.ValueTuple/4.5.0": {},
"PluginManager/1.0.0": {
"dependencies": {
- "Discord.Net": "3.1.0"
+ "Discord.Net": "3.5.0"
},
"runtime": {
"PluginManager.dll": {}
@@ -161,54 +161,54 @@
"serviceable": false,
"sha512": ""
},
- "Discord.Net/3.1.0": {
+ "Discord.Net/3.5.0": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-GAY7d+k8UN5BsObGpysvg7ca6YwTqvesTouM8S8eBWSmwGnK38iceVkURg0QNAG70tlJ4w8S/BOjocRRvXU2MQ==",
- "path": "discord.net/3.1.0",
- "hashPath": "discord.net.3.1.0.nupkg.sha512"
+ "sha512": "sha512-IUtexpvogudb1rllKBWkIEpBVQoToMjtVo81KPkt+gNMe7KtRDcZJgcn6+72viMtyw0e95OJPXFV5VEA/n2OQQ==",
+ "path": "discord.net/3.5.0",
+ "hashPath": "discord.net.3.5.0.nupkg.sha512"
},
- "Discord.Net.Commands/3.1.0": {
+ "Discord.Net.Commands/3.5.0": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-EZdtrAqj6Uspyz4CvIwFP/UQ4XUpXjIPG1b5LrfAKOo12ks4k6XO7up2h+UsHexk7mEz4sfZxkEXGrW6PSh+/Q==",
- "path": "discord.net.commands/3.1.0",
- "hashPath": "discord.net.commands.3.1.0.nupkg.sha512"
+ "sha512": "sha512-ClTv8aiTlitvS48YatRiTLvgE2f2uKgmHNPVBIuvJBHZO2u4bZCzoN1fid+pZn2sbVOkt8uftlLGzz5DSZlFIA==",
+ "path": "discord.net.commands/3.5.0",
+ "hashPath": "discord.net.commands.3.5.0.nupkg.sha512"
},
- "Discord.Net.Core/3.1.0": {
+ "Discord.Net.Core/3.5.0": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-Oxz3CiWVvenSaHRYZeCKgRqzcWqdjGYmpxVVN2vPikt6bTN+xHAR4jczk8plKDDdINt7Lac37iLsRaqzUtJZpQ==",
- "path": "discord.net.core/3.1.0",
- "hashPath": "discord.net.core.3.1.0.nupkg.sha512"
+ "sha512": "sha512-rCzzaznMVQ+bLMxOpYwTyqm9V22kMy6BxlQisSxemHZDe2Jedz3Clp/a0dToACLz+Dlp3u+jYUfCBnTz7L6f4g==",
+ "path": "discord.net.core/3.5.0",
+ "hashPath": "discord.net.core.3.5.0.nupkg.sha512"
},
- "Discord.Net.Interactions/3.1.0": {
+ "Discord.Net.Interactions/3.5.0": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-XzLChVRQGniUU8kdLMDYEOjifzvrcsOiAdKm/pO/PGPpZSMWSzPWlJUWaQlWMtOImrYULzRejOeoc2/3K3R30Q==",
- "path": "discord.net.interactions/3.1.0",
- "hashPath": "discord.net.interactions.3.1.0.nupkg.sha512"
+ "sha512": "sha512-wE9+V9DJ7r+1s4euOi4sGPIAt4sD7r+Tk5s9mrlbLCHVQTK4KllAvcrL25bPFI38FuFceREEzFoRlTrekSyB2Q==",
+ "path": "discord.net.interactions/3.5.0",
+ "hashPath": "discord.net.interactions.3.5.0.nupkg.sha512"
},
- "Discord.Net.Rest/3.1.0": {
+ "Discord.Net.Rest/3.5.0": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-97kdAYjlNuuOnhRQW/OoGK2oBObvpzZlCSPJjIcI4DneEq6k2WIFhG00fvxK7DCVTlB5BgBMAT1BeRUk4/rUxQ==",
- "path": "discord.net.rest/3.1.0",
- "hashPath": "discord.net.rest.3.1.0.nupkg.sha512"
+ "sha512": "sha512-BnTdLFuuQsKvCv08VQrD4X1Hw2Xp+MELIRQiDiKfG01IiQlRTN+1gc3LB1zXgn5xBvC0HXjHxwV22GrMD9uKHQ==",
+ "path": "discord.net.rest/3.5.0",
+ "hashPath": "discord.net.rest.3.5.0.nupkg.sha512"
},
- "Discord.Net.Webhook/3.1.0": {
+ "Discord.Net.Webhook/3.5.0": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-cZFxFf9H3GUBITlx1b7IskglgjJxSYpOIZOtyVW2WnPp7LpnxlOi1piRG22fH9fdhCC/RyDx3gZtYfN6WzacCw==",
- "path": "discord.net.webhook/3.1.0",
- "hashPath": "discord.net.webhook.3.1.0.nupkg.sha512"
+ "sha512": "sha512-vCIGZS+m88sQDuFmdbUqg+2RIXS/NJWx8ei3MX+ZEYiAvOkDgQfkIlEnU1NKpds6ivTt5GFlv6UzcWubb5VJ1w==",
+ "path": "discord.net.webhook/3.5.0",
+ "hashPath": "discord.net.webhook.3.5.0.nupkg.sha512"
},
- "Discord.Net.WebSocket/3.1.0": {
+ "Discord.Net.WebSocket/3.5.0": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-6OsLNXHNKC/laDKoBD+T0Km0vzqHaCcBOaI/NA8Qsed935MtEOTy7juorF22gF6TYOeoclUgSINrHCY4zWvxpA==",
- "path": "discord.net.websocket/3.1.0",
- "hashPath": "discord.net.websocket.3.1.0.nupkg.sha512"
+ "sha512": "sha512-LjBOvcP40vJ+dhOtBDi8haEeblPAKpAIqR04NBzTM1/0RVavJZH89ovfSQIk42ygkiOaDV4E2x0Mmh6DRoIYcw==",
+ "path": "discord.net.websocket/3.5.0",
+ "hashPath": "discord.net.websocket.3.5.0.nupkg.sha512"
},
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
"type": "package",
diff --git a/BUILDS/net5.0/MusicCommands.dll b/BUILDS/net5.0/MusicCommands.dll
index 58fc01a..bae106e 100644
Binary files a/BUILDS/net5.0/MusicCommands.dll and b/BUILDS/net5.0/MusicCommands.dll differ
diff --git a/BUILDS/net5.0/PluginManager.dll b/BUILDS/net5.0/PluginManager.dll
index 0928abb..4592f3b 100644
Binary files a/BUILDS/net5.0/PluginManager.dll and b/BUILDS/net5.0/PluginManager.dll differ
diff --git a/BUILDS/net5.0/ref/MusicCommands.dll b/BUILDS/net5.0/ref/MusicCommands.dll
index becb33c..da27931 100644
Binary files a/BUILDS/net5.0/ref/MusicCommands.dll and b/BUILDS/net5.0/ref/MusicCommands.dll differ
diff --git a/DiscordBot/DiscordBot.csproj b/DiscordBot/DiscordBot.csproj
index 89fc3d9..53de360 100644
--- a/DiscordBot/DiscordBot.csproj
+++ b/DiscordBot/DiscordBot.csproj
@@ -25,7 +25,7 @@
-
+
diff --git a/DiscordBot/Program.cs b/DiscordBot/Program.cs
index 5f12ecf..ad4efd5 100644
--- a/DiscordBot/Program.cs
+++ b/DiscordBot/Program.cs
@@ -137,7 +137,7 @@ namespace DiscordBot
{
string[] split = line.Split(',');
Console.WriteLine($"Downloading item: {split[1]}");
- await ServerCom.DownloadFileAsync(split[0], split[1], i, lines.Count);
+ await ServerCom.DownloadFileAsync(split[0], "./" + split[1], i, lines.Count);
Functions.WriteColorText($"Downloaded item {split[1]}");
i++;
}
diff --git a/MusicCommands/LinkMusic.cs b/MusicCommands/LinkMusic.cs
index 8247ac8..bf040cc 100644
--- a/MusicCommands/LinkMusic.cs
+++ b/MusicCommands/LinkMusic.cs
@@ -1,26 +1,66 @@
-using Discord.Net;
-
-using System;
-using System.Collections.Generic;
+using System;
using System.IO;
-using System.Linq;
using System.Net;
-using System.Text;
using System.Threading.Tasks;
-
namespace MusicCommands
{
public class LinkMusic
{
- private string URL;
+ public string URL { get; private set; }
+ public LinkType type { get; private set; }
+
+
public LinkMusic(string URL)
{
this.URL = URL;
+ if (URL.StartsWith("https://www.youtube.com/watch?v="))
+ type = LinkType.YOUTUBE;
+ else if (URL.StartsWith("https://open.spotify.com/track/"))
+ type = LinkType.SPOTIFY;
+ else type = LinkType.RAW;
}
- public async Task GetMusicStreamAsync()
+
+ private async Task GetYoutubeVideoID()
{
- WebClient client = new WebClient();
- return await client.OpenReadTaskAsync(this.URL);
+ //https://www.youtube.com/watch?v=i-p--m7qaCM&ab_channel=Leviathan
+ return URL.Split("=")[1].Split('&')[0];
+ }
+
+ public async Task GetStream()
+ {
+ Stream s;
+ if (type == LinkType.SPOTIFY) s = await GetSpotifyMusicStreamAsync();
+ else if (type == LinkType.YOUTUBE) s = await GetYoutubeMusicStreamAsync();
+ else s = await GetRAWMusicStreamAsync();
+ return s;
+ }
+
+ private async Task GetSpotifyMusicStreamAsync()
+ {
+ Stream response = null;
+ return response;
+ }
+
+ private async Task GetYoutubeMusicStreamAsync()
+ {
+ //https://www.youtube.com/get_video_info?video_id={id}&el=detailpage
+ string ID = await GetYoutubeVideoID();
+
+
+ using (var webc = new WebClient())
+ {
+ Stream s = await webc.OpenReadTaskAsync($"https://www.youtube.com/get_video_info?video_id={ID}&el=detailpage");
+ string str = await new StreamReader(s).ReadToEndAsync();
+ Console.WriteLine(str);
+
+ await Task.Delay(-1);
+ }
+ return null;
+ }
+
+ private async Task GetRAWMusicStreamAsync()
+ {
+ return await new WebClient().OpenReadTaskAsync(URL);
}
}
}
diff --git a/MusicCommands/LinkType.cs b/MusicCommands/LinkType.cs
new file mode 100644
index 0000000..3a65356
--- /dev/null
+++ b/MusicCommands/LinkType.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MusicCommands
+{
+ public enum LinkType
+ {
+ YOUTUBE, RAW, SPOTIFY
+ }
+}
diff --git a/MusicCommands/MusicCommands.csproj b/MusicCommands/MusicCommands.csproj
index be8cdaa..a63efed 100644
--- a/MusicCommands/MusicCommands.csproj
+++ b/MusicCommands/MusicCommands.csproj
@@ -2,10 +2,12 @@
net5.0
+ warnings
../BUILDS/
+ none
diff --git a/MusicCommands/lplay.cs b/MusicCommands/lplay.cs
index 43e33f3..fe06e8d 100644
--- a/MusicCommands/lplay.cs
+++ b/MusicCommands/lplay.cs
@@ -7,13 +7,6 @@ using Discord;
using PluginManager.Interfaces;
using PluginManager.Others;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
namespace MusicCommands
{
class lplay : DBCommand
@@ -33,7 +26,6 @@ namespace MusicCommands
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
{
-
Data.voiceChannel = (context.User as IGuildUser)?.VoiceChannel;
if (Data.voiceChannel == null) { await context.Channel.SendMessageAsync("User must be in a voice channel, or a voice channel must be passed as an argument."); return; }
@@ -44,7 +36,7 @@ namespace MusicCommands
if (Data.CurrentlyRunning != null)
Data.CurrentlyRunning.Stop();
LinkMusic music = new LinkMusic(Functions.GetArguments(message)[0]);
- Data.CurrentlyRunning = new MusicPlayer(await music.GetMusicStreamAsync(), discord);
+ Data.CurrentlyRunning = new MusicPlayer(await music.GetStream(), discord);
await Data.CurrentlyRunning.StartSendAudio();
}
}
diff --git a/PluginManager/Online/PluginsManager.cs b/PluginManager/Online/PluginsManager.cs
index 76a1620..dc47cf6 100644
--- a/PluginManager/Online/PluginsManager.cs
+++ b/PluginManager/Online/PluginsManager.cs
@@ -32,15 +32,15 @@ namespace PluginManager.Online
var op = Functions.GetOperatinSystem();
string[] lines = text.Split('\n');
int len = lines.Length;
- string[] titles = { "Name", "Description", "Plugin Type" };
- data.Add(new string[] { "-", "-", "-" });
+ string[] titles = { "Name", "Description", "Plugin Type", "Libraries" };
+ data.Add(new string[] { "-", "-", "-", "-" });
data.Add(titles);
- data.Add(new string[] { "-", "-", "-" });
+ data.Add(new string[] { "-", "-", "-", "-" });
for (int i = 0; i < len; i++)
{
if (lines[i].Length <= 2) continue;
string[] content = lines[i].Split(',');
- string[] display = new string[3];
+ string[] display = new string[4];
if (op == PluginManager.Others.OperatingSystem.WINDOWS)
{
if (content[4].Contains("Windows"))
@@ -48,6 +48,10 @@ namespace PluginManager.Online
display[0] = content[0];
display[1] = content[1];
display[2] = content[2];
+ if (content.Length == 6 && (content[5] != null || content[5].Length > 2))
+ display[3] = ((await ServerCom.ReadTextFromFile(content[5])).Count + 1).ToString();
+
+ else display[3] = "1";
data.Add(display);
continue;
}
@@ -65,7 +69,7 @@ namespace PluginManager.Online
}
}
- data.Add(new string[] { "-", "-", "-" });
+ data.Add(new string[] { "-", "-", "-", "-" });
Functions.FormatAndAlignTable(data);
}
diff --git a/PluginManager/Online/ServerCom.cs b/PluginManager/Online/ServerCom.cs
index df24653..c5df790 100644
--- a/PluginManager/Online/ServerCom.cs
+++ b/PluginManager/Online/ServerCom.cs
@@ -33,7 +33,7 @@ namespace PluginManager.Online
string oldTitle = Console.Title ?? "";
client.DownloadProgressChanged += (sender, e) =>
{
- Console.Title = e.BytesReceived / 1024 + "/" + e.TotalBytesToReceive / 1024 + " (" + e.ProgressPercentage + "%) (" + downloadNumber + " / " + totalToDownload + ")";
+ Console.Title = e.BytesReceived + "/" + e.TotalBytesToReceive + " (" + e.ProgressPercentage + "%) (" + downloadNumber + " / " + totalToDownload + ")";
};
client.DownloadFileCompleted += (sender, e) =>
{
diff --git a/PluginManager/Others/Functions.cs b/PluginManager/Others/Functions.cs
index 6cd2e85..f8cece8 100644
--- a/PluginManager/Others/Functions.cs
+++ b/PluginManager/Others/Functions.cs
@@ -174,14 +174,68 @@ namespace PluginManager.Others
return command.Arguments;
}
+
///
/// A way to create a table based on input data
- /// EpicWings (Pasca Robert) este cel mai bun
- /// Special thanks to Kami-sama <3
///
/// The List of arrays of strings that represent the rows.
public static void FormatAndAlignTable(List data)
{
+ char tableLine = '-';
+ char tableCross = '+';
+ char tableWall = '|';
+
+ int[] len = new int[data[0].Length];
+ foreach (var line in data)
+ {
+ for (int i = 0; i < line.Length; i++)
+ if (line[i].Length > len[i])
+ len[i] = line[i].Length;
+ }
+
+
+ foreach (string[] row in data)
+ {
+ //Console.Write("\t");
+ if (row[0][0] == tableLine) Console.Write(tableCross);
+ else Console.Write(tableWall);
+ for (int l = 0; l < row.Length; l++)
+ {
+ if (row[l][0] == tableLine)
+ {
+ for (int i = 0; i < len[l] + 4; ++i)
+ Console.Write(tableLine);
+ }
+ else if (row[l].Length == len[l])
+ {
+ Console.Write(" ");
+ Console.Write(row[l]);
+ Console.Write(" ");
+ }
+ else
+ {
+
+ int lenHalf = row[l].Length / 2;
+ for (int i = 0; i < ((len[l] + 4) / 2 - lenHalf); ++i)
+ Console.Write(" ");
+ Console.Write(row[l]);
+ for (int i = (len[l] + 4) / 2 + lenHalf + 1; i < len[l] + 4; ++i)
+ Console.Write(" ");
+ if (row[l].Length % 2 == 0)
+ Console.Write(" ");
+ }
+
+ if (row[l][0] == tableLine) Console.Write(tableCross);
+ else Console.Write(tableWall);
+ }
+ Console.WriteLine(); //end line
+
+ }
+
+
+ //Obsolite
+ #region Old Code -> Spacing by the lomgest item in any cell
+ /*
int maxLen = 0;
foreach (string[] row in data)
foreach (string s in row)
@@ -192,7 +246,7 @@ namespace PluginManager.Others
foreach (string[] row in data)
{
- Console.Write("\t");
+ //Console.Write("\t");
if (row[0] == "-") Console.Write("+");
else Console.Write("|");
@@ -225,7 +279,8 @@ namespace PluginManager.Others
else Console.Write("|");
}
Console.WriteLine(); //end line
- }
+ }*/
+ #endregion
}
///
diff --git a/PluginManager/PluginManager.csproj b/PluginManager/PluginManager.csproj
index c084911..2ceefd2 100644
--- a/PluginManager/PluginManager.csproj
+++ b/PluginManager/PluginManager.csproj
@@ -6,7 +6,7 @@
-
+