136 Commits
Author SHA1 Message Date
kennyboy55 6744c7c40e Visual studio glitch 2015-11-08 19:39:27 +01:00
kennyboy55 3dae7b6258 Load default cover from local storage 2015-11-08 19:38:48 +01:00
kennyboy55 f3485ba283 Added exit to notifyicon 2015-11-08 19:17:30 +01:00
kennyboy55 7e2496dd74 Calculate proper length invalid seconds 2015-11-08 18:51:21 +01:00
kennyboy55 401d832430 Bugfixes with filesaving 2015-11-08 18:50:57 +01:00
kennyboy55 1e974a645c Save buffer to file. Minimize player to system tray 2015-11-08 17:48:15 +01:00
kennyboy55 91e22bf08b Save buffer to file 2015-11-08 17:48:01 +01:00
kennyboy55 69c1d8bd3a Added volume control 2015-11-04 21:33:14 +01:00
kennyboy55 c4d71e60b0 Bugfixes 2015-11-03 12:00:03 +01:00
kennyboy55 870a291b7e Add class diagram 2015-11-03 11:23:12 +01:00
kennyboy55 830c50a947 Fix seeking when song is null 2015-11-03 11:22:55 +01:00
Janco Kock 6659e2dff7 Fixed search image load 2015-11-02 23:23:27 +01:00
kennyboy55 4788a80b78 Merge branch 'developer' into gui 2015-11-02 23:07:58 +01:00
kennyboy55 2f82bd96c6 Fix search not returning data 2015-11-02 23:05:36 +01:00
Janco Kock f385ff773f Fixed repopulate images 2015-11-02 22:57:06 +01:00
kennyboy55 3ea423c87e Gui fix 2015-11-02 22:39:50 +01:00
kennyboy55 9fb8550dbf Fix crashes 2015-11-02 22:27:08 +01:00
kennyboy55 f07b9e0fdb Possible fix for trackbar not working properly 2015-11-02 22:20:51 +01:00
kennyboy55 d4b916137b Merge remote-tracking branch 'origin/developer' into developer
Conflicts:
	MusicPlayer/MusicPlayer/MainForm.Designer.cs
2015-11-02 22:02:59 +01:00
kennyboy55 e7eba01ac7 Merge branch 'gui' into developer
Conflicts:
	MusicPlayer/MusicPlayer/MainForm.Designer.cs
2015-11-02 22:02:17 +01:00
Yorick Rommers 8e64b6e5b6 merge gui to dev 2015-11-02 22:00:46 +01:00
Yorick Rommers 96683d3b57 merge gui to dev 2015-11-02 21:52:47 +01:00
kennyboy55 c760e5a559 Drag to add to queue 2015-11-02 21:42:59 +01:00
Yorick Rommers 5a07e6251b added reset button 2015-11-02 21:40:28 +01:00
Yorick Rommers b9b300b14d Merge remote-tracking branch 'origin/search' into developer 2015-11-02 21:38:32 +01:00
Yorick Rommers 4e9d2222cf Merge branch 'developer' of https://github.com/yorickr/musicplayer into developer 2015-11-02 21:37:41 +01:00
Yorick Rommers 4a869f3399 added advanced search 2015-11-02 21:37:24 +01:00
kennyboy55 0d0a92f33a Fix albumart interface 2015-11-02 21:27:33 +01:00
kennyboy55 66c5285418 Merge remote-tracking branch 'origin/gui' into gui 2015-11-02 21:15:46 +01:00
kennyboy55 292405cf4d Remove playlist and songs from playlist 2015-11-02 21:15:24 +01:00
Janco Kock 8d7d8eaabc Some album art edits, bigger covers and current playing cover 2015-11-02 20:37:39 +01:00
kennyboy55 40cb55d7f6 Implemented Advanced Search interface 2015-11-02 18:17:22 +01:00
yorickr 56586355d3 Merge remote-tracking branch 'origin/gui' into developer 2015-11-02 17:38:12 +01:00
yorickr 56a2cb91a4 Removed useless arguments 2015-11-02 17:37:50 +01:00
kennyboy55 a4031daae8 Playlist based on server 2015-11-02 17:25:52 +01:00
kennyboy55 a1bfb15e6b Implemented song searching in application. API does not support it yet. 2015-11-02 17:03:31 +01:00
kennyboy55 c2229db72a Handle server error's 2015-11-02 12:18:09 +01:00
kennyboy55 f81c526255 Translate to english 2015-11-02 11:14:43 +01:00
kennyboy55 7b712460d2 Small GUI changes 2015-11-02 11:09:39 +01:00
kennyboy55 57229fc8b9 Added todo 2015-11-02 07:06:44 +01:00
kennyboy55 515f17eb62 Made genre/artist box larger 2015-11-01 20:16:55 +01:00
kennyboy55 98f6ab9bc0 Better handling of radiostation 2015-11-01 19:51:43 +01:00
kennyboy55 90f35de242 Better naming and buffering 2015-11-01 19:10:30 +01:00
kennyboy55 aa85ca5d26 Clear playlist when starting radio 2015-11-01 19:03:55 +01:00
kennyboy55 270db2d1a4 Added Slam-FM 2015-11-01 18:59:59 +01:00
Janco Kock fd629f54ff Fixed 3fm radio 2015-11-01 14:39:11 +01:00
kennyboy55 d774e250c5 Calculate length if unknown. 2015-11-01 14:24:16 +01:00
Janco Kock 93f9879c14 Fixed cross thread bug 2015-11-01 14:07:09 +01:00
kennyboy55 a6514189b0 Fix bufferbar not filling completely 2015-11-01 14:05:14 +01:00
Yorick Rommers 192e132f1d Changed artwork folder and server 2015-11-01 14:00:27 +01:00
Yorick Rommers d8a900ecb9 Changed artwork folder and server 2015-11-01 13:59:15 +01:00
kennyboy55 7e5dcb3cef Fix 3FM url and name 2015-11-01 13:55:34 +01:00
kennyboy55 17eaac40bf Added 3FM, added custom Radio URL 2015-11-01 13:39:37 +01:00
kennyboy55 dad829d1dd Added URL tools 2015-11-01 13:39:24 +01:00
kennyboy55 e218b58421 Faster buffering of radio station 2015-11-01 13:39:06 +01:00
Janco Kock 7f45afe80f Added support for radio stations 2015-11-01 13:07:11 +01:00
kennyboy55 05bf1bce21 Merge pull request #1 from yorickr/gui
Merge gui into develop
2015-11-01 12:12:52 +01:00
kennyboy55 740264099d Merge branch 'developer' into gui 2015-11-01 12:07:35 +01:00
kennyboy55 70bed9b661 Switch between server (untested) 2015-11-01 12:05:22 +01:00
kennyboy55 aa769cfad9 Easier switching when testing 2015-11-01 12:04:18 +01:00
kennyboy55 2f0b1915a3 Merge remote-tracking branch 'origin/gui' into gui 2015-11-01 01:00:58 +01:00
kennyboy55 cbf8588855 Improve dragging 2015-11-01 01:00:38 +01:00
kennyboy55 d665d0466d Press enter to create playlist. Handle / and \. Clear textbox on create. 2015-11-01 01:00:26 +01:00
Janco Kock e6683f0478 Changed image key 2015-11-01 00:29:10 +01:00
kennyboy55 46410149b1 Merge remote-tracking branch 'origin/gui' into gui 2015-11-01 00:22:33 +01:00
kennyboy55 34771e43c8 Catch negative position 2015-11-01 00:22:17 +01:00
Janco Kock 918bfd8871 Dragable songs to playlist working. We only need a better cursor 2015-11-01 00:18:11 +01:00
Janco Kock 68ca3af5ff Fixed albumcover load on startup 2015-10-31 22:23:39 +01:00
Yorick Rommers bc75eb9d34 Using URL Encoding now with the AntiXSS Library 2015-10-31 20:56:29 +01:00
kennyboy55 a8b618cd46 Don't keep selection when showing current playlist 2015-10-31 20:03:04 +01:00
kennyboy55 00dfd2a78b Search through all songs when creating playlist 2015-10-31 19:33:05 +01:00
kennyboy55 29eb193aea Bugfix gui anchor 2015-10-31 19:22:50 +01:00
kennyboy55 78cb6ccee7 Possible fix for handling broken songs 2015-10-31 19:19:51 +01:00
kennyboy55 88681a04e6 Add button to view current playlist 2015-10-31 19:16:30 +01:00
kennyboy55 5af3b29a84 Removed old code 2015-10-31 19:16:05 +01:00
kennyboy55 2a699353d2 Player now remembers playlist and allows previous/next 2015-10-31 19:09:44 +01:00
Janco Kock 6a9b2956de Fixed seeking on specific click on trackbar 2015-10-31 16:09:44 +01:00
kennyboy55 3ccfdbe282 Add icon. Add minimum size and Controls Anchors 2015-10-31 12:24:25 +01:00
kennyboy55 60f7d41279 Changed minimum size 2015-10-31 12:23:33 +01:00
kennyboy55 c99d3955d3 Bugfixes in loop song 2015-10-31 12:03:15 +01:00
kennyboy55 87404b0f85 Implemented play next, shuffle and loop. Implemented Artist and Genre search 2015-10-31 11:57:05 +01:00
kennyboy55 f9d92de0ab Visual Studio NewLine Change 2015-10-31 11:56:27 +01:00
kennyboy55 6190a6f0da Switch api 2015-10-31 11:56:15 +01:00
kennyboy55 a902b8c370 Disable album loading for testing 2015-10-31 11:56:05 +01:00
kennyboy55 c20a20534b Merge remote-tracking branch 'origin/gui' into gui 2015-10-31 00:05:46 +01:00
kennyboy55 9d56e2e3b4 Switch to new playlist automatically 2015-10-31 00:05:30 +01:00
Janco Kock 006bba7980 Added artwork download!! This is only a bottleneck at startup. 2015-10-31 00:03:24 +01:00
kennyboy55 d5bc7df7e1 Redesigned and fixed Playlist Maker 2015-10-30 23:57:02 +01:00
Yorick Rommers d31519aeca refhresh on close dialog 2015-10-30 23:33:34 +01:00
kennyboy55 b3e397d0bf Merge branch 'developer' into gui
Conflicts:
	MusicPlayer/MusicPlayer/MainForm.Designer.cs
	MusicPlayer/MusicPlayer/MainForm.cs
