diff --git a/Alchemy.Forms/Alchemy.Forms.csproj b/Alchemy.Forms/Alchemy.Forms.csproj
index 9723e19..1c7817d 100644
--- a/Alchemy.Forms/Alchemy.Forms.csproj
+++ b/Alchemy.Forms/Alchemy.Forms.csproj
@@ -5,7 +5,7 @@
Debug
AnyCPU
{6DD4019E-F67C-4CA3-90FF-BDAEF775F1D1}
- Exe
+ WinExe
Sarsoo.Alchemy.Forms
Alchemy
v4.7.2
@@ -67,6 +67,12 @@
ConfigForm.cs
+
+ Form
+
+
+ PlaylistForm.cs
+
Form
@@ -81,6 +87,9 @@
ConfigForm.cs
+
+ PlaylistForm.cs
+
Main.cs
diff --git a/Alchemy.Forms/Main.Designer.cs b/Alchemy.Forms/Main.Designer.cs
index 2eb3c40..7871521 100644
--- a/Alchemy.Forms/Main.Designer.cs
+++ b/Alchemy.Forms/Main.Designer.cs
@@ -33,12 +33,12 @@
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aPIKeysToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.spotifyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.refreshPlaylistsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.playlistRefreshButton = new System.Windows.Forms.Button();
this.playlistListBox = new System.Windows.Forms.ListBox();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.messageLabel = new System.Windows.Forms.ToolStripLabel();
this.RefreshPlaylists = new System.ComponentModel.BackgroundWorker();
@@ -49,8 +49,10 @@
//
// menuStrip1
//
+ this.menuStrip1.BackColor = System.Drawing.SystemColors.WindowFrame;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
+ this.spotifyToolStripMenuItem,
this.helpToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
@@ -70,17 +72,32 @@
// aPIKeysToolStripMenuItem
//
this.aPIKeysToolStripMenuItem.Name = "aPIKeysToolStripMenuItem";
- this.aPIKeysToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.aPIKeysToolStripMenuItem.Size = new System.Drawing.Size(110, 22);
this.aPIKeysToolStripMenuItem.Text = "Config";
this.aPIKeysToolStripMenuItem.Click += new System.EventHandler(this.aPIKeysToolStripMenuItem_Click);
//
// closeToolStripMenuItem
//
this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
- this.closeToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.closeToolStripMenuItem.Size = new System.Drawing.Size(110, 22);
this.closeToolStripMenuItem.Text = "Close";
this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click);
//
+ // spotifyToolStripMenuItem
+ //
+ this.spotifyToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.refreshPlaylistsToolStripMenuItem});
+ this.spotifyToolStripMenuItem.Name = "spotifyToolStripMenuItem";
+ this.spotifyToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
+ this.spotifyToolStripMenuItem.Text = "Spotify";
+ //
+ // refreshPlaylistsToolStripMenuItem
+ //
+ this.refreshPlaylistsToolStripMenuItem.Name = "refreshPlaylistsToolStripMenuItem";
+ this.refreshPlaylistsToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
+ this.refreshPlaylistsToolStripMenuItem.Text = "Refresh Playlists";
+ this.refreshPlaylistsToolStripMenuItem.Click += new System.EventHandler(this.refreshPlaylistsToolStripMenuItem_Click);
+ //
// helpToolStripMenuItem
//
this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -101,54 +118,36 @@
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox1.Controls.Add(this.playlistRefreshButton);
this.groupBox1.Controls.Add(this.playlistListBox);
+ this.groupBox1.ForeColor = System.Drawing.SystemColors.ControlLight;
this.groupBox1.Location = new System.Drawing.Point(12, 27);
this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(289, 316);
+ this.groupBox1.Size = new System.Drawing.Size(610, 316);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Playlists";
//
- // playlistRefreshButton
- //
- this.playlistRefreshButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.playlistRefreshButton.Location = new System.Drawing.Point(6, 287);
- this.playlistRefreshButton.Name = "playlistRefreshButton";
- this.playlistRefreshButton.Size = new System.Drawing.Size(277, 23);
- this.playlistRefreshButton.TabIndex = 1;
- this.playlistRefreshButton.Text = "Refresh";
- this.playlistRefreshButton.UseVisualStyleBackColor = true;
- this.playlistRefreshButton.Click += new System.EventHandler(this.playlistRefreshButton_Click);
- //
// playlistListBox
//
this.playlistListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
+ this.playlistListBox.BackColor = System.Drawing.SystemColors.ControlDark;
this.playlistListBox.DisplayMember = "Name";
+ this.playlistListBox.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.playlistListBox.FormattingEnabled = true;
this.playlistListBox.Location = new System.Drawing.Point(6, 19);
this.playlistListBox.Name = "playlistListBox";
- this.playlistListBox.Size = new System.Drawing.Size(277, 264);
+ this.playlistListBox.Size = new System.Drawing.Size(598, 290);
this.playlistListBox.TabIndex = 0;
- this.playlistListBox.ValueMember = "Name";
- //
- // groupBox2
- //
- this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox2.Location = new System.Drawing.Point(307, 27);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(315, 316);
- this.groupBox2.TabIndex = 1;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "Scrobbles";
+ this.playlistListBox.ValueMember = "Id";
+ this.playlistListBox.DoubleClick += new System.EventHandler(this.playlistListBox_DoubleClick);
//
// toolStrip1
//
+ this.toolStrip1.BackColor = System.Drawing.SystemColors.ControlDark;
this.toolStrip1.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.messageLabel});
this.toolStrip1.Location = new System.Drawing.Point(0, 346);
@@ -159,6 +158,7 @@
//
// messageLabel
//
+ this.messageLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.messageLabel.Name = "messageLabel";
this.messageLabel.Size = new System.Drawing.Size(81, 22);
this.messageLabel.Text = "messageLabel";
@@ -172,9 +172,9 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.ClientSize = new System.Drawing.Size(634, 371);
this.Controls.Add(this.toolStrip1);
- this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
@@ -203,12 +203,12 @@
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem aPIKeysToolStripMenuItem;
private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.Button playlistRefreshButton;
private System.Windows.Forms.ListBox playlistListBox;
- private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripLabel messageLabel;
private System.ComponentModel.BackgroundWorker RefreshPlaylists;
+ private System.Windows.Forms.ToolStripMenuItem spotifyToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem refreshPlaylistsToolStripMenuItem;
}
}
diff --git a/Alchemy.Forms/Main.cs b/Alchemy.Forms/Main.cs
index 49b7088..55cbffa 100644
--- a/Alchemy.Forms/Main.cs
+++ b/Alchemy.Forms/Main.cs
@@ -24,6 +24,8 @@ namespace Sarsoo.Alchemy.Forms
Stream stream = new FileStream("config.bin", FileMode.Open, FileAccess.Read);
config = (Config)formatter.Deserialize(stream);
stream.Close();
+
+ // TODO load playlists if available
}
catch (Exception ex)
{
@@ -50,24 +52,7 @@ namespace Sarsoo.Alchemy.Forms
keys.Show();
}
- private void playlistRefreshButton_Click(object sender, EventArgs e)
- {
- if(config.SpotifyAccess.Length == 0)
- {
- SetMessage("No Spotify Access Token Provided");
- return;
- }
-
- if (!RefreshPlaylists.IsBusy)
- {
- RefreshPlaylists.RunWorkerAsync();
- } else
- {
- SetMessage("Already Refreshing");
- }
- }
-
- private void SetMessage(String message)
+ private void SetMessage(string message)
{
messageLabel.Text = message;
messageLabel.Visible = true;
@@ -83,22 +68,33 @@ namespace Sarsoo.Alchemy.Forms
TokenType = "Bearer"
};
- var _playlists = spot.GetUserPlaylists(config.spotifyID);
- if(_playlists.HasError())
- {
- SetMessage($"Playlist Refresh Error: {_playlists.Error.Status} {_playlists.Error.Message}");
- }
- else
- {
- playlistListBox.Items.Clear();
- //_playlists.Items.ForEach((playlist) => { playlistListBox.Items.Add(playlist); });
- playlistListBox.Refresh();
+ playlists.Clear();
+ Paging _playlistsPagers = spot.GetUserPlaylists(config.spotifyID);
+ while(true) {
+ if (_playlistsPagers.HasError())
+ {
+ SetMessage($"Playlist Refresh Error: {_playlistsPagers.Error.Status} {_playlistsPagers.Error.Message}");
+ }
+ else
+ {
+ playlists.AddRange(_playlistsPagers.Items);
+ if (!_playlistsPagers.HasNextPage()) break;
+ _playlistsPagers = spot.GetNextPage(_playlistsPagers);
+ }
}
+
+ playlistListBox.Invoke((MethodInvoker)delegate {
+ playlistListBox.DataSource = playlists
+ .OrderBy(playlist => playlist.Name.ToLower())
+ .ToList();
+ });
+
+ // TODO dump playlists to binary
}
private void MainForm_Load(object sender, EventArgs e)
{
- playlistListBox.DataSource = playlists;
+
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
@@ -108,6 +104,40 @@ namespace Sarsoo.Alchemy.Forms
Stream stream = new FileStream("config.bin", FileMode.Create, FileAccess.Write);
formatter.Serialize(stream, config);
stream.Close();
+
+ // TODO dump playlists
+ }
+
+ private void playlistListBox_DoubleClick(object sender, EventArgs e)
+ {
+ if(playlistListBox.SelectedItem != null)
+ {
+ if (playlistListBox.SelectedItem is SimplePlaylist playlist)
+ {
+ PlaylistForm form = new PlaylistForm(playlist);
+ form.Show();
+ }
+ else
+ SetMessage("Couldn't cast selected playlist");
+ }
+ }
+
+ private void refreshPlaylistsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (config.SpotifyAccess.Length == 0)
+ {
+ SetMessage("No Spotify Access Token Provided");
+ return;
+ }
+
+ if (!RefreshPlaylists.IsBusy)
+ {
+ RefreshPlaylists.RunWorkerAsync();
+ }
+ else
+ {
+ SetMessage("Already Refreshing");
+ }
}
}
}
diff --git a/Alchemy.Forms/Main.resx b/Alchemy.Forms/Main.resx
index ce6f885..f4eacf7 100644
--- a/Alchemy.Forms/Main.resx
+++ b/Alchemy.Forms/Main.resx
@@ -123,6 +123,9 @@
132, 17
+
+ True
+
237, 17
diff --git a/Alchemy.Forms/PlaylistForm.Designer.cs b/Alchemy.Forms/PlaylistForm.Designer.cs
new file mode 100644
index 0000000..a67551a
--- /dev/null
+++ b/Alchemy.Forms/PlaylistForm.Designer.cs
@@ -0,0 +1,83 @@
+namespace Sarsoo.Alchemy.Forms
+{
+ partial class PlaylistForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PlaylistForm));
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.trackListBox = new System.Windows.Forms.ListBox();
+ this.groupBox1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // groupBox1
+ //
+ this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupBox1.Controls.Add(this.trackListBox);
+ this.groupBox1.Location = new System.Drawing.Point(12, 268);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(765, 159);
+ this.groupBox1.TabIndex = 0;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "Tracks";
+ //
+ // trackListBox
+ //
+ this.trackListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.trackListBox.DisplayMember = "Name";
+ this.trackListBox.FormattingEnabled = true;
+ this.trackListBox.Location = new System.Drawing.Point(6, 19);
+ this.trackListBox.Name = "trackListBox";
+ this.trackListBox.Size = new System.Drawing.Size(753, 134);
+ this.trackListBox.TabIndex = 0;
+ this.trackListBox.ValueMember = "Name";
+ //
+ // PlaylistForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(789, 439);
+ this.Controls.Add(this.groupBox1);
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.MinimumSize = new System.Drawing.Size(805, 478);
+ this.Name = "PlaylistForm";
+ this.Text = "Playlist";
+ this.Load += new System.EventHandler(this.Playlist_Load);
+ this.groupBox1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.ListBox trackListBox;
+ }
+}
\ No newline at end of file
diff --git a/Alchemy.Forms/PlaylistForm.cs b/Alchemy.Forms/PlaylistForm.cs
new file mode 100644
index 0000000..5e8f0eb
--- /dev/null
+++ b/Alchemy.Forms/PlaylistForm.cs
@@ -0,0 +1,28 @@
+using SpotifyAPI.Web.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Sarsoo.Alchemy.Forms
+{
+ public partial class PlaylistForm : Form
+ {
+ private readonly SimplePlaylist playlist;
+ public PlaylistForm(SimplePlaylist _playlist)
+ {
+ InitializeComponent();
+ playlist = _playlist;
+ }
+
+ private void Playlist_Load(object sender, EventArgs e)
+ {
+ Text = playlist.Name;
+ }
+ }
+}
diff --git a/Alchemy.Forms/PlaylistForm.resx b/Alchemy.Forms/PlaylistForm.resx
new file mode 100644
index 0000000..5eb5a9b
--- /dev/null
+++ b/Alchemy.Forms/PlaylistForm.resx
@@ -0,0 +1,143 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+
+ AAABAAIAEBAQAAAABAAoAQAAJgAAACAgEAAAAAQA6AIAAE4BAAAoAAAAEAAAACAAAAABAAQAAAAAAIAA
+ AAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADAwMAAAAD/AAD/
+ AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAAAAVVUAAAAAAFVVVVUAAAAFVd1VVVAAAFVd1VVV
+ VQAAVd3VVf9VAABV3dVV/1UAAAVd3V/1UAAAAFVVVVUAAAAAAFVVAAAAAAAAVVUAAAAAAABVVQAAAAAA
+ AzMzMAAAAAAzMzMzAAAAAAMzMzAAAAAAAAAAAAAA//8AAPw/AADwDwAA4AcAAMADAADAAwAAwAMAAOAH
+ AADwDwAA/D8AAPw/AAD8PwAA+B8AAPAPAAD4HwAA//8AACgAAAAgAAAAQAAAAAEABAAAAAAAAAIAAAAA
+ AAAAAAAAEAAAABAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD/
+ /wD/AAAA/wD/AP//AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFVVVQ
+ AAAAAAAAAAAAAABVVVVVVVUAAAAAAAAAAABVVVVVVVVVVQAAAAAAAABVVVVd3VVVVVVVAAAAAAAAVVVd
+ 3d3VVVVVVQAAAAAABVVV3d3d1VVVVVVQAAAAAFVVXd3d3VVVVVVVVQAAAABVVV3d3dVVVVVVVVUAAAAF
+ VVXd3dVVVVVVVVVVUAAABVVV3d3VVVVVVVVVVVAAAAVVVd3d1VVVVVVVVVVQAAAFVVXd3dVVVVVf9VVV
+ UAAAAFVV3d3dVVVV//9VVQAAAABVVV3d3VVV////VVUAAAAABVVV3d3VX////1VQAAAAAABVVd3d1f//
+ //VVAAAAAAAAVVVd3VX///9VVQAAAAAAAABVVVVVX/9VVQAAAAAAAAAAAFVVVVVVVQAAAAAAAAAAAAAF
+ VVVVVVAAAAAAAAAAAAAABVVVVVVQAAAAAAAAAAAAAAVVVVVVUAAAAAAAAAAAAAAFVVVVVVAAAAAAAAAA
+ AAAABVVVVVVQAAAAAAAAAAAAMzMzMzMzMzMwAAAAAAAAAzMzMzMzMzMzMwAAAAAAAAMzMzMzMzMzMzMA
+ AAAAAAAAMzMzMzMzMzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD////////////4
+ H///wAP//wAA//wAAD/8AAA/+AAAH/AAAA/wAAAP4AAAB+AAAAfgAAAH4AAAB/AAAA/wAAAP+AAAH/wA
+ AD/8AAA//wAA///AA///4Af//+AH///gB///4Af//+AH//8AAH/+AAA//gAAP/8AAH///////////w==
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..f0b46ce
--- /dev/null
+++ b/README.md
@@ -0,0 +1,12 @@
+# Alchemy🔮⚗️
+
+Set of .NET projects for processing Spotify and Last.fm data.
+Invisiging using ML.net etc
+
+## Alchemy.Core
+
+.NET standard Library for majority of underlying logic
+
+## Alchemy.Forms
+
+Winforms application for messing around and debugging
\ No newline at end of file