MusicStore-2

article/2025/11/5 17:33:17

1.按照MusicStore-1步骤创建mvc项目,并初始化数据库

2.修改HomeController

using Chapter8.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;namespace Chapter8.Controllers
{public class HomeController : Controller{private MusicStoreEntities storeDB = new MusicStoreEntities();// GET: Homepublic ActionResult Index(){var albums = GetTopSellingAlbums(2);return View(albums);}private List<Album> GetTopSellingAlbums(int count){return storeDB.Albums.OrderByDescending(s => s.OrderDetails.Count).Take(count).ToList();}}
}

3修改index.cshtml

@{ViewBag.Title = "Home Page";
}<div class="jumbotron"><h1>MVC Music Store</h1><img src="~/Images/home-showcase.png" />
</div><ul class="row list-unstyled" id="album-list">@foreach (var album in Model){<li class="col-lg-2 col-md-2 col-sm-2 col-xs-4 container"><a href="@Url.Action("Details", "Store", new { id = album.AlbumId })"><img alt="@album.Title" src="@Url.Content( @album.AlbumArtUrl)" /><h4>@album.Title</h4></a></li>}
</ul>@section Scripts {<script src="~/Scripts/App/MusicScripts.js"></script>
}

4.在Scripts目录下新建App目录,并在其下面新增MusicScripts.js

$(function () {$("#album-list img").mouseover(function () {$(this).animate({ height: '+=25', width: '+=25' }).animate({ height: '-=25', width: '-=25' });});
});

5.运行程序,此时应能看到

6.通过nuget引入ajax,并添加到index的scripts节中,再视图里面添加查看打折信息的超链接,以及显示用的div

@{ViewBag.Title = "Home Page";
}<div class="jumbotron"><h1>MVC Music Store</h1><img src="~/Images/home-showcase.png" />
</div><ul class="row list-unstyled" id="album-list">@foreach (var album in Model){<li class="col-lg-2 col-md-2 col-sm-2 col-xs-4 container"><a href="@Url.Action("Details", "Store", new { id = album.AlbumId })"><img alt="@album.Title" src="@Url.Content( @album.AlbumArtUrl)" /><h4>@album.Title</h4></a></li>}
</ul><div id="dailydeal">@Ajax.ActionLink("Click here to see today's special","DailyDeal",null,new AjaxOptions
{UpdateTargetId = "dailydeal",InsertionMode = InsertionMode.Replace,HttpMethod= "GET"
},
new { @class = "btn btn-primary" })
</div>@section Scripts {<script src="~/Scripts/App/MusicScripts.js"></script><script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
}

 

7 在HomeController里面增加处理DailyDeal()方法,处理打折信息请求

using Chapter8.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;namespace Chapter8.Controllers
{public class HomeController : Controller{private MusicStoreEntities storeDB = new MusicStoreEntities();// GET: Homepublic ActionResult Index(){var albums = GetTopSellingAlbums(2);return View(albums);}private List<Album> GetTopSellingAlbums(int count){return storeDB.Albums.OrderByDescending(s => s.OrderDetails.Count).Take(count).ToList();}public ActionResult DailyDeal(){var album = GetDailyDeal();return PartialView("_DailyDeal", album);}private object GetDailyDeal(){var album = storeDB.Albums.OrderBy(a => System.Guid.NewGuid()).First();album.Price *=0.5m;return album;}}
}

 

8 在Views/Home下新建分部视图

@model Chapter8.Models.Album<div class="panel panel-primary"><div class="panel-heading"><h3>Your Daily Deal: @Model.Title</h3></div><div class="panel-body"><p><img alt="@Model.Title" src="@Url.Content(Model.AlbumArtUrl)" /></p><div id="album-details"><p><em>Artist:</em>@Model.Artist.Name</p><p><em>Price:</em>@string.Format("{0:F}", Model.Price)</p>@Html.ActionLink("Add to cart","AddToCart","ShoppingCart",new { id=Model.AlbumId},new { @class="btn btn-primary"})</div></div>
</div>

 

9 运行,点击Index下面的获取打折信息的超链接,就会在当前页面显示打折信息

10.在Index视图上增加搜索框来搜索Artist,以及用于显示搜索结果的div

@{ViewBag.Title = "Home Page";
}<div class="jumbotron"><h1>MVC Music Store</h1><img src="~/Images/home-showcase.png" />
</div><div class="panel panel-default"><div class="panel-heading">Artist Search</div><div class="panel-body">@using(Ajax.BeginForm("ArtistSearch","Home",new AjaxOptions{InsertionMode= InsertionMode.Replace,HttpMethod="GET",OnFailure="searchFailed",LoadingElementId="ajax-loader",UpdateTargetId="searchresults"})){<input type="text"  name="q" /><input type="submit" value="search" /><img id="ajax-loader" src="@Url.Content("~/Images/ajax-loader.gif")"  style="display:none"/>}<div id="searchresults"></div></div>
</div><ul class="row list-unstyled" id="album-list">@foreach (var album in Model){<li class="col-lg-2 col-md-2 col-sm-2 col-xs-4 container"><a href="@Url.Action("Details", "Store", new { id = album.AlbumId })"><img alt="@album.Title" src="@Url.Content( @album.AlbumArtUrl)" /><h4>@album.Title</h4></a></li>}
</ul><div id="dailydeal">@Ajax.ActionLink("Click here to see today's special","DailyDeal",null,new AjaxOptions
{UpdateTargetId = "dailydeal",InsertionMode = InsertionMode.Replace,HttpMethod= "GET"
},
new { @class = "btn btn-primary" })
</div>@section Scripts {<script src="~/Scripts/App/MusicScripts.js"></script><script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
}

11在HomeController里面增加ArtistSearch方法来处理请求

using Chapter8.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;namespace Chapter8.Controllers
{public class HomeController : Controller{private MusicStoreEntities storeDB = new MusicStoreEntities();// GET: Homepublic ActionResult Index(){var albums = GetTopSellingAlbums(2);return View(albums);}private List<Album> GetTopSellingAlbums(int count){return storeDB.Albums.OrderByDescending(s => s.OrderDetails.Count).Take(count).ToList();}public ActionResult DailyDeal(){var album = GetDailyDeal();return PartialView("_DailyDeal", album);}private object GetDailyDeal(){var album = storeDB.Albums.OrderBy(a => System.Guid.NewGuid()).First();album.Price *=0.5m;return album;}public ActionResult ArtistSearch(string q){var artists = GetArtist(q);return PartialView(artists);}private List<Artist> GetArtist(string searchstring){return storeDB.Artists.Where(a => a.Name.Contains(searchstring)).ToList();}}
}

12在Views/Home下面添加分部视图ArtistSearch.cshtml用于显示搜索结果

@model IEnumerable<Chapter8.Models.Artist><div id="searchResults"><ul>@foreach (var item in Model){<li>@item.Name</li>}</ul></div>

13.在项目中添加MaxWordsAttribute

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;namespace Chapter8
{public class MaxWordsAttribute : ValidationAttribute,IClientValidatable{public MaxWordsAttribute(int wordCount): base("Too many words in {0}"){WordCount = wordCount;}public int WordCount { get; set; }protected override ValidationResult IsValid(object value,ValidationContext validationContext){if (value != null){var wordCount = value.ToString().Split(' ').Length;if (wordCount > WordCount){return new ValidationResult(FormatErrorMessage(validationContext.DisplayName));}}return ValidationResult.Success;}public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context){var rule = new ModelClientValidationRule();rule.ErrorMessage = FormatErrorMessage(metadata.GetDisplayName());rule.ValidationParameters.Add("wordcount", WordCount);rule.ValidationType = "maxwords";yield return rule;}}
}

14.在Album的Title属性上添加MaxWords特性,增加特性后只会产生对应data-属性,验证要靠添加自定义JS来实现

using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;namespace MvcMusicStore.Models 
{public class Album {[ScaffoldColumn(false)]public int AlbumId { get; set; }public int GenreId { get; set; }public int ArtistId { get; set; }[Required][StringLength(160, MinimumLength = 2)][MaxWords(10)]public string Title { get; set; }[Required][Range(0.01, 100.00)][DataType(DataType.Currency)]public decimal Price { get; set; }[DisplayName("Album Art URL")][StringLength(1024)]public string AlbumArtUrl { get; set; }public virtual Genre Genre { get; set; }public virtual Artist Artist { get; set; }public virtual List<OrderDetail> OrderDetails { get; set; }}
}

 

15 基于Album模型类和MusicStoreEntities数据上下文新建AlbumsController控制器,并自动产生视图

16 通过nuget添加jquery,validation插件

17 在Scripts/App目录下新建CustomValidators.js

$.validator.unobtrusive.adapters.addSingleVal("maxwords", "wordcount");$.validator.addMethod("maxwords", function (value, element, maxwords) {if (value) {if (value.split(' ').length > maxwords) {return false;}}return true;
});

18在Views/Albums/Create.cshtml中添加jquery.validator和CustomValidators的引用

@model Chapter8.Models.Album@{ViewBag.Title = "Create";Layout = "~/Views/Shared/_Layout.cshtml";
}<h2>Create</h2>@using (Html.BeginForm())
{@Html.AntiForgeryToken()<div class="form-horizontal"><h4>Album</h4><hr />@Html.ValidationSummary(true, "", new { @class = "text-danger" })<div class="form-group">@Html.LabelFor(model => model.GenreId, "GenreId", htmlAttributes: new { @class = "control-label col-md-2" })<div class="col-md-10">@Html.DropDownList("GenreId", null, htmlAttributes: new { @class = "form-control" })@Html.ValidationMessageFor(model => model.GenreId, "", new { @class = "text-danger" })</div></div><div class="form-group">@Html.LabelFor(model => model.ArtistId, "ArtistId", htmlAttributes: new { @class = "control-label col-md-2" })<div class="col-md-10">@Html.DropDownList("ArtistId", null, htmlAttributes: new { @class = "form-control" })@Html.ValidationMessageFor(model => model.ArtistId, "", new { @class = "text-danger" })</div></div><div class="form-group">@Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" })<div class="col-md-10">@Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })@Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" })</div></div><div class="form-group">@Html.LabelFor(model => model.Price, htmlAttributes: new { @class = "control-label col-md-2" })<div class="col-md-10">@Html.EditorFor(model => model.Price, new { htmlAttributes = new { @class = "form-control" } })@Html.ValidationMessageFor(model => model.Price, "", new { @class = "text-danger" })</div></div><div class="form-group">@Html.LabelFor(model => model.AlbumArtUrl, htmlAttributes: new { @class = "control-label col-md-2" })<div class="col-md-10">@Html.EditorFor(model => model.AlbumArtUrl, new { htmlAttributes = new { @class = "form-control" } })@Html.ValidationMessageFor(model => model.AlbumArtUrl, "", new { @class = "text-danger" })</div></div><div class="form-group"><div class="col-md-offset-2 col-md-10"><input type="submit" value="Create" class="btn btn-default" /></div></div></div>
}<div>@Html.ActionLink("Back to List", "Index")
</div>@section Scripts {<script src="~/Scripts/jquery.validate.js"></script><script src="~/Scripts/jquery.validate.unobtrusive.js"></script><script src="~/Scripts/App/CustomValidators.js"></script>
}