2015-10-30 23:32:06 +01:00
kennyboy55 c7db59a8ab NotifyIcon contextmenu on left click 2015-10-30 23:13:52 +01:00
Yorick Rommers a0f52a636c Added playlist maker 2015-10-30 23:12:28 +01:00
kennyboy55 ff706d1bf5 Playlist fill. Format 2015-10-30 23:01:38 +01:00
kennyboy55 daf9f6d1ac Fix alignment in splitcontainer and moved playlistpanel 2015-10-30 22:20:16 +01:00
kennyboy55 3763e4fb22 Merge remote-tracking branch 'origin/gui' into gui 2015-10-30 21:38:21 +01:00
kennyboy55 e2be560a21 Changed album view 2015-10-30 21:37:48 +01:00
Janco Kock aaa9382e23 Added splitter 2015-10-30 21:27:12 +01:00
kennyboy55 9d78ac8b4b Error handling. Bugfix 2015-10-30 21:23:10 +01:00
kennyboy55 5f1093dd1c Bugfixes 2015-10-30 21:10:10 +01:00
kennyboy55 e80f9107c0 Better seeking. Better interface 2015-10-30 20:38:45 +01:00
Yorick Rommers 77a6951021 Merge remote-tracking branch 'origin/gui' into playlists 2015-10-30 20:33:43 +01:00
Yorick Rommers 08e485d6d4 Added base for playlists, puts files in dir and reads files from dir 2015-10-30 20:33:23 +01:00
kennyboy55 769f153e26 Add playlist buttons. Threadsafe application exit 2015-10-30 19:57:04 +01:00
Yorick Rommers d4f6869736 Merge remote-tracking branch 'origin/gui' into playlists 2015-10-30 19:48:50 +01:00
kennyboy55 c86b48da5f Added playlist to new interface 2015-10-30 19:45:34 +01:00
kennyboy55 bb60d94996 Merge remote-tracking branch 'origin/gui' into gui
Conflicts:
	MusicPlayer/MusicPlayer/MainForm.Designer.cs
2015-10-30 19:42:21 +01:00
Yorick Rommers ad6ee2f6ed Merge remote-tracking branch 'origin/gui' into developer 2015-10-30 19:41:53 +01:00
Yorick Rommers b6c90e97bd View buttonz added 2015-10-30 19:41:16 +01:00
kennyboy55 fe2f02a16d Merge remote-tracking branch 'origin/gui' into gui 2015-10-30 19:40:37 +01:00
kennyboy55 362a37f0eb Redesign interface 2015-10-30 19:40:22 +01:00
Yorick Rommers 7b763bac46 Lambdas to make things smaller 2015-10-30 19:21:58 +01:00
Yorick Rommers 91893e45e4 Genres added 2015-10-30 19:01:48 +01:00
kennyboy55 870c67595b Added missing code 2015-10-30 18:44:31 +01:00
kennyboy55 c0d5932f09 Disable Trackbar. Add Genre 2015-10-30 18:43:53 +01:00
Yorick Rommers 86d96515c0 Merge 2015-10-30 18:32:35 +01:00
Yorick Rommers 9bec1974f5 Reload mp3 stream when done buffering 2015-10-30 18:25:25 +01:00
kennyboy55 9a01b9e870 Attempt fix seeking (Again) 2015-10-30 17:37:53 +01:00
kennyboy55 41dd995175 New time handling in song 2015-10-30 16:48:33 +01:00
kennyboy55 e6d4eacd1c Fix seeking after SOMEONE broke it :p 2015-10-30 15:14:32 +01:00
Janco Kock 8c988dd475 Added fancy notification popup to taskbar 2015-10-30 11:46:42 +01:00
kennyboy55 5ad0fd72c2 Fixed trackbar jumping while seeking. 2015-10-30 11:21:12 +01:00
kennyboy55 c1f29f76c4 Merge remote-tracking branch 'origin/gui' into gui 2015-10-30 00:46:38 +01:00
kennyboy55 52903849f2 Timestamps. Attempt to fix seeking 2015-10-30 00:46:11 +01:00
kennyboy55 2d0b38e2d1 Display timestamps 2015-10-30 00:45:57 +01:00
kennyboy55 35097e88b9 Show timestamp. Play selected song with play button 2015-10-30 00:45:35 +01:00
Janco Kock 6090937072 Audio stops before playing another one 2015-10-30 00:25:27 +01:00
kennyboy55 23452531f9 Merge remote-tracking branch 'origin/gui' into gui 2015-10-30 00:18:12 +01:00
kennyboy55 1c8bde4f1e Semi-fix/add seeking. Still a problem when seeking further than ~20% of song. 2015-10-30 00:17:21 +01:00
Janco Kock 76f5753a6e Finally dubble click on a song plays a song 2015-10-30 00:16:45 +01:00
kennyboy55 c2afd44654 Merge remote-tracking branch 'origin/gui' into gui
Conflicts:
	MusicPlayer/MusicPlayer/MainForm.Designer.cs
	MusicPlayer/MusicPlayer/MainForm.cs
