Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35ded0f592 | ||
|
|
e1de890f33 | ||
|
|
dc7f8905ae |
@@ -13,36 +13,19 @@ namespace MusicPlayer
|
|||||||
public class APIHandler
|
public class APIHandler
|
||||||
{
|
{
|
||||||
private NetworkHandler nw;
|
private NetworkHandler nw;
|
||||||
public Image defaultCover;
|
private Image defaultCover;
|
||||||
public APIHandler(NetworkHandler nw)
|
public APIHandler(NetworkHandler nw)
|
||||||
{
|
{
|
||||||
this.nw = nw;
|
this.nw = nw;
|
||||||
defaultCover = MusicPlayer.Resource.default_cover;
|
defaultCover = Image.FromStream(nw.downloadArtwork("default-cover.png"));
|
||||||
}
|
|
||||||
|
|
||||||
public JObject GetAllBySearch(string search, string album, string artist, string genre)
|
|
||||||
{
|
|
||||||
// Q artist genre album
|
|
||||||
JObject o = nw.SendString($"search?q={search}&album={album}&genre={genre}&artist={artist}");
|
|
||||||
if (o != null)
|
|
||||||
{
|
|
||||||
Console.WriteLine(o.PropertyValues().ToString());
|
|
||||||
if (o["result"].ToString() == "OK") { return o; }
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetSongURLByID(string id)
|
public string GetSongURLByID(string id)
|
||||||
{
|
{
|
||||||
JObject o = nw.SendString("getsongbyid?id=" + id);
|
JObject o = nw.SendString("getsongbyid?id=" + id);
|
||||||
if (o != null)
|
if (o["result"].ToString() == "OK") {
|
||||||
{
|
|
||||||
if (o["result"].ToString() == "OK")
|
|
||||||
{
|
|
||||||
return o["songurl"].ToString();
|
return o["songurl"].ToString();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return o["errormsg"].ToString();
|
return o["errormsg"].ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,83 +49,10 @@ namespace MusicPlayer
|
|||||||
return GetSongsByArgs("album=" + year);
|
return GetSongsByArgs("album=" + year);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Song> GetSongsBySearch(string search)
|
|
||||||
{
|
|
||||||
return GetSongsByArgs("search=" + search);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Genre> Genrify(JObject o)
|
|
||||||
{
|
|
||||||
List<Genre> genreslist = new List<Genre>();
|
|
||||||
if (o != null)
|
|
||||||
{
|
|
||||||
if (o["result"].ToString() == "OK")
|
|
||||||
{
|
|
||||||
for (int i = 0; i < o["genres"].Count(); i++)
|
|
||||||
{
|
|
||||||
genreslist.Add(new Genre(o["genres"][i][0].ToString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return genreslist;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Artist> Artistify(JObject o)
|
|
||||||
{
|
|
||||||
List<Artist> artistlist = new List<Artist>();
|
|
||||||
if (o != null)
|
|
||||||
{
|
|
||||||
if (o["result"].ToString() == "OK")
|
|
||||||
{
|
|
||||||
for (int i = 0; i < o["artists"].Count(); i++)
|
|
||||||
{
|
|
||||||
artistlist.Add(new Artist(o["artists"][i][0].ToString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return artistlist;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Song> Songify(JObject o)
|
|
||||||
{
|
|
||||||
List<Song> allsongslist = new List<Song>();
|
|
||||||
if (o != null)
|
|
||||||
{
|
|
||||||
if (o["result"].ToString() == "OK")
|
|
||||||
{
|
|
||||||
dynamic songs = o["songs"];
|
|
||||||
for (int i = 0; i < songs.Count; i++)
|
|
||||||
{
|
|
||||||
allsongslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), songs[i][1].ToString(), (int)songs[i][9], this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return allsongslist;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Album> Albumify(JObject o)
|
|
||||||
{
|
|
||||||
List<Album> albumlist = new List<Album>();
|
|
||||||
if (o != null)
|
|
||||||
{
|
|
||||||
if (o["result"].ToString() == "OK")
|
|
||||||
{
|
|
||||||
for (int i = 0; i < o["albums"].Count(); i++)
|
|
||||||
{
|
|
||||||
albumlist.Add(new Album(o["albums"][i][0].ToString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return albumlist;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Song> GetAllSongs()
|
public List<Song> GetAllSongs()
|
||||||
{
|
{
|
||||||
List<Song> allsongslist = new List<Song>();
|
List<Song> allsongslist = new List<Song>();
|
||||||
JObject o = nw.SendString("getallsongs?");
|
JObject o = nw.SendString("getallsongs?");
|
||||||
if (o != null)
|
|
||||||
{
|
|
||||||
if (o["result"].ToString() == "OK")
|
if (o["result"].ToString() == "OK")
|
||||||
{
|
{
|
||||||
dynamic songs = o["songs"];
|
dynamic songs = o["songs"];
|
||||||
@@ -151,7 +61,6 @@ namespace MusicPlayer
|
|||||||
allsongslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), songs[i][1].ToString(), (int)songs[i][9], this));
|
allsongslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), songs[i][1].ToString(), (int)songs[i][9], this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return allsongslist;
|
return allsongslist;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -160,18 +69,15 @@ namespace MusicPlayer
|
|||||||
{
|
{
|
||||||
List<Song> songslist = new List<Song>();
|
List<Song> songslist = new List<Song>();
|
||||||
JObject o = nw.SendString("getsongs?"+args);
|
JObject o = nw.SendString("getsongs?"+args);
|
||||||
if (o != null)
|
|
||||||
{
|
|
||||||
if (o["result"].ToString() == "OK")
|
if (o["result"].ToString() == "OK")
|
||||||
{
|
{
|
||||||
dynamic songs = o["songs"];
|
dynamic songs = o["songs"];
|
||||||
for (int i = 0; i < songs.Count; i++)
|
for (int i = 0; i < songs.Count; i++)
|
||||||
{
|
{
|
||||||
if (songs[i][2].ToString().EndsWith(".mp3"))
|
if(songs[i][2].ToString().EndsWith(".mp3"))
|
||||||
songslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), songs[i][1].ToString(), (int)songs[i][9], this));
|
songslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), songs[i][1].ToString(), (int)songs[i][9], this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return songslist;
|
return songslist;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,17 +85,13 @@ namespace MusicPlayer
|
|||||||
{
|
{
|
||||||
List<Artist> artistlist = new List<Artist>();
|
List<Artist> artistlist = new List<Artist>();
|
||||||
|
|
||||||
JObject o = nw.SendString("getartists?");
|
JObject o = nw.SendString("getartists?id=hallo");
|
||||||
if (o != null)
|
|
||||||
{
|
|
||||||
if (o["result"].ToString() == "OK")
|
if (o["result"].ToString() == "OK")
|
||||||
{
|
{
|
||||||
for (int i = 0; i < o["artists"].Count(); i++)
|
for (int i = 0; i < o["artists"].Count(); i++) {
|
||||||
{
|
|
||||||
artistlist.Add(new Artist(o["artists"][i][0].ToString()));
|
artistlist.Add(new Artist(o["artists"][i][0].ToString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return artistlist;
|
return artistlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,9 +109,7 @@ namespace MusicPlayer
|
|||||||
{
|
{
|
||||||
List<Album> albumlist = new List<Album>();
|
List<Album> albumlist = new List<Album>();
|
||||||
|
|
||||||
JObject o = nw.SendString("getalbums?");
|
JObject o = nw.SendString("getalbums?id=hallo");
|
||||||
if (o != null)
|
|
||||||
{
|
|
||||||
if (o["result"].ToString() == "OK")
|
if (o["result"].ToString() == "OK")
|
||||||
{
|
{
|
||||||
for (int i = 0; i < o["albums"].Count(); i++)
|
for (int i = 0; i < o["albums"].Count(); i++)
|
||||||
@@ -217,7 +117,6 @@ namespace MusicPlayer
|
|||||||
albumlist.Add(new Album(o["albums"][i][0].ToString()));
|
albumlist.Add(new Album(o["albums"][i][0].ToString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return albumlist;
|
return albumlist;
|
||||||
}
|
}
|
||||||
@@ -225,9 +124,7 @@ namespace MusicPlayer
|
|||||||
public List<Year> GetYears()
|
public List<Year> GetYears()
|
||||||
{
|
{
|
||||||
List<Year> yearlist = new List<Year> ();
|
List<Year> yearlist = new List<Year> ();
|
||||||
JObject o = nw.SendString("getyears?");
|
JObject o = nw.SendString("getyears?id=hallo");
|
||||||
if (o != null)
|
|
||||||
{
|
|
||||||
if (o["result"].ToString() == "OK")
|
if (o["result"].ToString() == "OK")
|
||||||
{
|
{
|
||||||
for (int i = 0; i < o["years"].Count(); i++)
|
for (int i = 0; i < o["years"].Count(); i++)
|
||||||
@@ -235,16 +132,13 @@ namespace MusicPlayer
|
|||||||
yearlist.Add(new Year(o["years"][i][0].ToString()));
|
yearlist.Add(new Year(o["years"][i][0].ToString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return yearlist;
|
return yearlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Genre> GetGenres()
|
public List<Genre> GetGenres()
|
||||||
{
|
{
|
||||||
List<Genre> genreslist = new List<Genre>();
|
List<Genre> genreslist = new List<Genre>();
|
||||||
JObject o = nw.SendString("getgenres?");
|
JObject o = nw.SendString("getgenres?id=hallo");
|
||||||
if (o != null)
|
|
||||||
{
|
|
||||||
if (o["result"].ToString() == "OK")
|
if (o["result"].ToString() == "OK")
|
||||||
{
|
{
|
||||||
for (int i = 0; i < o["genres"].Count(); i++)
|
for (int i = 0; i < o["genres"].Count(); i++)
|
||||||
@@ -252,7 +146,6 @@ namespace MusicPlayer
|
|||||||
genreslist.Add(new Genre(o["genres"][i][0].ToString()));
|
genreslist.Add(new Genre(o["genres"][i][0].ToString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return genreslist;
|
return genreslist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-177
@@ -1,177 +0,0 @@
|
|||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace MusicPlayer
|
|
||||||
{
|
|
||||||
partial class AdvancedSearch
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AdvancedSearch));
|
|
||||||
this.SearchTermTextBox = new System.Windows.Forms.TextBox();
|
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
|
||||||
this.AlbumTextBox = new System.Windows.Forms.TextBox();
|
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
|
||||||
this.ArtistTextBox = new System.Windows.Forms.TextBox();
|
|
||||||
this.GenreTextBox = new System.Windows.Forms.TextBox();
|
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
|
||||||
this.SearchButton = new System.Windows.Forms.Button();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// SearchTermTextBox
|
|
||||||
//
|
|
||||||
this.SearchTermTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.SearchTermTextBox.Location = new System.Drawing.Point(12, 29);
|
|
||||||
this.SearchTermTextBox.Name = "SearchTermTextBox";
|
|
||||||
this.SearchTermTextBox.Size = new System.Drawing.Size(210, 20);
|
|
||||||
this.SearchTermTextBox.TabIndex = 0;
|
|
||||||
this.SearchTermTextBox.KeyDown += TextBox_KeyDown;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.Location = new System.Drawing.Point(12, 13);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(68, 13);
|
|
||||||
this.label1.TabIndex = 1;
|
|
||||||
this.label1.Text = "Search Term";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
this.label2.AutoSize = true;
|
|
||||||
this.label2.Location = new System.Drawing.Point(12, 70);
|
|
||||||
this.label2.Name = "label2";
|
|
||||||
this.label2.Size = new System.Drawing.Size(36, 13);
|
|
||||||
this.label2.TabIndex = 2;
|
|
||||||
this.label2.Text = "Album";
|
|
||||||
//
|
|
||||||
// AlbumTextBox
|
|
||||||
//
|
|
||||||
this.AlbumTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.AlbumTextBox.Location = new System.Drawing.Point(12, 86);
|
|
||||||
this.AlbumTextBox.Name = "AlbumTextBox";
|
|
||||||
this.AlbumTextBox.Size = new System.Drawing.Size(210, 20);
|
|
||||||
this.AlbumTextBox.TabIndex = 3;
|
|
||||||
this.AlbumTextBox.KeyDown += TextBox_KeyDown;
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
this.label3.AutoSize = true;
|
|
||||||
this.label3.Location = new System.Drawing.Point(12, 119);
|
|
||||||
this.label3.Name = "label3";
|
|
||||||
this.label3.Size = new System.Drawing.Size(30, 13);
|
|
||||||
this.label3.TabIndex = 4;
|
|
||||||
this.label3.Text = "Artist";
|
|
||||||
//
|
|
||||||
// ArtistTextBox
|
|
||||||
//
|
|
||||||
this.ArtistTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.ArtistTextBox.Location = new System.Drawing.Point(12, 135);
|
|
||||||
this.ArtistTextBox.Name = "ArtistTextBox";
|
|
||||||
this.ArtistTextBox.Size = new System.Drawing.Size(210, 20);
|
|
||||||
this.ArtistTextBox.TabIndex = 5;
|
|
||||||
this.ArtistTextBox.KeyDown += TextBox_KeyDown;
|
|
||||||
//
|
|
||||||
// GenreTextBox
|
|
||||||
//
|
|
||||||
this.GenreTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.GenreTextBox.Location = new System.Drawing.Point(12, 187);
|
|
||||||
this.GenreTextBox.Name = "GenreTextBox";
|
|
||||||
this.GenreTextBox.Size = new System.Drawing.Size(210, 20);
|
|
||||||
this.GenreTextBox.TabIndex = 6;
|
|
||||||
this.GenreTextBox.KeyDown += TextBox_KeyDown;
|
|
||||||
//
|
|
||||||
// label4
|
|
||||||
//
|
|
||||||
this.label4.AutoSize = true;
|
|
||||||
this.label4.Location = new System.Drawing.Point(13, 168);
|
|
||||||
this.label4.Name = "label4";
|
|
||||||
this.label4.Size = new System.Drawing.Size(36, 13);
|
|
||||||
this.label4.TabIndex = 7;
|
|
||||||
this.label4.Text = "Genre";
|
|
||||||
//
|
|
||||||
// SearchButton
|
|
||||||
//
|
|
||||||
this.SearchButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.SearchButton.Location = new System.Drawing.Point(12, 226);
|
|
||||||
this.SearchButton.Name = "SearchButton";
|
|
||||||
this.SearchButton.Size = new System.Drawing.Size(210, 23);
|
|
||||||
this.SearchButton.TabIndex = 8;
|
|
||||||
this.SearchButton.Text = "Search";
|
|
||||||
this.SearchButton.UseVisualStyleBackColor = true;
|
|
||||||
this.SearchButton.Click += new System.EventHandler(this.SearchButton_Click);
|
|
||||||
//
|
|
||||||
// AdvancedSearch
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(234, 261);
|
|
||||||
this.Controls.Add(this.SearchButton);
|
|
||||||
this.Controls.Add(this.label4);
|
|
||||||
this.Controls.Add(this.GenreTextBox);
|
|
||||||
this.Controls.Add(this.ArtistTextBox);
|
|
||||||
this.Controls.Add(this.label3);
|
|
||||||
this.Controls.Add(this.AlbumTextBox);
|
|
||||||
this.Controls.Add(this.label2);
|
|
||||||
this.Controls.Add(this.label1);
|
|
||||||
this.Controls.Add(this.SearchTermTextBox);
|
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
|
||||||
this.MaximumSize = new System.Drawing.Size(450, 300);
|
|
||||||
this.MinimumSize = new System.Drawing.Size(250, 300);
|
|
||||||
this.Name = "AdvancedSearch";
|
|
||||||
this.Text = "Advanced Search";
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TextBox_KeyDown(object sender, KeyEventArgs e)
|
|
||||||
{
|
|
||||||
if(e.KeyCode == Keys.Enter)
|
|
||||||
{
|
|
||||||
SearchButton_Click(sender, new System.EventArgs());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private TextBox SearchTermTextBox;
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private TextBox AlbumTextBox;
|
|
||||||
private Label label3;
|
|
||||||
private TextBox ArtistTextBox;
|
|
||||||
private TextBox GenreTextBox;
|
|
||||||
private Label label4;
|
|
||||||
private Button SearchButton;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace MusicPlayer
|
|
||||||
{
|
|
||||||
public partial class AdvancedSearch : Form
|
|
||||||
{
|
|
||||||
private Main main;
|
|
||||||
|
|
||||||
public AdvancedSearch(Main main)
|
|
||||||
{
|
|
||||||
this.main = main;
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SearchButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if(SearchTermTextBox.Text.Length > 1)
|
|
||||||
{
|
|
||||||
SearchTermTextBox.ForeColor = Color.Black;
|
|
||||||
main.AdvancedSearchFilter(SearchTermTextBox.Text, AlbumTextBox.Text, ArtistTextBox.Text, GenreTextBox.Text);
|
|
||||||
this.Close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SearchTermTextBox.ForeColor = Color.Red;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -17,13 +17,7 @@ namespace MusicPlayer
|
|||||||
public AudioState AState { get; set; }
|
public AudioState AState { get; set; }
|
||||||
public BufferState BState { get; set; }
|
public BufferState BState { get; set; }
|
||||||
|
|
||||||
public int Buffered { get
|
public int Buffered { get { return Math.Min((int)((bufpos / (double)LengthBuffer) * 1000), 1000); } }
|
||||||
{
|
|
||||||
if(CurrentSong is RadioStation)
|
|
||||||
return Math.Min((int)((bufpos - ms.Position) / 1000), 1000);
|
|
||||||
else
|
|
||||||
return Math.Min((int)((bufpos / (double)LengthBuffer) * 1000), 1000);
|
|
||||||
} }
|
|
||||||
private long LengthBuffer { get; set; }
|
private long LengthBuffer { get; set; }
|
||||||
private long bufpos = 0;
|
private long bufpos = 0;
|
||||||
|
|
||||||
@@ -31,7 +25,6 @@ namespace MusicPlayer
|
|||||||
public int Position { get { return Math.Min((int)((playpos / (double)Length) * 1000), 1000); } }
|
public int Position { get { return Math.Min((int)((playpos / (double)Length) * 1000), 1000); } }
|
||||||
private long Length { get; set; }
|
private long Length { get; set; }
|
||||||
private long playpos = 0;
|
private long playpos = 0;
|
||||||
public float Volume { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public int CurrentTime { get; set; }
|
public int CurrentTime { get; set; }
|
||||||
@@ -40,7 +33,7 @@ namespace MusicPlayer
|
|||||||
|
|
||||||
private long seek = 0;
|
private long seek = 0;
|
||||||
|
|
||||||
private MemoryStream ms;
|
private Stream ms;
|
||||||
|
|
||||||
private Thread network;
|
private Thread network;
|
||||||
private Thread audio;
|
private Thread audio;
|
||||||
@@ -52,7 +45,6 @@ namespace MusicPlayer
|
|||||||
public AudioHandler(Main main)
|
public AudioHandler(Main main)
|
||||||
{
|
{
|
||||||
this.main = main;
|
this.main = main;
|
||||||
Volume = 1.0f;
|
|
||||||
CreateThreads();
|
CreateThreads();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +55,7 @@ namespace MusicPlayer
|
|||||||
|
|
||||||
CurrentSong = null;
|
CurrentSong = null;
|
||||||
|
|
||||||
Thread.Sleep(10);
|
Thread.Sleep(11);
|
||||||
|
|
||||||
ms = new MemoryStream();
|
ms = new MemoryStream();
|
||||||
|
|
||||||
@@ -104,20 +96,6 @@ namespace MusicPlayer
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SaveBufferToFile(string savelocation)
|
|
||||||
{
|
|
||||||
if(ms != null && BState == BufferState.DONE)
|
|
||||||
{
|
|
||||||
using (FileStream fs = new FileStream(savelocation, FileMode.OpenOrCreate))
|
|
||||||
{
|
|
||||||
ms.WriteTo(fs);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
CreateThreads();
|
CreateThreads();
|
||||||
@@ -144,7 +122,7 @@ namespace MusicPlayer
|
|||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
AState = AudioState.STOPPED;
|
AState = AudioState.STOPPED;
|
||||||
//main.form.SongFinished();
|
main.form.SongFinished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,22 +133,15 @@ namespace MusicPlayer
|
|||||||
using (WaveOut waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback()))
|
using (WaveOut waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback()))
|
||||||
{
|
{
|
||||||
waveOut.Init(blockAlignedStream);
|
waveOut.Init(blockAlignedStream);
|
||||||
waveOut.Volume = Volume;
|
|
||||||
waveOut.Play();
|
waveOut.Play();
|
||||||
|
|
||||||
if (CurrentSong == null || CurrentSong.Seconds == 0)
|
|
||||||
Length = ms.Length;
|
|
||||||
else
|
|
||||||
Length = CurrentSong.Seconds * waveOut.OutputWaveFormat.AverageBytesPerSecond;
|
Length = CurrentSong.Seconds * waveOut.OutputWaveFormat.AverageBytesPerSecond;
|
||||||
|
|
||||||
CurrentTime = (int)(ms.Position / waveOut.OutputWaveFormat.AverageBytesPerSecond);
|
CurrentTime = (int)(ms.Position / waveOut.OutputWaveFormat.AverageBytesPerSecond);
|
||||||
|
|
||||||
while (waveOut.PlaybackState != PlaybackState.Stopped)
|
while (waveOut.PlaybackState != PlaybackState.Stopped)
|
||||||
{
|
{
|
||||||
System.Threading.Thread.Sleep(10);
|
System.Threading.Thread.Sleep(10);
|
||||||
|
|
||||||
waveOut.Volume = Volume;
|
|
||||||
|
|
||||||
if (AState == AudioState.PLAYING && waveOut.PlaybackState == PlaybackState.Paused)
|
if (AState == AudioState.PLAYING && waveOut.PlaybackState == PlaybackState.Paused)
|
||||||
{
|
{
|
||||||
blockAlignedStream.Position = position;
|
blockAlignedStream.Position = position;
|
||||||
@@ -192,28 +163,19 @@ namespace MusicPlayer
|
|||||||
waveOut.Stop();
|
waveOut.Stop();
|
||||||
}
|
}
|
||||||
if (BState == BufferState.DONE && firstrun )
|
if (BState == BufferState.DONE && firstrun )
|
||||||
{
|
|
||||||
if( ! (CurrentSong is RadioStation))
|
|
||||||
{
|
{
|
||||||
position = mp3fr.Position;
|
position = mp3fr.Position;
|
||||||
mp3fr.Close();
|
mp3fr.Close();
|
||||||
StreamFromMP3(ms, position, false);
|
StreamFromMP3(ms,position, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
BState = BufferState.EMPTY;
|
|
||||||
AState = AudioState.STOPPED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
playpos = blockAlignedStream.Position;
|
playpos = blockAlignedStream.Position;
|
||||||
CurrentTime = (int)(playpos / waveOut.OutputWaveFormat.AverageBytesPerSecond);
|
CurrentTime = (int)(playpos / waveOut.OutputWaveFormat.AverageBytesPerSecond);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(AState == AudioState.PLAYING && !firstrun)
|
if(AState == AudioState.PLAYING)
|
||||||
main.form.SongFinished();
|
main.form.SongFinished();
|
||||||
AState = AudioState.STOPPED;
|
AState = AudioState.STOPPED;
|
||||||
playpos = 0;
|
playpos = 0;
|
||||||
@@ -225,14 +187,7 @@ namespace MusicPlayer
|
|||||||
private void PlayAudio()
|
private void PlayAudio()
|
||||||
{
|
{
|
||||||
AState = AudioState.WAITING;
|
AState = AudioState.WAITING;
|
||||||
|
while (ms.Length < 65536 * 10 && BState != BufferState.DONE)
|
||||||
int buffertime = 0;
|
|
||||||
if (CurrentSong is RadioStation)
|
|
||||||
buffertime = 32768 * 10;
|
|
||||||
else
|
|
||||||
buffertime = 65536 * 10;
|
|
||||||
|
|
||||||
while (ms.Length < buffertime && BState != BufferState.DONE)
|
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
AState = AudioState.PLAYING;
|
AState = AudioState.PLAYING;
|
||||||
|
|
||||||
@@ -263,7 +218,7 @@ namespace MusicPlayer
|
|||||||
using (var stream = response.GetResponseStream())
|
using (var stream = response.GetResponseStream())
|
||||||
{
|
{
|
||||||
byte[] buffer = new byte[65536]; // 64KB chunks
|
byte[] buffer = new byte[65536]; // 64KB chunks
|
||||||
|
//byte[] buffer = new byte[65536*4]; // 256KB chunks
|
||||||
int read;
|
int read;
|
||||||
BState = BufferState.BUFFERING;
|
BState = BufferState.BUFFERING;
|
||||||
AState = AudioState.WAITING;
|
AState = AudioState.WAITING;
|
||||||
@@ -275,6 +230,7 @@ namespace MusicPlayer
|
|||||||
ms.Write(buffer, 0, read);
|
ms.Write(buffer, 0, read);
|
||||||
ms.Position = pos;
|
ms.Position = pos;
|
||||||
|
|
||||||
|
|
||||||
this.bufpos = ms.Length;
|
this.bufpos = ms.Length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,109 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<ClassDiagram MajorVersion="1" MinorVersion="1">
|
|
||||||
<Class Name="MusicPlayer.AdvancedSearch" Collapsed="true">
|
|
||||||
<Position X="4" Y="3.75" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>AgAAAACAACAABBAAAQCAAAACIAAQAAAAAIAAAAAAAAQ=</HashCode>
|
|
||||||
<FileName>AdvancedSearch.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Class Name="MusicPlayer.Album" Collapsed="true">
|
|
||||||
<Position X="2.25" Y="2" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAA=</HashCode>
|
|
||||||
<FileName>Album.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Class Name="MusicPlayer.APIHandler" Collapsed="true">
|
|
||||||
<Position X="4.5" Y="0.5" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>AACoAAAEAAAAAAwAAEIAQAYAAAAiAQAAAAIEAAAAgII=</HashCode>
|
|
||||||
<FileName>APIHandler.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Class Name="MusicPlayer.Artist" Collapsed="true">
|
|
||||||
<Position X="2.25" Y="0.5" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAA=</HashCode>
|
|
||||||
<FileName>Artist.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Class Name="MusicPlayer.AudioHandler" Collapsed="true">
|
|
||||||
<Position X="4.5" Y="2" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>AAAgAAAgBQAIAAAwCAAAAADBAAAAAAEApAYIgAQECAY=</HashCode>
|
|
||||||
<FileName>AudioHandler.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Class Name="MusicPlayer.Genre" Collapsed="true">
|
|
||||||
<Position X="2.25" Y="1.25" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAA=</HashCode>
|
|
||||||
<FileName>Genre.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Class Name="MusicPlayer.Main" Collapsed="true">
|
|
||||||
<Position X="0.5" Y="3" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>CQQAgAQAQQAQAABEAAAAIIMDAAAgAAAAACAFQABAAAg=</HashCode>
|
|
||||||
<FileName>Main.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Class Name="MusicPlayer.MainForm" Collapsed="true">
|
|
||||||
<Position X="2.25" Y="3" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>lBiEqv2DtukQMwGvAROAcednBwz2giwRpBQj4IrABKU=</HashCode>
|
|
||||||
<FileName>MainForm.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Class Name="MusicPlayer.NetworkHandler" Collapsed="true">
|
|
||||||
<Position X="4.5" Y="1.25" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAACAAAgAAAIgAAAAAAA=</HashCode>
|
|
||||||
<FileName>NetworkHandler.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Class Name="MusicPlayer.Playlist" Collapsed="true">
|
|
||||||
<Position X="6.25" Y="1.25" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>AAABAAAAAAAAAQQAAAAAAAAEAEEEAAAEACAAAAAAgAI=</HashCode>
|
|
||||||
<FileName>Playlist.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Class Name="MusicPlayer.PlaylistHandler" Collapsed="true">
|
|
||||||
<Position X="6.25" Y="0.5" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>CAABABAAAAAAAAAIAAAAAAAAAACAAAAAAAAAIAAAEAQ=</HashCode>
|
|
||||||
<FileName>PlaylistHandler.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Class Name="MusicPlayer.PlaylistMaker" Collapsed="true">
|
|
||||||
<Position X="4" Y="3" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>iiCCAAAAAKAAABAWQBiAQAACCQAAACAAACAIQAEICAA=</HashCode>
|
|
||||||
<FileName>PlaylistMaker.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Class Name="MusicPlayer.RadioStation" Collapsed="true">
|
|
||||||
<Position X="0.5" Y="1.25" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>AAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgA=</HashCode>
|
|
||||||
<FileName>RadioStation.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Class Name="MusicPlayer.Song" Collapsed="true">
|
|
||||||
<Position X="0.5" Y="0.5" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>AAACAAAAAAABAAAEgAIAIAQAAIAIAIAACCABCAAAAAA=</HashCode>
|
|
||||||
<FileName>Song.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Class Name="MusicPlayer.SongsTable" Collapsed="true">
|
|
||||||
<Position X="0.5" Y="3.75" Width="1.5" />
|
|
||||||
<TypeIdentifier>
|
|
||||||
<HashCode>AAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
|
||||||
<FileName>SongsTable.cs</FileName>
|
|
||||||
</TypeIdentifier>
|
|
||||||
</Class>
|
|
||||||
<Font Name="Segoe UI" Size="9" />
|
|
||||||
</ClassDiagram>
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
namespace MusicPlayer
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// Form1
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(284, 261);
|
|
||||||
this.Name = "Form1";
|
|
||||||
this.Text = "Form1";
|
|
||||||
this.Load += new System.EventHandler(this.Form1_Load);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
namespace MusicPlayer
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.components = new System.ComponentModel.Container();
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.Text = "Form1";
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
namespace MusicPlayer
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// Form1
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(284, 261);
|
|
||||||
this.Name = "Form1";
|
|
||||||
this.Text = "Form1";
|
|
||||||
this.Load += new System.EventHandler(this.Form1_Load);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
namespace MusicPlayer
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// Form1
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(284, 261);
|
|
||||||
this.Name = "Form1";
|
|
||||||
this.Text = "Form1";
|
|
||||||
this.Load += new System.EventHandler(this.Form1_Load);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -5,7 +5,6 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace MusicPlayer
|
namespace MusicPlayer
|
||||||
{
|
{
|
||||||
@@ -16,6 +15,7 @@ namespace MusicPlayer
|
|||||||
public NetworkHandler nw;
|
public NetworkHandler nw;
|
||||||
public PlaylistHandler pl;
|
public PlaylistHandler pl;
|
||||||
public AudioHandler audio;
|
public AudioHandler audio;
|
||||||
|
|
||||||
public SongsTable table;
|
public SongsTable table;
|
||||||
|
|
||||||
private List<string> genres;
|
private List<string> genres;
|
||||||
@@ -29,8 +29,6 @@ namespace MusicPlayer
|
|||||||
this.api = api;
|
this.api = api;
|
||||||
this.form = form;
|
this.form = form;
|
||||||
form.main = this;
|
form.main = this;
|
||||||
pl.main = this;
|
|
||||||
pl.Populate();
|
|
||||||
this.pl = pl;
|
this.pl = pl;
|
||||||
|
|
||||||
audio = new AudioHandler(this);
|
audio = new AudioHandler(this);
|
||||||
@@ -42,10 +40,7 @@ namespace MusicPlayer
|
|||||||
artists = new List<string>();
|
artists = new List<string>();
|
||||||
|
|
||||||
currentPlayingList = new List<Song>();
|
currentPlayingList = new List<Song>();
|
||||||
}
|
|
||||||
|
|
||||||
public void Init()
|
|
||||||
{
|
|
||||||
Populate();
|
Populate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,29 +77,15 @@ namespace MusicPlayer
|
|||||||
{
|
{
|
||||||
BackgroundWorker b = o as BackgroundWorker;
|
BackgroundWorker b = o as BackgroundWorker;
|
||||||
ImageList imagelist = new ImageList();
|
ImageList imagelist = new ImageList();
|
||||||
List<string> templist = new List<string>();
|
|
||||||
Action action = () =>
|
|
||||||
{
|
|
||||||
foreach (ListViewItem item in form.AlbumListView.Items)
|
foreach (ListViewItem item in form.AlbumListView.Items)
|
||||||
{
|
{
|
||||||
templist.Add(item.Text);
|
imagelist.Images.Add(item.ToString(), api.getAlbumCover(item.Text));
|
||||||
}
|
}
|
||||||
};
|
Action action = () => {
|
||||||
form.Invoke(action);
|
|
||||||
|
|
||||||
foreach (string item in templist)
|
|
||||||
{
|
|
||||||
imagelist.Images.Add(item, api.getAlbumCover(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
action = () => {
|
|
||||||
imagelist.ImageSize = new System.Drawing.Size(64,64);
|
|
||||||
imagelist.ColorDepth = ColorDepth.Depth32Bit;
|
|
||||||
form.AlbumListView.View = View.LargeIcon;
|
|
||||||
form.AlbumListView.LargeImageList = imagelist;
|
form.AlbumListView.LargeImageList = imagelist;
|
||||||
foreach (ListViewItem item in form.AlbumListView.Items)
|
foreach (ListViewItem item in form.AlbumListView.Items)
|
||||||
{
|
{
|
||||||
item.ImageKey = item.Text;
|
item.ImageKey = item.ToString();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
form.Invoke(action);
|
form.Invoke(action);
|
||||||
@@ -118,8 +99,7 @@ namespace MusicPlayer
|
|||||||
form.ArtistListBox.Items.Clear();
|
form.ArtistListBox.Items.Clear();
|
||||||
form.GenreListBox.Items.Clear();
|
form.GenreListBox.Items.Clear();
|
||||||
form.PlaylistBox.Items.Clear();
|
form.PlaylistBox.Items.Clear();
|
||||||
|
this.api.GetAlbums().ForEach(a => form.AlbumListView.Items.Add(a.albumnaam));
|
||||||
this.api.GetAlbums().ForEach(a => form.AlbumListView.Items.Add(a.albumnaam,a.albumnaam));
|
|
||||||
this.api.GetArtists().ForEach(a => form.ArtistListBox.Items.Add(a.naam));
|
this.api.GetArtists().ForEach(a => form.ArtistListBox.Items.Add(a.naam));
|
||||||
this.api.GetGenres().ForEach(g => form.GenreListBox.Items.Add(g.name));
|
this.api.GetGenres().ForEach(g => form.GenreListBox.Items.Add(g.name));
|
||||||
this.pl.GetPlaylists().ForEach(p => form.PlaylistBox.Items.Add(p.name));
|
this.pl.GetPlaylists().ForEach(p => form.PlaylistBox.Items.Add(p.name));
|
||||||
@@ -134,40 +114,6 @@ namespace MusicPlayer
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SearchFilter(string search)
|
|
||||||
{
|
|
||||||
table.Clear();
|
|
||||||
api.GetSongsBySearch(search).ForEach(s =>
|
|
||||||
{
|
|
||||||
table.Add(s);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AdvancedSearchFilter(string search, string album, string artist, string genre)
|
|
||||||
{
|
|
||||||
JObject o = api.GetAllBySearch(search, album, artist, genre);
|
|
||||||
if (o != null)
|
|
||||||
{
|
|
||||||
//q
|
|
||||||
form.AlbumListView.Items.Clear();
|
|
||||||
form.ArtistListBox.Items.Clear();
|
|
||||||
form.GenreListBox.Items.Clear();
|
|
||||||
form.PlaylistBox.Items.Clear();
|
|
||||||
table.Clear();
|
|
||||||
api.Songify(o).ForEach(s => table.Add(s));
|
|
||||||
|
|
||||||
//albums
|
|
||||||
api.Albumify(o).ForEach(a => form.AlbumListView.Items.Add(a.albumnaam, a.albumnaam));
|
|
||||||
|
|
||||||
//artists
|
|
||||||
api.Artistify(o).ForEach(a => form.ArtistListBox.Items.Add(a.naam));
|
|
||||||
|
|
||||||
//genres
|
|
||||||
api.Genrify(o).ForEach(g => form.GenreListBox.Items.Add(g.name));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void FilterCurrentPlaying()
|
public void FilterCurrentPlaying()
|
||||||
{
|
{
|
||||||
table.Clear();
|
table.Clear();
|
||||||
@@ -268,18 +214,6 @@ namespace MusicPlayer
|
|||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CheckURLValid(string source)
|
|
||||||
{
|
|
||||||
Uri uriResult;
|
|
||||||
return Uri.TryCreate(source, UriKind.Absolute, out uriResult) && uriResult.Scheme == Uri.UriSchemeHttp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetDomain(string url)
|
|
||||||
{
|
|
||||||
Uri uri = new Uri(url);
|
|
||||||
return uri.Host;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+55
-444
@@ -38,7 +38,6 @@ namespace MusicPlayer
|
|||||||
this.AlbumListView = new System.Windows.Forms.ListView();
|
this.AlbumListView = new System.Windows.Forms.ListView();
|
||||||
this.ArtistListBox = new System.Windows.Forms.ListBox();
|
this.ArtistListBox = new System.Windows.Forms.ListBox();
|
||||||
this.MainPanel = new System.Windows.Forms.Panel();
|
this.MainPanel = new System.Windows.Forms.Panel();
|
||||||
this.AddToQueueLabel = new System.Windows.Forms.Label();
|
|
||||||
this.SplitContainer = new System.Windows.Forms.SplitContainer();
|
this.SplitContainer = new System.Windows.Forms.SplitContainer();
|
||||||
this.PlaylistBox = new System.Windows.Forms.ListBox();
|
this.PlaylistBox = new System.Windows.Forms.ListBox();
|
||||||
this.AlbumListLabel = new System.Windows.Forms.Label();
|
this.AlbumListLabel = new System.Windows.Forms.Label();
|
||||||
@@ -53,15 +52,13 @@ namespace MusicPlayer
|
|||||||
this.overviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.overviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.playlistsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.playlistsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.ViewQueueButton = new System.Windows.Forms.ToolStripMenuItem();
|
this.ViewCurrentPlaylistButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.playbackToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.playbackToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.PlayNextSongButton = new System.Windows.Forms.ToolStripMenuItem();
|
this.PlayNextSongButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.LoopSongButton = new System.Windows.Forms.ToolStripMenuItem();
|
this.LoopSongButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.ShuffleSongButton = new System.Windows.Forms.ToolStripMenuItem();
|
this.ShuffleSongButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.playlistToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.playlistToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.makeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.makeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
|
|
||||||
this.viewPlaylistToolstripMenuButton = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.SearchGenresToolStripLabel = new System.Windows.Forms.ToolStripMenuItem();
|
this.SearchGenresToolStripLabel = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.SearchGenresTextBox = new System.Windows.Forms.ToolStripTextBox();
|
this.SearchGenresTextBox = new System.Windows.Forms.ToolStripTextBox();
|
||||||
@@ -69,26 +66,10 @@ namespace MusicPlayer
|
|||||||
this.SearchArtistToolStripLabel = new System.Windows.Forms.ToolStripMenuItem();
|
this.SearchArtistToolStripLabel = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.SearchArtistsTextBox = new System.Windows.Forms.ToolStripTextBox();
|
this.SearchArtistsTextBox = new System.Windows.Forms.ToolStripTextBox();
|
||||||
this.ClearArtistSearchButton = new System.Windows.Forms.ToolStripMenuItem();
|
this.ClearArtistSearchButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.songsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.SearchSongsTextBox = new System.Windows.Forms.ToolStripTextBox();
|
|
||||||
this.SearchSongsButton = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
|
|
||||||
this.AdvancedSearchButton = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.resetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.serverToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.serverToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.SelectServerJancoButton = new System.Windows.Forms.ToolStripMenuItem();
|
this.SelectServerJancoButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.SelectServerYorickButton = new System.Windows.Forms.ToolStripMenuItem();
|
this.SelectServerYorickButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.radioToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.fMToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.slamFMToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.qDanceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
|
||||||
this.customToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.RadioStationTextBox = new System.Windows.Forms.ToolStripTextBox();
|
|
||||||
this.SetRadioStationButton = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.ControlsPanel = new System.Windows.Forms.Panel();
|
this.ControlsPanel = new System.Windows.Forms.Panel();
|
||||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
|
||||||
this.NextButton = new System.Windows.Forms.Button();
|
this.NextButton = new System.Windows.Forms.Button();
|
||||||
this.PreviousButton = new System.Windows.Forms.Button();
|
this.PreviousButton = new System.Windows.Forms.Button();
|
||||||
this.CurrentSongLabel = new System.Windows.Forms.Label();
|
this.CurrentSongLabel = new System.Windows.Forms.Label();
|
||||||
@@ -109,27 +90,9 @@ namespace MusicPlayer
|
|||||||
this.NotifyMenuStripPlayButton = new System.Windows.Forms.ToolStripMenuItem();
|
this.NotifyMenuStripPlayButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.NotifyMenuStripPauseButton = new System.Windows.Forms.ToolStripMenuItem();
|
this.NotifyMenuStripPauseButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.NotifyMenuStripStopButton = new System.Windows.Forms.ToolStripMenuItem();
|
this.NotifyMenuStripStopButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
|
|
||||||
this.VolumeMenuStripButton = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.VolumeCurrentLabel = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();
|
|
||||||
this.Volume100Button = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.Volume75Button = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.Volume50Button = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.Volume25Button = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.Volume0Button = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
|
|
||||||
this.VolumeCustomButton = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.VolumeCustomTextBox = new System.Windows.Forms.ToolStripTextBox();
|
|
||||||
this.VolumeCustomSetButton = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.NotifyMenuStripNextButton = new System.Windows.Forms.ToolStripMenuItem();
|
this.NotifyMenuStripNextButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.NotifyMenuStripPreviousButton = new System.Windows.Forms.ToolStripMenuItem();
|
this.NotifyMenuStripPreviousButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.VolumeControl = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.VolumeLabel = new System.Windows.Forms.Label();
|
|
||||||
this.SaveBufferButton = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.ExitNotifyIconMenuStrip = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).BeginInit();
|
||||||
this.MainPanel.SuspendLayout();
|
this.MainPanel.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.SplitContainer)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.SplitContainer)).BeginInit();
|
||||||
@@ -138,10 +101,8 @@ namespace MusicPlayer
|
|||||||
this.SplitContainer.SuspendLayout();
|
this.SplitContainer.SuspendLayout();
|
||||||
this.MenuStrip.SuspendLayout();
|
this.MenuStrip.SuspendLayout();
|
||||||
this.ControlsPanel.SuspendLayout();
|
this.ControlsPanel.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.PositionTrackBar)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.PositionTrackBar)).BeginInit();
|
||||||
this.NotifyMenuStrip.SuspendLayout();
|
this.NotifyMenuStrip.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.VolumeControl)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// SongsTableView
|
// SongsTableView
|
||||||
@@ -183,7 +144,7 @@ namespace MusicPlayer
|
|||||||
this.GenreListBox.FormattingEnabled = true;
|
this.GenreListBox.FormattingEnabled = true;
|
||||||
this.GenreListBox.Location = new System.Drawing.Point(0, 0);
|
this.GenreListBox.Location = new System.Drawing.Point(0, 0);
|
||||||
this.GenreListBox.Name = "GenreListBox";
|
this.GenreListBox.Name = "GenreListBox";
|
||||||
this.GenreListBox.Size = new System.Drawing.Size(175, 121);
|
this.GenreListBox.Size = new System.Drawing.Size(150, 121);
|
||||||
this.GenreListBox.Sorted = true;
|
this.GenreListBox.Sorted = true;
|
||||||
this.GenreListBox.TabIndex = 1;
|
this.GenreListBox.TabIndex = 1;
|
||||||
this.GenreListBox.SelectedIndexChanged += new System.EventHandler(this.GenreListBox_SelectedIndexChanged);
|
this.GenreListBox.SelectedIndexChanged += new System.EventHandler(this.GenreListBox_SelectedIndexChanged);
|
||||||
@@ -194,13 +155,13 @@ namespace MusicPlayer
|
|||||||
| System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.AlbumListView.BackColor = System.Drawing.SystemColors.Control;
|
this.AlbumListView.BackColor = System.Drawing.SystemColors.Control;
|
||||||
this.AlbumListView.Location = new System.Drawing.Point(362, 0);
|
this.AlbumListView.Location = new System.Drawing.Point(312, 0);
|
||||||
this.AlbumListView.MultiSelect = false;
|
this.AlbumListView.MultiSelect = false;
|
||||||
this.AlbumListView.Name = "AlbumListView";
|
this.AlbumListView.Name = "AlbumListView";
|
||||||
this.AlbumListView.Size = new System.Drawing.Size(398, 121);
|
this.AlbumListView.Size = new System.Drawing.Size(448, 121);
|
||||||
this.AlbumListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
this.AlbumListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
||||||
this.AlbumListView.TabIndex = 2;
|
this.AlbumListView.TabIndex = 2;
|
||||||
this.AlbumListView.TileSize = new System.Drawing.Size(185, 30);
|
this.AlbumListView.TileSize = new System.Drawing.Size(140, 30);
|
||||||
this.AlbumListView.UseCompatibleStateImageBehavior = false;
|
this.AlbumListView.UseCompatibleStateImageBehavior = false;
|
||||||
this.AlbumListView.View = System.Windows.Forms.View.Tile;
|
this.AlbumListView.View = System.Windows.Forms.View.Tile;
|
||||||
this.AlbumListView.SelectedIndexChanged += new System.EventHandler(this.AlbumListView_SelectedIndexChanged);
|
this.AlbumListView.SelectedIndexChanged += new System.EventHandler(this.AlbumListView_SelectedIndexChanged);
|
||||||
@@ -211,9 +172,9 @@ namespace MusicPlayer
|
|||||||
| System.Windows.Forms.AnchorStyles.Left)));
|
| System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.ArtistListBox.BackColor = System.Drawing.SystemColors.Control;
|
this.ArtistListBox.BackColor = System.Drawing.SystemColors.Control;
|
||||||
this.ArtistListBox.FormattingEnabled = true;
|
this.ArtistListBox.FormattingEnabled = true;
|
||||||
this.ArtistListBox.Location = new System.Drawing.Point(181, 0);
|
this.ArtistListBox.Location = new System.Drawing.Point(156, 0);
|
||||||
this.ArtistListBox.Name = "ArtistListBox";
|
this.ArtistListBox.Name = "ArtistListBox";
|
||||||
this.ArtistListBox.Size = new System.Drawing.Size(175, 121);
|
this.ArtistListBox.Size = new System.Drawing.Size(150, 121);
|
||||||
this.ArtistListBox.Sorted = true;
|
this.ArtistListBox.Sorted = true;
|
||||||
this.ArtistListBox.TabIndex = 3;
|
this.ArtistListBox.TabIndex = 3;
|
||||||
this.ArtistListBox.SelectedIndexChanged += new System.EventHandler(this.ArtistListBox_SelectedIndexChanged);
|
this.ArtistListBox.SelectedIndexChanged += new System.EventHandler(this.ArtistListBox_SelectedIndexChanged);
|
||||||
@@ -224,7 +185,6 @@ namespace MusicPlayer
|
|||||||
| System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.MainPanel.BackColor = System.Drawing.SystemColors.Window;
|
this.MainPanel.BackColor = System.Drawing.SystemColors.Window;
|
||||||
this.MainPanel.Controls.Add(this.AddToQueueLabel);
|
|
||||||
this.MainPanel.Controls.Add(this.SplitContainer);
|
this.MainPanel.Controls.Add(this.SplitContainer);
|
||||||
this.MainPanel.Controls.Add(this.AlbumListLabel);
|
this.MainPanel.Controls.Add(this.AlbumListLabel);
|
||||||
this.MainPanel.Controls.Add(this.ArtistListLabel);
|
this.MainPanel.Controls.Add(this.ArtistListLabel);
|
||||||
@@ -235,20 +195,6 @@ namespace MusicPlayer
|
|||||||
this.MainPanel.Size = new System.Drawing.Size(784, 351);
|
this.MainPanel.Size = new System.Drawing.Size(784, 351);
|
||||||
this.MainPanel.TabIndex = 5;
|
this.MainPanel.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// AddToQueueLabel
|
|
||||||
//
|
|
||||||
this.AddToQueueLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.AddToQueueLabel.AutoSize = true;
|
|
||||||
this.AddToQueueLabel.BackColor = System.Drawing.SystemColors.Control;
|
|
||||||
this.AddToQueueLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.AddToQueueLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.AddToQueueLabel.Location = new System.Drawing.Point(668, 4);
|
|
||||||
this.AddToQueueLabel.Name = "AddToQueueLabel";
|
|
||||||
this.AddToQueueLabel.Size = new System.Drawing.Size(104, 18);
|
|
||||||
this.AddToQueueLabel.TabIndex = 10;
|
|
||||||
this.AddToQueueLabel.Text = "Add to Queue";
|
|
||||||
this.AddToQueueLabel.Visible = false;
|
|
||||||
//
|
|
||||||
// SplitContainer
|
// SplitContainer
|
||||||
//
|
//
|
||||||
this.SplitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
this.SplitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
@@ -288,7 +234,7 @@ namespace MusicPlayer
|
|||||||
// AlbumListLabel
|
// AlbumListLabel
|
||||||
//
|
//
|
||||||
this.AlbumListLabel.AutoSize = true;
|
this.AlbumListLabel.AutoSize = true;
|
||||||
this.AlbumListLabel.Location = new System.Drawing.Point(371, 9);
|
this.AlbumListLabel.Location = new System.Drawing.Point(321, 8);
|
||||||
this.AlbumListLabel.Name = "AlbumListLabel";
|
this.AlbumListLabel.Name = "AlbumListLabel";
|
||||||
this.AlbumListLabel.Size = new System.Drawing.Size(36, 13);
|
this.AlbumListLabel.Size = new System.Drawing.Size(36, 13);
|
||||||
this.AlbumListLabel.TabIndex = 6;
|
this.AlbumListLabel.TabIndex = 6;
|
||||||
@@ -297,7 +243,7 @@ namespace MusicPlayer
|
|||||||
// ArtistListLabel
|
// ArtistListLabel
|
||||||
//
|
//
|
||||||
this.ArtistListLabel.AutoSize = true;
|
this.ArtistListLabel.AutoSize = true;
|
||||||
this.ArtistListLabel.Location = new System.Drawing.Point(190, 9);
|
this.ArtistListLabel.Location = new System.Drawing.Point(165, 8);
|
||||||
this.ArtistListLabel.Name = "ArtistListLabel";
|
this.ArtistListLabel.Name = "ArtistListLabel";
|
||||||
this.ArtistListLabel.Size = new System.Drawing.Size(30, 13);
|
this.ArtistListLabel.Size = new System.Drawing.Size(30, 13);
|
||||||
this.ArtistListLabel.TabIndex = 5;
|
this.ArtistListLabel.TabIndex = 5;
|
||||||
@@ -306,7 +252,7 @@ namespace MusicPlayer
|
|||||||
// GenreListLabel
|
// GenreListLabel
|
||||||
//
|
//
|
||||||
this.GenreListLabel.AutoSize = true;
|
this.GenreListLabel.AutoSize = true;
|
||||||
this.GenreListLabel.Location = new System.Drawing.Point(9, 9);
|
this.GenreListLabel.Location = new System.Drawing.Point(9, 8);
|
||||||
this.GenreListLabel.Name = "GenreListLabel";
|
this.GenreListLabel.Name = "GenreListLabel";
|
||||||
this.GenreListLabel.Size = new System.Drawing.Size(36, 13);
|
this.GenreListLabel.Size = new System.Drawing.Size(36, 13);
|
||||||
this.GenreListLabel.TabIndex = 4;
|
this.GenreListLabel.TabIndex = 4;
|
||||||
@@ -324,15 +270,14 @@ namespace MusicPlayer
|
|||||||
//
|
//
|
||||||
// MenuStrip
|
// MenuStrip
|
||||||
//
|
//
|
||||||
this.MenuStrip.BackColor = System.Drawing.SystemColors.GrayText;
|
this.MenuStrip.BackColor = System.Drawing.SystemColors.WindowFrame;
|
||||||
this.MenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.MenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.fileToolStripMenuItem,
|
this.fileToolStripMenuItem,
|
||||||
this.viewToolStripMenuItem,
|
this.viewToolStripMenuItem,
|
||||||
this.playbackToolStripMenuItem,
|
this.playbackToolStripMenuItem,
|
||||||
this.playlistToolStripMenuItem,
|
this.playlistToolStripMenuItem,
|
||||||
this.searchToolStripMenuItem,
|
this.searchToolStripMenuItem,
|
||||||
this.serverToolStripMenuItem,
|
this.serverToolStripMenuItem});
|
||||||
this.radioToolStripMenuItem});
|
|
||||||
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
|
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
|
||||||
this.MenuStrip.Name = "MenuStrip";
|
this.MenuStrip.Name = "MenuStrip";
|
||||||
this.MenuStrip.Size = new System.Drawing.Size(784, 24);
|
this.MenuStrip.Size = new System.Drawing.Size(784, 24);
|
||||||
@@ -342,10 +287,8 @@ namespace MusicPlayer
|
|||||||
// fileToolStripMenuItem
|
// fileToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.SaveBufferButton,
|
|
||||||
this.toolStripSeparator1,
|
this.toolStripSeparator1,
|
||||||
this.exitToolStripMenuItem});
|
this.exitToolStripMenuItem});
|
||||||
this.fileToolStripMenuItem.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
||||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||||
this.fileToolStripMenuItem.Text = "File";
|
this.fileToolStripMenuItem.Text = "File";
|
||||||
@@ -353,12 +296,12 @@ namespace MusicPlayer
|
|||||||
// toolStripSeparator1
|
// toolStripSeparator1
|
||||||
//
|
//
|
||||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||||
this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
|
this.toolStripSeparator1.Size = new System.Drawing.Size(89, 6);
|
||||||
//
|
//
|
||||||
// exitToolStripMenuItem
|
// exitToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
|
||||||
this.exitToolStripMenuItem.Text = "Exit";
|
this.exitToolStripMenuItem.Text = "Exit";
|
||||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
@@ -368,7 +311,7 @@ namespace MusicPlayer
|
|||||||
this.overviewToolStripMenuItem,
|
this.overviewToolStripMenuItem,
|
||||||
this.playlistsToolStripMenuItem,
|
this.playlistsToolStripMenuItem,
|
||||||
this.toolStripSeparator4,
|
this.toolStripSeparator4,
|
||||||
this.ViewQueueButton});
|
this.ViewCurrentPlaylistButton});
|
||||||
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
|
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
|
||||||
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
|
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
|
||||||
this.viewToolStripMenuItem.Text = "View";
|
this.viewToolStripMenuItem.Text = "View";
|
||||||
@@ -376,28 +319,28 @@ namespace MusicPlayer
|
|||||||
// overviewToolStripMenuItem
|
// overviewToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.overviewToolStripMenuItem.Name = "overviewToolStripMenuItem";
|
this.overviewToolStripMenuItem.Name = "overviewToolStripMenuItem";
|
||||||
this.overviewToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
this.overviewToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
|
||||||
this.overviewToolStripMenuItem.Text = "Overview";
|
this.overviewToolStripMenuItem.Text = "Overview";
|
||||||
this.overviewToolStripMenuItem.Click += new System.EventHandler(this.overviewToolStripMenuItem_Click);
|
this.overviewToolStripMenuItem.Click += new System.EventHandler(this.overviewToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// playlistsToolStripMenuItem
|
// playlistsToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.playlistsToolStripMenuItem.Name = "playlistsToolStripMenuItem";
|
this.playlistsToolStripMenuItem.Name = "playlistsToolStripMenuItem";
|
||||||
this.playlistsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
this.playlistsToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
|
||||||
this.playlistsToolStripMenuItem.Text = "Playlists";
|
this.playlistsToolStripMenuItem.Text = "Playlists";
|
||||||
this.playlistsToolStripMenuItem.Click += new System.EventHandler(this.playlistsToolStripMenuItem_Click);
|
this.playlistsToolStripMenuItem.Click += new System.EventHandler(this.playlistsToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// toolStripSeparator4
|
// toolStripSeparator4
|
||||||
//
|
//
|
||||||
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
||||||
this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6);
|
this.toolStripSeparator4.Size = new System.Drawing.Size(151, 6);
|
||||||
//
|
//
|
||||||
// ViewQueueButton
|
// ViewCurrentPlaylistButton
|
||||||
//
|
//
|
||||||
this.ViewQueueButton.Name = "ViewQueueButton";
|
this.ViewCurrentPlaylistButton.Name = "ViewCurrentPlaylistButton";
|
||||||
this.ViewQueueButton.Size = new System.Drawing.Size(152, 22);
|
this.ViewCurrentPlaylistButton.Size = new System.Drawing.Size(154, 22);
|
||||||
this.ViewQueueButton.Text = "Queue";
|
this.ViewCurrentPlaylistButton.Text = "Current Playlist";
|
||||||
this.ViewQueueButton.Click += new System.EventHandler(this.ViewCurrentPlaylistButton_Click);
|
this.ViewCurrentPlaylistButton.Click += new System.EventHandler(this.ViewCurrentPlaylistButton_Click);
|
||||||
//
|
//
|
||||||
// playbackToolStripMenuItem
|
// playbackToolStripMenuItem
|
||||||
//
|
//
|
||||||
@@ -415,7 +358,7 @@ namespace MusicPlayer
|
|||||||
this.PlayNextSongButton.CheckOnClick = true;
|
this.PlayNextSongButton.CheckOnClick = true;
|
||||||
this.PlayNextSongButton.CheckState = System.Windows.Forms.CheckState.Checked;
|
this.PlayNextSongButton.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
this.PlayNextSongButton.Name = "PlayNextSongButton";
|
this.PlayNextSongButton.Name = "PlayNextSongButton";
|
||||||
this.PlayNextSongButton.Size = new System.Drawing.Size(152, 22);
|
this.PlayNextSongButton.Size = new System.Drawing.Size(123, 22);
|
||||||
this.PlayNextSongButton.Text = "Play Next";
|
this.PlayNextSongButton.Text = "Play Next";
|
||||||
//
|
//
|
||||||
// LoopSongButton
|
// LoopSongButton
|
||||||
@@ -424,7 +367,7 @@ namespace MusicPlayer
|
|||||||
this.LoopSongButton.CheckOnClick = true;
|
this.LoopSongButton.CheckOnClick = true;
|
||||||
this.LoopSongButton.CheckState = System.Windows.Forms.CheckState.Checked;
|
this.LoopSongButton.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
this.LoopSongButton.Name = "LoopSongButton";
|
this.LoopSongButton.Name = "LoopSongButton";
|
||||||
this.LoopSongButton.Size = new System.Drawing.Size(152, 22);
|
this.LoopSongButton.Size = new System.Drawing.Size(123, 22);
|
||||||
this.LoopSongButton.Text = "Loop";
|
this.LoopSongButton.Text = "Loop";
|
||||||
//
|
//
|
||||||
// ShuffleSongButton
|
// ShuffleSongButton
|
||||||
@@ -432,15 +375,13 @@ namespace MusicPlayer
|
|||||||
this.ShuffleSongButton.CheckOnClick = true;
|
this.ShuffleSongButton.CheckOnClick = true;
|
||||||
this.ShuffleSongButton.Enabled = false;
|
this.ShuffleSongButton.Enabled = false;
|
||||||
this.ShuffleSongButton.Name = "ShuffleSongButton";
|
this.ShuffleSongButton.Name = "ShuffleSongButton";
|
||||||
this.ShuffleSongButton.Size = new System.Drawing.Size(152, 22);
|
this.ShuffleSongButton.Size = new System.Drawing.Size(123, 22);
|
||||||
this.ShuffleSongButton.Text = "Shuffle";
|
this.ShuffleSongButton.Text = "Shuffle";
|
||||||
//
|
//
|
||||||
// playlistToolStripMenuItem
|
// playlistToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.playlistToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.playlistToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.makeToolStripMenuItem,
|
this.makeToolStripMenuItem});
|
||||||
this.toolStripSeparator6,
|
|
||||||
this.viewPlaylistToolstripMenuButton});
|
|
||||||
this.playlistToolStripMenuItem.Name = "playlistToolStripMenuItem";
|
this.playlistToolStripMenuItem.Name = "playlistToolStripMenuItem";
|
||||||
this.playlistToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
|
this.playlistToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
|
||||||
this.playlistToolStripMenuItem.Text = "Playlist";
|
this.playlistToolStripMenuItem.Text = "Playlist";
|
||||||
@@ -448,31 +389,15 @@ namespace MusicPlayer
|
|||||||
// makeToolStripMenuItem
|
// makeToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.makeToolStripMenuItem.Name = "makeToolStripMenuItem";
|
this.makeToolStripMenuItem.Name = "makeToolStripMenuItem";
|
||||||
this.makeToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
this.makeToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
|
||||||
this.makeToolStripMenuItem.Text = "Create / Edit";
|
this.makeToolStripMenuItem.Text = "Create / Edit";
|
||||||
this.makeToolStripMenuItem.Click += new System.EventHandler(this.makeToolStripMenuItem_Click);
|
this.makeToolStripMenuItem.Click += new System.EventHandler(this.makeToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// toolStripSeparator6
|
|
||||||
//
|
|
||||||
this.toolStripSeparator6.Name = "toolStripSeparator6";
|
|
||||||
this.toolStripSeparator6.Size = new System.Drawing.Size(149, 6);
|
|
||||||
//
|
|
||||||
// viewPlaylistToolstripMenuButton
|
|
||||||
//
|
|
||||||
this.viewPlaylistToolstripMenuButton.Name = "viewPlaylistToolstripMenuButton";
|
|
||||||
this.viewPlaylistToolstripMenuButton.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.viewPlaylistToolstripMenuButton.Text = "View";
|
|
||||||
this.viewPlaylistToolstripMenuButton.Click += new System.EventHandler(this.playlistsToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// searchToolStripMenuItem
|
// searchToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.searchToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.searchToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.SearchGenresToolStripLabel,
|
this.SearchGenresToolStripLabel,
|
||||||
this.SearchArtistToolStripLabel,
|
this.SearchArtistToolStripLabel});
|
||||||
this.songsToolStripMenuItem,
|
|
||||||
this.toolStripSeparator7,
|
|
||||||
this.AdvancedSearchButton,
|
|
||||||
this.resetToolStripMenuItem});
|
|
||||||
this.searchToolStripMenuItem.Name = "searchToolStripMenuItem";
|
this.searchToolStripMenuItem.Name = "searchToolStripMenuItem";
|
||||||
this.searchToolStripMenuItem.Size = new System.Drawing.Size(54, 20);
|
this.searchToolStripMenuItem.Size = new System.Drawing.Size(54, 20);
|
||||||
this.searchToolStripMenuItem.Text = "Search";
|
this.searchToolStripMenuItem.Text = "Search";
|
||||||
@@ -483,7 +408,7 @@ namespace MusicPlayer
|
|||||||
this.SearchGenresTextBox,
|
this.SearchGenresTextBox,
|
||||||
this.ClearGenreSearchButton});
|
this.ClearGenreSearchButton});
|
||||||
this.SearchGenresToolStripLabel.Name = "SearchGenresToolStripLabel";
|
this.SearchGenresToolStripLabel.Name = "SearchGenresToolStripLabel";
|
||||||
this.SearchGenresToolStripLabel.Size = new System.Drawing.Size(152, 22);
|
this.SearchGenresToolStripLabel.Size = new System.Drawing.Size(110, 22);
|
||||||
this.SearchGenresToolStripLabel.Text = "Genres";
|
this.SearchGenresToolStripLabel.Text = "Genres";
|
||||||
//
|
//
|
||||||
// SearchGenresTextBox
|
// SearchGenresTextBox
|
||||||
@@ -506,7 +431,7 @@ namespace MusicPlayer
|
|||||||
this.SearchArtistsTextBox,
|
this.SearchArtistsTextBox,
|
||||||
this.ClearArtistSearchButton});
|
this.ClearArtistSearchButton});
|
||||||
this.SearchArtistToolStripLabel.Name = "SearchArtistToolStripLabel";
|
this.SearchArtistToolStripLabel.Name = "SearchArtistToolStripLabel";
|
||||||
this.SearchArtistToolStripLabel.Size = new System.Drawing.Size(152, 22);
|
this.SearchArtistToolStripLabel.Size = new System.Drawing.Size(110, 22);
|
||||||
this.SearchArtistToolStripLabel.Text = "Artists";
|
this.SearchArtistToolStripLabel.Text = "Artists";
|
||||||
//
|
//
|
||||||
// SearchArtistsTextBox
|
// SearchArtistsTextBox
|
||||||
@@ -523,47 +448,6 @@ namespace MusicPlayer
|
|||||||
this.ClearArtistSearchButton.Text = "Clear Search";
|
this.ClearArtistSearchButton.Text = "Clear Search";
|
||||||
this.ClearArtistSearchButton.Click += new System.EventHandler(this.ClearArtistSearchButton_Click);
|
this.ClearArtistSearchButton.Click += new System.EventHandler(this.ClearArtistSearchButton_Click);
|
||||||
//
|
//
|
||||||
// songsToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.songsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.SearchSongsTextBox,
|
|
||||||
this.SearchSongsButton});
|
|
||||||
this.songsToolStripMenuItem.Name = "songsToolStripMenuItem";
|
|
||||||
this.songsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.songsToolStripMenuItem.Text = "Songs";
|
|
||||||
//
|
|
||||||
// SearchSongsTextBox
|
|
||||||
//
|
|
||||||
this.SearchSongsTextBox.Name = "SearchSongsTextBox";
|
|
||||||
this.SearchSongsTextBox.Size = new System.Drawing.Size(100, 23);
|
|
||||||
//
|
|
||||||
// SearchSongsButton
|
|
||||||
//
|
|
||||||
this.SearchSongsButton.Enabled = false;
|
|
||||||
this.SearchSongsButton.Name = "SearchSongsButton";
|
|
||||||
this.SearchSongsButton.Size = new System.Drawing.Size(160, 22);
|
|
||||||
this.SearchSongsButton.Text = "Search";
|
|
||||||
this.SearchSongsButton.Click += new System.EventHandler(this.SearchSongsButton_Click);
|
|
||||||
//
|
|
||||||
// toolStripSeparator7
|
|
||||||
//
|
|
||||||
this.toolStripSeparator7.Name = "toolStripSeparator7";
|
|
||||||
this.toolStripSeparator7.Size = new System.Drawing.Size(149, 6);
|
|
||||||
//
|
|
||||||
// AdvancedSearchButton
|
|
||||||
//
|
|
||||||
this.AdvancedSearchButton.Name = "AdvancedSearchButton";
|
|
||||||
this.AdvancedSearchButton.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.AdvancedSearchButton.Text = "Advanced";
|
|
||||||
this.AdvancedSearchButton.Click += new System.EventHandler(this.AdvancedSearchButton_Click);
|
|
||||||
//
|
|
||||||
// resetToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.resetToolStripMenuItem.Name = "resetToolStripMenuItem";
|
|
||||||
this.resetToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.resetToolStripMenuItem.Text = "Reset";
|
|
||||||
this.resetToolStripMenuItem.Click += new System.EventHandler(this.resetToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// serverToolStripMenuItem
|
// serverToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.serverToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.serverToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
@@ -576,88 +460,20 @@ namespace MusicPlayer
|
|||||||
// SelectServerJancoButton
|
// SelectServerJancoButton
|
||||||
//
|
//
|
||||||
this.SelectServerJancoButton.Name = "SelectServerJancoButton";
|
this.SelectServerJancoButton.Name = "SelectServerJancoButton";
|
||||||
this.SelectServerJancoButton.Size = new System.Drawing.Size(152, 22);
|
this.SelectServerJancoButton.Size = new System.Drawing.Size(148, 22);
|
||||||
this.SelectServerJancoButton.Text = "jancokock.me";
|
this.SelectServerJancoButton.Text = "jancokock.me";
|
||||||
this.SelectServerJancoButton.Click += new System.EventHandler(this.SelectServerJancoButton_Click);
|
this.SelectServerJancoButton.Click += new System.EventHandler(this.SelectServerJancoButton_Click);
|
||||||
//
|
//
|
||||||
// SelectServerYorickButton
|
// SelectServerYorickButton
|
||||||
//
|
//
|
||||||
this.SelectServerYorickButton.Name = "SelectServerYorickButton";
|
this.SelectServerYorickButton.Name = "SelectServerYorickButton";
|
||||||
this.SelectServerYorickButton.Size = new System.Drawing.Size(152, 22);
|
this.SelectServerYorickButton.Size = new System.Drawing.Size(148, 22);
|
||||||
this.SelectServerYorickButton.Text = "imegumii.nl";
|
this.SelectServerYorickButton.Text = "imegumii.nl";
|
||||||
this.SelectServerYorickButton.Click += new System.EventHandler(this.SelectServerYorickButton_Click);
|
this.SelectServerYorickButton.Click += new System.EventHandler(this.SelectServerYorickButton_Click);
|
||||||
//
|
//
|
||||||
// radioToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.radioToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.toolStripMenuItem2,
|
|
||||||
this.fMToolStripMenuItem,
|
|
||||||
this.slamFMToolStripMenuItem,
|
|
||||||
this.qDanceToolStripMenuItem,
|
|
||||||
this.toolStripSeparator5,
|
|
||||||
this.customToolStripMenuItem});
|
|
||||||
this.radioToolStripMenuItem.Name = "radioToolStripMenuItem";
|
|
||||||
this.radioToolStripMenuItem.Size = new System.Drawing.Size(49, 20);
|
|
||||||
this.radioToolStripMenuItem.Text = "Radio";
|
|
||||||
//
|
|
||||||
// toolStripMenuItem2
|
|
||||||
//
|
|
||||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
|
||||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.toolStripMenuItem2.Text = "538";
|
|
||||||
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
|
|
||||||
//
|
|
||||||
// fMToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.fMToolStripMenuItem.Name = "fMToolStripMenuItem";
|
|
||||||
this.fMToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.fMToolStripMenuItem.Text = "3FM";
|
|
||||||
this.fMToolStripMenuItem.Click += new System.EventHandler(this.fMToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// slamFMToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.slamFMToolStripMenuItem.Name = "slamFMToolStripMenuItem";
|
|
||||||
this.slamFMToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.slamFMToolStripMenuItem.Text = "Slam-FM";
|
|
||||||
this.slamFMToolStripMenuItem.Click += new System.EventHandler(this.slamFMToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// qDanceToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.qDanceToolStripMenuItem.Name = "qDanceToolStripMenuItem";
|
|
||||||
this.qDanceToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.qDanceToolStripMenuItem.Text = "Q-Dance";
|
|
||||||
this.qDanceToolStripMenuItem.Click += new System.EventHandler(this.qDanceToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// toolStripSeparator5
|
|
||||||
//
|
|
||||||
this.toolStripSeparator5.Name = "toolStripSeparator5";
|
|
||||||
this.toolStripSeparator5.Size = new System.Drawing.Size(149, 6);
|
|
||||||
//
|
|
||||||
// customToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.customToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.RadioStationTextBox,
|
|
||||||
this.SetRadioStationButton});
|
|
||||||
this.customToolStripMenuItem.Name = "customToolStripMenuItem";
|
|
||||||
this.customToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.customToolStripMenuItem.Text = "Custom";
|
|
||||||
//
|
|
||||||
// RadioStationTextBox
|
|
||||||
//
|
|
||||||
this.RadioStationTextBox.Name = "RadioStationTextBox";
|
|
||||||
this.RadioStationTextBox.Size = new System.Drawing.Size(100, 23);
|
|
||||||
//
|
|
||||||
// SetRadioStationButton
|
|
||||||
//
|
|
||||||
this.SetRadioStationButton.Name = "SetRadioStationButton";
|
|
||||||
this.SetRadioStationButton.Size = new System.Drawing.Size(160, 22);
|
|
||||||
this.SetRadioStationButton.Text = "Set";
|
|
||||||
this.SetRadioStationButton.Click += new System.EventHandler(this.SetRadioStationButton_Click);
|
|
||||||
//
|
|
||||||
// ControlsPanel
|
// ControlsPanel
|
||||||
//
|
//
|
||||||
this.ControlsPanel.BackColor = System.Drawing.SystemColors.GrayText;
|
this.ControlsPanel.BackColor = System.Drawing.SystemColors.WindowFrame;
|
||||||
this.ControlsPanel.Controls.Add(this.pictureBox1);
|
|
||||||
this.ControlsPanel.Controls.Add(this.NextButton);
|
this.ControlsPanel.Controls.Add(this.NextButton);
|
||||||
this.ControlsPanel.Controls.Add(this.PreviousButton);
|
this.ControlsPanel.Controls.Add(this.PreviousButton);
|
||||||
this.ControlsPanel.Controls.Add(this.CurrentSongLabel);
|
this.ControlsPanel.Controls.Add(this.CurrentSongLabel);
|
||||||
@@ -675,19 +491,9 @@ namespace MusicPlayer
|
|||||||
this.ControlsPanel.Size = new System.Drawing.Size(784, 83);
|
this.ControlsPanel.Size = new System.Drawing.Size(784, 83);
|
||||||
this.ControlsPanel.TabIndex = 4;
|
this.ControlsPanel.TabIndex = 4;
|
||||||
//
|
//
|
||||||
// pictureBox1
|
|
||||||
//
|
|
||||||
this.pictureBox1.BackColor = System.Drawing.SystemColors.Control;
|
|
||||||
this.pictureBox1.Location = new System.Drawing.Point(5, 5);
|
|
||||||
this.pictureBox1.Name = "pictureBox1";
|
|
||||||
this.pictureBox1.Size = new System.Drawing.Size(72, 72);
|
|
||||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
|
||||||
this.pictureBox1.TabIndex = 14;
|
|
||||||
this.pictureBox1.TabStop = false;
|
|
||||||
//
|
|
||||||
// NextButton
|
// NextButton
|
||||||
//
|
//
|
||||||
this.NextButton.Location = new System.Drawing.Point(295, 54);
|
this.NextButton.Location = new System.Drawing.Point(214, 51);
|
||||||
this.NextButton.Name = "NextButton";
|
this.NextButton.Name = "NextButton";
|
||||||
this.NextButton.Size = new System.Drawing.Size(31, 23);
|
this.NextButton.Size = new System.Drawing.Size(31, 23);
|
||||||
this.NextButton.TabIndex = 13;
|
this.NextButton.TabIndex = 13;
|
||||||
@@ -697,7 +503,7 @@ namespace MusicPlayer
|
|||||||
//
|
//
|
||||||
// PreviousButton
|
// PreviousButton
|
||||||
//
|
//
|
||||||
this.PreviousButton.Location = new System.Drawing.Point(258, 54);
|
this.PreviousButton.Location = new System.Drawing.Point(177, 51);
|
||||||
this.PreviousButton.Name = "PreviousButton";
|
this.PreviousButton.Name = "PreviousButton";
|
||||||
this.PreviousButton.Size = new System.Drawing.Size(31, 23);
|
this.PreviousButton.Size = new System.Drawing.Size(31, 23);
|
||||||
this.PreviousButton.TabIndex = 12;
|
this.PreviousButton.TabIndex = 12;
|
||||||
@@ -708,7 +514,7 @@ namespace MusicPlayer
|
|||||||
// CurrentSongLabel
|
// CurrentSongLabel
|
||||||
//
|
//
|
||||||
this.CurrentSongLabel.AutoSize = true;
|
this.CurrentSongLabel.AutoSize = true;
|
||||||
this.CurrentSongLabel.Location = new System.Drawing.Point(332, 59);
|
this.CurrentSongLabel.Location = new System.Drawing.Point(256, 56);
|
||||||
this.CurrentSongLabel.Name = "CurrentSongLabel";
|
this.CurrentSongLabel.Name = "CurrentSongLabel";
|
||||||
this.CurrentSongLabel.Size = new System.Drawing.Size(111, 13);
|
this.CurrentSongLabel.Size = new System.Drawing.Size(111, 13);
|
||||||
this.CurrentSongLabel.TabIndex = 11;
|
this.CurrentSongLabel.TabIndex = 11;
|
||||||
@@ -727,7 +533,7 @@ namespace MusicPlayer
|
|||||||
// LabelCurrentTime
|
// LabelCurrentTime
|
||||||
//
|
//
|
||||||
this.LabelCurrentTime.AutoSize = true;
|
this.LabelCurrentTime.AutoSize = true;
|
||||||
this.LabelCurrentTime.Location = new System.Drawing.Point(93, 29);
|
this.LabelCurrentTime.Location = new System.Drawing.Point(12, 26);
|
||||||
this.LabelCurrentTime.Name = "LabelCurrentTime";
|
this.LabelCurrentTime.Name = "LabelCurrentTime";
|
||||||
this.LabelCurrentTime.Size = new System.Drawing.Size(49, 13);
|
this.LabelCurrentTime.Size = new System.Drawing.Size(49, 13);
|
||||||
this.LabelCurrentTime.TabIndex = 8;
|
this.LabelCurrentTime.TabIndex = 8;
|
||||||
@@ -738,10 +544,10 @@ namespace MusicPlayer
|
|||||||
this.PositionTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.PositionTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.PositionTrackBar.Enabled = false;
|
this.PositionTrackBar.Enabled = false;
|
||||||
this.PositionTrackBar.Location = new System.Drawing.Point(83, 3);
|
this.PositionTrackBar.Location = new System.Drawing.Point(3, 3);
|
||||||
this.PositionTrackBar.Maximum = 1000;
|
this.PositionTrackBar.Maximum = 1000;
|
||||||
this.PositionTrackBar.Name = "PositionTrackBar";
|
this.PositionTrackBar.Name = "PositionTrackBar";
|
||||||
this.PositionTrackBar.Size = new System.Drawing.Size(698, 45);
|
this.PositionTrackBar.Size = new System.Drawing.Size(778, 45);
|
||||||
this.PositionTrackBar.TabIndex = 7;
|
this.PositionTrackBar.TabIndex = 7;
|
||||||
this.PositionTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
|
this.PositionTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||||
this.PositionTrackBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionTrackBar_MouseDown);
|
this.PositionTrackBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionTrackBar_MouseDown);
|
||||||
@@ -767,7 +573,7 @@ namespace MusicPlayer
|
|||||||
// StopButton
|
// StopButton
|
||||||
//
|
//
|
||||||
this.StopButton.Enabled = false;
|
this.StopButton.Enabled = false;
|
||||||
this.StopButton.Location = new System.Drawing.Point(203, 54);
|
this.StopButton.Location = new System.Drawing.Point(122, 51);
|
||||||
this.StopButton.Name = "StopButton";
|
this.StopButton.Name = "StopButton";
|
||||||
this.StopButton.Size = new System.Drawing.Size(49, 23);
|
this.StopButton.Size = new System.Drawing.Size(49, 23);
|
||||||
this.StopButton.TabIndex = 2;
|
this.StopButton.TabIndex = 2;
|
||||||
@@ -778,7 +584,7 @@ namespace MusicPlayer
|
|||||||
// PauseButton
|
// PauseButton
|
||||||
//
|
//
|
||||||
this.PauseButton.Enabled = false;
|
this.PauseButton.Enabled = false;
|
||||||
this.PauseButton.Location = new System.Drawing.Point(148, 54);
|
this.PauseButton.Location = new System.Drawing.Point(67, 51);
|
||||||
this.PauseButton.Name = "PauseButton";
|
this.PauseButton.Name = "PauseButton";
|
||||||
this.PauseButton.Size = new System.Drawing.Size(49, 23);
|
this.PauseButton.Size = new System.Drawing.Size(49, 23);
|
||||||
this.PauseButton.TabIndex = 1;
|
this.PauseButton.TabIndex = 1;
|
||||||
@@ -788,7 +594,7 @@ namespace MusicPlayer
|
|||||||
//
|
//
|
||||||
// PlayButton
|
// PlayButton
|
||||||
//
|
//
|
||||||
this.PlayButton.Location = new System.Drawing.Point(93, 54);
|
this.PlayButton.Location = new System.Drawing.Point(12, 51);
|
||||||
this.PlayButton.Name = "PlayButton";
|
this.PlayButton.Name = "PlayButton";
|
||||||
this.PlayButton.Size = new System.Drawing.Size(49, 23);
|
this.PlayButton.Size = new System.Drawing.Size(49, 23);
|
||||||
this.PlayButton.TabIndex = 0;
|
this.PlayButton.TabIndex = 0;
|
||||||
@@ -803,14 +609,10 @@ namespace MusicPlayer
|
|||||||
//
|
//
|
||||||
// NotifyIcon
|
// NotifyIcon
|
||||||
//
|
//
|
||||||
this.NotifyIcon.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info;
|
|
||||||
this.NotifyIcon.BalloonTipText = "YJMPD Music player stays active in the background. Click to show.";
|
|
||||||
this.NotifyIcon.BalloonTipTitle = "YJMPD Minimized";
|
|
||||||
this.NotifyIcon.ContextMenuStrip = this.NotifyMenuStrip;
|
this.NotifyIcon.ContextMenuStrip = this.NotifyMenuStrip;
|
||||||
this.NotifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("NotifyIcon.Icon")));
|
this.NotifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("NotifyIcon.Icon")));
|
||||||
this.NotifyIcon.Text = "YJMPD Music Player. Click to show.";
|
this.NotifyIcon.Text = "NotifyIcon";
|
||||||
this.NotifyIcon.Visible = true;
|
this.NotifyIcon.Visible = true;
|
||||||
this.NotifyIcon.BalloonTipClicked += new System.EventHandler(this.NotifyIcon_BalloonTipClicked);
|
|
||||||
this.NotifyIcon.MouseUp += new System.Windows.Forms.MouseEventHandler(this.NotifyIcon_Click);
|
this.NotifyIcon.MouseUp += new System.Windows.Forms.MouseEventHandler(this.NotifyIcon_Click);
|
||||||
//
|
//
|
||||||
// NotifyMenuStrip
|
// NotifyMenuStrip
|
||||||
@@ -821,15 +623,11 @@ namespace MusicPlayer
|
|||||||
this.NotifyMenuStripPlayButton,
|
this.NotifyMenuStripPlayButton,
|
||||||
this.NotifyMenuStripPauseButton,
|
this.NotifyMenuStripPauseButton,
|
||||||
this.NotifyMenuStripStopButton,
|
this.NotifyMenuStripStopButton,
|
||||||
this.toolStripSeparator8,
|
|
||||||
this.VolumeMenuStripButton,
|
|
||||||
this.toolStripSeparator3,
|
this.toolStripSeparator3,
|
||||||
this.NotifyMenuStripNextButton,
|
this.NotifyMenuStripNextButton,
|
||||||
this.NotifyMenuStripPreviousButton,
|
this.NotifyMenuStripPreviousButton});
|
||||||
this.toolStripSeparator11,
|
|
||||||
this.ExitNotifyIconMenuStrip});
|
|
||||||
this.NotifyMenuStrip.Name = "NotifyMenuStrip";
|
this.NotifyMenuStrip.Name = "NotifyMenuStrip";
|
||||||
this.NotifyMenuStrip.Size = new System.Drawing.Size(153, 226);
|
this.NotifyMenuStrip.Size = new System.Drawing.Size(120, 148);
|
||||||
//
|
//
|
||||||
// NotifyMenuStripPlayingLabel
|
// NotifyMenuStripPlayingLabel
|
||||||
//
|
//
|
||||||
@@ -837,7 +635,7 @@ namespace MusicPlayer
|
|||||||
this.NotifyMenuStripPlayingSongLabel});
|
this.NotifyMenuStripPlayingSongLabel});
|
||||||
this.NotifyMenuStripPlayingLabel.Enabled = false;
|
this.NotifyMenuStripPlayingLabel.Enabled = false;
|
||||||
this.NotifyMenuStripPlayingLabel.Name = "NotifyMenuStripPlayingLabel";
|
this.NotifyMenuStripPlayingLabel.Name = "NotifyMenuStripPlayingLabel";
|
||||||
this.NotifyMenuStripPlayingLabel.Size = new System.Drawing.Size(152, 22);
|
this.NotifyMenuStripPlayingLabel.Size = new System.Drawing.Size(119, 22);
|
||||||
this.NotifyMenuStripPlayingLabel.Text = "Stopped";
|
this.NotifyMenuStripPlayingLabel.Text = "Stopped";
|
||||||
//
|
//
|
||||||
// NotifyMenuStripPlayingSongLabel
|
// NotifyMenuStripPlayingSongLabel
|
||||||
@@ -851,12 +649,12 @@ namespace MusicPlayer
|
|||||||
// toolStripSeparator2
|
// toolStripSeparator2
|
||||||
//
|
//
|
||||||
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||||
this.toolStripSeparator2.Size = new System.Drawing.Size(149, 6);
|
this.toolStripSeparator2.Size = new System.Drawing.Size(116, 6);
|
||||||
//
|
//
|
||||||
// NotifyMenuStripPlayButton
|
// NotifyMenuStripPlayButton
|
||||||
//
|
//
|
||||||
this.NotifyMenuStripPlayButton.Name = "NotifyMenuStripPlayButton";
|
this.NotifyMenuStripPlayButton.Name = "NotifyMenuStripPlayButton";
|
||||||
this.NotifyMenuStripPlayButton.Size = new System.Drawing.Size(152, 22);
|
this.NotifyMenuStripPlayButton.Size = new System.Drawing.Size(119, 22);
|
||||||
this.NotifyMenuStripPlayButton.Text = "Play";
|
this.NotifyMenuStripPlayButton.Text = "Play";
|
||||||
this.NotifyMenuStripPlayButton.Click += new System.EventHandler(this.NotifyMenuStripPlayButton_Click);
|
this.NotifyMenuStripPlayButton.Click += new System.EventHandler(this.NotifyMenuStripPlayButton_Click);
|
||||||
//
|
//
|
||||||
@@ -864,7 +662,7 @@ namespace MusicPlayer
|
|||||||
//
|
//
|
||||||
this.NotifyMenuStripPauseButton.Enabled = false;
|
this.NotifyMenuStripPauseButton.Enabled = false;
|
||||||
this.NotifyMenuStripPauseButton.Name = "NotifyMenuStripPauseButton";
|
this.NotifyMenuStripPauseButton.Name = "NotifyMenuStripPauseButton";
|
||||||
this.NotifyMenuStripPauseButton.Size = new System.Drawing.Size(152, 22);
|
this.NotifyMenuStripPauseButton.Size = new System.Drawing.Size(119, 22);
|
||||||
this.NotifyMenuStripPauseButton.Text = "Pause";
|
this.NotifyMenuStripPauseButton.Text = "Pause";
|
||||||
this.NotifyMenuStripPauseButton.Click += new System.EventHandler(this.NotifyMenuStripPauseButton_Click);
|
this.NotifyMenuStripPauseButton.Click += new System.EventHandler(this.NotifyMenuStripPauseButton_Click);
|
||||||
//
|
//
|
||||||
@@ -872,181 +670,34 @@ namespace MusicPlayer
|
|||||||
//
|
//
|
||||||
this.NotifyMenuStripStopButton.Enabled = false;
|
this.NotifyMenuStripStopButton.Enabled = false;
|
||||||
this.NotifyMenuStripStopButton.Name = "NotifyMenuStripStopButton";
|
this.NotifyMenuStripStopButton.Name = "NotifyMenuStripStopButton";
|
||||||
this.NotifyMenuStripStopButton.Size = new System.Drawing.Size(152, 22);
|
this.NotifyMenuStripStopButton.Size = new System.Drawing.Size(119, 22);
|
||||||
this.NotifyMenuStripStopButton.Text = "Stop";
|
this.NotifyMenuStripStopButton.Text = "Stop";
|
||||||
this.NotifyMenuStripStopButton.Click += new System.EventHandler(this.NotifyMenuStripStopButton_Click);
|
this.NotifyMenuStripStopButton.Click += new System.EventHandler(this.NotifyMenuStripStopButton_Click);
|
||||||
//
|
//
|
||||||
// toolStripSeparator8
|
|
||||||
//
|
|
||||||
this.toolStripSeparator8.Name = "toolStripSeparator8";
|
|
||||||
this.toolStripSeparator8.Size = new System.Drawing.Size(149, 6);
|
|
||||||
//
|
|
||||||
// VolumeMenuStripButton
|
|
||||||
//
|
|
||||||
this.VolumeMenuStripButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.VolumeCurrentLabel,
|
|
||||||
this.toolStripSeparator10,
|
|
||||||
this.Volume100Button,
|
|
||||||
this.Volume75Button,
|
|
||||||
this.Volume50Button,
|
|
||||||
this.Volume25Button,
|
|
||||||
this.Volume0Button,
|
|
||||||
this.toolStripSeparator9,
|
|
||||||
this.VolumeCustomButton});
|
|
||||||
this.VolumeMenuStripButton.Name = "VolumeMenuStripButton";
|
|
||||||
this.VolumeMenuStripButton.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.VolumeMenuStripButton.Text = "Volume";
|
|
||||||
//
|
|
||||||
// VolumeCurrentLabel
|
|
||||||
//
|
|
||||||
this.VolumeCurrentLabel.Enabled = false;
|
|
||||||
this.VolumeCurrentLabel.Name = "VolumeCurrentLabel";
|
|
||||||
this.VolumeCurrentLabel.Size = new System.Drawing.Size(154, 22);
|
|
||||||
this.VolumeCurrentLabel.Text = "Currently 100%";
|
|
||||||
//
|
|
||||||
// toolStripSeparator10
|
|
||||||
//
|
|
||||||
this.toolStripSeparator10.Name = "toolStripSeparator10";
|
|
||||||
this.toolStripSeparator10.Size = new System.Drawing.Size(151, 6);
|
|
||||||
//
|
|
||||||
// Volume100Button
|
|
||||||
//
|
|
||||||
this.Volume100Button.Name = "Volume100Button";
|
|
||||||
this.Volume100Button.Size = new System.Drawing.Size(154, 22);
|
|
||||||
this.Volume100Button.Text = "100%";
|
|
||||||
this.Volume100Button.Click += new System.EventHandler(this.Volume100Button_Click);
|
|
||||||
//
|
|
||||||
// Volume75Button
|
|
||||||
//
|
|
||||||
this.Volume75Button.Name = "Volume75Button";
|
|
||||||
this.Volume75Button.Size = new System.Drawing.Size(154, 22);
|
|
||||||
this.Volume75Button.Text = "75%";
|
|
||||||
this.Volume75Button.Click += new System.EventHandler(this.Volume75Button_Click);
|
|
||||||
//
|
|
||||||
// Volume50Button
|
|
||||||
//
|
|
||||||
this.Volume50Button.Name = "Volume50Button";
|
|
||||||
this.Volume50Button.Size = new System.Drawing.Size(154, 22);
|
|
||||||
this.Volume50Button.Text = "50%";
|
|
||||||
this.Volume50Button.Click += new System.EventHandler(this.Volume50Button_Click);
|
|
||||||
//
|
|
||||||
// Volume25Button
|
|
||||||
//
|
|
||||||
this.Volume25Button.Name = "Volume25Button";
|
|
||||||
this.Volume25Button.Size = new System.Drawing.Size(154, 22);
|
|
||||||
this.Volume25Button.Text = "25%";
|
|
||||||
this.Volume25Button.Click += new System.EventHandler(this.Volume25Button_Click);
|
|
||||||
//
|
|
||||||
// Volume0Button
|
|
||||||
//
|
|
||||||
this.Volume0Button.Name = "Volume0Button";
|
|
||||||
this.Volume0Button.Size = new System.Drawing.Size(154, 22);
|
|
||||||
this.Volume0Button.Text = "Mute";
|
|
||||||
this.Volume0Button.Click += new System.EventHandler(this.Volume0Button_Click);
|
|
||||||
//
|
|
||||||
// toolStripSeparator9
|
|
||||||
//
|
|
||||||
this.toolStripSeparator9.Name = "toolStripSeparator9";
|
|
||||||
this.toolStripSeparator9.Size = new System.Drawing.Size(151, 6);
|
|
||||||
//
|
|
||||||
// VolumeCustomButton
|
|
||||||
//
|
|
||||||
this.VolumeCustomButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.VolumeCustomTextBox,
|
|
||||||
this.VolumeCustomSetButton});
|
|
||||||
this.VolumeCustomButton.Name = "VolumeCustomButton";
|
|
||||||
this.VolumeCustomButton.Size = new System.Drawing.Size(154, 22);
|
|
||||||
this.VolumeCustomButton.Text = "Custom";
|
|
||||||
//
|
|
||||||
// VolumeCustomTextBox
|
|
||||||
//
|
|
||||||
this.VolumeCustomTextBox.Name = "VolumeCustomTextBox";
|
|
||||||
this.VolumeCustomTextBox.Size = new System.Drawing.Size(100, 23);
|
|
||||||
//
|
|
||||||
// VolumeCustomSetButton
|
|
||||||
//
|
|
||||||
this.VolumeCustomSetButton.Name = "VolumeCustomSetButton";
|
|
||||||
this.VolumeCustomSetButton.Size = new System.Drawing.Size(160, 22);
|
|
||||||
this.VolumeCustomSetButton.Text = "Set";
|
|
||||||
this.VolumeCustomSetButton.Click += new System.EventHandler(this.VolumeCustomSetButton_Click);
|
|
||||||
//
|
|
||||||
// toolStripSeparator3
|
// toolStripSeparator3
|
||||||
//
|
//
|
||||||
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||||
this.toolStripSeparator3.Size = new System.Drawing.Size(149, 6);
|
this.toolStripSeparator3.Size = new System.Drawing.Size(116, 6);
|
||||||
//
|
//
|
||||||
// NotifyMenuStripNextButton
|
// NotifyMenuStripNextButton
|
||||||
//
|
//
|
||||||
this.NotifyMenuStripNextButton.Name = "NotifyMenuStripNextButton";
|
this.NotifyMenuStripNextButton.Name = "NotifyMenuStripNextButton";
|
||||||
this.NotifyMenuStripNextButton.Size = new System.Drawing.Size(152, 22);
|
this.NotifyMenuStripNextButton.Size = new System.Drawing.Size(119, 22);
|
||||||
this.NotifyMenuStripNextButton.Text = "Next";
|
this.NotifyMenuStripNextButton.Text = "Next";
|
||||||
this.NotifyMenuStripNextButton.Click += new System.EventHandler(this.NotifyMenuStripNextButton_Click);
|
this.NotifyMenuStripNextButton.Click += new System.EventHandler(this.NotifyMenuStripNextButton_Click);
|
||||||
//
|
//
|
||||||
// NotifyMenuStripPreviousButton
|
// NotifyMenuStripPreviousButton
|
||||||
//
|
//
|
||||||
this.NotifyMenuStripPreviousButton.Name = "NotifyMenuStripPreviousButton";
|
this.NotifyMenuStripPreviousButton.Name = "NotifyMenuStripPreviousButton";
|
||||||
this.NotifyMenuStripPreviousButton.Size = new System.Drawing.Size(152, 22);
|
this.NotifyMenuStripPreviousButton.Size = new System.Drawing.Size(119, 22);
|
||||||
this.NotifyMenuStripPreviousButton.Text = "Previous";
|
this.NotifyMenuStripPreviousButton.Text = "Previous";
|
||||||
this.NotifyMenuStripPreviousButton.Click += new System.EventHandler(this.NotifyMenuStripPreviousButton_Click);
|
this.NotifyMenuStripPreviousButton.Click += new System.EventHandler(this.NotifyMenuStripPreviousButton_Click);
|
||||||
//
|
//
|
||||||
// VolumeControl
|
|
||||||
//
|
|
||||||
this.VolumeControl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.VolumeControl.BackColor = System.Drawing.SystemColors.GrayText;
|
|
||||||
this.VolumeControl.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
|
||||||
this.VolumeControl.Increment = new decimal(new int[] {
|
|
||||||
5,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.VolumeControl.Location = new System.Drawing.Point(736, 4);
|
|
||||||
this.VolumeControl.Name = "VolumeControl";
|
|
||||||
this.VolumeControl.Size = new System.Drawing.Size(36, 16);
|
|
||||||
this.VolumeControl.TabIndex = 7;
|
|
||||||
this.VolumeControl.Value = new decimal(new int[] {
|
|
||||||
100,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.VolumeControl.ValueChanged += new System.EventHandler(this.VolumeControl_ValueChanged);
|
|
||||||
//
|
|
||||||
// VolumeLabel
|
|
||||||
//
|
|
||||||
this.VolumeLabel.AutoSize = true;
|
|
||||||
this.VolumeLabel.BackColor = System.Drawing.SystemColors.GrayText;
|
|
||||||
this.VolumeLabel.Location = new System.Drawing.Point(682, 4);
|
|
||||||
this.VolumeLabel.Name = "VolumeLabel";
|
|
||||||
this.VolumeLabel.Size = new System.Drawing.Size(48, 13);
|
|
||||||
this.VolumeLabel.TabIndex = 8;
|
|
||||||
this.VolumeLabel.Text = "Volume: ";
|
|
||||||
//
|
|
||||||
// SaveBufferButton
|
|
||||||
//
|
|
||||||
this.SaveBufferButton.Enabled = false;
|
|
||||||
this.SaveBufferButton.Name = "SaveBufferButton";
|
|
||||||
this.SaveBufferButton.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.SaveBufferButton.Text = "Save";
|
|
||||||
this.SaveBufferButton.Click += new System.EventHandler(this.SaveBufferButton_Click);
|
|
||||||
//
|
|
||||||
// ExitNotifyIconMenuStrip
|
|
||||||
//
|
|
||||||
this.ExitNotifyIconMenuStrip.Name = "ExitNotifyIconMenuStrip";
|
|
||||||
this.ExitNotifyIconMenuStrip.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.ExitNotifyIconMenuStrip.Text = "Exit";
|
|
||||||
this.ExitNotifyIconMenuStrip.Click += new System.EventHandler(this.ExitNotifyIconMenuStrip_Click);
|
|
||||||
//
|
|
||||||
// toolStripSeparator11
|
|
||||||
//
|
|
||||||
this.toolStripSeparator11.Name = "toolStripSeparator11";
|
|
||||||
this.toolStripSeparator11.Size = new System.Drawing.Size(149, 6);
|
|
||||||
//
|
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(784, 461);
|
this.ClientSize = new System.Drawing.Size(784, 461);
|
||||||
this.Controls.Add(this.VolumeLabel);
|
|
||||||
this.Controls.Add(this.VolumeControl);
|
|
||||||
this.Controls.Add(this.ControlsPanel);
|
this.Controls.Add(this.ControlsPanel);
|
||||||
this.Controls.Add(this.MainPanel);
|
this.Controls.Add(this.MainPanel);
|
||||||
this.Controls.Add(this.MenuStrip);
|
this.Controls.Add(this.MenuStrip);
|
||||||
@@ -1057,7 +708,6 @@ namespace MusicPlayer
|
|||||||
this.Text = "YJMPD Music Player";
|
this.Text = "YJMPD Music Player";
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
|
||||||
this.Load += new System.EventHandler(this.MainForm_Load);
|
this.Load += new System.EventHandler(this.MainForm_Load);
|
||||||
this.Resize += new System.EventHandler(this.MainForm_Resize);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).EndInit();
|
||||||
this.MainPanel.ResumeLayout(false);
|
this.MainPanel.ResumeLayout(false);
|
||||||
this.MainPanel.PerformLayout();
|
this.MainPanel.PerformLayout();
|
||||||
@@ -1069,10 +719,8 @@ namespace MusicPlayer
|
|||||||
this.MenuStrip.PerformLayout();
|
this.MenuStrip.PerformLayout();
|
||||||
this.ControlsPanel.ResumeLayout(false);
|
this.ControlsPanel.ResumeLayout(false);
|
||||||
this.ControlsPanel.PerformLayout();
|
this.ControlsPanel.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.PositionTrackBar)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.PositionTrackBar)).EndInit();
|
||||||
this.NotifyMenuStrip.ResumeLayout(false);
|
this.NotifyMenuStrip.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.VolumeControl)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
@@ -1136,47 +784,10 @@ namespace MusicPlayer
|
|||||||
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripNextButton;
|
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripNextButton;
|
||||||
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPreviousButton;
|
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPreviousButton;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
|
||||||
private System.Windows.Forms.ToolStripMenuItem ViewQueueButton;
|
private System.Windows.Forms.ToolStripMenuItem ViewCurrentPlaylistButton;
|
||||||
private System.Windows.Forms.ToolStripMenuItem serverToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem serverToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem SelectServerJancoButton;
|
private System.Windows.Forms.ToolStripMenuItem SelectServerJancoButton;
|
||||||
private System.Windows.Forms.ToolStripMenuItem SelectServerYorickButton;
|
private System.Windows.Forms.ToolStripMenuItem SelectServerYorickButton;
|
||||||
private System.Windows.Forms.ToolStripMenuItem radioToolStripMenuItem;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem qDanceToolStripMenuItem;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem customToolStripMenuItem;
|
|
||||||
private System.Windows.Forms.ToolStripTextBox RadioStationTextBox;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem SetRadioStationButton;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem fMToolStripMenuItem;
|
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem slamFMToolStripMenuItem;
|
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem viewPlaylistToolstripMenuButton;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem songsToolStripMenuItem;
|
|
||||||
private System.Windows.Forms.ToolStripTextBox SearchSongsTextBox;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem SearchSongsButton;
|
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem AdvancedSearchButton;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem resetToolStripMenuItem;
|
|
||||||
private System.Windows.Forms.PictureBox pictureBox1;
|
|
||||||
private System.Windows.Forms.Label AddToQueueLabel;
|
|
||||||
private System.Windows.Forms.NumericUpDown VolumeControl;
|
|
||||||
private System.Windows.Forms.Label VolumeLabel;
|
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator8;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem VolumeMenuStripButton;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem Volume100Button;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem Volume75Button;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem Volume50Button;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem Volume25Button;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem Volume0Button;
|
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem VolumeCustomButton;
|
|
||||||
private System.Windows.Forms.ToolStripTextBox VolumeCustomTextBox;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem VolumeCustomSetButton;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem VolumeCurrentLabel;
|
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator10;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem SaveBufferButton;
|
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator11;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem ExitNotifyIconMenuStrip;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -25,8 +24,6 @@ namespace MusicPlayer
|
|||||||
int startx = 0;
|
int startx = 0;
|
||||||
int starty = 0;
|
int starty = 0;
|
||||||
|
|
||||||
bool showed;
|
|
||||||
|
|
||||||
public Main main
|
public Main main
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
@@ -54,13 +51,11 @@ namespace MusicPlayer
|
|||||||
};
|
};
|
||||||
|
|
||||||
songFinished = false;
|
songFinished = false;
|
||||||
showed = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainForm_Load(object sender, EventArgs e)
|
private void MainForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
UpdateTimer.Start();
|
UpdateTimer.Start();
|
||||||
main.Init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PlayButton_Click(object sender, EventArgs e)
|
private void PlayButton_Click(object sender, EventArgs e)
|
||||||
@@ -97,7 +92,6 @@ namespace MusicPlayer
|
|||||||
PositionTrackBar.Value = Math.Max(main.audio.Position, 0);
|
PositionTrackBar.Value = Math.Max(main.audio.Position, 0);
|
||||||
|
|
||||||
//Buffer display
|
//Buffer display
|
||||||
if(main.audio.Buffered / 10 >= BufferBar.Minimum && main.audio.Buffered / 10 <= BufferBar.Maximum)
|
|
||||||
BufferBar.Value = main.audio.Buffered / 10;
|
BufferBar.Value = main.audio.Buffered / 10;
|
||||||
|
|
||||||
//Time labels
|
//Time labels
|
||||||
@@ -115,13 +109,6 @@ namespace MusicPlayer
|
|||||||
CurrentSongLabel.Text = "Currently playing: " + main.audio.CurrentSong.Name;
|
CurrentSongLabel.Text = "Currently playing: " + main.audio.CurrentSong.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
//image box
|
|
||||||
if (AlbumListView.LargeImageList != null && main.audio.CurrentSong != null)
|
|
||||||
{
|
|
||||||
//Console.WriteLine(AlbumListView.LargeImageList.Images["Get Wet"]);
|
|
||||||
pictureBox1.Image = AlbumListView.LargeImageList.Images[main.audio.CurrentSong.Album];
|
|
||||||
}
|
|
||||||
|
|
||||||
//Buttons and context menu
|
//Buttons and context menu
|
||||||
if (main.audio.AState == AudioHandler.AudioState.PLAYING)
|
if (main.audio.AState == AudioHandler.AudioState.PLAYING)
|
||||||
{
|
{
|
||||||
@@ -149,11 +136,6 @@ namespace MusicPlayer
|
|||||||
else
|
else
|
||||||
SelectServerYorickButton.Enabled = true;
|
SelectServerYorickButton.Enabled = true;
|
||||||
|
|
||||||
if (SearchSongsTextBox.Text.Length == 0)
|
|
||||||
SearchSongsButton.Enabled = false;
|
|
||||||
else
|
|
||||||
SearchSongsButton.Enabled = true;
|
|
||||||
|
|
||||||
if (main.audio.AState == AudioHandler.AudioState.PAUSED)
|
if (main.audio.AState == AudioHandler.AudioState.PAUSED)
|
||||||
{
|
{
|
||||||
PauseButton.Enabled = false;
|
PauseButton.Enabled = false;
|
||||||
@@ -184,21 +166,6 @@ namespace MusicPlayer
|
|||||||
NotifyMenuStripStopButton.Enabled = true;
|
NotifyMenuStripStopButton.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (main.audio.BState == AudioHandler.BufferState.DONE)
|
|
||||||
SaveBufferButton.Enabled = true;
|
|
||||||
else
|
|
||||||
SaveBufferButton.Enabled = false;
|
|
||||||
|
|
||||||
if (VolumeCustomTextBox.Text == "")
|
|
||||||
VolumeCustomSetButton.Enabled = false;
|
|
||||||
else
|
|
||||||
VolumeCustomSetButton.Enabled = true;
|
|
||||||
|
|
||||||
if (RadioStationTextBox.Text.Length <= 10)
|
|
||||||
SetRadioStationButton.Enabled = false;
|
|
||||||
else
|
|
||||||
SetRadioStationButton.Enabled = true;
|
|
||||||
|
|
||||||
if(PlayNextSongButton.Checked)
|
if(PlayNextSongButton.Checked)
|
||||||
{
|
{
|
||||||
ShuffleSongButton.Enabled = true;
|
ShuffleSongButton.Enabled = true;
|
||||||
@@ -217,12 +184,6 @@ namespace MusicPlayer
|
|||||||
NotifyMenuStripNextButton.Enabled = false;
|
NotifyMenuStripNextButton.Enabled = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (main.audio.CurrentSong is RadioStation)
|
|
||||||
{
|
|
||||||
main.currentPlayingList.Clear();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
NextButton.Enabled = true;
|
NextButton.Enabled = true;
|
||||||
NotifyMenuStripNextButton.Enabled = true;
|
NotifyMenuStripNextButton.Enabled = true;
|
||||||
@@ -238,11 +199,8 @@ namespace MusicPlayer
|
|||||||
NotifyMenuStripPreviousButton.Enabled = true;
|
NotifyMenuStripPreviousButton.Enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (songFinished)
|
if (songFinished)
|
||||||
{
|
|
||||||
if (! (main.audio.CurrentSong is RadioStation) )
|
|
||||||
{
|
{
|
||||||
Thread.Sleep(20);
|
Thread.Sleep(20);
|
||||||
|
|
||||||
@@ -254,7 +212,6 @@ namespace MusicPlayer
|
|||||||
{
|
{
|
||||||
main.audio.Play(main.audio.CurrentSong);
|
main.audio.Play(main.audio.CurrentSong);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
songFinished = false;
|
songFinished = false;
|
||||||
}
|
}
|
||||||
@@ -325,10 +282,19 @@ namespace MusicPlayer
|
|||||||
{
|
{
|
||||||
if (!clicked)
|
if (!clicked)
|
||||||
main.audio.Seek(PositionTrackBar.Value);
|
main.audio.Seek(PositionTrackBar.Value);
|
||||||
if(main.audio.CurrentSong != null)
|
|
||||||
LabelCurrentTime.Text = Main.SecondsToTimestamp((int)(((double)PositionTrackBar.Value / 1000) * main.audio.CurrentSong.Seconds));
|
LabelCurrentTime.Text = Main.SecondsToTimestamp((int)(((double)PositionTrackBar.Value / 1000) * main.audio.CurrentSong.Seconds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void NotifyIcon_Click(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Button == MouseButtons.Left)
|
||||||
|
{
|
||||||
|
MethodInfo mi = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
|
mi.Invoke(NotifyIcon, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void overviewToolStripMenuItem_Click(object sender, EventArgs e)
|
private void overviewToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.PlaylistBox.Visible = false;
|
this.PlaylistBox.Visible = false;
|
||||||
@@ -427,10 +393,8 @@ namespace MusicPlayer
|
|||||||
|
|
||||||
private void PositionTrackBar_MouseDown(object sender, MouseEventArgs e)
|
private void PositionTrackBar_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
clicked = true;
|
|
||||||
double dblValue;
|
double dblValue;
|
||||||
//dblValue = ((double)(e.X+PositionTrackBar.Location.X) / (double)(PositionTrackBar.Width + PositionTrackBar.Location.X)) * (PositionTrackBar.Maximum - PositionTrackBar.Minimum);
|
dblValue = ((double)(e.X+PositionTrackBar.Location.X) / (double)(PositionTrackBar.Width + PositionTrackBar.Location.X)) * (PositionTrackBar.Maximum - PositionTrackBar.Minimum);
|
||||||
dblValue = ((double)e.X / (double)PositionTrackBar.Width) * (PositionTrackBar.Maximum - PositionTrackBar.Minimum);
|
|
||||||
PositionTrackBar.Value = Convert.ToInt32(dblValue);
|
PositionTrackBar.Value = Convert.ToInt32(dblValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,7 +458,7 @@ namespace MusicPlayer
|
|||||||
{
|
{
|
||||||
main.FilterCurrentPlaying();
|
main.FilterCurrentPlaying();
|
||||||
int selected = main.currentPlayingList.IndexOf(main.audio.CurrentSong);
|
int selected = main.currentPlayingList.IndexOf(main.audio.CurrentSong);
|
||||||
if(main.currentPlayingList.Count >= 1 && selected >= 0)
|
if(main.currentPlayingList.Count >= 1)
|
||||||
SongsTableView.CurrentCell = SongsTableView.Rows[selected].Cells[0];
|
SongsTableView.CurrentCell = SongsTableView.Rows[selected].Cells[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,30 +477,13 @@ namespace MusicPlayer
|
|||||||
{
|
{
|
||||||
Cursor.Current = Cursors.Default;
|
Cursor.Current = Cursors.Default;
|
||||||
Point point = PlaylistBox.PointToClient(Cursor.Position);
|
Point point = PlaylistBox.PointToClient(Cursor.Position);
|
||||||
Point point2 = AddToQueueLabel.PointToClient(Cursor.Position);
|
|
||||||
bool queue = AddToQueueLabel.ClientRectangle.Contains(point2);
|
|
||||||
int index = PlaylistBox.IndexFromPoint(point);
|
int index = PlaylistBox.IndexFromPoint(point);
|
||||||
if (index < 0 && !queue) //nope, niet op een playlist gesleept
|
if (index < 0) //nope, niet op een playlist gesleept
|
||||||
{
|
{
|
||||||
draggedstarted = false;
|
draggedstarted = false;
|
||||||
draggedcompleted = false;
|
draggedcompleted = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (queue)
|
|
||||||
{
|
|
||||||
SongsTable s = new SongsTable();
|
|
||||||
if (SongsTableView.SelectedRows.Count > 0)
|
|
||||||
{
|
|
||||||
var drv = SongsTableView.SelectedRows[0].DataBoundItem as DataRowView;
|
|
||||||
var row = drv.Row as DataRow;
|
|
||||||
s.ImportRow(row);
|
|
||||||
main.currentPlayingList.Add((s.Rows[0][5] as Song));
|
|
||||||
ViewCurrentPlaylistButton_Click(this, new EventArgs());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Playlist currentPlaylist = main.pl.GetPlaylistByName(PlaylistBox.Items[index].ToString());
|
Playlist currentPlaylist = main.pl.GetPlaylistByName(PlaylistBox.Items[index].ToString());
|
||||||
SongsTable s = new SongsTable();
|
SongsTable s = new SongsTable();
|
||||||
if (SongsTableView.SelectedRows.Count > 0)
|
if (SongsTableView.SelectedRows.Count > 0)
|
||||||
@@ -549,9 +496,6 @@ namespace MusicPlayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddToQueueLabel.Visible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
draggedcompleted = false;
|
draggedcompleted = false;
|
||||||
draggedstarted = false;
|
draggedstarted = false;
|
||||||
}
|
}
|
||||||
@@ -565,7 +509,6 @@ namespace MusicPlayer
|
|||||||
{
|
{
|
||||||
draggedcompleted = true;
|
draggedcompleted = true;
|
||||||
playlistsToolStripMenuItem_Click(this, new EventArgs());
|
playlistsToolStripMenuItem_Click(this, new EventArgs());
|
||||||
AddToQueueLabel.Visible = true;
|
|
||||||
Cursor.Current = Cursors.Hand;
|
Cursor.Current = Cursors.Hand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -579,158 +522,5 @@ namespace MusicPlayer
|
|||||||
{
|
{
|
||||||
main.SwitchServer("http://imegumii.nl");
|
main.SwitchServer("http://imegumii.nl");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toolStripMenuItem2_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
main.audio.Play(new RadioStation("538", main.api, "http://vip-icecast.538.lw.triple-it.nl:80/RADIO538_MP3"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void qDanceToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
main.audio.Play(new RadioStation("Q-Dance", main.api, "http://stream01.platform02.true.nl:8000/qdance-hard"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fMToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
main.audio.Play(new RadioStation("3FM", main.api, "http://icecast.omroep.nl:80/3fm-bb-mp3"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void slamFMToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
main.audio.Play(new RadioStation("Slam-FM", main.api, "http://vip-icecast.538.lw.triple-it.nl/SLAMFM_MP3"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetRadioStationButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string input = RadioStationTextBox.Text;
|
|
||||||
|
|
||||||
if(Main.CheckURLValid(input))
|
|
||||||
{
|
|
||||||
main.audio.Play(new RadioStation(Main.GetDomain(input), main.api, input));
|
|
||||||
}
|
|
||||||
|
|
||||||
RadioStationTextBox.Text = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SearchSongsButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if(SearchSongsTextBox.Text.Length > 0)
|
|
||||||
{
|
|
||||||
main.SearchFilter(SearchSongsTextBox.Text);
|
|
||||||
SearchSongsTextBox.Text = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AdvancedSearchButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AdvancedSearch av = new AdvancedSearch(main);
|
|
||||||
av.ShowDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void resetToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
main.Repopulate();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void VolumeControl_ValueChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
main.audio.Volume = (float)(VolumeControl.Value/100);
|
|
||||||
VolumeCurrentLabel.Text = "Currently " + VolumeControl.Value + "%";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Volume100Button_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
VolumeControl.Value = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Volume75Button_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
VolumeControl.Value = 75;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Volume50Button_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
VolumeControl.Value = 50;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Volume25Button_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
VolumeControl.Value = 25;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Volume0Button_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
VolumeControl.Value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void VolumeCustomSetButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
int volume;
|
|
||||||
bool volumeOK = int.TryParse(VolumeCustomTextBox.Text, out volume);
|
|
||||||
|
|
||||||
if(volumeOK)
|
|
||||||
VolumeControl.Value = Math.Max(Math.Min(volume, 100), 0);
|
|
||||||
VolumeCustomTextBox.Text = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MainForm_Resize(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if(this.WindowState == FormWindowState.Minimized)
|
|
||||||
{
|
|
||||||
this.ShowInTaskbar = false;
|
|
||||||
if (!showed)
|
|
||||||
{
|
|
||||||
this.NotifyIcon.ShowBalloonTip(0);
|
|
||||||
showed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NotifyIcon_Click(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Button == MouseButtons.Left)
|
|
||||||
{
|
|
||||||
this.WindowState = FormWindowState.Normal;
|
|
||||||
this.ShowInTaskbar = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NotifyIcon_BalloonTipClicked(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
NotifyIcon_Click(sender, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveBufferButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
SaveFileDialog SaveMP3FromBuffer = new SaveFileDialog();
|
|
||||||
SaveMP3FromBuffer.Filter = "MP3 File|*.mp3";
|
|
||||||
SaveMP3FromBuffer.Title = "Save current song to mp3 file";
|
|
||||||
SaveMP3FromBuffer.FileName = main.audio.CurrentSong.Name + ".mp3";
|
|
||||||
|
|
||||||
if(SaveMP3FromBuffer.ShowDialog() != DialogResult.OK)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// If the file name is not an empty string open it for saving.
|
|
||||||
if (SaveMP3FromBuffer.FileName != "")
|
|
||||||
{
|
|
||||||
if (main.audio.SaveBufferToFile(SaveMP3FromBuffer.FileName))
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
Process.Start("explorer.exe", @"/select, " + SaveMP3FromBuffer.FileName);
|
|
||||||
}
|
|
||||||
catch(Exception)
|
|
||||||
{
|
|
||||||
MessageBox.Show("File saved.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
MessageBox.Show("Error while saving file");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ExitNotifyIconMenuStrip_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
ExitProgram();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,12 +77,6 @@
|
|||||||
<Compile Include="NetworkHandler.cs" />
|
<Compile Include="NetworkHandler.cs" />
|
||||||
<Compile Include="Playlist.cs" />
|
<Compile Include="Playlist.cs" />
|
||||||
<Compile Include="PlaylistHandler.cs" />
|
<Compile Include="PlaylistHandler.cs" />
|
||||||
<Compile Include="AdvancedSearch.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="AdvancedSearch.Designer.cs">
|
|
||||||
<DependentUpon>AdvancedSearch.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="PlaylistMaker.cs">
|
<Compile Include="PlaylistMaker.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -91,12 +85,6 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="RadioStation.cs" />
|
|
||||||
<Compile Include="Resource.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
<DependentUpon>Resource.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Song.cs" />
|
<Compile Include="Song.cs" />
|
||||||
<Compile Include="SongsTable.cs">
|
<Compile Include="SongsTable.cs">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
@@ -105,9 +93,6 @@
|
|||||||
<EmbeddedResource Include="MainForm.resx">
|
<EmbeddedResource Include="MainForm.resx">
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
<DependentUpon>MainForm.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="AdvancedSearch.resx">
|
|
||||||
<DependentUpon>AdvancedSearch.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Include="PlaylistMaker.resx">
|
<EmbeddedResource Include="PlaylistMaker.resx">
|
||||||
<DependentUpon>PlaylistMaker.cs</DependentUpon>
|
<DependentUpon>PlaylistMaker.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
@@ -120,11 +105,6 @@
|
|||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<EmbeddedResource Include="Resource.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<None Include="ClassDiagram1.cd" />
|
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
@@ -140,7 +120,7 @@
|
|||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Resources\default-cover.png" />
|
<Folder Include="Resources\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|||||||
@@ -1,99 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{E2B99339-3251-48BE-91C9-FAB21CD07A39}</ProjectGuid>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>MusicPlayer</RootNamespace>
|
|
||||||
<AssemblyName>MusicPlayer</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Deployment" />
|
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Windows.Forms" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="MainForm.cs" >
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Album.cs" />
|
|
||||||
<Compile Include="APIHandler.cs" />
|
|
||||||
<Compile Include="Artist.cs" />
|
|
||||||
<Compile Include="MainForm.Designer.cs">
|
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="NetworkHandler.cs" />
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<<<<<<< HEAD
|
|
||||||
<EmbeddedResource Include="MainForm.resx">
|
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
|
||||||
=======
|
|
||||||
<EmbeddedResource Include="Form1.resx">
|
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
|
||||||
>>>>>>> origin/api
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<None Include="Properties\Settings.settings">
|
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
|
||||||
</None>
|
|
||||||
<Compile Include="Properties\Settings.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Settings.settings</DependentUpon>
|
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="App.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
||||||
@@ -24,13 +24,11 @@ namespace MusicPlayer
|
|||||||
public JObject SendString(string m)
|
public JObject SendString(string m)
|
||||||
{
|
{
|
||||||
string encodedstring = Microsoft.Security.Application.Encoder.HtmlEncode(m);
|
string encodedstring = Microsoft.Security.Application.Encoder.HtmlEncode(m);
|
||||||
|
Console.WriteLine(encodedstring);
|
||||||
HttpWebRequest server = (HttpWebRequest)WebRequest.Create(ip+":"+port+"/"+encodedstring);
|
HttpWebRequest server = (HttpWebRequest)WebRequest.Create(ip+":"+port+"/"+encodedstring);
|
||||||
server.ReadWriteTimeout = 500;
|
|
||||||
server.KeepAlive = false;
|
server.KeepAlive = false;
|
||||||
try {
|
|
||||||
HttpWebResponse respond = (HttpWebResponse)server.GetResponse();
|
HttpWebResponse respond = (HttpWebResponse)server.GetResponse();
|
||||||
Stream streamResponse = respond.GetResponseStream();
|
Stream streamResponse = respond.GetResponseStream();
|
||||||
streamResponse.ReadTimeout = 500;
|
|
||||||
StreamReader streamRead = new StreamReader(streamResponse);
|
StreamReader streamRead = new StreamReader(streamResponse);
|
||||||
Char[] readBuff = new Char[256];
|
Char[] readBuff = new Char[256];
|
||||||
int count = streamRead.Read(readBuff, 0, 256);
|
int count = streamRead.Read(readBuff, 0, 256);
|
||||||
@@ -38,7 +36,7 @@ namespace MusicPlayer
|
|||||||
while (count > 0)
|
while (count > 0)
|
||||||
{
|
{
|
||||||
String outputData = new String(readBuff, 0, count);
|
String outputData = new String(readBuff, 0, count);
|
||||||
data += outputData;
|
data +=outputData;
|
||||||
count = streamRead.Read(readBuff, 0, 256);
|
count = streamRead.Read(readBuff, 0, 256);
|
||||||
}
|
}
|
||||||
JObject o = JObject.Parse(data);
|
JObject o = JObject.Parse(data);
|
||||||
@@ -47,30 +45,14 @@ namespace MusicPlayer
|
|||||||
streamRead.Close();
|
streamRead.Close();
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
catch(WebException e)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Server is offline");
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Er is iets fout gegaan bij het communiceren met de server.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public MemoryStream downloadArtwork(string album)
|
public MemoryStream downloadArtwork(string album)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string encodedstring = Microsoft.Security.Application.Encoder.HtmlEncode(ip + "/music/.artwork/" + album);
|
WebRequest req = WebRequest.Create((ip + "/music/artwork/"+album).Replace(" ", "%20"));
|
||||||
WebRequest req = WebRequest.Create(encodedstring);
|
|
||||||
req.Timeout = 500;
|
|
||||||
//WebRequest req = WebRequest.Create((ip + "/music/.artwork/" + album).Replace(" ","%20"));
|
|
||||||
WebResponse response = req.GetResponse();
|
WebResponse response = req.GetResponse();
|
||||||
Stream stream = response.GetResponseStream();
|
Stream stream = response.GetResponseStream();
|
||||||
stream.ReadTimeout = 500;
|
|
||||||
|
|
||||||
//Download in chuncks
|
//Download in chuncks
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
|
|||||||
@@ -9,16 +9,14 @@ namespace MusicPlayer
|
|||||||
public string name { get; }
|
public string name { get; }
|
||||||
private string basedir;
|
private string basedir;
|
||||||
public List<Song> songs;
|
public List<Song> songs;
|
||||||
public string server;
|
|
||||||
|
|
||||||
private APIHandler api;
|
private APIHandler api;
|
||||||
public Playlist(string name, string basedir, string server, APIHandler api)
|
public Playlist(string name, string basedir, APIHandler api)
|
||||||
{
|
{
|
||||||
this.songs = new List<Song>();
|
this.songs = new List<Song>();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.api = api;
|
this.api = api;
|
||||||
this.basedir = basedir;
|
this.basedir = basedir;
|
||||||
this.server = server;
|
|
||||||
this.ReadFromFile();
|
this.ReadFromFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,8 +35,6 @@ namespace MusicPlayer
|
|||||||
try {
|
try {
|
||||||
using (StreamReader str = new StreamReader(basedir + name + ".txt"))
|
using (StreamReader str = new StreamReader(basedir + name + ".txt"))
|
||||||
{
|
{
|
||||||
server = str.ReadLine();
|
|
||||||
|
|
||||||
string readline;
|
string readline;
|
||||||
while ((readline = str.ReadLine()) != null)
|
while ((readline = str.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
@@ -52,7 +48,6 @@ namespace MusicPlayer
|
|||||||
{
|
{
|
||||||
FileStream fs = new FileStream(basedir + name + ".txt", FileMode.CreateNew);
|
FileStream fs = new FileStream(basedir + name + ".txt", FileMode.CreateNew);
|
||||||
fs.Close();
|
fs.Close();
|
||||||
File.WriteAllText(basedir + name + ".txt", server);
|
|
||||||
ReadFromFile();
|
ReadFromFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,8 +57,6 @@ namespace MusicPlayer
|
|||||||
{
|
{
|
||||||
using (StreamWriter stw = new StreamWriter(basedir + name + ".txt"))
|
using (StreamWriter stw = new StreamWriter(basedir + name + ".txt"))
|
||||||
{
|
{
|
||||||
stw.WriteLine(server.ToString());
|
|
||||||
|
|
||||||
this.songs.ForEach(s =>
|
this.songs.ForEach(s =>
|
||||||
{
|
{
|
||||||
stw.WriteLine(s.ToString());
|
stw.WriteLine(s.ToString());
|
||||||
@@ -71,21 +64,5 @@ namespace MusicPlayer
|
|||||||
stw.Flush();
|
stw.Flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
System.IO.File.Move(basedir + name + ".txt", basedir + name + ".txt.old");
|
|
||||||
}
|
|
||||||
catch(Exception)
|
|
||||||
{
|
|
||||||
//Already removed.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void RemoveSong(Song s)
|
|
||||||
{
|
|
||||||
this.songs.Remove(s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,26 +8,23 @@ namespace MusicPlayer
|
|||||||
public class PlaylistHandler
|
public class PlaylistHandler
|
||||||
{
|
{
|
||||||
private List<Playlist> playlists;
|
private List<Playlist> playlists;
|
||||||
public Main main
|
private APIHandler api;
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
private readonly string basedir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\.mpplaylists\\";
|
private readonly string basedir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\.mpplaylists\\";
|
||||||
public PlaylistHandler()
|
public PlaylistHandler(APIHandler api)
|
||||||
{
|
{
|
||||||
this.playlists = new List<Playlist>();
|
this.playlists = new List<Playlist>();
|
||||||
|
this.api = api;
|
||||||
|
Populate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Populate()
|
private void Populate()
|
||||||
{
|
{
|
||||||
playlists.Clear();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Directory.GetFiles(basedir).ToList().ForEach(f =>
|
Directory.GetFiles(basedir).ToList().ForEach(f =>
|
||||||
{
|
{
|
||||||
if (f.EndsWith(".txt"))
|
if (f.EndsWith(".txt"))
|
||||||
{
|
{
|
||||||
playlists.Add(new Playlist(Path.GetFileName(f.Replace(".txt","")) ,basedir, main.nw.ip, main.api));
|
playlists.Add(new Playlist(Path.GetFileName(f.Replace(".txt","")) ,basedir, api));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -42,7 +39,7 @@ namespace MusicPlayer
|
|||||||
|
|
||||||
public void MakeNewPlaylistByName(string name)
|
public void MakeNewPlaylistByName(string name)
|
||||||
{
|
{
|
||||||
playlists.Add(new Playlist(name, basedir, main.nw.ip, main.api));
|
playlists.Add(new Playlist(name, basedir, api));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Playlist GetPlaylistByName(string name)
|
public Playlist GetPlaylistByName(string name)
|
||||||
@@ -57,28 +54,7 @@ namespace MusicPlayer
|
|||||||
|
|
||||||
public List<Playlist> GetPlaylists()
|
public List<Playlist> GetPlaylists()
|
||||||
{
|
{
|
||||||
List<Playlist> currentPlaylists = new List<Playlist>();
|
return playlists;
|
||||||
foreach(Playlist pl in playlists)
|
|
||||||
{
|
|
||||||
if (pl.server == main.nw.ip)
|
|
||||||
currentPlaylists.Add(pl);
|
|
||||||
}
|
|
||||||
return currentPlaylists;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void RemovePlaylistByName(string name)
|
|
||||||
{
|
|
||||||
Playlist toRemove = null;
|
|
||||||
playlists.ForEach(p =>
|
|
||||||
{
|
|
||||||
if (p.name == name) { toRemove = p; }
|
|
||||||
});
|
|
||||||
|
|
||||||
if(toRemove != null)
|
|
||||||
{
|
|
||||||
toRemove.Delete();
|
|
||||||
playlists.Remove(toRemove);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-31
@@ -43,8 +43,6 @@ namespace MusicPlayer
|
|||||||
this.label4 = new System.Windows.Forms.Label();
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
this.FilterTextBox = new System.Windows.Forms.TextBox();
|
this.FilterTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.label5 = new System.Windows.Forms.Label();
|
this.label5 = new System.Windows.Forms.Label();
|
||||||
this.DeletePlaylistButton = new System.Windows.Forms.Button();
|
|
||||||
this.DeleteSongsButton = new System.Windows.Forms.Button();
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// PlaylistSelectBox
|
// PlaylistSelectBox
|
||||||
@@ -89,7 +87,6 @@ namespace MusicPlayer
|
|||||||
this.PlaylistSongContainer.FormattingEnabled = true;
|
this.PlaylistSongContainer.FormattingEnabled = true;
|
||||||
this.PlaylistSongContainer.Location = new System.Drawing.Point(10, 319);
|
this.PlaylistSongContainer.Location = new System.Drawing.Point(10, 319);
|
||||||
this.PlaylistSongContainer.Name = "PlaylistSongContainer";
|
this.PlaylistSongContainer.Name = "PlaylistSongContainer";
|
||||||
this.PlaylistSongContainer.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
|
|
||||||
this.PlaylistSongContainer.Size = new System.Drawing.Size(306, 82);
|
this.PlaylistSongContainer.Size = new System.Drawing.Size(306, 82);
|
||||||
this.PlaylistSongContainer.TabIndex = 3;
|
this.PlaylistSongContainer.TabIndex = 3;
|
||||||
//
|
//
|
||||||
@@ -126,7 +123,7 @@ namespace MusicPlayer
|
|||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
this.label2.AutoSize = true;
|
this.label2.AutoSize = true;
|
||||||
this.label2.Location = new System.Drawing.Point(8, 75);
|
this.label2.Location = new System.Drawing.Point(10, 80);
|
||||||
this.label2.Name = "label2";
|
this.label2.Name = "label2";
|
||||||
this.label2.Size = new System.Drawing.Size(97, 13);
|
this.label2.Size = new System.Drawing.Size(97, 13);
|
||||||
this.label2.TabIndex = 7;
|
this.label2.TabIndex = 7;
|
||||||
@@ -136,7 +133,7 @@ namespace MusicPlayer
|
|||||||
//
|
//
|
||||||
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.label3.AutoSize = true;
|
this.label3.AutoSize = true;
|
||||||
this.label3.Location = new System.Drawing.Point(11, 297);
|
this.label3.Location = new System.Drawing.Point(7, 303);
|
||||||
this.label3.Name = "label3";
|
this.label3.Name = "label3";
|
||||||
this.label3.Size = new System.Drawing.Size(82, 13);
|
this.label3.Size = new System.Drawing.Size(82, 13);
|
||||||
this.label3.TabIndex = 8;
|
this.label3.TabIndex = 8;
|
||||||
@@ -168,35 +165,11 @@ namespace MusicPlayer
|
|||||||
this.label5.TabIndex = 11;
|
this.label5.TabIndex = 11;
|
||||||
this.label5.Text = "Filter";
|
this.label5.Text = "Filter";
|
||||||
//
|
//
|
||||||
// DeletePlaylistButton
|
|
||||||
//
|
|
||||||
this.DeletePlaylistButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.DeletePlaylistButton.Location = new System.Drawing.Point(225, 70);
|
|
||||||
this.DeletePlaylistButton.Name = "DeletePlaylistButton";
|
|
||||||
this.DeletePlaylistButton.Size = new System.Drawing.Size(92, 23);
|
|
||||||
this.DeletePlaylistButton.TabIndex = 12;
|
|
||||||
this.DeletePlaylistButton.Text = "Delete Playlist";
|
|
||||||
this.DeletePlaylistButton.UseVisualStyleBackColor = true;
|
|
||||||
this.DeletePlaylistButton.Click += new System.EventHandler(this.DeletePlaylistButton_Click);
|
|
||||||
//
|
|
||||||
// DeleteSongsButton
|
|
||||||
//
|
|
||||||
this.DeleteSongsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.DeleteSongsButton.Location = new System.Drawing.Point(172, 292);
|
|
||||||
this.DeleteSongsButton.Name = "DeleteSongsButton";
|
|
||||||
this.DeleteSongsButton.Size = new System.Drawing.Size(143, 23);
|
|
||||||
this.DeleteSongsButton.TabIndex = 13;
|
|
||||||
this.DeleteSongsButton.Text = "Delete Selected Songs";
|
|
||||||
this.DeleteSongsButton.UseVisualStyleBackColor = true;
|
|
||||||
this.DeleteSongsButton.Click += new System.EventHandler(this.DeleteSongsButton_Click);
|
|
||||||
//
|
|
||||||
// PlaylistMaker
|
// PlaylistMaker
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(334, 411);
|
this.ClientSize = new System.Drawing.Size(334, 411);
|
||||||
this.Controls.Add(this.DeleteSongsButton);
|
|
||||||
this.Controls.Add(this.DeletePlaylistButton);
|
|
||||||
this.Controls.Add(this.label5);
|
this.Controls.Add(this.label5);
|
||||||
this.Controls.Add(this.FilterTextBox);
|
this.Controls.Add(this.FilterTextBox);
|
||||||
this.Controls.Add(this.label4);
|
this.Controls.Add(this.label4);
|
||||||
@@ -233,7 +206,5 @@ namespace MusicPlayer
|
|||||||
private Label label4;
|
private Label label4;
|
||||||
private TextBox FilterTextBox;
|
private TextBox FilterTextBox;
|
||||||
private Label label5;
|
private Label label5;
|
||||||
private Button DeletePlaylistButton;
|
|
||||||
private Button DeleteSongsButton;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,17 +47,12 @@ namespace MusicPlayer
|
|||||||
PlaylistSelectBox.SelectedIndex = PlaylistSelectBox.Items.Count - 1;
|
PlaylistSelectBox.SelectedIndex = PlaylistSelectBox.Items.Count - 1;
|
||||||
else
|
else
|
||||||
PlaylistSelectBox.SelectedIndex = selection;
|
PlaylistSelectBox.SelectedIndex = selection;
|
||||||
PlaylistSongContainer.Items.Clear();
|
|
||||||
if (PlaylistSelectBox.SelectedItem != null)
|
if (PlaylistSelectBox.SelectedItem != null)
|
||||||
{
|
{
|
||||||
|
PlaylistSongContainer.Items.Clear();
|
||||||
allPlaylistSongs = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString()).GetSongs();
|
allPlaylistSongs = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString()).GetSongs();
|
||||||
allPlaylistSongs.ForEach(s => PlaylistSongContainer.Items.Add(s.Name));
|
allPlaylistSongs.ForEach(s => PlaylistSongContainer.Items.Add(s.Name));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
PlaylistSelectBox.SelectedIndex = -1;
|
|
||||||
PlaylistSelectBox.Text = "";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Repopulate()
|
public void Repopulate()
|
||||||
@@ -150,38 +145,5 @@ namespace MusicPlayer
|
|||||||
PlaylistNewButton_Click(sender, new EventArgs());
|
PlaylistNewButton_Click(sender, new EventArgs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeletePlaylistButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (PlaylistSelectBox.SelectedItem != null)
|
|
||||||
if (MessageBox.Show("Are you sure to delete " + PlaylistSelectBox.SelectedItem.ToString() + "?", "Confirm Delete!", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
pl.RemovePlaylistByName(PlaylistSelectBox.SelectedItem.ToString());
|
|
||||||
Repopulate(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DeleteSongsButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (PlaylistSelectBox.SelectedItem != null)
|
|
||||||
{
|
|
||||||
Playlist currentPlaylist = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString());
|
|
||||||
foreach (string song in PlaylistSongSelector.SelectedItems)
|
|
||||||
{
|
|
||||||
for (int i = currentPlaylist.GetSongs().Count - 1; i > 0; i--)
|
|
||||||
{
|
|
||||||
Song s = currentPlaylist.GetSongs()[i];
|
|
||||||
if (s.Name == song)
|
|
||||||
{
|
|
||||||
currentPlaylist.RemoveSong(s);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
currentPlaylist.WriteToFile();
|
|
||||||
}
|
|
||||||
Thread.Sleep(10);
|
|
||||||
Repopulate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,11 @@ namespace MusicPlayer
|
|||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
||||||
NetworkHandler nw = new NetworkHandler("http://imegumii.nl");
|
NetworkHandler nw = new NetworkHandler("http://jancokock.me");
|
||||||
|
//NetworkHandler nw = new NetworkHandler("http://imegumii.nl");
|
||||||
APIHandler api = new APIHandler(nw);
|
APIHandler api = new APIHandler(nw);
|
||||||
MainForm form = new MainForm();
|
MainForm form = new MainForm();
|
||||||
PlaylistHandler pl = new PlaylistHandler();
|
PlaylistHandler pl = new PlaylistHandler(api);
|
||||||
new Main(nw, api, form,pl);
|
new Main(nw, api, form,pl);
|
||||||
|
|
||||||
Application.Run(form);
|
Application.Run(form);
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MusicPlayer
|
|
||||||
{
|
|
||||||
class RadioStation :Song
|
|
||||||
{
|
|
||||||
string radiourl;
|
|
||||||
public RadioStation(string name, APIHandler api, string url):base("-1", name,"","","",0,api)
|
|
||||||
{
|
|
||||||
radiourl = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GetURL()
|
|
||||||
{
|
|
||||||
return radiourl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-73
@@ -1,73 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
// Runtime Version:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace MusicPlayer {
|
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
|
||||||
/// </summary>
|
|
||||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
|
||||||
// class via a tool like ResGen or Visual Studio.
|
|
||||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
|
||||||
// with the /str option, or rebuild your VS project.
|
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
||||||
internal class Resource {
|
|
||||||
|
|
||||||
private static global::System.Resources.ResourceManager resourceMan;
|
|
||||||
|
|
||||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
|
||||||
|
|
||||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
|
||||||
internal Resource() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the cached ResourceManager instance used by this class.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
|
||||||
get {
|
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MusicPlayer.Resource", typeof(Resource).Assembly);
|
|
||||||
resourceMan = temp;
|
|
||||||
}
|
|
||||||
return resourceMan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Overrides the current thread's CurrentUICulture property for all
|
|
||||||
/// resource lookups using this strongly typed resource class.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Globalization.CultureInfo Culture {
|
|
||||||
get {
|
|
||||||
return resourceCulture;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
resourceCulture = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap default_cover {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("default_cover", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="default_cover" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>Resources\default-cover.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 147 KiB |
Regular → Executable
+1
-25
@@ -34,7 +34,7 @@ namespace MusicPlayer
|
|||||||
url = "";
|
url = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual string GetURL()
|
private string GetURL()
|
||||||
{
|
{
|
||||||
if (url == "")
|
if (url == "")
|
||||||
{
|
{
|
||||||
@@ -53,29 +53,5 @@ namespace MusicPlayer
|
|||||||
{
|
{
|
||||||
return $"{this.SongID}|{this.Name}|{this.Album}|{this.Artist}|{this.Genre}|{this.Seconds}";
|
return $"{this.SongID}|{this.Name}|{this.Album}|{this.Artist}|{this.Genre}|{this.Seconds}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(System.Object obj)
|
|
||||||
{
|
|
||||||
// If parameter is null return false.
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If parameter cannot be cast to Point return false.
|
|
||||||
Song s = obj as Song;
|
|
||||||
if ((System.Object)s == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return true if the fields match:
|
|
||||||
return (s.Name == Name) && (s.SongID == SongID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return int.Parse(this.SongID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ namespace MusicPlayer
|
|||||||
public SongsTable() : base()
|
public SongsTable() : base()
|
||||||
{
|
{
|
||||||
this.Columns.Clear();
|
this.Columns.Clear();
|
||||||
this.Columns.Add("Name", typeof(string));
|
this.Columns.Add("Naam", typeof(string));
|
||||||
this.Columns.Add("Album", typeof(string));
|
this.Columns.Add("Album", typeof(string));
|
||||||
this.Columns.Add("Artist", typeof(string));
|
this.Columns.Add("Artiest", typeof(string));
|
||||||
this.Columns.Add("Genre", typeof(string));
|
this.Columns.Add("Genre", typeof(string));
|
||||||
this.Columns.Add("Duration", typeof(string));
|
this.Columns.Add("Duration", typeof(string));
|
||||||
this.Columns.Add("song", typeof(Song));
|
this.Columns.Add("song", typeof(Song));
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
[HTTP]
|
||||||
|
port = 8585
|
||||||
|
|
||||||
|
[Daemon]
|
||||||
|
port = 17170
|
||||||
|
|
||||||
|
[Library]
|
||||||
|
musicdir = /media/USBHDD/shares/Music/English
|
||||||
|
jancodir = /mnt/Muziek/
|
||||||
|
|
||||||
|
[Database]
|
||||||
|
username = yjmpd
|
||||||
|
password = qLjStxr6xncrfcna
|
||||||
|
host = imegumii.nl
|
||||||
|
database = yjmpd
|
||||||
|
port = 3306
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
configparser
|
||||||
|
mutagen
|
||||||
|
PyMySQL
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import configparser
|
||||||
|
|
||||||
|
from yjdaemon.yjmpd import YJMPD
|
||||||
|
from yjdaemon.HTTPServer import HTTPServerThread
|
||||||
|
from yjdaemon.Database import Database
|
||||||
|
from yjdaemon.libraryscanner import LibraryScanner
|
||||||
|
|
||||||
|
debug = True
|
||||||
|
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
try:
|
||||||
|
config.read("config.cfg")
|
||||||
|
HTTP_PORT = int(config.get("HTTP", "port"))
|
||||||
|
DAEMON_PORT = int(config.get("Daemon","port"))
|
||||||
|
MUSIC_DIR = str(config.get("Library", "musicdir"))
|
||||||
|
DB_USERNAME = config.get("Database", "username")
|
||||||
|
DB_PASSWORD = config.get("Database", "password")
|
||||||
|
DB_HOST = config.get("Database", "host")
|
||||||
|
DB_DATABASE = config.get("Database", "database")
|
||||||
|
DB_PORT = config.getint("Database", "port")
|
||||||
|
except Exception as e:
|
||||||
|
print(e.with_traceback())
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
class MainDaemon(YJMPD):
|
||||||
|
def run(self):
|
||||||
|
HTTP_thread = HTTPServerThread(HTTP_PORT)
|
||||||
|
HTTP_thread.start()
|
||||||
|
|
||||||
|
|
||||||
|
def Test():
|
||||||
|
print("Test")
|
||||||
|
|
||||||
|
# socket_thread = ServiceSocket(DAEMON_PORT)
|
||||||
|
# socket_thread.start()
|
||||||
|
#HTTP_thread = HTTPServerThread(HTTP_PORT)
|
||||||
|
#HTTP_thread.start()
|
||||||
|
db = Database(DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT, DB_DATABASE)
|
||||||
|
LibraryScanner(db, MUSIC_DIR)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if debug:
|
||||||
|
Test()
|
||||||
|
else:
|
||||||
|
if __name__ == "__main__":
|
||||||
|
username = os.getenv('USER')
|
||||||
|
if None == username:
|
||||||
|
dir = "/tmp/.pydaemon.pid"
|
||||||
|
else:
|
||||||
|
dir = "/home/" + username + "/.pydaemon.pid"
|
||||||
|
daemon = MainDaemon(dir, MUSIC_DIR)
|
||||||
|
if len(sys.argv) == 2:
|
||||||
|
if 'start' == sys.argv[1]:
|
||||||
|
daemon.start()
|
||||||
|
elif 'stop' == sys.argv[1]:
|
||||||
|
daemon.stop()
|
||||||
|
elif 'restart' == sys.argv[1]:
|
||||||
|
daemon.restart()
|
||||||
|
elif 'status' == sys.argv[1]:
|
||||||
|
daemon.status()
|
||||||
|
else:
|
||||||
|
print("Unknown command")
|
||||||
|
sys.exit(2)
|
||||||
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
print("usage: %s start|stop|status|restart" % sys.argv[0])
|
||||||
|
sys.exit(2)
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import configparser
|
||||||
|
|
||||||
|
from yjdaemon.yjmpd import YJMPD
|
||||||
|
from yjdaemon.HTTPServer import HTTPServerThread
|
||||||
|
from yjdaemon.Database import Database
|
||||||
|
from yjdaemon.libraryscanner import LibraryScanner
|
||||||
|
|
||||||
|
debug = True
|
||||||
|
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
try:
|
||||||
|
config.read("config.cfg")
|
||||||
|
HTTP_PORT = int(config.get("HTTP", "port"))
|
||||||
|
DAEMON_PORT = int(config.get("Daemon","port"))
|
||||||
|
MUSIC_DIR = str(config.get("Library", "musicdir"))
|
||||||
|
DB_USERNAME = config.get("Database", "username")
|
||||||
|
DB_PASSWORD = config.get("Database", "password")
|
||||||
|
DB_HOST = config.get("Database", "host")
|
||||||
|
DB_DATABASE = config.get("Database", "database")
|
||||||
|
DB_PORT = config.getint("Database", "port")
|
||||||
|
except Exception as e:
|
||||||
|
print(e.with_traceback())
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
class MainDaemon(YJMPD):
|
||||||
|
def run(self):
|
||||||
|
HTTP_thread = HTTPServerThread(HTTP_PORT)
|
||||||
|
HTTP_thread.start()
|
||||||
|
|
||||||
|
|
||||||
|
def Test():
|
||||||
|
print("Test")
|
||||||
|
|
||||||
|
# socket_thread = ServiceSocket(DAEMON_PORT)
|
||||||
|
# socket_thread.start()
|
||||||
|
HTTP_thread = HTTPServerThread(HTTP_PORT)
|
||||||
|
HTTP_thread.start()
|
||||||
|
#db = Database(DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT, DB_DATABASE)
|
||||||
|
#LibraryScanner(db, MUSIC_DIR)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if debug:
|
||||||
|
Test()
|
||||||
|
else:
|
||||||
|
if __name__ == "__main__":
|
||||||
|
username = os.getenv('USER')
|
||||||
|
if None == username:
|
||||||
|
dir = "/tmp/.pydaemon.pid"
|
||||||
|
else:
|
||||||
|
dir = "/home/" + username + "/.pydaemon.pid"
|
||||||
|
daemon = MainDaemon(dir, MUSIC_DIR)
|
||||||
|
if len(sys.argv) == 2:
|
||||||
|
if 'start' == sys.argv[1]:
|
||||||
|
daemon.start()
|
||||||
|
elif 'stop' == sys.argv[1]:
|
||||||
|
daemon.stop()
|
||||||
|
elif 'restart' == sys.argv[1]:
|
||||||
|
daemon.restart()
|
||||||
|
elif 'status' == sys.argv[1]:
|
||||||
|
daemon.status()
|
||||||
|
else:
|
||||||
|
print("Unknown command")
|
||||||
|
sys.exit(2)
|
||||||
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
print("usage: %s start|stop|status|restart" % sys.argv[0])
|
||||||
|
sys.exit(2)
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
from yjdaemon.Database import Database as db
|
||||||
|
import configparser
|
||||||
|
import string
|
||||||
|
"""
|
||||||
|
Add a key to the validAPIcalls dictionary, with a corresponding function
|
||||||
|
Function should return jsonified data, so that it can then be passed on to the client.
|
||||||
|
example:
|
||||||
|
|
||||||
|
Add this to the dictionary
|
||||||
|
"getsongs": calls.getsongs
|
||||||
|
|
||||||
|
then implement this function
|
||||||
|
@staticmethod
|
||||||
|
def getsongs():
|
||||||
|
return calls.jsonify({"song": song})
|
||||||
|
|
||||||
|
And the jsonified data will be returned to the client.
|
||||||
|
|
||||||
|
Every function MUST return jsonified data!
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class calls:
|
||||||
|
@staticmethod
|
||||||
|
def APIcall(sanitizedpath):
|
||||||
|
if sanitizedpath in validAPIcalls:
|
||||||
|
return validAPIcalls[sanitizedpath]
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getfromrawjson(data, param):
|
||||||
|
return calls.dejsonify(data)[param]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def jsonify(data):
|
||||||
|
return json.dumps(data, sort_keys=True, indent=4).encode("utf-8")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def dejsonify(rawdata):
|
||||||
|
return json.loads(rawdata.decode("utf-8"))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getallsongs(args):
|
||||||
|
return calls.jsonify({"songs": db.executequerystatic("SELECT * FROM tracks;"), "args": args , "result": "OK"})
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getartists(args):
|
||||||
|
return calls.jsonify({"artists": db.executequerystatic("SELECT artistName FROM tracks GROUP BY artistName;"), "args": args, "result" : "OK"})
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getalbums(args):
|
||||||
|
return calls.jsonify({"albums": db.executequerystatic("SELECT albumName FROM tracks GROUP BY albumName;"), "args": args, "result":"OK"})
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getgenres(args):
|
||||||
|
return calls.jsonify({"genres": db.executequerystatic("SELECT genre FROM tracks GROUP BY genre;"), "args": args, "result":"OK"})
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getyears(args):
|
||||||
|
return calls.jsonify({"years": db.executequerystatic("SELECT year FROM tracks GROUP BY year;"), "args": args, "result":"OK"})
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getalbumnames(args):
|
||||||
|
return calls.jsonify({"albumnames": db.executequerystatic("SELECT albumName FROM tracks GROUP BY albumName;"), "args": args})
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def search(args):
|
||||||
|
data = args.split("&")
|
||||||
|
genquery="""
|
||||||
|
SELECT $ident FROM tracks WHERE LCASE(trackName) LIKE LCASE(\"%$trackname%\") $orgenre LCASE(genre) LIKE LCASE(\"%$genre%\") $oralbum LCASE(albumName) LIKE LCASE(\"%$album%\") $orartist LCASE(artistName) LIKE LCASE(\"%$artistname%\") $end;
|
||||||
|
"""
|
||||||
|
query="""
|
||||||
|
SELECT $ident FROM tracks WHERE ($or1 OR $or2 OR $or3 ) $and1 $and2 $and3 $end;
|
||||||
|
"""
|
||||||
|
test = string.Template(query)
|
||||||
|
genqueryres = ""
|
||||||
|
arguments = []
|
||||||
|
general = ""
|
||||||
|
for entry in data:
|
||||||
|
values = entry.split("=")
|
||||||
|
values[1] = values[1].replace("%20"," ")
|
||||||
|
if values[0] == "q":
|
||||||
|
general = values[1]
|
||||||
|
continue
|
||||||
|
if values[1]:
|
||||||
|
arguments.append(values)
|
||||||
|
print(arguments)
|
||||||
|
finalstring = "" + genquery
|
||||||
|
for arg in arguments:
|
||||||
|
if arg[0] == "artist":
|
||||||
|
finalstring = string.Template(finalstring).safe_substitute(artistname=arg[1], orartist="AND")
|
||||||
|
test = string.Template(test.safe_substitute(and1="AND LCASE(artistName) LIKE LCASE(\"%"+ arg[1] +"%\")"))
|
||||||
|
elif arg[0] == "genre":
|
||||||
|
finalstring = string.Template(finalstring).safe_substitute(genre=arg[1],orgenre="AND")
|
||||||
|
test = string.Template(test.safe_substitute(and2="AND LCASE(genre) LIKE LCASE(\"%"+ arg[1] +"%\")"))
|
||||||
|
elif arg[0] == "album":
|
||||||
|
finalstring = string.Template(finalstring).safe_substitute(album=arg[1],oralbum="AND")
|
||||||
|
test = string.Template(test.safe_substitute(and3="AND LCASE(albumName) LIKE LCASE(\"%"+ arg[1] +"%\")"))
|
||||||
|
print(finalstring)
|
||||||
|
finalstring = string.Template(finalstring).safe_substitute(genre=general,artistname=general,album=general,trackname=general)
|
||||||
|
print(finalstring)
|
||||||
|
test = test.safe_substitute( and1="", and2="",and3="",or1="LCASE(artistName) LIKE LCASE(\"%"+general+"%\")",or2="LCASE(genre) LIKE LCASE(\"%"+general+"%\")",or3="LCASE(albumName) LIKE LCASE(\"%"+general+"%\")")
|
||||||
|
print(test)
|
||||||
|
print(string.Template(test).safe_substitute(ident="*",end=""))
|
||||||
|
return calls.jsonify({"result":"OK", "genres": db.executequerystatic(string.Template(test).safe_substitute(ident="genre",end="GROUP BY genre")),"artists": db.executequerystatic(string.Template(test).safe_substitute(ident="artistName",end="GROUP BY artistName")), "albums": db.executequerystatic(string.Template(test).safe_substitute(ident="albumName",end="GROUP BY albumName")), "songs" : db.executequerystatic(string.Template(test).safe_substitute(ident="*",end=""))})
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getsongs(args):
|
||||||
|
"""Get song by album, genre, year, artist"""
|
||||||
|
data = args.partition("?")
|
||||||
|
splitstring = data[0].partition("=")
|
||||||
|
name= splitstring[0]
|
||||||
|
value = splitstring[2].replace("%20"," ")
|
||||||
|
if name == "album":
|
||||||
|
songs = db.executequerystatic("SELECT * FROM tracks WHERE albumName = \"" + value + "\"")
|
||||||
|
elif name == "genre":
|
||||||
|
songs = db.executequerystatic("SELECT * FROM tracks WHERE genre = \"" + value + "\"")
|
||||||
|
elif name == "year":
|
||||||
|
songs = db.executequerystatic("SELECT * FROM tracks WHERE year = \"" + value + "\"")
|
||||||
|
elif name == "artist":
|
||||||
|
songs = db.executequerystatic("SELECT * FROM tracks WHERE artistName = \"" + value + "\"")
|
||||||
|
elif name == "search":
|
||||||
|
songs = db.executequerystatic("SELECT * FROM tracks WHERE LCASE(trackName) LIKE LCASE(\"%"+ value + "%\") GROUP BY trackName")
|
||||||
|
else:
|
||||||
|
return calls.jsonify({"result":"NOK", "errormsg": "Not a valid argument"})
|
||||||
|
return calls.jsonify({"result":"OK","songs":songs})
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getsongbyid(args):
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
try:
|
||||||
|
config.read("config.cfg")
|
||||||
|
musicdir = config.get("Library","musicdir")
|
||||||
|
port = config.get("HTTP","port")
|
||||||
|
except:
|
||||||
|
return calls.jsonify({"result" : "NOK" , "errormsg" : "I/O error while reading config."})
|
||||||
|
data = args.split("&")
|
||||||
|
splitsting = data[0].split("=")
|
||||||
|
id = splitsting[1]
|
||||||
|
file = db.executequerystatic(
|
||||||
|
"SELECT SUBSTRING_INDEX(trackUrl,'" + musicdir + "',-1) as filedir FROM `tracks` WHERE id = " + id)
|
||||||
|
try:
|
||||||
|
url = str(file[0][0])
|
||||||
|
except:
|
||||||
|
return calls.jsonify({"result": "NOK", "errormsg" : "Song ID does not exist in database."})
|
||||||
|
return calls.jsonify({"result": "OK", "songurl": "http://imegumii.nl:"+ "/music/English"+ url})
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def setsong(args, songname):
|
||||||
|
global song
|
||||||
|
song = songname
|
||||||
|
return calls.jsonify({"result": "OK", "args": args})
|
||||||
|
|
||||||
|
|
||||||
|
validAPIcalls = {"getallsongs": calls.getallsongs,
|
||||||
|
"setsong": calls.setsong,
|
||||||
|
"search": calls.search,
|
||||||
|
"getsongs": calls.getsongs,
|
||||||
|
"getsongbyid": calls.getsongbyid,
|
||||||
|
"getartists": calls.getartists,
|
||||||
|
"getalbums": calls.getalbums,
|
||||||
|
"getgenres": calls.getgenres,
|
||||||
|
"getyears": calls.getyears,
|
||||||
|
"getalbumnames": calls.getalbumnames
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import pymysql
|
||||||
|
import configparser
|
||||||
|
from threading import RLock as Lock
|
||||||
|
from warnings import filterwarnings
|
||||||
|
|
||||||
|
filterwarnings('ignore', category = pymysql.Warning)
|
||||||
|
class Database:
|
||||||
|
|
||||||
|
buffer = []
|
||||||
|
cout = 0
|
||||||
|
lock = Lock()
|
||||||
|
def __init__(self, DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT, DB_DATABASE):
|
||||||
|
"""Init class """
|
||||||
|
self.cnx = pymysql.connect(user=DB_USERNAME, password=DB_PASSWORD, host=DB_HOST, database=DB_DATABASE, port=DB_PORT, charset='utf8')
|
||||||
|
self.cursor = self.cnx.cursor()
|
||||||
|
|
||||||
|
def executeQuery(self, query):
|
||||||
|
try:
|
||||||
|
self.cursor.execute(query)
|
||||||
|
self.cnx.commit()
|
||||||
|
return self.cursor.fetchall()
|
||||||
|
except pymysql.ProgrammingError as e:
|
||||||
|
print(e)
|
||||||
|
print(query)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def executequerystatic(query):
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
try:
|
||||||
|
config.read("config.cfg")
|
||||||
|
DB_USERNAME = config.get("Database", "username")
|
||||||
|
DB_PASSWORD = config.get("Database", "password")
|
||||||
|
DB_HOST = config.get("Database", "host")
|
||||||
|
DB_DATABASE = config.get("Database", "database")
|
||||||
|
DB_PORT = config.getint("Database", "port")
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
cnx = pymysql.connect(user=DB_USERNAME, password=DB_PASSWORD, host=DB_HOST, database=DB_DATABASE, port=DB_PORT)
|
||||||
|
cursor = cnx.cursor()
|
||||||
|
if query != "":
|
||||||
|
cursor.execute(query)
|
||||||
|
cnx.commit()
|
||||||
|
return cursor.fetchall()
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
def turnoffautocommit(self):
|
||||||
|
self.cursor.execute("SET autocommit=0;")
|
||||||
|
self.cnx.commit()
|
||||||
|
|
||||||
|
def removeSong(self, path):
|
||||||
|
self.db.executeQuery("DELETE FROM `tracks` WHERE trackUrl = " + path.replace("'", '\\\''))
|
||||||
|
|
||||||
|
def updateInsertSong(self, genre, trackname, artistname, albumname, albumartist, tracknumber, year, duration, path): #notworking
|
||||||
|
self.db.executeQuery("INSERT INTO `tracks` (`genre`, `trackUrl`, `trackName`, `artistName`, `albumName`, `albumArtist`, `trackNumber`, `year`, `duration`) VALUES ('" + genre + b"','" + path.replace("'", '\\\'') + "','" + trackname + "','" + artistname + "','" + albumname + "','" + albumartist + "','" + tracknumber + "','" + year + "','0') " +
|
||||||
|
b" ON DUPLICATE KEY UPDATE `genre`=VALUES(`genre`) , `trackName` = VALUES(`trackName`) , `artistName` = VALUES(`artistName`) ,`albumName` = VALUES(`albumName`) , `albumArtist` = VALUES(`albumArtist`) , `trackNumber` = VALUES(`trackNumber`) , `year` = VALUES(`year`) , `duration` = VALUES(`duration`)")
|
||||||
|
|
||||||
|
def insertMultipleSongs(self, genre, trackname, artistname, albumname, albumartist, tracknumber, year, duration, path):
|
||||||
|
self.buffer.append([genre, trackname, artistname, albumname, albumartist, tracknumber, year, duration, path])
|
||||||
|
# Database.lock.acquire()
|
||||||
|
if len(self.buffer) > 50:
|
||||||
|
self.pushbuffer()
|
||||||
|
# Database.lock.release()
|
||||||
|
|
||||||
|
def pushbuffer(self):
|
||||||
|
query = ('INSERT INTO `tracks` (`genre`, `trackUrl`, `trackName`, `artistName`, `albumName`, `albumArtist`, `trackNumber`, `year`, `duration`) VALUES ')
|
||||||
|
for song in self.buffer:
|
||||||
|
query += "("
|
||||||
|
for field in song:
|
||||||
|
query += "'" + field + "',"
|
||||||
|
query = query[:-1]
|
||||||
|
query += "),"
|
||||||
|
query = query[:-1]
|
||||||
|
query += " ON DUPLICATE KEY UPDATE `genre`=VALUES(`genre`) , `trackName` = VALUES(`trackName`) , `artistName` = VALUES(`artistName`) ,`albumName` = VALUES(`albumName`) , `albumArtist` = VALUES(`albumArtist`) , `trackNumber` = VALUES(`trackNumber`) , `year` = VALUES(`year`) , `duration` = VALUES(`duration`);"
|
||||||
|
self.executeQuery(query)
|
||||||
|
del self.buffer[:]
|
||||||
|
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
|
||||||
|
import http.server
|
||||||
|
import socketserver
|
||||||
|
import threading
|
||||||
|
import html
|
||||||
|
|
||||||
|
import yjdaemon.API as API
|
||||||
|
|
||||||
|
"""
|
||||||
|
HTTP request handler.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class HTTPServerThread(threading.Thread):
|
||||||
|
def __init__(self, PORT):
|
||||||
|
threading.Thread.__init__(self)
|
||||||
|
self.PORT = PORT
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
Handler = HTTPHandler
|
||||||
|
socketserver.TCPServer.allow_reuse_address = True
|
||||||
|
httpd = socketserver.TCPServer(("", self.PORT), Handler)
|
||||||
|
httpd.serve_forever()
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
REST API
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class HTTPHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
|
def send_message(self, status, content_type, data):
|
||||||
|
self.send_response(status)
|
||||||
|
self.send_header("Content-type:", content_type)
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write(data)
|
||||||
|
self.wfile.write("\n".encode("utf-8"))
|
||||||
|
|
||||||
|
def do_GET(self):
|
||||||
|
""" Serve a GET request. """
|
||||||
|
path = html.unescape(self.path)
|
||||||
|
path = str(path).lstrip("/").split("?")[0]
|
||||||
|
retval = API.calls.APIcall(path)
|
||||||
|
if retval is not None: # if call is valid API function
|
||||||
|
try:
|
||||||
|
args = str(html.unescape(self.path)).lstrip("/").split("?")[1]
|
||||||
|
except IndexError as e:
|
||||||
|
print(e)
|
||||||
|
self.send_message(403, "application/json", API.calls.jsonify({"error": "Missing parameters."}))
|
||||||
|
return
|
||||||
|
self.send_message(200, "application/json", retval(args))
|
||||||
|
else: # else parse as normal HTTP request
|
||||||
|
f = self.send_head()
|
||||||
|
if f:
|
||||||
|
try:
|
||||||
|
self.copyfile(f, self.wfile)
|
||||||
|
finally:
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
def do_POST(self):
|
||||||
|
""" Serve a POST request. """
|
||||||
|
path = html.unescape(self.path)
|
||||||
|
path = str(path).lstrip("/").split("?")[0]
|
||||||
|
retval = API.calls.APIcall(path)
|
||||||
|
if retval is not None: # if call is valid API function
|
||||||
|
try:
|
||||||
|
args = str(html.unescape(self.path)).lstrip("/").split("?")[1] #if no args
|
||||||
|
except IndexError as e:
|
||||||
|
print(e)
|
||||||
|
self.send_message(403, "application/json", API.calls.jsonify({"error": "Missing parameters."}))
|
||||||
|
return
|
||||||
|
if self.headers["Content-Type"] == 'application/json': # if data is json data
|
||||||
|
length = int(self.headers["Content-Length"])
|
||||||
|
rawdata = self.rfile.read(length)
|
||||||
|
result = retval(args, API.calls.getfromrawjson(rawdata, "data"))
|
||||||
|
self.send_message(200, "application/json", result)
|
||||||
|
else: # if not json data
|
||||||
|
self.send_message(422, "application/json", API.calls.jsonify({"error": "Not JSON data."}))
|
||||||
|
else: # if not API function
|
||||||
|
self.send_message(403, "application/json", API.calls.jsonify({"error": "Not an API function"}))
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import socket
|
||||||
|
import threading
|
||||||
|
|
||||||
|
endline = "\r\n"
|
||||||
|
|
||||||
|
class ServiceSocket(threading.Thread):
|
||||||
|
def __init__(self, PORT):
|
||||||
|
threading.Thread.__init__(self)
|
||||||
|
self.PORT = PORT
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
self.s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
|
self.s.bind(("", self.PORT))
|
||||||
|
self.s.listen(1)
|
||||||
|
while 1:
|
||||||
|
conn, addr = self.s.accept()
|
||||||
|
ClientHandler(conn).start()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ClientHandler(threading.Thread):
|
||||||
|
def __init__(self,conn):
|
||||||
|
threading.Thread.__init__(self)
|
||||||
|
self.conn = conn
|
||||||
|
def run(self):
|
||||||
|
while 1:
|
||||||
|
data = self.conn.recv(1024)
|
||||||
|
if not data:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
datastring = data.decode('utf-8', "ignore").rstrip(endline).lower()
|
||||||
|
print(datastring)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable
+78
@@ -0,0 +1,78 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from mutagen.easyid3 import EasyID3
|
||||||
|
from mutagen.mp3 import MP3
|
||||||
|
import mutagen._util
|
||||||
|
import os
|
||||||
|
from watchdog.observers import Observer
|
||||||
|
from watchdog.events import FileSystemEventHandler
|
||||||
|
|
||||||
|
class LibraryScanner:
|
||||||
|
|
||||||
|
def __init__(self, Database, librarypath):
|
||||||
|
"""Init class """
|
||||||
|
self.url = librarypath
|
||||||
|
self.db = Database
|
||||||
|
self.scanRecursif()
|
||||||
|
ob = Observer()
|
||||||
|
ob.schedule(Filehandler(self), self.url, recursive=True)
|
||||||
|
ob.start()
|
||||||
|
|
||||||
|
|
||||||
|
def scanRecursif(self):
|
||||||
|
print("Scanning library "+self.url+" recursively...")
|
||||||
|
# musicdirs = [os.path.join(self.url,o) for o in os.listdir(self.url) if os.path.isdir(os.path.join(self.url,o))]
|
||||||
|
self.db.turnoffautocommit()
|
||||||
|
for root, directories, filenames in os.walk(self.url):
|
||||||
|
self.scandir(filenames,root)
|
||||||
|
|
||||||
|
def scandir(self,filenames, root):
|
||||||
|
for filename in filenames:
|
||||||
|
if filename.lower().endswith(('.mp3')):
|
||||||
|
path = os.path.join(root,filename)
|
||||||
|
try:
|
||||||
|
print(path, end='\r')
|
||||||
|
id3 = EasyID3(path)
|
||||||
|
audio = MP3(path)
|
||||||
|
print(audio.info.length)
|
||||||
|
self.db.insertMultipleSongs(self.getValue(id3, "genre"),path.replace("'", '\\\''),self.getValue(id3, "title"),self.getValue(id3, "artist"),self.getValue(id3, "album"),self.getValue(id3, "performer"),self.getValue(id3, "tracknumber"),self.getValue(id3, "date"),str(audio.info.length))
|
||||||
|
except (mutagen.id3._util.ID3NoHeaderError):
|
||||||
|
print("Error reading ID3 tag", end='\r')
|
||||||
|
|
||||||
|
|
||||||
|
def insertSong(self, path):
|
||||||
|
try:
|
||||||
|
id3 = EasyID3(path)
|
||||||
|
self.db.executeQuery(b"INSERT INTO `tracks` (`genre`, `trackUrl`, `trackName`, `artistName`, `albumName`, `albumArtist`, `trackNumber`, `year`, `duration`) VALUES ('" + self.getValue(id3,"genre") + b"'," + b"'" + path.replace("'", '\\\'').encode('utf8') + b"'," + b"'" + self.getValue(id3, "title") + b"'," + b"'" + self.getValue(id3, "artist") + b"'," + b"'" + self.getValue(id3, "album") + b"'," + b"'" + self.getValue(id3, "performer") + b"'," + b"'" + self.getValue(id3, "tracknumber") + b"'," + b"'" + self.getValue(id3, "date") + b"'," + b"'0') " +
|
||||||
|
b" ON DUPLICATE KEY UPDATE `genre`=VALUES(`genre`) , `trackName` = VALUES(`trackName`) , `artistName` = VALUES(`artistName`) ,`albumName` = VALUES(`albumName`) , `albumArtist` = VALUES(`albumArtist`) , `trackNumber` = VALUES(`trackNumber`) , `year` = VALUES(`year`) , `duration` = VALUES(`duration`)")
|
||||||
|
|
||||||
|
except (mutagen.id3._util.ID3NoHeaderError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def removeSong(self,path):
|
||||||
|
self.db.removeSong(path)
|
||||||
|
|
||||||
|
def getValue(self, id3, value):
|
||||||
|
try:
|
||||||
|
return id3[value][0].replace("'", "\\'")
|
||||||
|
except (KeyError, IndexError, ValueError):
|
||||||
|
print("Error reading value of ID3 tag", end='\r')
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
class Filehandler(FileSystemEventHandler):
|
||||||
|
def __init__(self, LibraryScanner):
|
||||||
|
self.libscanner = LibraryScanner
|
||||||
|
|
||||||
|
def process(self, event):
|
||||||
|
if not(event.is_directory):
|
||||||
|
if os.path.isfile(event.src_path) and event.src_path.lower().endswith(('.mp3','.flac', 'm4a')):
|
||||||
|
self.libscanner.insertSong(event.src_path)
|
||||||
|
else:
|
||||||
|
self.libscanner.removeSong(event.src_path)
|
||||||
|
|
||||||
|
def on_modified(self, event):
|
||||||
|
self.process(event)
|
||||||
|
|
||||||
|
def on_created(self, event):
|
||||||
|
self.process(event)
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import configparser
|
||||||
|
from yjdaemon.Database import Database
|
||||||
|
from yjdaemon.libraryscanner import LibraryScanner
|
||||||
|
from yjdaemon.yjmpd import YJMPD
|
||||||
|
from yjdaemon.HTTPServer import HTTPServerThread
|
||||||
|
|
||||||
|
debug = False
|
||||||
|
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
try:
|
||||||
|
config.read("../config.cfg")
|
||||||
|
HTTP_PORT = int(config.get("HTTP", "port"))
|
||||||
|
DAEMON_PORT = int(config.get("Daemon", "port"))
|
||||||
|
MUSIC_DIR = str(config.get("Library", "jancodir"))
|
||||||
|
|
||||||
|
DB_USERNAME = config.get("Database", "username")
|
||||||
|
DB_PASSWORD = config.get("Database", "password")
|
||||||
|
DB_HOST = config.get("Database", "host")
|
||||||
|
DB_DATABASE = config.get("Database", "database")
|
||||||
|
DB_PORT = config.getint("Database", "port")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(e.with_traceback())
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
class MainDaemon(YJMPD):
|
||||||
|
def run(self):
|
||||||
|
HTTP_thread = HTTPServerThread(HTTP_PORT)
|
||||||
|
HTTP_thread.start()
|
||||||
|
db = Database(DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT, DB_DATABASE)
|
||||||
|
LibraryScanner(db, MUSIC_DIR)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
username = os.getenv('USER')
|
||||||
|
if None == username:
|
||||||
|
dir = "/tmp/.pydaemon.pid"
|
||||||
|
else:
|
||||||
|
dir = "/home/" + username + "/.pydaemon.pid"
|
||||||
|
daemon = MainDaemon(dir, MUSIC_DIR)
|
||||||
|
if len(sys.argv) == 2:
|
||||||
|
if 'start' == sys.argv[1]:
|
||||||
|
daemon.start()
|
||||||
|
elif 'stop' == sys.argv[1]:
|
||||||
|
daemon.stop()
|
||||||
|
elif 'restart' == sys.argv[1]:
|
||||||
|
daemon.restart()
|
||||||
|
elif 'status' == sys.argv[1]:
|
||||||
|
daemon.status()
|
||||||
|
else:
|
||||||
|
print("Unknown command")
|
||||||
|
sys.exit(2)
|
||||||
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
print("usage: %s start|stop|status|restart" % sys.argv[0])
|
||||||
|
sys.exit(2)
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import atexit
|
||||||
|
import signal
|
||||||
|
|
||||||
|
|
||||||
|
class YJMPD:
|
||||||
|
"""A generic yjdaemon class.
|
||||||
|
|
||||||
|
Usage: subclass the yjdaemon class and override the run() method."""
|
||||||
|
|
||||||
|
def __init__(self, pidfile, root):
|
||||||
|
self.pidfile = pidfile
|
||||||
|
self.root = root
|
||||||
|
|
||||||
|
def daemonize(self):
|
||||||
|
"""Deamonize class. UNIX double fork mechanism."""
|
||||||
|
|
||||||
|
try:
|
||||||
|
pid = os.fork()
|
||||||
|
if pid > 0:
|
||||||
|
# exit first parent
|
||||||
|
sys.exit(0)
|
||||||
|
except OSError as err:
|
||||||
|
sys.stderr.write('fork #1 failed: {0}\n'.format(err))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# decouple from parent environment
|
||||||
|
os.chdir(self.root)
|
||||||
|
os.setsid()
|
||||||
|
os.umask(0)
|
||||||
|
|
||||||
|
# do second fork
|
||||||
|
try:
|
||||||
|
pid = os.fork()
|
||||||
|
if pid > 0:
|
||||||
|
# exit from second parent
|
||||||
|
sys.exit(0)
|
||||||
|
except OSError as err:
|
||||||
|
sys.stderr.write('fork #2 failed: {0}\n'.format(err))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# redirect standard file descriptors
|
||||||
|
sys.stdout.flush()
|
||||||
|
sys.stderr.flush()
|
||||||
|
si = open(os.devnull, 'r')
|
||||||
|
so = open(os.devnull, 'a+')
|
||||||
|
se = open(os.devnull, 'a+')
|
||||||
|
|
||||||
|
os.dup2(si.fileno(), sys.stdin.fileno())
|
||||||
|
os.dup2(so.fileno(), sys.stdout.fileno())
|
||||||
|
os.dup2(se.fileno(), sys.stderr.fileno())
|
||||||
|
|
||||||
|
# write pidfile
|
||||||
|
atexit.register(self.delpid)
|
||||||
|
|
||||||
|
pid = str(os.getpid())
|
||||||
|
with open(self.pidfile, 'w+') as f:
|
||||||
|
f.write(pid + '\n')
|
||||||
|
|
||||||
|
def delpid(self):
|
||||||
|
os.remove(self.pidfile)
|
||||||
|
|
||||||
|
def start(self):
|
||||||
|
"""Start the yjdaemon."""
|
||||||
|
|
||||||
|
# Check for a pidfile to see if the yjdaemon already runs
|
||||||
|
try:
|
||||||
|
with open(self.pidfile, 'r') as pf:
|
||||||
|
|
||||||
|
pid = int(pf.read().strip())
|
||||||
|
except IOError:
|
||||||
|
pid = None
|
||||||
|
|
||||||
|
if pid:
|
||||||
|
message = "pidfile {0} already exist. " + \
|
||||||
|
"Daemon already running?\n"
|
||||||
|
sys.stderr.write(message.format(self.pidfile))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Start the yjdaemon
|
||||||
|
self.daemonize()
|
||||||
|
self.run()
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
"""Stop the yjdaemon."""
|
||||||
|
|
||||||
|
# Get the pid from the pidfile
|
||||||
|
try:
|
||||||
|
with open(self.pidfile, 'r') as pf:
|
||||||
|
pid = int(pf.read().strip())
|
||||||
|
except IOError:
|
||||||
|
pid = None
|
||||||
|
|
||||||
|
if not pid:
|
||||||
|
message = "pidfile {0} does not exist. " + \
|
||||||
|
"Daemon not running?\n"
|
||||||
|
sys.stderr.write(message.format(self.pidfile))
|
||||||
|
return # not an error in a restart
|
||||||
|
|
||||||
|
# Try killing the yjdaemon process
|
||||||
|
try:
|
||||||
|
while 1:
|
||||||
|
os.kill(pid, signal.SIGTERM)
|
||||||
|
time.sleep(0.1)
|
||||||
|
except OSError as err:
|
||||||
|
e = str(err.args)
|
||||||
|
if e.find("No such process") > 0:
|
||||||
|
if os.path.exists(self.pidfile):
|
||||||
|
os.remove(self.pidfile)
|
||||||
|
else:
|
||||||
|
print(str(err.args))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
def restart(self):
|
||||||
|
"""Restart the yjdaemon."""
|
||||||
|
self.stop()
|
||||||
|
self.start()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def status(self):
|
||||||
|
"""Print out status."""
|
||||||
|
if os.path.exists(self.pidfile):
|
||||||
|
message = "Daemon running.\n"
|
||||||
|
else:
|
||||||
|
message = "Daemon not running.\n"
|
||||||
|
sys.stdout.write(message)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
"""You should override this method when you subclass Daemon.
|
||||||
|
|
||||||
|
It will be called after the process has been daemonized by
|
||||||
|
start() or restart()."""
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
-- phpMyAdmin SQL Dump
|
||||||
|
-- version 4.3.8deb0.1
|
||||||
|
-- http://www.phpmyadmin.net
|
||||||
|
--
|
||||||
|
-- Host: localhost
|
||||||
|
-- Gegenereerd op: 27 sep 2015 om 22:19
|
||||||
|
-- Serverversie: 5.6.19-0ubuntu0.14.04.1
|
||||||
|
-- PHP-versie: 5.5.9-1ubuntu4.11
|
||||||
|
|
||||||
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||||
|
SET time_zone = "+00:00";
|
||||||
|
|
||||||
|
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
|
/*!40101 SET NAMES utf8 */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Database: `yjmpd`
|
||||||
|
--
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Tabelstructuur voor tabel `tracks`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `tracks` (
|
||||||
|
`id` int(11) NOT NULL,
|
||||||
|
`genre` varchar(100) DEFAULT NULL,
|
||||||
|
`trackUrl` varchar(200) NOT NULL,
|
||||||
|
`trackName` varchar(100) DEFAULT NULL,
|
||||||
|
`artistName` varchar(100) DEFAULT NULL,
|
||||||
|
`albumName` varchar(100) DEFAULT NULL,
|
||||||
|
`albumArtist` varchar(100) DEFAULT NULL,
|
||||||
|
`trackNumber` int(11) DEFAULT NULL,
|
||||||
|
`year` int(11) DEFAULT NULL,
|
||||||
|
`duration` time DEFAULT NULL,
|
||||||
|
`playCount` int(11) NOT NULL DEFAULT '0'
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=8135 DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Indexen voor geëxporteerde tabellen
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Indexen voor tabel `tracks`
|
||||||
|
--
|
||||||
|
ALTER TABLE `tracks`
|
||||||
|
ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `trackUrl` (`trackUrl`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT voor geëxporteerde tabellen
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT voor een tabel `tracks`
|
||||||
|
--
|
||||||
|
ALTER TABLE `tracks`
|
||||||
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=8135;
|
||||||
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
Reference in New Issue
Block a user