18.运行,访问Albums/Create页面,当TiTle的长度(以空格隔开)大于设定长度,提示错误信息

19.通过nuget添加jquery.ui

20.修改MusicScripts.js

$(function () {$("#album-list img").mouseover(function () {//$(this).animate({ height: '+=25', width: '+=25' })//       .animate({ height: '-=25', width: '-=25' });//$(this).effect("bounce");$(this).effect("bounce", { time: 3, distance: 40 });});});

21 在index视图里面添加jquery.ui的引用

@{ViewBag.Title = "Home Page";
}<div class="jumbotron"><h1>MVC Music Store</h1><img src="~/Images/home-showcase.png" />
</div><div class="panel panel-default"><div class="panel-heading">Artist Search</div><div class="panel-body">@using (Ajax.BeginForm("ArtistSearch", "Home",new AjaxOptions{InsertionMode = InsertionMode.Replace,HttpMethod = "GET",OnFailure = "searchFailed",LoadingElementId = "ajax-loader",UpdateTargetId = "searchresults"})){<input type="text" name="q" /><input type="submit" value="search" /><img id="ajax-loader" src="@Url.Content("~/Images/ajax-loader.gif")" style="display:none" />}<div id="searchresults"></div></div>
</div><ul class="row list-unstyled" id="album-list">@foreach (var album in Model){<li class="col-lg-2 col-md-2 col-sm-2 col-xs-4 container"><a href="@Url.Action("Details", "Store", new { id = album.AlbumId })"><img alt="@album.Title" src="@Url.Content( @album.AlbumArtUrl)" /><h4>@album.Title</h4></a></li>}
</ul><div id="dailydeal">@Ajax.ActionLink("Click here to see today's special","DailyDeal",null,new AjaxOptions
{UpdateTargetId = "dailydeal",InsertionMode = InsertionMode.Replace,HttpMethod= "GET"
},
new { @class = "btn btn-primary" })
</div>@section Scripts {<script src="~/Scripts/jquery.unobtrusive-ajax.js"></script><script src="~/Scripts/jquery-ui-1.12.1.js"></script><script src="~/Scripts/App/MusicScripts.js"></script>}

22.运行,鼠标放到Album上面可以看到上下跳动的效果

24 在index视图上增加搜索框属性<input type="text" name="q" data-autocomplete-source="@Url.Action("QuickSearch","Home")" />

@{ViewBag.Title = "Home Page";
}<div class="jumbotron"><h1>MVC Music Store</h1><img src="~/Images/home-showcase.png" />
</div><div class="panel panel-default"><div class="panel-heading">Artist Search</div><div class="panel-body">@using (Ajax.BeginForm("ArtistSearch", "Home",new AjaxOptions{InsertionMode = InsertionMode.Replace,HttpMethod = "GET",OnFailure = "searchFailed",LoadingElementId = "ajax-loader",UpdateTargetId = "searchresults"})){<input type="text" name="q" data-autocomplete-source="@Url.Action("QuickSearch","Home")" /><input type="submit" value="search" /><img id="ajax-loader" src="@Url.Content("~/Images/ajax-loader.gif")" style="display:none" />}<div id="searchresults"></div></div>
</div><ul class="row list-unstyled" id="album-list">@foreach (var album in Model){<li class="col-lg-2 col-md-2 col-sm-2 col-xs-4 container"><a href="@Url.Action("Details", "Store", new { id = album.AlbumId })"><img alt="@album.Title" src="@Url.Content( @album.AlbumArtUrl)" /><h4>@album.Title</h4></a></li>}
</ul><div id="dailydeal">@Ajax.ActionLink("Click here to see today's special","DailyDeal",null,new AjaxOptions
{UpdateTargetId = "dailydeal",InsertionMode = InsertionMode.Replace,HttpMethod= "GET"
},
new { @class = "btn btn-primary" })
</div>@section Scripts {<script src="~/Scripts/jquery.unobtrusive-ajax.js"></script><script src="~/Scripts/jquery-ui-1.12.1.js"></script><script src="~/Scripts/App/MusicScripts.js"></script>}

25 在HomeController里面增加QuickSearch方法

using Chapter8.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;namespace Chapter8.Controllers
{public class HomeController : Controller{private MusicStoreEntities storeDB = new MusicStoreEntities();// GET: Homepublic ActionResult Index(){var albums = GetTopSellingAlbums(2);return View(albums);}private List<Album> GetTopSellingAlbums(int count){return storeDB.Albums.OrderByDescending(s => s.OrderDetails.Count).Take(count).ToList();}public ActionResult DailyDeal(){var album = GetDailyDeal();return PartialView("_DailyDeal", album);}private object GetDailyDeal(){var album = storeDB.Albums.OrderBy(a => System.Guid.NewGuid()).First();album.Price *=0.5m;return album;}public ActionResult ArtistSearch(string q){var artists = GetArtist(q);return PartialView(artists);}private List<Artist> GetArtist(string searchstring){return storeDB.Artists.Where(a => a.Name.Contains(searchstring)).ToList();}public ActionResult QuickSearch(string term){var artists = GetArtists(term).Select(a => new { value = a.Name });return Json(artists, JsonRequestBehavior.AllowGet);}private List<Artist> GetArtists(string searchstring){return storeDB.Artists.Where(a => a.Name.Contains(searchstring)).ToList();}}
}

 

26.在MusicStore.js中添加js代码

$(function () {$("#album-list img").mouseover(function () {//$(this).animate({ height: '+=25', width: '+=25' })//       .animate({ height: '-=25', width: '-=25' });//$(this).effect("bounce");$(this).effect("bounce", { time: 3, distance: 40 });});$("input[data-autocomplete-source]").each(function () {var target = $(this);target.autocomplete({ source: target.attr("data-autocomplete-source") });});});

27 运行,当在搜索框输入a时候,会自动弹出相关项目,从而实现自动完成功能


http://chatgpt.dhexx.cn/article/xoRI9ZhN.shtml

相关文章

音乐i网站

开发工具(eclipse/idea/vscode等)&#xff1a; 数据库(sqlite/mysql/sqlserver等)&#xff1a; 功能模块(请用文字描述&#xff0c;至少200字) &#xff1a;

musicbox(暂停/启动,停止,下一曲上一首)

主界面 按下开始 按下暂停 按下停止 下一首 上一首 代码 activity_main.xml <?xml version"1.0" encoding"utf-8"?> <LinearLayout xmlns:android"http://schemas.android.com/apk/res/android"android:orientation"vertical&…

node-webkit-MusicBox 基于nwjs ,html5 ,制作的音乐盒子

太长&#xff1f;单击目录直接去看最终效果&#xff0c;在最下边 文件下载地址&#xff1a;http://download.csdn.net/detail/u013934914/9180053 1.思路&#xff08;简单设想&#xff09; index.html 实现 对页面的显示&#xff0c;并调用绑定ymusic.js中的方法 需要&…

算数计算机音乐模拟器,Musicalculator

musicalculatorapp它是一个音乐旋律软件&#xff0c;在这上面你可以随时随地的记录你有灵感时创作出来的乐谱&#xff0c;还可以放好听的音色包进行自动的弹奏&#xff0c;还可以根据自己的想法设定速度音长&#xff0c;这一款非常的适合喜爱音乐的用户。该应用只是一款音乐计算…

HTML5 CSS3实战——自定义音乐播放器(一)

前几天才刚开始接触HTML5和CSS3。学习了一下里面的一些炫酷的新特性。不过&#xff0c;对于原生的HTML5的媒体播放器&#xff0c;真的不得不吐槽&#xff1a;就三个按钮 界面还那么丑。所以觉得自己整一个好看的播放器。老话说&#xff1a;说不如干&#xff0c;纸上谈兵终觉浅。…

NetEase MusicBox —— Linux系统里的网易云音乐(转载)

功能特性 320kbps的高品质音乐 歌曲&#xff0c;艺术家&#xff0c;专辑检索 网易 22 个歌曲排行榜 网易新碟推荐 网易精选歌单 网易 DJ 节目 私人歌单&#xff0c;每日推荐 随心打碟 本地收藏&#xff0c;随时加 ? 播放进度及播放模式显示 Vimer 式快捷键让操作丝般顺滑 可使…

MusicBox - 仿千千静听

大学毕业时业余之作 最新下载地址&#xff1a; 匿名提取文件连接 http://pickup.mofile.com/5412819180446197 或登录Mofile&#xff0c;使用提取码 5412819180446197 提取文件 MusicBox 停止开发&#xff01;&#xff01; 淘宝开卖源代码 有意者 http://item.taobao.co…

音乐播放器

用HTML做了个音乐播放器&#xff0c;可以循环播放&#xff0c;选择歌曲&#xff0c;以及自动播放下一首&#xff0c;运用了js和json知识&#xff0c;下面是效果图和源码&#xff0c;有兴趣的可以试试哦 效果图&#xff1a; 源码&#xff1a;html <span style"color:#9…

MusicPlay播放器

文章目录 一丶前端布局二丶Activity三丶Service实验演示 一丶前端布局 Layout的框架 一个自定义的音乐播放器&#xff0c;页面布局大致如下 二丶Activity 首先定义控件 // 获取界面中显示歌曲标题、作者文本框TextView title, author;// 喜欢&#xff0c;播放&#xff0c;暂…

MusicPlay 音乐播放器(纯前端)

纯Css,js前端音乐播放器,界面UI比较好。我特别喜欢,适合二次开发,调用了网易云第三方接口以及将歌曲链接导出可以访问的歌曲链接,实现了异步歌曲搜索播放,以及异步显示歌词等.结合html5 新特性实现歌曲暂停,下一首,快进等等.为大二前端练手项目.采用渐变质背景 是前端练手的好…

HTML5+JS实现简易的音乐播放器

HTML5JS实现简易的音乐播放器 播放器实现的功能 播放/暂停音乐切换歌曲&#xff0c;上/下一首歌音量最大或静音音乐播放时间实时变化进度条拖拽歌曲图片切换 播放器效果展示 代码展示 html <div class"musicBox" id"musicBox"><audio src"…

音乐播放器MusicBox

音乐播放器MusicBox 功能界面分析 界面要求较为简洁&#xff0c;仅需两个TextView&#xff0c;用于输出音乐名称及歌手姓名&#xff0c;下方三个ImageButton&#xff0c;用于播放&#xff0c;暂停或切换上一首&#xff0c;下一首歌曲。 实现 总体规划 在MainActivity中&a…

索尼音乐应用android,Sony Music Center

Sony Music Center是全新的索尼音乐中心也是原来的songpal应用&#xff0c;作为sony手机上面的专业播放器的软件&#xff0c;它能够为用户播放各种音乐上面的内容&#xff0c;它可以直接的为用户解析各种音乐的内容&#xff0c;让用户能够随时的在手机上面收听到自己所喜欢的无…

MusicLibrary:一个丰富的音乐播放封装库

code小生,一个专注 Android 领域的技术分享平台 作者&#xff1a;lizixian18链接&#xff1a;https://github.com/lizixian18/MusicLibrary声明&#xff1a;本文是 lizixian18 投稿,转载等请联系作者获得授权。 MusicLibrary 一个丰富的音乐播放封装库&#xff0c;针对快速集成…

MusicBox

MusicBox 编写音乐盒代码&#xff0c;并添加音乐播放的 上一首 和 下一首 控制。 1.添加所需的图片以及音乐文件&#xff1b; 2.编写xml文件&#xff0c;上一首、下一首、暂停、播放按钮以及歌曲的名字和作者 <?xml version"1.0" encoding"utf-8"?&…

Musicplayer

Musicplayer Python 音乐播放器 功能&#xff1a; 首先可以实现本地音乐的播放&#xff0c;能够打开电脑端的文件&#xff0c;文件中进行多选&#xff0c;实现暂停、上一曲、下一曲的功能。在此基础上&#xff0c;完成随机播放列表和网络端下载的功能。 设计方法&#xff1a; 本…

MusicBox(音乐播放器)

这两天做了一个小型的音乐播放器&#xff0c;基本功能都已实现&#xff0c;同时也让我对CSliderCtrl&#xff0c;MCI_OPEN_PARMS以及控件之间的消息映射&#xff0c;数据转换等有了更深入的理解&#xff0c;下面是自己编程的详细过程&#xff1a; 1 首先将控件的位置都摆好&a…

musicbox使用方法_使用Pi MusicBox收听流音乐

musicbox使用方法 在用Raspberry Pi 控制圣诞树灯的项目完成之后&#xff0c;下一个项目是什么&#xff1f; 我最终开始尝试使用Pi Musicbox进行修补&#xff0c;这是Mopidy的Raspbian的一种版本 &#xff0c;它允许用户在“无头”的Raspberry Pi上播放各种流媒体服务&#xff…

推荐一个高大上的网易云音乐命令行播放工具:musicbox

网易云音乐上有很多适合程序猿的歌单&#xff0c;但是今天文章介绍的不是这些适合程序员工作时听的歌&#xff0c;而是一个用Python开发的开源播放器&#xff0c;专门适用于网易云音乐的播放。这个播放器的名称为MusicBox, 特色是用命令行版本执行音乐的播放。 github地址&…

移动开发技术(三)MusicBox

实验要求 使用广播机制&#xff0c;编写音乐盒代码&#xff0c;添加音乐播放的播放、暂停、停止、上一首和下一首控制 实验步骤 一、布局设置 添加一个LinearLayout&#xff0c;选择垂直分布。在里面添加两个LinearLayout&#xff1a; ①music_show&#xff1a;用于展示图片…