2015-10-29 23:45:57 +01:00
kennyboy55 4f5aaee125 Added visuals for buffering and position 2015-10-29 23:43:42 +01:00
Yorick Rommers da378f5fbf Implemented GetAllSongs 2015-10-29 23:24:40 +01:00
Janco Kock 2ddbe6e9c8 Merge refs/heads/developer into refs/heads/gui 2015-10-29 23:01:35 +01:00
Janco Kock 85028d04a9 Load data from server into views 2015-10-29 22:57:35 +01:00
kennyboy55 1f2983d712 Better Audio Handling 2015-10-29 22:48:54 +01:00
kennyboy55 615934557c Added more audio handling 2015-10-29 22:27:12 +01:00
50 changed files with 7251 additions and 599 deletions
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
+170 -19
View File
@@ -5,23 +5,43 @@ using System.Text;
using System.Threading.Tasks;
using MusicPlayer;
using Newtonsoft.Json.Linq;
using System.IO;
using System.Drawing;
namespace MusicPlayer
{
public class APIHandler
{
private NetworkHandler nw;
public Image defaultCover;
public APIHandler(NetworkHandler nw)
{
this.nw = nw;
defaultCover = MusicPlayer.Resource.default_cover;
}
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)
{
JObject o = nw.SendString("getsongbyid?id=" + id);
if (o["result"].ToString() == "OK") {
return o["songurl"].ToString();
if (o != null)
{
if (o["result"].ToString() == "OK")
{
return o["songurl"].ToString();
}
}
return o["errormsg"].ToString();
}
@@ -46,16 +66,110 @@ namespace MusicPlayer
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()
{
List<Song> allsongslist = new List<Song>();
JObject o = nw.SendString("getallsongs?");
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<Song> GetSongsByArgs(string args)
{
List<Song> songslist = new List<Song>();
JObject o = nw.SendString("getsongs?"+args);
if (o["result"].ToString() == "OK")
if (o != null)
{
dynamic songs = o["songs"];
for (int i = 0; i < songs.Count; i++)
if (o["result"].ToString() == "OK")
{
songslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), this));
dynamic songs = o["songs"];
for (int i = 0; i < songs.Count; i++)
{
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));
}
}
}
return songslist;
@@ -65,26 +179,43 @@ namespace MusicPlayer
{
List<Artist> artistlist = new List<Artist>();
JObject o = nw.SendString("getartists?id=hallo");
if (o["result"].ToString() == "OK")
JObject o = nw.SendString("getartists?");
if (o != null)
{
for (int i = 0; i < o["artists"].Count(); i++) {
artistlist.Add(new Artist(o["artists"][i][0].ToString()));
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 Image getAlbumCover(string album)
{
MemoryStream stream = nw.downloadArtwork(album + ".jpg");
if(stream != null)
{
return Image.FromStream(stream);
}
return defaultCover;
}
public List<Album> GetAlbums()
{
List<Album> albumlist = new List<Album>();
JObject o = nw.SendString("getalbums?id=hallo");
if (o["result"].ToString() == "OK")
JObject o = nw.SendString("getalbums?");
if (o != null)
{
for (int i = 0; i < o["albums"].Count(); i++)
if (o["result"].ToString() == "OK")
{
albumlist.Add(new Album(o["albums"][i][0].ToString()));
for (int i = 0; i < o["albums"].Count(); i++)
{
albumlist.Add(new Album(o["albums"][i][0].ToString()));
}
}
}
@@ -94,15 +225,35 @@ namespace MusicPlayer
public List<Year> GetYears()
{
List<Year> yearlist = new List<Year> ();
JObject o = nw.SendString("getyears?id=hallo");
if (o["result"].ToString() == "OK")
JObject o = nw.SendString("getyears?");
if (o != null)
{
for (int i = 0; i < o["years"].Count(); i++)
if (o["result"].ToString() == "OK")
{
yearlist.Add(new Year(o["years"][i][0].ToString()));
for (int i = 0; i < o["years"].Count(); i++)
{
yearlist.Add(new Year(o["years"][i][0].ToString()));
}
}
}
return yearlist;
}
public List<Genre> GetGenres()
{
List<Genre> genreslist = new List<Genre>();
JObject o = nw.SendString("getgenres?");
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;
}
}
}
+177
View File
@@ -0,0 +1,177 @@
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;
}
}
+38
View File
@@ -0,0 +1,38 @@
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
+4 -1
View File
@@ -1,4 +1,7 @@
namespace MusicPlayer
using System.Drawing;
namespace MusicPlayer
{
public class Album
{
View File
View File
+267 -39
View File
@@ -12,47 +12,275 @@ namespace MusicPlayer
{
public class AudioHandler
{
public static Stream ms = new MemoryStream();
public enum AudioState { PLAYING, WAITING, STOPPED, PAUSED, SEEKING }
public enum BufferState { EMPTY, BUFFERING, DONE }
public AudioState AState { get; set; }
public BufferState BState { get; set; }
public static void PlayMp3FromUrl(string url)
public int Buffered { get
{
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 bufpos = 0;
public int Position { get { return Math.Min((int)((playpos / (double)Length) * 1000), 1000); } }
private long Length { get; set; }
private long playpos = 0;
public float Volume { get; set; }
public int CurrentTime { get; set; }
public int TotalTime { get { return CurrentSong != null ? CurrentSong.Seconds : 0; } }
private long seek = 0;
private MemoryStream ms;
private Thread network;
private Thread audio;
public Song CurrentSong;
private Main main;
public AudioHandler(Main main)
{
new Thread(delegate (object o)
{
var response = WebRequest.Create(url).GetResponse();
using (var stream = response.GetResponseStream())
{
byte[] buffer = new byte[65536]; // 64KB chunks
int read;
while ((read = stream.Read(buffer, 0, buffer.Length)) > 0)
{
var pos = ms.Position;
ms.Position = ms.Length;
ms.Write(buffer, 0, read);
ms.Position = pos;
}
}
}).Start();
new Thread(delegate (object o)
{
// Pre-buffering some data to allow NAudio to start playing
while (ms.Length < 65536 * 10)
Thread.Sleep(1000);
ms.Position = 0;
using (WaveStream blockAlignedStream = new BlockAlignReductionStream(WaveFormatConversionStream.CreatePcmStream(new Mp3FileReader(ms))))
{
using (WaveOut waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback()))
{
waveOut.Init(blockAlignedStream);
waveOut.Play();
while (waveOut.PlaybackState == PlaybackState.Playing)
{
System.Threading.Thread.Sleep(100);
}
}
}
}).Start();
this.main = main;
Volume = 1.0f;
CreateThreads();
}
private void CreateThreads()
{
AState = AudioState.STOPPED;
BState = BufferState.EMPTY;
CurrentSong = null;
Thread.Sleep(10);
ms = new MemoryStream();
network = new Thread(LoadAudio);
audio = new Thread(PlayAudio);
network.IsBackground = true;
audio.IsBackground = true;
Length = 1;
LengthBuffer = 1;
bufpos = 0;
playpos = 0;
CurrentTime = 0;
}
public void Play(Song s)
{
if (CurrentSong == s && AState == AudioState.PAUSED)
AState = AudioState.PLAYING;
else
{
Stop();
CurrentSong = s;
network.Start(s);
audio.Start();
}
}
public void Seek(int position)
{
if (position >= Buffered-1)
return;
seek = Length / 1000 * position;
AState = AudioState.SEEKING;
}
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()
{
CreateThreads();
}
public void Pause()
{
if(CurrentSong == null)
AState = AudioState.STOPPED;
else
AState = AudioState.PAUSED;
}
private void StreamFromMP3(Stream s, long pos, bool firstrun)
{
long position = 0;
ms.Position = position;
Mp3FileReader mp3fr = null;
try
{
mp3fr = new Mp3FileReader(ms);
}
catch(Exception e)
{
AState = AudioState.STOPPED;
//main.form.SongFinished();
return;
}
using (WaveStream blockAlignedStream = new BlockAlignReductionStream(WaveFormatConversionStream.CreatePcmStream(mp3fr)))
{
blockAlignedStream.Position = pos;
using (WaveOut waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback()))
{
waveOut.Init(blockAlignedStream);
waveOut.Volume = Volume;
waveOut.Play();
if (CurrentSong == null || CurrentSong.Seconds == 0)
Length = ms.Length;
else
Length = CurrentSong.Seconds * waveOut.OutputWaveFormat.AverageBytesPerSecond;
CurrentTime = (int)(ms.Position / waveOut.OutputWaveFormat.AverageBytesPerSecond);
while (waveOut.PlaybackState != PlaybackState.Stopped)
{
System.Threading.Thread.Sleep(10);
waveOut.Volume = Volume;
if (AState == AudioState.PLAYING && waveOut.PlaybackState == PlaybackState.Paused)
{
blockAlignedStream.Position = position;
waveOut.Play();
}
if (AState == AudioState.PAUSED && waveOut.PlaybackState == PlaybackState.Playing)
{
position = blockAlignedStream.Position;
waveOut.Pause();
}
if (AState == AudioState.SEEKING)
{
blockAlignedStream.Seek(seek - (seek % blockAlignedStream.WaveFormat.BlockAlign), SeekOrigin.Begin);
AState = AudioState.PLAYING;
waveOut.Play();
}
if (AState == AudioState.STOPPED)
{
waveOut.Stop();
}
if (BState == BufferState.DONE && firstrun )
{
if( ! (CurrentSong is RadioStation))
{
position = mp3fr.Position;
mp3fr.Close();
StreamFromMP3(ms, position, false);
break;
}
else
{
BState = BufferState.EMPTY;
AState = AudioState.STOPPED;
}
}
playpos = blockAlignedStream.Position;
CurrentTime = (int)(playpos / waveOut.OutputWaveFormat.AverageBytesPerSecond);
}
if(AState == AudioState.PLAYING && !firstrun)
main.form.SongFinished();
AState = AudioState.STOPPED;
playpos = 0;
CurrentTime = 0;
}
}
}
private void PlayAudio()
{
AState = AudioState.WAITING;
int buffertime = 0;
if (CurrentSong is RadioStation)
buffertime = 32768 * 10;
else
buffertime = 65536 * 10;
while (ms.Length < buffertime && BState != BufferState.DONE)
Thread.Sleep(1000);
AState = AudioState.PLAYING;
StreamFromMP3(ms,0, true);
}
private void LoadAudio(object o)
{
Song s = (Song) o;
WebResponse response = null;
try
{
response = WebRequest.Create(s.Url).GetResponse();
}
catch(Exception e)
{
BState = BufferState.EMPTY;
AState = AudioState.STOPPED;
main.form.SongFinished();
return;
}
BState = BufferState.EMPTY;
LengthBuffer = response.ContentLength;
using (var stream = response.GetResponseStream())
{
byte[] buffer = new byte[65536]; // 64KB chunks
int read;
BState = BufferState.BUFFERING;
AState = AudioState.WAITING;
while ((read = stream.Read(buffer, 0, buffer.Length)) > 0 && AState != AudioState.STOPPED)
{
var pos = ms.Position;
ms.Position = ms.Length;
ms.Write(buffer, 0, read);
ms.Position = pos;
this.bufpos = ms.Length;
}
}
BState = BufferState.DONE;
}
}
}
+109
View File
@@ -0,0 +1,109 @@
<?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>
Generated Regular → Executable
View File
@@ -0,0 +1,48 @@
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
}
}
@@ -0,0 +1,39 @@
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
}
}
@@ -0,0 +1,48 @@
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
}
}
@@ -0,0 +1,48 @@
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
}
}
View File
+11
View File
@@ -0,0 +1,11 @@
namespace MusicPlayer
{
public class Genre
{
public string name { get; set; }
public Genre(string name)
{
this.name = name;
}
}
}
+250 -14
View File
@@ -1,8 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json.Linq;
namespace MusicPlayer
{
@@ -11,41 +14,274 @@ namespace MusicPlayer
public APIHandler api;
public MainForm form;
public NetworkHandler nw;
public PlaylistHandler pl;
public AudioHandler audio;
public SongsTable table;
private SongsTable table;
private List<string> genres;
private List<string> artists;
public Main(NetworkHandler nw, APIHandler api, MainForm form)
public List<Song> currentPlayingList;
public Main(NetworkHandler nw, APIHandler api, MainForm form, PlaylistHandler pl)
{
this.nw = nw;
this.api = api;
this.form = form;
form.main = this;
pl.main = this;
pl.Populate();
this.pl = pl;
audio = new AudioHandler();
audio = new AudioHandler(this);
table = new SongsTable();
form.SongsTableView.DataSource = table;
form.SongsTableView.Columns[5].Visible = false;
genres = new List<string>();
artists = new List<string>();
currentPlayingList = new List<Song>();
}
public void Init()
{
Populate();
}
public void SwitchServer(string server)
{
Clear();
nw.ip = server;
Populate();
}
private void Clear()
{
form.GenreListBox.Items.Clear();
form.ArtistListBox.Items.Clear();
form.AlbumListView.Items.Clear();
form.PlaylistBox.Items.Clear();
table.Clear();
genres = new List<string>();
artists = new List<string>();
currentPlayingList = new List<Song>();
}
private void Populate()
{
table.Add(new Song("102", "Test Song 1", "Test Album 1", "Test Artist 1", api));
this.api.GetAlbums().ForEach(a => { form.AlbumListView.Items.Add(a.albumnaam);});
this.api.GetArtists().ForEach(a => { artists.Add(a.naam); form.ArtistListBox.Items.Add(a.naam); });
this.api.GetGenres().ForEach(g => { genres.Add(g.name); form.GenreListBox.Items.Add(g.name); });
this.pl.GetPlaylists().ForEach(p => form.PlaylistBox.Items.Add(p.name));
BackgroundWorker bw = new BackgroundWorker();
bw.DoWork += new DoWorkEventHandler(
delegate (object o, DoWorkEventArgs args)
{
BackgroundWorker b = o as BackgroundWorker;
ImageList imagelist = new ImageList();
List<string> templist = new List<string>();
Action action = () =>
{
foreach (ListViewItem item in form.AlbumListView.Items)
{
templist.Add(item.Text);
}
};
form.Invoke(action);
form.GenreListBox.Items.Add("Hardcore");
form.GenreListBox.Items.Add("Hardstyle");
form.GenreListBox.Items.Add("Pop");
foreach (string item in templist)
{
imagelist.Images.Add(item, api.getAlbumCover(item));
}
form.ArtistListBox.Items.Add("Kygo");
form.ArtistListBox.Items.Add("Monstercat");
form.ArtistListBox.Items.Add("Mozart");
action = () => {
imagelist.ImageSize = new System.Drawing.Size(64,64);
imagelist.ColorDepth = ColorDepth.Depth32Bit;
form.AlbumListView.View = View.LargeIcon;
form.AlbumListView.LargeImageList = imagelist;
foreach (ListViewItem item in form.AlbumListView.Items)
{
item.ImageKey = item.Text;
}
};
form.Invoke(action);
});
bw.RunWorkerAsync();
}
form.AlbumListView.Items.Add("Album 1");
form.AlbumListView.Items.Add("Album 2");
form.AlbumListView.Items.Add("Album 3");
public void Repopulate()
{
form.AlbumListView.Items.Clear();
form.ArtistListBox.Items.Clear();
form.GenreListBox.Items.Clear();
form.PlaylistBox.Items.Clear();
table.Add(new Song("104", "Test Song 2", "Test Album 2", "Test Artist 2", api));
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.GetGenres().ForEach(g => form.GenreListBox.Items.Add(g.name));
this.pl.GetPlaylists().ForEach(p => form.PlaylistBox.Items.Add(p.name));
}
public void ArtistFilter(string artist)
{
table.Clear();
api.GetSongsByArtist(artist).ForEach(s =>
{
table.Add(s);
});
}
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()
{
table.Clear();
currentPlayingList.ForEach(s =>
{
table.Add(s);
});
form.GenreListBox.ClearSelected();
form.ArtistListBox.ClearSelected();
form.PlaylistBox.ClearSelected();
form.AlbumListView.SelectedIndices.Clear();
}
public void SearchArtist(string search)
{
form.ArtistListBox.Items.Clear();
if (search.Length > 1)
{
string sPattern = search;
foreach (string s in artists)
{
if (System.Text.RegularExpressions.Regex.IsMatch(s, sPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
{
form.ArtistListBox.Items.Add(s);
}
}
}
else
{
artists.ForEach(a => form.ArtistListBox.Items.Add(a));
}
}
public void SearchGenre(string search)
{
form.GenreListBox.Items.Clear();
if (search.Length > 1)
{
string sPattern = search;
foreach (string s in genres)
{
if (System.Text.RegularExpressions.Regex.IsMatch(s, sPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
{
form.GenreListBox.Items.Add(s);
}
}
}
else
{
genres.ForEach(g => form.GenreListBox.Items.Add(g));
}
}
public void GenreFilter(string genre)
{
table.Clear();
api.GetSongsByGenre(genre).ForEach(s =>
{
table.Add(s);
});
}
public void PlaylistFilter(string name)
{
table.Clear();
pl.GetPlaylistByName(name).GetSongs().ForEach(s => table.Add(s));
}
public void AlbumFilter(string album)
{
table.Clear();
api.GetSongsByAlbum(album).ForEach(s =>
{
table.Add(s);
});
}
public static string SecondsToTimestamp(int seconds)
{
string str = "";
//Hours
str += (seconds / 3600).ToString("D2") + ":";
seconds %= 3600;
//Minutes
str += (seconds / 60).ToString("D2") + ":";
seconds %= 60;
//Seconds
str += seconds.ToString("D2");
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;
}
}
}
File diff suppressed because it is too large Load Diff
+695 -4
View File
@@ -3,10 +3,12 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -17,6 +19,14 @@ namespace MusicPlayer
{
public partial class MainForm : Form
{
bool songFinished;
bool draggedstarted = false;
bool draggedcompleted = false;
int startx = 0;
int starty = 0;
bool showed;
public Main main
{
get; set;
@@ -25,21 +35,702 @@ namespace MusicPlayer
public MainForm()
{
InitializeComponent();
PositionTrackBar.Scroll += (s, e) =>
{
this.PositionTrackBar_ValueChanged();
};
PositionTrackBar.MouseDown += (s, e) =>
{
clicked = true;
};
PositionTrackBar.MouseUp += (s, e) =>
{
if (!clicked)
return;
clicked = false;
this.PositionTrackBar_ValueChanged();
};
songFinished = false;
showed = false;
}
private void MainForm_Load(object sender, EventArgs e)
{
UpdateTimer.Start();
main.Init();
}
private void PlayButton_Click(object sender, EventArgs e)
{
AudioHandler.PlayMp3FromUrl("http://imegumii.nl/music/English/Monstercat/Direct%20-%20Eternity.mp3");
if (main.audio.AState == AudioHandler.AudioState.PAUSED)
main.audio.Play(main.audio.CurrentSong);
else
SongsTableView_CellDoubleClick(sender, new DataGridViewCellEventArgs(0, 0));
}
private void SongsTableView_SelectionChanged(object sender, EventArgs e)
private void PauseButton_Click(object sender, EventArgs e)
{
DataGridViewSelectedRowCollection col = SongsTableView.SelectedRows;
main.audio.Pause();
}
private void StopButton_Click(object sender, EventArgs e)
{
main.audio.Stop();
}
public void SongFinished()
{
songFinished = true;
}
private void UpdateTimer_Tick(object sender, EventArgs e)
{
//Trackbar
if (main.audio.BState == AudioHandler.BufferState.DONE)
PositionTrackBar.Enabled = true;
else
PositionTrackBar.Enabled = false;
if (!clicked)
PositionTrackBar.Value = Math.Max(main.audio.Position, 0);
//Buffer display
if(main.audio.Buffered / 10 >= BufferBar.Minimum && main.audio.Buffered / 10 <= BufferBar.Maximum)
BufferBar.Value = main.audio.Buffered / 10;
//Time labels
if (!clicked)
LabelCurrentTime.Text = Main.SecondsToTimestamp(main.audio.CurrentTime);
LabelTotalTime.Text = Main.SecondsToTimestamp(main.audio.TotalTime);
//Current song label
if (main.audio.CurrentSong == null)
CurrentSongLabel.Text = "Not playing any songs";
else
{
if (main.audio.CurrentSong.Seconds < 1)
PositionTrackBar.Enabled = false;
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
if (main.audio.AState == AudioHandler.AudioState.PLAYING)
{
PlayButton.Enabled = false;
NotifyMenuStripPlayButton.Enabled = false;
NotifyMenuStripPlayingLabel.Text = "Playing";
NotifyMenuStripPlayingLabel.Enabled = true;
NotifyMenuStripPlayingSongLabel.Visible = true;
NotifyMenuStripPlayingSongLabel.Text = main.audio.CurrentSong.Name;
}
else
{
PlayButton.Enabled = true;
NotifyMenuStripPlayButton.Enabled = true;
NotifyMenuStripPlayingSongLabel.Visible = false;
}
if (main.nw.ip == "http://jancokock.me")
SelectServerJancoButton.Enabled = false;
else
SelectServerJancoButton.Enabled = true;
if (main.nw.ip == "http://imegumii.nl")
SelectServerYorickButton.Enabled = false;
else
SelectServerYorickButton.Enabled = true;
if (SearchSongsTextBox.Text.Length == 0)
SearchSongsButton.Enabled = false;
else
SearchSongsButton.Enabled = true;
if (main.audio.AState == AudioHandler.AudioState.PAUSED)
{
PauseButton.Enabled = false;
NotifyMenuStripPauseButton.Enabled = false;
NotifyMenuStripPlayingLabel.Text = "Paused";
NotifyMenuStripPlayingLabel.Enabled = true;
NotifyMenuStripPlayingSongLabel.Visible = true;
NotifyMenuStripPlayingSongLabel.Text = main.audio.CurrentSong.Name;
}
else
{
PauseButton.Enabled = true;
NotifyMenuStripPauseButton.Enabled = true;
}
if (main.audio.AState == AudioHandler.AudioState.STOPPED)
{
StopButton.Enabled = false;
NotifyMenuStripStopButton.Enabled = false;
NotifyMenuStripPlayingLabel.Text = "Stopped";
NotifyMenuStripPlayingLabel.Enabled = false;
NotifyMenuStripPlayingSongLabel.Visible = false;
NotifyMenuStripPlayingSongLabel.Text = "Stopped";
}
else
{
StopButton.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)
{
ShuffleSongButton.Enabled = true;
}
else
{
ShuffleSongButton.Enabled = false;
ShuffleSongButton.Checked = false;
}
if (main.currentPlayingList.Count <= 1)
{
PreviousButton.Enabled = false;
NextButton.Enabled = false;
NotifyMenuStripPreviousButton.Enabled = false;
NotifyMenuStripNextButton.Enabled = false;
}
else
{
if (main.audio.CurrentSong is RadioStation)
{
main.currentPlayingList.Clear();
}
else
{
NextButton.Enabled = true;
NotifyMenuStripNextButton.Enabled = true;
if (ShuffleSongButton.Checked)
{
PreviousButton.Enabled = false;
NotifyMenuStripPreviousButton.Enabled = false;
}
else
{
PreviousButton.Enabled = true;
NotifyMenuStripPreviousButton.Enabled = true;
}
}
}
if (songFinished)
{
if (! (main.audio.CurrentSong is RadioStation) )
{
Thread.Sleep(20);
if (PlayNextSongButton.Checked)
{
NextButton_Click(this, new EventArgs());
}
else if (LoopSongButton.Checked)
{
main.audio.Play(main.audio.CurrentSong);
}
}
songFinished = false;
}
}
private void GenreListBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (GenreListBox.SelectedItems.Count != 0)
{
main.GenreFilter(GenreListBox.SelectedItems[0].ToString());
ArtistListBox.ClearSelected();
PlaylistBox.ClearSelected();
AlbumListView.SelectedIndices.Clear();
}
}
private void PlaylistBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (PlaylistBox.SelectedItems.Count != 0)
{
main.PlaylistFilter(PlaylistBox.SelectedItems[0].ToString());
GenreListBox.ClearSelected();
ArtistListBox.ClearSelected();
AlbumListView.SelectedIndices.Clear();
}
}
private void ArtistListBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (ArtistListBox.SelectedItems.Count != 0)
{
main.ArtistFilter(ArtistListBox.SelectedItems[0].ToString());
GenreListBox.ClearSelected();
PlaylistBox.ClearSelected();
AlbumListView.SelectedIndices.Clear();
}
}
private void AlbumListView_SelectedIndexChanged(object sender, EventArgs e)
{
if (AlbumListView.SelectedItems.Count != 0)
{
main.AlbumFilter(AlbumListView.SelectedItems[0].Text);
PlaylistBox.ClearSelected();
ArtistListBox.ClearSelected();
GenreListBox.ClearSelected();
}
}
private void SongsTableView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex != -1)
{
SongsTable s = new SongsTable();
if (SongsTableView.SelectedRows.Count > 0)
{
main.currentPlayingList = main.table.AsEnumerable().Select(x => x[5] as Song).ToList();
var drv = SongsTableView.SelectedRows[0].DataBoundItem as DataRowView;
var row = drv.Row as DataRow;
s.ImportRow(row);
main.audio.Play((s.Rows[0][5] as Song));
}
}
}
private void PositionTrackBar_ValueChanged()
{
if (!clicked)
main.audio.Seek(PositionTrackBar.Value);
if(main.audio.CurrentSong != null)
LabelCurrentTime.Text = Main.SecondsToTimestamp((int)(((double)PositionTrackBar.Value / 1000) * main.audio.CurrentSong.Seconds));
}
private void overviewToolStripMenuItem_Click(object sender, EventArgs e)
{
this.PlaylistBox.Visible = false;
this.GenreListBox.Visible = true;
this.ArtistListBox.Visible = true;
this.AlbumListView.Visible = true;
this.GenreListLabel.Visible = true;
this.AlbumListLabel.Visible = true;
this.ArtistListLabel.Visible = true;
this.PlaylistListLabel.Visible = false;
}
private void playlistsToolStripMenuItem_Click(object sender, EventArgs e)
{
this.PlaylistBox.Visible = true;
this.GenreListBox.Visible = false;
this.ArtistListBox.Visible = false;
this.AlbumListView.Visible = false;
this.GenreListLabel.Visible = false;
this.AlbumListLabel.Visible = false;
this.ArtistListLabel.Visible = false;
this.PlaylistListLabel.Visible = true;
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
ExitProgram();
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
ExitProgram();
}
private void ExitProgram()
{
main.audio.AState = AudioHandler.AudioState.STOPPED;
NotifyIcon.Visible = false;
NotifyIcon.Icon = null;
System.Windows.Forms.Application.Exit();
}
private void NotifyMenuStripPlayButton_Click(object sender, EventArgs e)
{
PlayButton_Click(sender, e);
}
private void NotifyMenuStripPauseButton_Click(object sender, EventArgs e)
{
PauseButton_Click(sender, e);
}
private void NotifyMenuStripStopButton_Click(object sender, EventArgs e)
{
StopButton_Click(sender, e);
}
private void makeToolStripMenuItem_Click(object sender, EventArgs e)
{
PlaylistMaker p = new PlaylistMaker(main.pl, main.api);
p.ShowDialog();
main.Repopulate();
}
private void SearchArtistsTextBox_KeyUp(object sender, KeyEventArgs e)
{
main.SearchArtist(SearchArtistsTextBox.Text);
if (SearchArtistsTextBox.Text.Length < 1)
ClearArtistSearchButton.Enabled = false;
else
ClearArtistSearchButton.Enabled = true;
}
private void SearchGenresTextBox_KeyUp(object sender, KeyEventArgs e)
{
main.SearchGenre(SearchGenresTextBox.Text);
if (SearchGenresTextBox.Text.Length < 1)
ClearGenreSearchButton.Enabled = false;
else
ClearGenreSearchButton.Enabled = true;
}
private void ClearArtistSearchButton_Click(object sender, EventArgs e)
{
main.SearchArtist("");
SearchArtistsTextBox.Text = "";
ClearArtistSearchButton.Enabled = false;
}
private void ClearGenreSearchButton_Click(object sender, EventArgs e)
{
main.SearchGenre("");
SearchGenresTextBox.Text = "";
ClearGenreSearchButton.Enabled = false;
}
private void PositionTrackBar_MouseDown(object sender, MouseEventArgs e)
{
clicked = true;
double dblValue;
//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);
}
private void PreviousButton_Click(object sender, EventArgs e)
{
int selected = 0;
selected = main.currentPlayingList.IndexOf(main.audio.CurrentSong) - 1;
if (selected < 0)
{
if (LoopSongButton.Checked)
selected = main.currentPlayingList.Count-1;
}
main.FilterCurrentPlaying();
SongsTableView.CurrentCell = SongsTableView.Rows[selected].Cells[0];
main.audio.Play(main.currentPlayingList[selected]);
}
private void NextButton_Click(object sender, EventArgs e)
{
int selected = 0;
if (ShuffleSongButton.Checked)
{
Random r = new Random();
selected = r.Next(0, main.currentPlayingList.Count);
while (selected == main.currentPlayingList.IndexOf(main.audio.CurrentSong) && main.currentPlayingList.Count > 1)
selected = r.Next(0, main.currentPlayingList.Count);
}
else
selected = main.currentPlayingList.IndexOf(main.audio.CurrentSong) + 1;
if (selected >= main.currentPlayingList.Count)
{
if (LoopSongButton.Checked)
selected = 0;
else
{
songFinished = false;
return;
}
}
main.FilterCurrentPlaying();
SongsTableView.CurrentCell = SongsTableView.Rows[selected].Cells[0];
main.audio.Play(main.currentPlayingList[selected]);
}
private void NotifyMenuStripNextButton_Click(object sender, EventArgs e)
{
NextButton_Click(sender, e);
}
private void NotifyMenuStripPreviousButton_Click(object sender, EventArgs e)
{
PreviousButton_Click(sender, e);
}
private void ViewCurrentPlaylistButton_Click(object sender, EventArgs e)
{
main.FilterCurrentPlaying();
int selected = main.currentPlayingList.IndexOf(main.audio.CurrentSong);
if(main.currentPlayingList.Count >= 1 && selected >= 0)
SongsTableView.CurrentCell = SongsTableView.Rows[selected].Cells[0];
}
private void SongsTableView_MouseDown(object sender, MouseEventArgs e)
{
draggedstarted = true;
draggedcompleted = false;
startx = e.X;
starty = e.Y;
}
private void SongsTableView_MouseUp(object sender, MouseEventArgs e)
{
if (draggedcompleted)
{
Cursor.Current = Cursors.Default;
Point point = PlaylistBox.PointToClient(Cursor.Position);
Point point2 = AddToQueueLabel.PointToClient(Cursor.Position);
bool queue = AddToQueueLabel.ClientRectangle.Contains(point2);
int index = PlaylistBox.IndexFromPoint(point);
if (index < 0 && !queue) //nope, niet op een playlist gesleept
{
draggedstarted = false;
draggedcompleted = false;
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());
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);
currentPlaylist.AddSong((s.Rows[0][5] as Song));
currentPlaylist.WriteToFile();
}
}
AddToQueueLabel.Visible = false;
}
draggedcompleted = false;
draggedstarted = false;
}
private void SongsTableView_MouseMove(object sender, MouseEventArgs e)
{
int deltax = Math.Abs(startx - e.X);
int deltay = Math.Abs(starty - e.Y);
if ((deltax > 5 || deltay > 5) && draggedstarted && !draggedcompleted)
{
draggedcompleted = true;
playlistsToolStripMenuItem_Click(this, new EventArgs());
AddToQueueLabel.Visible = true;
Cursor.Current = Cursors.Hand;
}
}
private void SelectServerJancoButton_Click(object sender, EventArgs e)
{
main.SwitchServer("http://jancokock.me");
}
private void SelectServerYorickButton_Click(object sender, EventArgs e)
{
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();
}
}
}
File diff suppressed because it is too large Load Diff
+39 -5
View File
@@ -33,6 +33,14 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AntiXssLibrary, Version=4.3.0.0, Culture=neutral, PublicKeyToken=d127efab8a9c114f, processorArchitecture=MSIL">
<HintPath>..\packages\AntiXSS.4.3.0\lib\net40\AntiXssLibrary.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="HtmlSanitizationLibrary, Version=4.3.0.0, Culture=neutral, PublicKeyToken=d127efab8a9c114f, processorArchitecture=MSIL">
<HintPath>..\packages\AntiXSS.4.3.0\lib\net40\HtmlSanitizationLibrary.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
@@ -55,6 +63,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AudioHandler.cs" />
<Compile Include="Genre.cs" />
<Compile Include="Main.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
@@ -66,14 +75,28 @@
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="NetworkHandler.cs" />
<Compile Include="NotificationPopup.cs">
<Compile Include="Playlist.cs" />
<Compile Include="PlaylistHandler.cs" />
<Compile Include="AdvancedSearch.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="NotificationPopup.Designer.cs">
<DependentUpon>NotificationPopup.cs</DependentUpon>
<Compile Include="AdvancedSearch.Designer.cs">
<DependentUpon>AdvancedSearch.cs</DependentUpon>
</Compile>
<Compile Include="PlaylistMaker.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PlaylistMaker.Designer.cs">
<DependentUpon>PlaylistMaker.cs</DependentUpon>
</Compile>
<Compile Include="Program.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="SongsTable.cs">
<SubType>Component</SubType>
@@ -82,8 +105,11 @@
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="NotificationPopup.resx">
<DependentUpon>NotificationPopup.cs</DependentUpon>
<EmbeddedResource Include="AdvancedSearch.resx">
<DependentUpon>AdvancedSearch.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PlaylistMaker.resx">
<DependentUpon>PlaylistMaker.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
@@ -94,6 +120,11 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="Resource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="ClassDiagram1.cd" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -108,6 +139,9 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\default-cover.png" />
</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.
@@ -0,0 +1,99 @@
<?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>
+79 -18
View File
@@ -2,8 +2,10 @@
using System.Text;
using System.Net.Sockets;
using System.Threading;
using System.Web;
using System.Net;
using System.IO;
using Microsoft.Security.Application;
using Newtonsoft.Json.Linq;
@@ -12,7 +14,7 @@ namespace MusicPlayer
public class NetworkHandler
{
private int port = 8585;
private string ip;
public string ip { get; set; }
public NetworkHandler(string ip)
{
@@ -21,25 +23,84 @@ namespace MusicPlayer
public JObject SendString(string m)
{
HttpWebRequest server = (HttpWebRequest)WebRequest.Create(ip+":"+port+"/"+m);
string encodedstring = Microsoft.Security.Application.Encoder.HtmlEncode(m);
HttpWebRequest server = (HttpWebRequest)WebRequest.Create(ip+":"+port+"/"+encodedstring);
server.ReadWriteTimeout = 500;
server.KeepAlive = false;
HttpWebResponse respond = (HttpWebResponse)server.GetResponse();
Stream streamResponse = respond.GetResponseStream();
StreamReader streamRead = new StreamReader(streamResponse);
Char[] readBuff = new Char[256];
int count = streamRead.Read(readBuff, 0, 256);
string data = "";
while (count > 0)
{
String outputData = new String(readBuff, 0, count);
data +=outputData;
count = streamRead.Read(readBuff, 0, 256);
try {
HttpWebResponse respond = (HttpWebResponse)server.GetResponse();
Stream streamResponse = respond.GetResponseStream();
streamResponse.ReadTimeout = 500;
StreamReader streamRead = new StreamReader(streamResponse);
Char[] readBuff = new Char[256];
int count = streamRead.Read(readBuff, 0, 256);
string data = "";
while (count > 0)
{
String outputData = new String(readBuff, 0, count);
data += outputData;
count = streamRead.Read(readBuff, 0, 256);
}
JObject o = JObject.Parse(data);
respond.Close();
streamResponse.Close();
streamRead.Close();
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)
{
try
{
string encodedstring = Microsoft.Security.Application.Encoder.HtmlEncode(ip + "/music/.artwork/" + album);
WebRequest req = WebRequest.Create(encodedstring);
req.Timeout = 500;
//WebRequest req = WebRequest.Create((ip + "/music/.artwork/" + album).Replace(" ","%20"));
WebResponse response = req.GetResponse();
Stream stream = response.GetResponseStream();
stream.ReadTimeout = 500;
//Download in chuncks
byte[] buffer = new byte[1024];
//Get Total Size
int dataLength = (int)response.ContentLength;
//Download to memory
MemoryStream memStream = new MemoryStream();
while (true)
{
//Try to read the data
int bytesRead = stream.Read(buffer, 0, buffer.Length);
if (bytesRead == 0)
{
break;
}
else
{
memStream.Write(buffer, 0, bytesRead);
}
}
//Clean up
stream.Close();
//Convert the downloaded stream to a byte array
return memStream;
}
catch (Exception)
{
return null;
}
JObject o = JObject.Parse(data);
respond.Close();
streamResponse.Close();
streamRead.Close();
return o;
}
}
}
-97
View File
@@ -1,97 +0,0 @@
namespace MusicPlayer
{
partial class NotificationPopup
{
/// <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(NotificationPopup));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.BackColor = System.Drawing.Color.White;
this.groupBox1.Controls.Add(this.pictureBox3);
this.groupBox1.Controls.Add(this.pictureBox2);
this.groupBox1.Controls.Add(this.pictureBox1);
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false;
//
// pictureBox1
//
resources.ApplyResources(this.pictureBox1, "pictureBox1");
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.TabStop = false;
//
// pictureBox2
//
resources.ApplyResources(this.pictureBox2, "pictureBox2");
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.TabStop = false;
//
// pictureBox3
//
resources.ApplyResources(this.pictureBox3, "pictureBox3");
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.TabStop = false;
//
// NotificationPopup
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ControlBox = false;
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "NotificationPopup";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox1;
}
}
@@ -1,20 +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.Tasks;
using System.Windows.Forms;
namespace MusicPlayer
{
public partial class NotificationPopup : Form
{
public NotificationPopup()
{
InitializeComponent();
}
}
}
@@ -1,276 +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.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="pictureBox3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQffCh0UITh4zTVoAAABr0lEQVRYR8WXQW7CMBRE
wxVY9AA9D0k4QXqCrqqqaqtKPQOVWHOgcgyWHIHCjPmmcRjiOInISE8B/+/xF9ixnaWoKJYVWINfsAcH
g5/Zxlhl6eMIhnOwAcdE2GduNmlCR/9cmdkQVnXPqJA4Aw9gB5RhH+hFz5kNo8UE8AiUyRjQWxeBAGGV
quOYcAwbtSEExvzZb7Gz4UIh0HfC/Ym2GG5iXoQGLjWVGONJtHXlf4niS/I6z/Pli/WV8Q5s3OCUCMZ4
ta5DCjh6A75eZcIN3lxHk4inUNGA728VVLzbuBeJnBTWNOAmooINyk8bM5DODWhbJVsacCdTwTpfNl4g
tLe/WqGGT5M9E7idqqDn6mdPkfCrc4gWkOflh3n1kvKs4QqI/gUo4tv8AiE2yl/QaRK2FCHza0QnYedl
qIpQeQm4ZZj0ImoWoXISOJ8fRaCVehEq3hWzcCY9NqNzESrWkWAz6rkdl8+6Pc5iUYQnZjTe80DyY8OG
QmDSIxmZ/FA63bHciwmAVd7/YuKFRP8c42rmJhyezjNZ6Nj7cnq11IYKpv56vgXN6znbEq/nWXYCplmG
3mQZHZoAAAAASUVORK5CYII=
</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="pictureBox3.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pictureBox3.Location" type="System.Drawing.Point, System.Drawing">
<value>75, 158</value>
</data>
<data name="pictureBox3.Size" type="System.Drawing.Size, System.Drawing">
<value>33, 32</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="pictureBox3.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="&gt;&gt;pictureBox3.Name" xml:space="preserve">
<value>pictureBox3</value>
</data>
<data name="&gt;&gt;pictureBox3.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBox3.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;pictureBox3.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="pictureBox2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQffCh0UIRU9EmkdAAABx0lEQVRYR81XS26DMBDl
EJGSdaXeoLkG0C7KtZIDZJWTdNlK6S2yzA2atu8NM9S4JnyMS5/0NMYzfjOAMXbWh6IotcX2YwUewHfw
Al6VbLOPvkrDGa+tCbDBsBvwCH6NJMdsqJHnPzcxCBhodqdiMdy7mr1gILgCz2BIcAqptSrLJ83SAQSR
dyDfa0gohtSEdkcRcNqdp0hupDZzaFZFnjfvfM7H3sVzndObmHDcmnCfgb4Y7jRt8+j5qYUCXd6Db15f
DNfNU8BF73deR0rsFpyjkKNKimgooEUNlSemloW8mn8KTYjLazDApQQ7QJ/ZmEIqCnD9DjlblGwBwGd2
SiEHDuRPJORsUbLcAGLMjinkxAH8k4WcLYr6ACDW7APYV8iFgYNWPlEdAYwxyyfyYjoer/+igFSvYMhc
kFew+CRc/DNcciF6NpGQs0UJBNA2G5NYKEIELpb7GaFBLvI7BqUGAS72jtNnug0JYRsDOP5sS1YUheRs
AAeZelP6Af7elBq4ZYYz1bacyamt2TqgRSQ5mICapQcWCDvH0UwmHKxoDoZzVuDnMvVwuq41vAk3Bu4B
AoJ2PD+B/vGcffTVyyuAtra6kGXfchVyMfY7IlMAAAAASUVORK5CYII=
</value>
</data>
<data name="pictureBox2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pictureBox2.Location" type="System.Drawing.Point, System.Drawing">
<value>114, 158</value>
</data>
<data name="pictureBox2.Size" type="System.Drawing.Size, System.Drawing">
<value>33, 32</value>
</data>
<data name="pictureBox2.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="&gt;&gt;pictureBox2.Name" xml:space="preserve">
<value>pictureBox2</value>
</data>
<data name="&gt;&gt;pictureBox2.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBox2.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;pictureBox2.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQffCh0UHx1yDPpSAAABo0lEQVRYR8WXTW7CMBCF
wxVY9AA9D4ScID1BV1VVFVSpZ6ASaw5Ej8GSI1D63nRME2si/8SQJ30ieMbPI7Bju0pRXTct2IFvcAJn
hc9sY6zV9DJaLOo5TPfgkgj7zNUmTejoPr/UbAzbrmdQSJyBB3AElmEO9KLnTIexxQTwCCyTEtDbLgIB
wiqtjiXhGDqqJwRK/uxDHHW4vhDImXA/RlsMMjGv0qVmJUawerbbg/wvUXzJWecC+y+Xq08rFmAvg1NG
MBq1yCpCOuKBr1czIQYxUWUU0bIAvr+tYBQ69lWJRexYADcRK0iCs1zH7SmhiAML4E5mBQX1HBRyzDdb
ZBEnGnA7tYKC+mUJRawtzw7nmxaA/u++n4cUcJO/AO0fXZ8B5C8oPgnxdtxYuQYyCYsuQ7SFfvYusgyL
vYjw/c2PB/g7PxqBaMQAwvOrHwuhXaXzyM2oebFiAXqb0YjtuHky2mLon5jRsPUSYihzIHFCYNIjGZn8
UDrdsdyJCYBV3v9i4oRE95kzMX3Srma+0PH+l9MhwdBdzw/Av56zLfF6XlW/G66G3g3Cfq0AAAAASUVO
RK5CYII=
</value>
</data>
<data name="pictureBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>153, 158</value>
</data>
<data name="pictureBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>33, 32</value>
</data>
<data name="pictureBox1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;pictureBox1.Name" xml:space="preserve">
<value>pictureBox1</value>
</data>
<data name="&gt;&gt;pictureBox1.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBox1.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;pictureBox1.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 12</value>
</data>
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>266, 196</value>
</data>
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;groupBox1.Name" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;groupBox1.Type" xml:space="preserve">
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;groupBox1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;groupBox1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>290, 220</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>NotificationPopup</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>NotificationPopup</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
+91
View File
@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace MusicPlayer
{
public class Playlist
{
public string name { get; }
private string basedir;
public List<Song> songs;
public string server;
private APIHandler api;
public Playlist(string name, string basedir, string server, APIHandler api)
{
this.songs = new List<Song>();
this.name = name;
this.api = api;
this.basedir = basedir;
this.server = server;
this.ReadFromFile();
}
public void AddSong(Song s)
{
this.songs.Add(s);
}
public List<Song> GetSongs()
{
return songs;
}
public void ReadFromFile()
{
try {
using (StreamReader str = new StreamReader(basedir + name + ".txt"))
{
server = str.ReadLine();
string readline;
while ((readline = str.ReadLine()) != null)
{
string[] songsvalues = readline.Split('|');
songs.Add(new Song(songsvalues[0], songsvalues[1], songsvalues[2], songsvalues[3], songsvalues[4], Int32.Parse(songsvalues[5]), api));
}
}
}
catch (FileNotFoundException)
{
FileStream fs = new FileStream(basedir + name + ".txt", FileMode.CreateNew);
fs.Close();
File.WriteAllText(basedir + name + ".txt", server);
ReadFromFile();
}
}
public void WriteToFile()
{
using (StreamWriter stw = new StreamWriter(basedir + name + ".txt"))
{
stw.WriteLine(server.ToString());
this.songs.ForEach(s =>
{
stw.WriteLine(s.ToString());
});
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);
}
}
}
@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace MusicPlayer
{
public class PlaylistHandler
{
private List<Playlist> playlists;
public Main main
{
get; set;
}
private readonly string basedir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\.mpplaylists\\";
public PlaylistHandler()
{
this.playlists = new List<Playlist>();
}
public void Populate()
{
playlists.Clear();
try {
Directory.GetFiles(basedir).ToList().ForEach(f =>
{
if (f.EndsWith(".txt"))
{
playlists.Add(new Playlist(Path.GetFileName(f.Replace(".txt","")) ,basedir, main.nw.ip, main.api));
}
});
}
catch (DirectoryNotFoundException)
{
Directory.CreateDirectory(basedir);
Populate();
}
}
public void MakeNewPlaylistByName(string name)
{
playlists.Add(new Playlist(name, basedir, main.nw.ip, main.api));
}
public Playlist GetPlaylistByName(string name)
{
Playlist toFind = null;
playlists.ForEach(p =>
{
if (p.name == name) { toFind = p; }
});
return toFind;
}
public List<Playlist> GetPlaylists()
{
List<Playlist> currentPlaylists = new List<Playlist>();
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);
}
}
}
}
+239
View File
@@ -0,0 +1,239 @@
using System.Windows.Forms;
namespace MusicPlayer
{
partial class PlaylistMaker
{
/// <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(PlaylistMaker));
this.PlaylistSelectBox = new System.Windows.Forms.ComboBox();
this.PlaylistSongSelector = new System.Windows.Forms.ListBox();
this.PlaylistAddSongsButton = new System.Windows.Forms.Button();
this.PlaylistSongContainer = new System.Windows.Forms.ListBox();
this.PlaylistNewButton = new System.Windows.Forms.Button();
this.PlaylistNewInputfield = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.FilterTextBox = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.DeletePlaylistButton = new System.Windows.Forms.Button();
this.DeleteSongsButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// PlaylistSelectBox
//
this.PlaylistSelectBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PlaylistSelectBox.FormattingEnabled = true;
this.PlaylistSelectBox.Location = new System.Drawing.Point(10, 96);
this.PlaylistSelectBox.Name = "PlaylistSelectBox";
this.PlaylistSelectBox.Size = new System.Drawing.Size(306, 21);
this.PlaylistSelectBox.TabIndex = 0;
this.PlaylistSelectBox.SelectedIndexChanged += new System.EventHandler(this.PlaylistSelectBox_SelectedIndexChanged);
//
// PlaylistSongSelector
//
this.PlaylistSongSelector.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PlaylistSongSelector.FormattingEnabled = true;
this.PlaylistSongSelector.Location = new System.Drawing.Point(11, 149);
this.PlaylistSongSelector.Name = "PlaylistSongSelector";
this.PlaylistSongSelector.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.PlaylistSongSelector.Size = new System.Drawing.Size(305, 108);
this.PlaylistSongSelector.TabIndex = 1;
//
// PlaylistAddSongsButton
//
this.PlaylistAddSongsButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PlaylistAddSongsButton.Location = new System.Drawing.Point(10, 263);
this.PlaylistAddSongsButton.Name = "PlaylistAddSongsButton";
this.PlaylistAddSongsButton.Size = new System.Drawing.Size(306, 23);
this.PlaylistAddSongsButton.TabIndex = 2;
this.PlaylistAddSongsButton.Text = "Add selected to playlist";
this.PlaylistAddSongsButton.UseVisualStyleBackColor = true;
this.PlaylistAddSongsButton.Click += new System.EventHandler(this.PlaylistAddSongsButton_Click);
//
// PlaylistSongContainer
//
this.PlaylistSongContainer.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PlaylistSongContainer.FormattingEnabled = true;
this.PlaylistSongContainer.Location = new System.Drawing.Point(10, 319);
this.PlaylistSongContainer.Name = "PlaylistSongContainer";
this.PlaylistSongContainer.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.PlaylistSongContainer.Size = new System.Drawing.Size(306, 82);
this.PlaylistSongContainer.TabIndex = 3;
//
// PlaylistNewButton
//
this.PlaylistNewButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.PlaylistNewButton.Location = new System.Drawing.Point(242, 23);
this.PlaylistNewButton.Name = "PlaylistNewButton";
this.PlaylistNewButton.Size = new System.Drawing.Size(75, 23);
this.PlaylistNewButton.TabIndex = 4;
this.PlaylistNewButton.Text = "New";
this.PlaylistNewButton.UseVisualStyleBackColor = true;
this.PlaylistNewButton.Click += new System.EventHandler(this.PlaylistNewButton_Click);
//
// PlaylistNewInputfield
//
this.PlaylistNewInputfield.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PlaylistNewInputfield.Location = new System.Drawing.Point(11, 25);
this.PlaylistNewInputfield.Name = "PlaylistNewInputfield";
this.PlaylistNewInputfield.Size = new System.Drawing.Size(225, 20);
this.PlaylistNewInputfield.TabIndex = 5;
this.PlaylistNewInputfield.KeyUp += new System.Windows.Forms.KeyEventHandler(this.PlaylistNewInputfield_KeyUp);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(95, 13);
this.label1.TabIndex = 6;
this.label1.Text = "Create new playlist";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(8, 75);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(97, 13);
this.label2.TabIndex = 7;
this.label2.Text = "Edit existing playlist";
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(11, 297);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(82, 13);
this.label3.TabIndex = 8;
this.label3.Text = "Songs in playlist";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(11, 130);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(49, 13);
this.label4.TabIndex = 9;
this.label4.Text = "All songs";
//
// FilterTextBox
//
this.FilterTextBox.Location = new System.Drawing.Point(172, 127);
this.FilterTextBox.Name = "FilterTextBox";
this.FilterTextBox.Size = new System.Drawing.Size(144, 20);
this.FilterTextBox.TabIndex = 10;
this.FilterTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.FilterTextBox_KeyUp);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(137, 130);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(29, 13);
this.label5.TabIndex = 11;
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
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
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.FilterTextBox);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.PlaylistNewInputfield);
this.Controls.Add(this.PlaylistNewButton);
this.Controls.Add(this.PlaylistSongContainer);
this.Controls.Add(this.PlaylistAddSongsButton);
this.Controls.Add(this.PlaylistSongSelector);
this.Controls.Add(this.PlaylistSelectBox);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MinimumSize = new System.Drawing.Size(300, 425);
this.Name = "PlaylistMaker";
this.Text = "Create / Edit playlists";
this.Shown += new System.EventHandler(this.PlaylistMaker_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ComboBox PlaylistSelectBox;
private System.Windows.Forms.ListBox PlaylistSongSelector;
private System.Windows.Forms.Button PlaylistAddSongsButton;
private System.Windows.Forms.ListBox PlaylistSongContainer;
private Button PlaylistNewButton;
private TextBox PlaylistNewInputfield;
private Label label1;
private Label label2;
private Label label3;
private Label label4;
private TextBox FilterTextBox;
private Label label5;
private Button DeletePlaylistButton;
private Button DeleteSongsButton;
}
}
+187
View File
@@ -0,0 +1,187 @@
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 PlaylistMaker : Form
{
private PlaylistHandler pl;
private APIHandler api;
private List<Song> allPlaylistSongs;
private List<Song> allsongs;
public PlaylistMaker(PlaylistHandler pl, APIHandler api)
{
this.pl = pl;
this.api = api;
this.allPlaylistSongs = new List<Song>();
this.allsongs = new List<Song>();
InitializeComponent();
}
public void PlaylistSelectBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (PlaylistSelectBox.SelectedItem != null)
{
PlaylistSongContainer.Items.Clear();
allPlaylistSongs = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString()).GetSongs();
allPlaylistSongs.ForEach(s => PlaylistSongContainer.Items.Add(s.Name));
}
}
public void Repopulate(bool lastIndex)
{
int selection = PlaylistSelectBox.SelectedIndex;
PlaylistSelectBox.Items.Clear();
pl.GetPlaylists().ForEach(p => PlaylistSelectBox.Items.Add(p.name));
if (lastIndex)
PlaylistSelectBox.SelectedIndex = PlaylistSelectBox.Items.Count - 1;
else
PlaylistSelectBox.SelectedIndex = selection;
PlaylistSongContainer.Items.Clear();
if (PlaylistSelectBox.SelectedItem != null)
{
allPlaylistSongs = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString()).GetSongs();
allPlaylistSongs.ForEach(s => PlaylistSongContainer.Items.Add(s.Name));
}
else
{
PlaylistSelectBox.SelectedIndex = -1;
PlaylistSelectBox.Text = "";
}
}
public void Repopulate()
{
Repopulate(false);
}
public void Populate()
{
pl.GetPlaylists().ForEach(p => PlaylistSelectBox.Items.Add(p.name));
if (PlaylistSelectBox.Items.Count > 0)
PlaylistSelectBox.SelectedIndex = 0;
allsongs = api.GetAllSongs();
allsongs.ForEach(s => PlaylistSongSelector.Items.Add(s.Name));
if (PlaylistSelectBox.SelectedItem != null)
{
allPlaylistSongs = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString()).GetSongs();
allPlaylistSongs.ForEach(s => PlaylistSongContainer.Items.Add(s.Name));
}
}
private void PlaylistAddSongsButton_Click(object sender, EventArgs e)
{
if (PlaylistSelectBox.SelectedItem!=null)
{
Playlist currentPlaylist = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString());
foreach (string song in PlaylistSongSelector.SelectedItems)
{
foreach (Song s in allsongs) {
if (s.Name == song)
{
currentPlaylist.AddSong(s);
break;
}
}
}
currentPlaylist.WriteToFile();
}
Thread.Sleep(10);
Repopulate();
}
public void SearchAllSongs(string search)
{
PlaylistSongSelector.Items.Clear();
if (search.Length > 1)
{
string sPattern = search;
foreach (Song s in allsongs)
{
if (System.Text.RegularExpressions.Regex.IsMatch(s.Name, sPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
{
PlaylistSongSelector.Items.Add(s.Name);
}
}
}
else
{
allsongs.ForEach(s => PlaylistSongSelector.Items.Add(s.Name));
}
}
private void PlaylistNewButton_Click(object sender, EventArgs e)
{
string name = PlaylistNewInputfield.Text;
PlaylistNewInputfield.Text = "";
name = name.Replace('/', '-');
name = name.Replace('\\', '-');
pl.MakeNewPlaylistByName(name);
Repopulate(true);
}
private void PlaylistMaker_Load(object sender, EventArgs e)
{
Populate();
}
private void FilterTextBox_KeyUp(object sender, KeyEventArgs e)
{
SearchAllSongs(FilterTextBox.Text);
}
private void PlaylistNewInputfield_KeyUp(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Enter)
{
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();
}
}
}
File diff suppressed because it is too large Load Diff
+3 -18
View File
@@ -17,26 +17,11 @@ namespace MusicPlayer
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
NetworkHandler nw = new NetworkHandler("http://www.imegumii.nl");
NetworkHandler nw = new NetworkHandler("http://imegumii.nl");
APIHandler api = new APIHandler(nw);
// api.GetSongsByArtist("Amon Amarth").ForEach(s =>
// {
// Console.WriteLine(s.SongID);
// });
// api.GetSongsByYear("2009").ForEach(s =>
// {
// Console.WriteLine(s.Name);
// });
api.GetSongsByGenre("Melodic Death Metal").ForEach(s =>
{
Console.WriteLine(s.Name);
});
// api.GetSongsByAlbum("Stronger").ForEach(s =>
// {
// Console.WriteLine(s.Name);
// });
MainForm form = new MainForm();
new Main(nw, api, form);
PlaylistHandler pl = new PlaylistHandler();
new Main(nw, api, form,pl);
Application.Run(form);
}
View File
+10 -18
View File
@@ -8,8 +8,8 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace MusicPlayer.Properties
{
namespace MusicPlayer.Properties {
using System;
/// <summary>
@@ -22,28 +22,23 @@ namespace MusicPlayer.Properties
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
internal Resources() {
}
/// <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 ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MusicPlayer.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
@@ -56,14 +51,11 @@ namespace MusicPlayer.Properties
/// 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
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
: 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">
@@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<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">
@@ -85,9 +87,10 @@
<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" msdata:Ordinal="1" />
<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">
@@ -109,9 +112,9 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
View File
View File
+23
View File
@@ -0,0 +1,23 @@
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
View File
@@ -0,0 +1,73 @@
//------------------------------------------------------------------------------
// <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));
}
}
}
}
+124
View File
@@ -0,0 +1,124 @@
<?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.

