Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export the list of Artist / Album in the clipboard to be pasted anywhere #3

Open
CyberSinh opened this issue Aug 12, 2017 · 0 comments
Labels

Comments

@CyberSinh
Copy link
Member

// Export the list of Artist / Album in the clipboard to be pasted anywhere

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using Metatogger.Data;

var data = new Dictionary<string, HashSet<string>>(StringComparer.InvariantCultureIgnoreCase);

void ProcessAudioFiles(string artist, string album)
{
   if (artist == null || album == null) return;

   if (data.ContainsKey(artist))
      data[artist].Add(album);
   else
      data.Add(artist, new HashSet<string>(new[] { album }, StringComparer.InvariantCultureIgnoreCase));
}

foreach (var file in files)
   if (file.IsEnabled)
      ProcessAudioFiles(file.GetFirstValue(TagName.Artist), file.GetFirstValue(TagName.Album));

var sb = new StringBuilder();
foreach (var kvp in data)
{
   sb.AppendLine(kvp.Key);
   foreach (string album in kvp.Value)
      sb.AppendLine("\t" + album);
   sb.AppendLine();
}

Clipboard.SetText(sb.ToString(), TextDataFormat.UnicodeText);
@luminescence-software luminescence-software locked and limited conversation to collaborators May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant