From 1460cb4a3c4e1ec3e9272b8bf0583d13012578f9 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期四, 28 十月 2021 17:10:55 +0800
Subject: [PATCH] 还原音乐功能
---
HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs | 7
HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs | 427 ++++++++++++++++++++++++++++++++---------------
HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs | 106 +----------
3 files changed, 300 insertions(+), 240 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
index 097d477..d651ae9 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
@@ -97,8 +97,6 @@
///鍒囨崲鎾斁妯″紡鐐瑰嚮浜嬩欢;
playView.playOrderBtn.MouseUpEventHandler += (sender, e) =>
{
- //single/single_cycle/order/list_cycle/random
- string modeValueString = string.Empty;
string msg = Language.StringByID(StringId.switchTo);
switch (A31MusicModel.Current.A31PlayStatus.loop)
{
@@ -121,9 +119,8 @@
break;
}
new PublicAssmebly().TipMsgAutoClose(msg, false,1000);
- Dictionary<string, string> dic = new Dictionary<string, string>();
- dic.Add("mode",modeValueString);
- //SendMethod.sendMethod.SendControlCommand(,dic);
+ string url = "http://" + A31MusicModel.Current.IPAddress + "/httpapi.asp?command=setPlayerCmd:" + "loopmode:" + A31MusicModel.Current.A31PlayStatus.loop;
+ SendMethod.SendCommand(url);
};
///娣诲姞鍠滅埍鐐瑰嚮浜嬩欢;
playView.loveBtn.MouseUpEventHandler += (sender, e) =>
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
index 6c88a70..01c7106 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
@@ -3,8 +3,6 @@
using Shared;
using Shared.IO;
using System.Net;
-using HDL_ON.Entity;
-
namespace HDL_ON.UI.Music
{
public class MusicMain : FrameLayout
@@ -58,22 +56,19 @@
/// <summary>
/// 鏄剧ず鍔犺浇鐣岄潰
/// </summary>
- public static Loading loading = new Loading();
+ public static Loading loading = new Loading();
/// <summary>
/// 瀹氫箟鍏ㄥ眬瀵硅薄
/// </summary>
VerticalRefreshLayout verticalRefresh;
- /// <summary>
- /// 涓轰簡闊充箰鍒锋柊鐘舵�佸畾涔夊叏灞�瀵硅薄
- /// </summary>
- MusicView musicView = new MusicView();
public void Show()
{
+
#region 鐣岄潰甯冨眬
this.BackgroundColor = MusicColor.ViewColor;
var topView = new TopView();
this.AddChidren(topView.TopFLayoutView());
- topView.topNameBtn.TextID = StringId.a31Music;
+ topView.topNameBtn.TextID =StringId.a31Music;
topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
{
RemoveFromParent();
@@ -89,71 +84,200 @@
verticalRefresh.BeginHeaderRefreshingAction += () =>
{
- SeachMusic();
+ SeachMusic(false);
+
};
this.AddChidren(loading);
- SeachMusic();
+ if (A31MusicModel.A31MusicModelList.Count == 0)
+ {
+ SeachMusic(true);
+ }
+ else
+ {
+ clearA31Threads();
+ //verticalRefresh.RemoveAll();
+ for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
+ {
+ var a31player = A31MusicModel.A31MusicModelList[i];
+ ///杩欎釜鐘舵�佹槸涔嬪墠淇濆瓨鐨勶紝鍔犺浇瀹屾垚鍚庤鏍囪涓轰笉鍦ㄧ嚎锛屽悗闈㈠啀璇诲彇姝g‘鐨勭姸鎬�
+ if (!a31player.IsCanShow)
+ {
+ continue;
+ }
+ if (A31MusicModel.A31MusicModelList.Count - 1 == i)
+ {
+ a31player.IsEnd = true;
+ }
+ else
+ {
+ a31player.IsEnd = false;
+ }
+ ///鍔犺浇鐣岄潰鏃堕粯璁や笉鍦ㄧ嚎
+ ///杩欓噷鏍囪鏄负浜嗕笉璇诲彇涓嶅湪绾挎挱鏀惧櫒鐘舵��
+ a31player.IsOnLine = false;
+ MusicListView(a31player);
+ }
+ ///璇诲彇姝g‘鐨勪俊鎭紝鍖呮嫭IP鍜岀鍙e強鍚嶇О
+ SendMethod.Seach((obj) =>
+ {
+ try
+ {
+ if (obj == null)
+ {
+ ///杩欓噷瑕佽鍙栦富浠庡叧绯�
+ readServerOrClientMode();
+ A31MusicModel.Save();
+ return;
+ }
+ var a31MusicModel = A31MusicModel.A31MusicModelList.Find((music) => music.UniqueDeviceName == obj.UniqueDeviceName);
+ if (a31MusicModel != null)
+ {
+ a31MusicModel.IPAddress = obj.IPAddress;
+ a31MusicModel.Port = obj.Port;
+ a31MusicModel.Name = obj.Name;
+ a31MusicModel.IsCanShow = true;
+ a31MusicModel.IsOnLine = true;
+ }
+ }
+ catch (Exception e) { MainPage.Log(e.Message); }
+ });
+ }
}
/// <summary>
/// 鍒锋柊鎾斁鍣ㄥ垪琛�
/// </summary>
- void SeachMusic()
+ /// <param name="Yes">鏄惁鏄剧ず鍒锋柊鍥炬爣</param>
+ void SeachMusic(bool Yes = false)
{
- Application.RunOnMainThread(() =>
+ for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
{
- verticalRefresh.RemoveAll();
- for (int i = 0; i < SendMethod.sendMethod.GetMusicList.Count; i++)
+ var a31player = A31MusicModel.A31MusicModelList[i];
+ a31player.IsCanShow = false;
+ a31player.IsOnLine = false;
+ }
+ if (Yes)
+ {
+ //涓轰簡绗竴娆¤繘鏉og涓�涓�;
+ loading.Start();
+ }
+ SendMethod.Seach((obj) =>
+ {
+ if (obj == null)
{
- var playerFunction = SendMethod.sendMethod.GetMusicList[i];
- if (!playerFunction.online)
+ readServerOrClientMode();
+ A31MusicModel.Save();
+ if (!Yes)
{
- //杩囨护鎺変笉鍦ㄧ嚎鐨勯煶涔愭挱鏀惧櫒
- continue;
+ ///绛夊緟璺戝畬鍦ㄥ叧闂�
+ verticalRefresh.EndHeaderRefreshing();
}
- MusicListView(playerFunction);
- }
+ Application.RunOnMainThread(() =>
+ {
+ if (Yes)
+ {
+ //涓轰簡绗竴娆¤繘鏉og涓�涓�;
+ loading.Hide();
+ }
+ verticalRefresh.RemoveAll();
+ for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
+ {
+ var a31player = A31MusicModel.A31MusicModelList[i];
+ //杩欎釜鐘舵�佹槸涔嬪墠淇濆瓨鐨勶紝鍔犺浇瀹屾垚鍚庤鏍囪涓轰笉鍦ㄧ嚎锛屽悗闈㈠啀璇诲彇姝g‘鐨勭姸鎬�
+ if (!a31player.IsCanShow)
+ {
+ continue;
+ }
+ if (A31MusicModel.A31MusicModelList.Count - 1 == i)
+ {
+ a31player.IsEnd = true;
+ }
+ else
+ {
+ a31player.IsEnd = false;
+ }
+ MusicListView(a31player);
+ }
+ //A31MusicModel.ReadMusicStates();
+ });
+ return;
+ }
+ var a31MusicModel = A31MusicModel.A31MusicModelList.Find((music) => { return music.UniqueDeviceName == obj.UniqueDeviceName; });
+ if (a31MusicModel == null)
+ {
+ //涓嶆槸鎴戜滑鏀寔鐨勫搧鐗屼笉鏀寔
+ if (obj.Name != null)
+ {
+ obj.sid = "030101123456780909020123AABB" + obj.UniqueDeviceName;
+ A31MusicModel.A31MusicModelList.Add(obj);
+ }
+ }
+ else
+ {
+ a31MusicModel.IPAddress = obj.IPAddress;
+ a31MusicModel.Port = obj.Port;
+ a31MusicModel.Name = obj.Name;
+ a31MusicModel.IsCanShow = true;
+ a31MusicModel.IsOnLine = true;
+ }
});
}
/// <summary>
/// 鏄剧ず闊充箰鍒楄〃鐨勬柟娉�
/// </summary>
- void MusicListView(Function player)
+ void MusicListView(A31MusicModel a31player)
{
+ MusicView musicView = new MusicView();
musicView.View(verticalRefresh);
- musicView.singerBtn.Text = player.GetAttrState("song_name");
- musicView.songNameBtn.Text = player.GetAttrState("song_name");
- musicView.musicNameBtn.Text = player.name;
- //if (player.IsEnd)
- //{
- // musicView.muiscFl.Height = Application.GetRealHeight(12 + 139 + 12);
- //}
+ musicView.singerBtn.Text = a31player.A31PlayStatus.Artist;
+ musicView.songNameBtn.Text = a31player.A31PlayStatus.Title;
+ musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(a31player);
+ if (a31player.IsEnd)
+ {
+ musicView.muiscFl.Height = Application.GetRealHeight(12 + 139 + 12);
+ }
musicView.collectIconBtn.MouseUpEventHandler += (sender, e) =>
{
musicView.collectIconBtn.IsSelected = !musicView.collectIconBtn.IsSelected;
- if (musicView.collectIconBtn.IsSelected)
+ if (a31player.ServerClientType == 1)
{
- player.collect = true;
+ if (musicView.collectIconBtn.IsSelected)
+ {
+ a31player.MainPlayCollection = true;
+ }
+ else
+ {
+ a31player.MainPlayCollection = false;
+ }
}
else
{
- player.collect = false;
+ if (musicView.collectIconBtn.IsSelected)
+ {
+ a31player.collect = true;
+ }
+ else
+ {
+ a31player.collect = false;
+ }
}
+ A31MusicModel.Save();
};
EventHandler<MouseEventArgs> clickMergence = (sender, e) =>
{
- //if (player.ServerClientType == 0)
- //{
- // new View.DialogView { }.PlayMergence(player);
- //}
- //else if (player.ServerClientType == 1)
- //{
- // new View.DialogView { }.DetachPlayMergence(player);
- //}
+ if (a31player.ServerClientType == 0)
+ {
+ new View.DialogView { }.PlayMergence(a31player);
+ }
+ else if (a31player.ServerClientType == 1)
+ {
+ new View.DialogView { }.DetachPlayMergence(a31player);
+
+ }
};
musicView.mergeBjBtn.MouseUpEventHandler += clickMergence;
musicView.mergeBtn.MouseUpEventHandler += clickMergence;
@@ -161,6 +285,7 @@
EventHandler<MouseEventArgs> clickPlayView = (sender, e) =>
{
+ A31MusicModel.Current = a31player;//褰撳墠鎾斁鍣�
var a31PlayMusicPage = new A31PlayMusicPage();
MainPage.BasePageView.AddChidren(a31PlayMusicPage);
a31PlayMusicPage.Show();
@@ -177,9 +302,7 @@
musicView.prevBtn.MouseDownEventHandler += (sender, e) =>
{
musicView.prevBtn.IsSelected = true;
- Dictionary<string, string> dic = new Dictionary<string, string>();
- dic.Add("song_step", "up");
- SendMethod.sendMethod.SendControlCommand(player, dic);
+ SendMethod.Previous(a31player);
};
musicView.prevBtn.MouseUpEventHandler += (sender, e) =>
{
@@ -188,28 +311,24 @@
///鏆傚仠/鎾斁鐐瑰嚮浜嬩欢
musicView.playBtn.MouseDownEventHandler += (sender, e) =>
{
- string status = "off";
if (musicView.playBtn.IsSelected)
{
musicView.playBtn.IsSelected = false;
- status = "off";
+ SendMethod.Pause(a31player);
+ a31player.A31PlayStatus.status = "pause";
}
else
{
musicView.playBtn.IsSelected = true;
- status = "on";
+ SendMethod.Play(a31player);
+ a31player.A31PlayStatus.status = "play";
}
- Dictionary<string, string> dic = new Dictionary<string, string>();
- dic.Add("on_off", status);
- SendMethod.sendMethod.SendControlCommand(player, dic);
};
///涓嬩竴鏇茬偣鍑讳簨浠�
musicView.nextBtn.MouseDownEventHandler += (sender, e) =>
{
musicView.nextBtn.IsSelected = true;
- Dictionary<string, string> dic = new Dictionary<string, string>();
- dic.Add("song_step", "down");
- SendMethod.sendMethod.SendControlCommand(player, dic);
+ SendMethod.Next(a31player);
};
musicView.nextBtn.MouseUpEventHandler += (sender, e) =>
{
@@ -221,49 +340,47 @@
while (true)
{
System.Threading.Thread.Sleep(1000);
- if (!player.online)
+ if (!a31player.IsOnLine)
{
continue;
}
- //SendMethod.ReadStatus(player);
- SendMethod.sendMethod.RefreshDeviceStatus(player,new List<string> { player.deviceId });
-
+ SendMethod.ReadStatus(a31player);
Application.RunOnMainThread(() =>
{
- //musicView.singerBtn.Text = player.A31PlayStatus.Artist;
- //musicView.songNameBtn.Text = player.A31PlayStatus.Title;
- //musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(player);
- //if (player.A31PlayStatus.status == "play")
- //{
- // musicView.playBtn.IsSelected = true;
- //}
- //else
- //{
- // musicView.playBtn.IsSelected = false;
- //}
- //musicView.regionBtn.Text = player.GetRoomListName();
- //if (player.ServerClientType == 1)
- //{
- // if (player.MainPlayCollection)
- // {
- // musicView.collectIconBtn.IsSelected = true;
- // }
- // else
- // {
- // musicView.collectIconBtn.IsSelected = false;
- // }
- //}
- //else
- //{
- // if (player.collect)
- // {
- // musicView.collectIconBtn.IsSelected = true;
- // }
- // else
- // {
- // musicView.collectIconBtn.IsSelected = false;
- // }
- //}
+ musicView.singerBtn.Text = a31player.A31PlayStatus.Artist;
+ musicView.songNameBtn.Text = a31player.A31PlayStatus.Title;
+ musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(a31player);
+ if (a31player.A31PlayStatus.status == "play")
+ {
+ musicView.playBtn.IsSelected = true;
+ }
+ else
+ {
+ musicView.playBtn.IsSelected = false;
+ }
+ musicView.regionBtn.Text = a31player.GetRoomListName();
+ if (a31player.ServerClientType == 1)
+ {
+ if (a31player.MainPlayCollection)
+ {
+ musicView.collectIconBtn.IsSelected = true;
+ }
+ else
+ {
+ musicView.collectIconBtn.IsSelected = false;
+ }
+ }
+ else
+ {
+ if (a31player.collect)
+ {
+ musicView.collectIconBtn.IsSelected = true;
+ }
+ else
+ {
+ musicView.collectIconBtn.IsSelected = false;
+ }
+ }
});
}
})
@@ -271,67 +388,99 @@
musicThread.Start();
threadLists.Add(musicThread);
}
-
/// <summary>
- ///鎸囧畾鍒锋柊鐣岄潰
+ /// 璇诲彇涓讳粠鍏崇郴
/// </summary>
- /// <param name="strView">鍒ゆ柇瀛楃</param>
- public void RefreshView(string strView)
+ void readServerOrClientMode()
{
- Application.RunOnMainThread(() =>
+ try
{
- try
+ for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
{
-
- for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--)
+ var a31player = A31MusicModel.A31MusicModelList[i];
+ if (!a31player.IsOnLine)
{
- var view = MainPage.BasePageView.GetChildren(i);
- if (strView == view.Tag.ToString())
+ continue;
+ }
+ try
+ {
+ a31player.ServerClientType = 0;
+ var result = SendMethod.OpenWeb("http://" + a31player.IPAddress + "/httpapi.asp?command=multiroom:getSlaveList");
+ if (result == null && result == "Failed")
{
- if (view.GetType() == typeof(MusicMain))
- {
- //musicView.singerBtn.Text = player.A31PlayStatus.Artist;
- //musicView.songNameBtn.Text = player.A31PlayStatus.Title;
- //musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(player);
- //if (player.A31PlayStatus.status == "play")
- //{
- // musicView.playBtn.IsSelected = true;
- //}
- //else
- //{
- // musicView.playBtn.IsSelected = false;
- //}
- //musicView.regionBtn.Text = player.GetRoomListName();
- //if (player.ServerClientType == 1)
- //{
- // if (player.MainPlayCollection)
- // {
- // musicView.collectIconBtn.IsSelected = true;
- // }
- // else
- // {
- // musicView.collectIconBtn.IsSelected = false;
- // }
- //}
- //else
- //{
- // if (player.collect)
- // {
- // musicView.collectIconBtn.IsSelected = true;
- // }
- // else
- // {
- // musicView.collectIconBtn.IsSelected = false;
- // }
- //}
- }
+ result = SendMethod.OpenWeb("http://" + a31player.IPAddress + "/httpapi.asp?command=multiroom:getSlaveList");
}
-
+ if (result != null && result != "Failed")
+ {
+ a31player.Slave = Newtonsoft.Json.JsonConvert.DeserializeObject<Slaves>(result);
+ }
+ }
+ catch (Exception e)
+ {
+ var d = e.Message;
}
}
- catch { }
- });
+
+ //鍒嗘瀽涓讳粠鍏崇郴
+ for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
+ {
+ var a31player = A31MusicModel.A31MusicModelList[i];
+ if (!a31player.IsOnLine)
+ {
+ continue;
+ }
+ try
+ {
+ if (a31player.Slave != null && "0" != a31player.Slave.slaves)
+ {
+ a31player.ServerClientType = 1;//涓荤殑
+ string str = a31player.Name;
+ for (int j = 0; j < a31player.Slave.slave_list.Count; j++)
+ {
+
+ var slave = a31player.Slave.slave_list[j];
+ str = str + "+" + slave.name;
+ var tempA31Player = A31MusicModel.A31MusicModelList.Find((obj) => slave.uuid.Replace("uuid:", "") == obj.UniqueDeviceName);
+ if (tempA31Player == null)
+ {
+ A31MusicModel.A31MusicModelList.Add(new A31MusicModel
+ {
+ sid = "030101123456780909020123AABB" + slave.uuid.Replace("uuid:", ""),
+ ServerClientType = -1,//浠庣殑
+ IPAddress = slave.ip,
+ MainPlayIP = a31player.IPAddress,
+ UniqueDeviceName = slave.uuid.Replace("uuid:", ""),
+ Name = slave.name,
+ IsCanShow = false,
+ IsOnLine = false,//true浣滅敤涓轰簡璇诲彇浠庢挱鏀惧櫒鐨勯煶閲�
+ });
+ }
+ //濡傛灉鎵惧埌灏辨洿鏂颁负浠庣殑
+ else
+ {
+ tempA31Player.ServerClientType = -1;//浠庣殑
+ tempA31Player.IPAddress = slave.ip;
+ tempA31Player.MainPlayIP = a31player.IPAddress;
+ tempA31Player.Name = slave.name;
+ tempA31Player.UniqueDeviceName = slave.uuid.Replace("uuid:", "");
+ tempA31Player.IsCanShow = false;
+ tempA31Player.IsOnLine = false;//true浣滅敤涓轰簡璇诲彇浠庢挱鏀惧櫒鐨勯煶閲�
+
+ }
+ }
+ a31player.MainPlayName = str;
+ }
+ }
+ catch (Exception e)
+ {
+ var ss = e.Message;
+ }
+ }
+
+ }
+ catch { }
}
+
}
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs
index 0a3fc25..dd36144 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs
@@ -4,28 +4,12 @@
using System.Net.Sockets;
using System.Security;
using System.Text;
-using HDL_ON.DAL.Server;
-using HDL_ON.Entity;
using Shared;
namespace HDL_ON.UI.Music
{
public class SendMethod
{
- private static SendMethod m_sendMethod=null;
- public static SendMethod sendMethod
- {
- get
- {
- if (m_sendMethod == null)
- {
- m_sendMethod = new SendMethod();
- }
- return m_sendMethod;
- }
-
- }
-
/// <summary>
///鎼滅储A31闊充箰鎾斁鍣�
/// </summary>
@@ -225,7 +209,7 @@
a31MusicModel.A31PlayStatus.loop = se.SearchForTextOfTag("LoopMode");
a31MusicModel.A31PlayStatus.Source = se.SearchForTextOfTag("PlayMedium");
a31MusicModel.A31PlayStatus.playSource = se.SearchForTextOfTag("TrackSource");
- a31MusicModel.A31PlayStatus.TrackURL = se.SearchForTextOfTag("TrackURI").Replace("&", "&amp;");
+ a31MusicModel.A31PlayStatus.TrackURL = se.SearchForTextOfTag("TrackURI").Replace("&", "&amp;");
}
catch (Exception ex)
@@ -479,8 +463,7 @@
/// <param name="volume">Volume.</param>
public static void ControlVolume(int volume, A31MusicModel a31player)
{
- System.Threading.Tasks.Task.Run(() =>
- {
+ System.Threading.Tasks.Task.Run(() => {
A31MusicModel.ProgressDateTime = DateTime.Now;
try
{
@@ -543,7 +526,7 @@
musicInfo.URL = track.SearchForTextOfTag("URL").Replace("&", "&amp;");
var metadata = track.SearchForTextOfTag("Metadata").Replace("&", "&");
var item = SecurityElement.FromString(metadata).SearchForChildByTag("item");
- musicInfo.Title = item.SearchForTextOfTag("dc:title").Replace("&", "&amp;");
+ musicInfo.Title = item.SearchForTextOfTag("dc:title").Replace("&", "&amp;");
musicInfo.Artist = item.SearchForTextOfTag("upnp:artist").Replace("&", "&amp;");
musicInfo.Album = item.SearchForTextOfTag("upnp:album").Replace("&", "&amp;");
musicInfo.Duration = item.SearchForTextOfTag("res");
@@ -614,7 +597,7 @@
/// <summary>
/// 鑾峰彇褰撳墠鎾斁鐨勫垪琛�
/// </summary>
- public static string GetCurrentPlayList(A31MusicModel a31player)
+ public static string GetCurrentPlayList(A31MusicModel a31player)
{
System.Text.StringBuilder getPlayList = new System.Text.StringBuilder();
getPlayList.AppendLine("<?xml version=\"1.0\"encoding=\"utf-8\"?>");
@@ -673,7 +656,7 @@
/// <param name="musicInfo">鎾斁闊充箰</param>
/// <param name="listName">鍒楄〃鍚嶇О</param>
/// <param name="musicList">鎺ㄩ�佸垪琛�(榛樿鎺�50棣�)</param>
- public static void PushList(MusicInfo musicInfo, string listName, List<MusicInfo> musicList, A31MusicModel a31player, string musicSource)
+ public static void PushList(MusicInfo musicInfo, string listName, List<MusicInfo> musicList, A31MusicModel a31player,string musicSource)
{
//鏈�澶у彂閫佺殑鏉℃暟
@@ -756,12 +739,10 @@
sb.AppendLine("&lt;dc:title&gt;" + tempMusicInfo.Title + "&lt;/dc:title&gt;");
sb.AppendLine("&lt;dc:creator&gt;DJ Sanny J&lt;/dc:creator&gt;");
- if (musicSource == "鎴戠殑鍒楄〃")
- {
+ if (musicSource== "鎴戠殑鍒楄〃") {
sb.AppendLine("&lt;upnp:artist&gt;" + listName + "&lt;/upnp:artist&gt;");
}
- else
- {
+ else {
sb.AppendLine("&lt;upnp:artist&gt;" + tempMusicInfo.Artist + "&lt;/upnp:artist&gt;");
}
sb.AppendLine("&lt;upnp:album&gt;" + tempMusicInfo.Album + "&lt;/upnp:album&gt;");
@@ -797,7 +778,7 @@
Play(a31player.IPAddress, a31player.Port, playString.ToString());
}
- static void SendMusicLists(string ip, int port, string soapAction, string listInfo)
+ static void SendMusicLists(string ip, int port, string soapAction, string listInfo)
{
System.Net.WebClient webClient = new System.Net.WebClient();
webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#" + soapAction + "\"");
@@ -807,13 +788,13 @@
byte[] recevieBytes = webClient.UploadData(new Uri("http://" + ip + ":" + port + "/upnp/control/PlayQueue1"), "POST", System.Text.Encoding.UTF8.GetBytes(listInfo));
var s = System.Text.Encoding.UTF8.GetString(recevieBytes, 0, recevieBytes.Length);
}
- catch (Exception e)
+ catch(Exception e)
{
var d = e.Message;
}
}
- static void Play(string ip, int port, string info)
+ static void Play(string ip, int port, string info)
{
System.Net.WebClient webClient = new System.Net.WebClient();
webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#PlayQueueWithIndex\"");
@@ -901,72 +882,5 @@
public string creator = string.Empty;
}
- /// <summary>
- /// 鑾峰彇闊充箰鍒楄〃
- /// </summary>
- public List<Function> GetMusicList
- {
- get
- {
- return FunctionList.List.GetMusicList();
- }
- }
- /// <summary>
- /// 鍙戦�佹帶鍒跺懡浠�
- /// </summary>
- /// <param name="function">褰撳墠璁惧</param>
- /// <param name="dic">鍙戦�佹帶鍒舵暟鎹�</param>
- public void SendControlCommand(Function function, Dictionary<string, string> dic)
- {
- new System.Threading.Thread(() =>
- {
- DriverLayer.Control.Ins.SendWriteCommand(function, dic);
- })
- { IsBackground = true }.Start();
- }
-
- /// <summary>
- /// 鍒锋柊璁惧鐘舵��
- /// </summary>
- /// <returns></returns>
- public void RefreshDeviceStatus(Function music, List<string> functionIds)
- {
- try
- {
- Dictionary<string, object> d = new Dictionary<string, object>();
- d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
- d.Add("deviceIds", functionIds);
- var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_RefreshDeviceStatus);
- if (responsePackNew.Code != "0")
- {
- return;
- }
- //鏁版嵁杩斿簭鍒楀寲涓篎unction瀵硅薄
- var str = Newtonsoft.Json.JsonConvert.SerializeObject(responsePackNew.Data.ToString());
- var function = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(str);
- if (function == null)
- {
- return;
- }
- music.name = function.name;
- music.sid = function.sid;
- music.spk = function.spk;
- music.status = function.status;
- music.roomIds = function.roomIds;
- music.attributes = function.attributes;
- }
- catch { }
- }
-
- /// <summary>
- ///璇锋眰鏈嶅姟鍣紙涓庝綇瀹呮湁鍏�:渚嬪锛沨omeId锛�
- /// </summary>
- /// <returns></returns>
- public ResponsePackNew RequestServerhomeId(object o, string api_Url, int mTimeout = 5)
- {
- var requestJson = HttpUtil.GetSignRequestJson(o);
- return HttpUtil.RequestHttpsPostFroHome(api_Url, requestJson, mTimeout);
-
- }
}
}
--
Gitblit v1.8.0