After

Width:  |  Height:  |  Size: 147 KiB

+35 -2
View File
@@ -12,25 +12,29 @@ namespace MusicPlayer
public string Name { get; set; }
public string Album { get; set; }
public string Artist { get; set; }
public string Genre { get; set; }
public string Url { get { return GetURL(); } set { SetURL(value); } }
public int Seconds { get; set; }
private APIHandler api;
private string url;
public Song(string songid, string name, string album, string artist, APIHandler api)
public Song(string songid, string name, string album, string artist, string genre, int seconds, APIHandler api)
{
SongID = songid;
Name = name;
Album = album;
Artist = artist;
Seconds = seconds;
Genre = genre;
this.api = api;
url = "";
}
private string GetURL()
protected virtual string GetURL()
{
if (url == "")
{
@@ -44,5 +48,34 @@ namespace MusicPlayer
{
url = str;
}
public override string ToString()
{
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);
}
}
}
+7 -4
View File
@@ -7,19 +7,22 @@ using System.Threading.Tasks;
namespace MusicPlayer
{
class SongsTable : DataTable
public class SongsTable : DataTable
{
public SongsTable() : base()
{
this.Columns.Clear();
this.Columns.Add("Naam", typeof(string));
this.Columns.Add("Name", typeof(string));
this.Columns.Add("Album", typeof(string));
this.Columns.Add("Artiest", typeof(string));
this.Columns.Add("Artist", typeof(string));
this.Columns.Add("Genre", typeof(string));
this.Columns.Add("Duration", typeof(string));
this.Columns.Add("song", typeof(Song));
}
public void Add(Song s)
{
this.Rows.Add(s.Name, s.Album, s.Artist);
this.Rows.Add(s.Name, s.Album, s.Artist, s.Genre, Main.SecondsToTimestamp(s.Seconds), s);
}
}
Regular → Executable
View File
+1
View File
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AntiXSS" version="4.3.0" targetFramework="net452" />
<package id="NAudio" version="1.7.3" targetFramework="net452" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
</packages>
Regular → Executable
+8 -10
View File
@@ -1,12 +1,10 @@
# musicplayer
##Onderdelen
- Server/Client
- Threading/Threadpools
- File IO
- Socket communicatie
- Klasse Structuur
- Forms Applicatie
- Specifieke C# - Delegates/Lambda...
## todo
- afvangen server niet online
- server opslaan bij playlist
- doorzoeken van alle liedjes via API
- doorzoeken van albums
- playlist verwijderen
- liedjes uit playlist verwijderen
- presentatie