BigBoyConst
BigBoyConst
CC#
Created by BigBoyConst on 2/26/2024 in #help
✅ Editing audio file metadata with TagLib Sharp
well thanks a lot :D
15 replies
CC#
Created by BigBoyConst on 2/26/2024 in #help
✅ Editing audio file metadata with TagLib Sharp
that makes sense
15 replies
CC#
Created by BigBoyConst on 2/26/2024 in #help
✅ Editing audio file metadata with TagLib Sharp
ah i see
15 replies
CC#
Created by BigBoyConst on 2/26/2024 in #help
✅ Editing audio file metadata with TagLib Sharp
well it throws at line 50 but the error is actually at line 48
15 replies
CC#
Created by BigBoyConst on 2/26/2024 in #help
✅ Editing audio file metadata with TagLib Sharp
Console.Write("Input the path of the file you want to edit: ");

string path = Console.ReadLine() ?? throw new Exception();
path = path.Substring(1, path.Length - 2);
Console.WriteLine("Path: {0}", path);

Console.WriteLine("Current metadata: ");
Console.WriteLine(new string('-', 30));
GetMetadata(path);
Console.WriteLine(new string('-', 30));

ChangeMetadata(path);

Console.WriteLine("New metadata: ");
Console.WriteLine(new string('-', 30));
GetMetadata(path);
Console.WriteLine(new string('-', 30));

static void GetMetadata(string path)
{
var tFile = TagLib.File.Create(path);
string title, artist, album, genre;
uint trackNumber, year;
title = tFile.Tag.Title;
artist = tFile.Tag.FirstPerformer;
album = tFile.Tag.Album;
trackNumber = tFile.Tag.Track;
genre = tFile.Tag.FirstGenre;
year = tFile.Tag.Year;

foreach (var item in new string[] { title, artist, album, genre, trackNumber.ToString(), year.ToString() })
{
Console.WriteLine(string.IsNullOrEmpty(item) ? "none" : item);
}
}
// Change Artist, Album, Track no., Genre, Title, Year
static void ChangeMetadata(string path)
{
var tFile = TagLib.File.Create(path);

string[] uintMessages = { "Insert track no.: ", "Insert year: " };

Console.Write("Insert song title: ");
tFile.Tag.Title = Console.ReadLine();

Console.Write("Insert artist name: ");
tFile.Tag.Performers = new string[1];
tFile.Tag.Performers[0] = Console.ReadLine();

Console.Write("Insert album name: ");
tFile.Tag.Album = Console.ReadLine();

Console.Write("Insert genre: ");
tFile.Tag.Genres = new string[1];
tFile.Tag.Genres[0] = Console.ReadLine();

tFile.Tag.Track = ReadUInt(uintMessages[0]);

tFile.Tag.Year = ReadUInt(uintMessages[1]);

tFile.Save();
}

static uint ReadUInt(string message)
{
uint val;
do
Console.Write(message);
while (!uint.TryParse(Console.ReadLine(), out val));
return val;
}
Console.Write("Input the path of the file you want to edit: ");

string path = Console.ReadLine() ?? throw new Exception();
path = path.Substring(1, path.Length - 2);
Console.WriteLine("Path: {0}", path);

Console.WriteLine("Current metadata: ");
Console.WriteLine(new string('-', 30));
GetMetadata(path);
Console.WriteLine(new string('-', 30));

ChangeMetadata(path);

Console.WriteLine("New metadata: ");
Console.WriteLine(new string('-', 30));
GetMetadata(path);
Console.WriteLine(new string('-', 30));

static void GetMetadata(string path)
{
var tFile = TagLib.File.Create(path);
string title, artist, album, genre;
uint trackNumber, year;
title = tFile.Tag.Title;
artist = tFile.Tag.FirstPerformer;
album = tFile.Tag.Album;
trackNumber = tFile.Tag.Track;
genre = tFile.Tag.FirstGenre;
year = tFile.Tag.Year;

foreach (var item in new string[] { title, artist, album, genre, trackNumber.ToString(), year.ToString() })
{
Console.WriteLine(string.IsNullOrEmpty(item) ? "none" : item);
}
}
// Change Artist, Album, Track no., Genre, Title, Year
static void ChangeMetadata(string path)
{
var tFile = TagLib.File.Create(path);

string[] uintMessages = { "Insert track no.: ", "Insert year: " };

Console.Write("Insert song title: ");
tFile.Tag.Title = Console.ReadLine();

Console.Write("Insert artist name: ");
tFile.Tag.Performers = new string[1];
tFile.Tag.Performers[0] = Console.ReadLine();

Console.Write("Insert album name: ");
tFile.Tag.Album = Console.ReadLine();

Console.Write("Insert genre: ");
tFile.Tag.Genres = new string[1];
tFile.Tag.Genres[0] = Console.ReadLine();

tFile.Tag.Track = ReadUInt(uintMessages[0]);

tFile.Tag.Year = ReadUInt(uintMessages[1]);

tFile.Save();
}

static uint ReadUInt(string message)
{
uint val;
do
Console.Write(message);
while (!uint.TryParse(Console.ReadLine(), out val));
return val;
}
15 replies
CC#
Created by BigBoyConst on 2/26/2024 in #help
✅ Editing audio file metadata with TagLib Sharp
alright, it's horrible tho haha
15 replies
CC#
Created by BigBoyConst on 2/26/2024 in #help
✅ Editing audio file metadata with TagLib Sharp
that's what I'm doing
15 replies
CC#
Created by BigBoyConst on 1/31/2024 in #help
Setting a template project
its a basic college OOP class
14 replies
CC#
Created by BigBoyConst on 1/31/2024 in #help
Setting a template project
im not like doing advanced programming
14 replies
CC#
Created by BigBoyConst on 1/31/2024 in #help
Setting a template project
cause i dont like having the green squiggly line every time i do Console.ReadLine
14 replies
CC#
Created by BigBoyConst on 1/31/2024 in #help
Setting a template project
to be clearer, i want it to kinda replace the base project that you get when creating a console app with the comment and the hello world text
14 replies
CC#
Created by BigBoyConst on 12/17/2023 in #help
Graphs OOP app
No description
9 replies
CC#
Created by BigBoyConst on 12/17/2023 in #help
Graphs OOP app
thanks for the suggestion
9 replies
CC#
Created by BigBoyConst on 12/17/2023 in #help
Graphs OOP app
ah i see
9 replies
CC#
Created by BigBoyConst on 12/17/2023 in #help
Graphs OOP app
what's the difference?
9 replies