Thursday 16 May 2013 photo 1/4
|
Delar med mig av min media spelare som hämtar musik från mp3skull!
c#
http://pastebin.com/ixVCEzjP
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;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
namespace MusicPlayer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
//KlickButton play
private void button1_Click(object sender, EventArgs e)
{
if (comboBox1.Text != "")
{
label1.Text = "http://riobravofmradio.com/musica/" + label2.Text + listBox2.Items[listBox2.SelectedIndex].ToString();
axWindowsMediaPlayer1.URL = label1.Text;
}
}
//Klick play
private void listBox2_DoubleClick(object sender, EventArgs e)
{
label1.Text = "http://riobravofmradio.com/musica/" + label2.Text + listBox2.Items[listBox2.SelectedIndex].ToString();
axWindowsMediaPlayer1.URL = label1.Text;
}
//Select
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.Text == "Rock")
{
label2.Text = "rock%20en%20ingles/";
}
if (comboBox1.Text == "Pop")
{
label2.Text = "pop/";
}
if (comboBox1.Text == "Dance")
{
label2.Text = "dance/";
}
if (comboBox1.Text == "60s - 70s")
{
label2.Text = "60s y 70s/";
}
if (comboBox1.Text == "80s - 90s")
{
label2.Text = "80s y 90s/";
}
List<string> music = new List<string>();
WebClient web = new WebClient();
MatchCollection m1 = Regex.Matches(html, "mp3">s*(.+?)s*", RegexOptions.Singleline);
foreach (Match m in m1)
{
string city = m.Groups[1].Value;
music.Add(city);
}
listBox2.DataSource = music;
}
//KlickButton Search band
private void button3_Click(object sender, EventArgs e)
{
string myString = textBox1.Text;
int index = listBox2.FindString(myString, -1);
if (index != -1)
{
listBox2.SetSelected(index, true);
}
else
{
}
}
//KeyEnter search band
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
string myString = textBox1.Text;
int index = listBox2.FindString(myString, -1);
if (index != -1)
{
listBox2.SetSelected(index, true);
}
}
}
}
}
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;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
namespace MusicPlayer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
//KlickButton play
private void button1_Click(object sender, EventArgs e)
{
if (comboBox1.Text != "")
{
label1.Text = "http://riobravofmradio.com/musica/" + label2.Text + listBox2.Items[listBox2.SelectedIndex].ToString();
axWindowsMediaPlayer1.URL = label1.Text;
}
}
//Klick play
private void listBox2_DoubleClick(object sender, EventArgs e)
{
label1.Text = "http://riobravofmradio.com/musica/" + label2.Text + listBox2.Items[listBox2.SelectedIndex].ToString();
axWindowsMediaPlayer1.URL = label1.Text;
}
//Select
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.Text == "Rock")
{
label2.Text = "rock%20en%20ingles/";
}
if (comboBox1.Text == "Pop")
{
label2.Text = "pop/";
}
if (comboBox1.Text == "Dance")
{
label2.Text = "dance/";
}
if (comboBox1.Text == "60s - 70s")
{
label2.Text = "60s y 70s/";
}
if (comboBox1.Text == "80s - 90s")
{
label2.Text = "80s y 90s/";
}
List<string> music = new List<string>();
WebClient web = new WebClient();
MatchCollection m1 = Regex.Matches(html, "mp3">s*(.+?)s*", RegexOptions.Singleline);
foreach (Match m in m1)
{
string city = m.Groups[1].Value;
music.Add(city);
}
listBox2.DataSource = music;
}
//KlickButton Search band
private void button3_Click(object sender, EventArgs e)
{
string myString = textBox1.Text;
int index = listBox2.FindString(myString, -1);
if (index != -1)
{
listBox2.SetSelected(index, true);
}
else
{
}
}
//KeyEnter search band
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
string myString = textBox1.Text;
int index = listBox2.FindString(myString, -1);
if (index != -1)
{
listBox2.SetSelected(index, true);
}
}
}
}
}
Annons