GithubHelp home page GithubHelp logo

blumia / private-cloud-music Goto Github PK

View Code? Open in Web Editor NEW
42.0 10.0 11.0 117 KB

Private Cloud Music - a really simple and easy-to-use online music player.

License: MIT License

PHP 7.80% JavaScript 33.56% CSS 50.99% HTML 7.65%
music self-hosting selfhosted music-player music-streaming webapplication

private-cloud-music's Introduction

Private Cloud Music

What's this?

Getting tired copy the music file to your phone, your iTouch, your MP3 player and other device everytime when you leave your personal computer? Why not copy them to your personal cloud and enjoy them everywhere?

This is a really tinny simple web-app for user who want to listen music on his/her server conveniently. just require a server which can host php! Then just simply upload this web-app and your mp3 files, it's done.

How to deploy?

Download the source code, Upload them to a server can run php and place to the right path, then create folder at that path and upload your mp3 into it. Done!

Easy! right?

Customization?

  • index.html UI
    You can modify index.html if you want some little change. If you wanna more changes or wanna do this on your own, modify index-fast.html . Also, create one from scratch is also okay, remember import player.js , add <audio> element, and two elements with id playlist and folderlist .
  • player.js Logic
    Default folder (if not provide a folder name in URL) we open will be the first avaliable folder. Change the value of Player.path if you wanna "imperial" a folder(name end with a / ). Other logic just read the code yourself and modify as you like.
  • api.php Logic
    All two kinds of requests send to here. See it yourself. All request simply return as json contains the most important informations you need. You can do this with any programming language you love, create one and replace api.php , then replace all api.php inside player.js to let request goes to the right place.

LICENCE

MIT


私有云音乐

这什么玩意儿?

每次去个什么地方都得把自己私藏的洗脑mp3拷到各种要带设备?还不如传自己服务器上自己爱怎么听怎么听。服务器有了,差个web-app?用我这个啊:D

这个web-app是一个非常轻巧简单易部署的云音乐网页应用。只需要一个兹磁php的服务器就能用辣!传上去这个repo的代码,然后同目录搞几个文件夹放你想到处听的歌,就完事儿辣!

这玩意儿怎么用?

下载代码,然后传到你的能跑php的服务器上,同路径创建几个文件夹上传你的私藏mp3,就完事儿辣!

能魔改嘛?

当然啦!尽量保持代码和结构简单的目的就在于保持“方便部署”和“方便魔改”的特点。代码基本打开之后看两眼就知道是怎么回事儿了,不懂代码?下面有一些简单帮助:

  • 网页前端略丑啊这个 index.html
    你可以用你任意喜欢的编辑器编辑 index.html 修改成你要的效果,当然如果你想大改,还是从 index-fast.html 改起比较好。当然,你也可以完全自己写前端页面,别忘了,除了导入 player.js 之外,网页一定要有一个 <audio> 标签,以及两个id分别为 playlistfolderlist 的元素(这里是列表组)。
  • 钦定更多逻辑吼吗? player.js
    如果你没有从URL钦定一个文件夹的话,你打开网页后会默认载入第一个可用的文件夹。如果你想钦定一个文件夹,直接修改 Player.path 的值为你要钦定的文件夹就好(文件夹名称末尾需要有一个 / 结尾)。其它针对这个文件的定制基本都是改源码逻辑的,所以你至少得能看懂js,然后改就是了。
  • 请求都去哪了 api.php
    所有的请求都会发送到 api.php ,且所有的请求返回值都是一个包含着你肯定需要用到的内容的json。详细内容自己看看就清楚。当然,你也可以用任意你喜欢的语言实现这个文件本身的功能,并替代这个文件。别忘了去 player.js 中替换所有发送到 api.php 的请求到正确的地方就好。

协议?

MIT

private-cloud-music's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

private-cloud-music's Issues

Feature Request: Basic Login

Thanks for this great web-app!

Is there any chance that you will implement a basic login to avoid exposing the music to the public ?
Ideally, you also prevent search engines from accessing the individual song-files.

Private Cloud Music API struct (Chinese)

Private Cloud Music API 结构说明 征求意见稿

设计理念和简要说明

Private Cloud Music (以下简称PCM) 设计上最初是为了便于可以极度方便快速的部署自己的在线私有云音乐播放 web-app ,而日常使用有了一些新的需求,于是希望有个确定且合理的 API 结构,以便日后修改和使用。新的需求大概如下:

  • 确立一套明确的API标准,可将一个 PCM API 地址作为一个“源”使用。
  • 为了保持任何步骤都足够简单,不能使用影响简易使用的程度的技术。
  • 对于文件夹形式的结构,可能需要允许支持子文件夹。
  • 可能需要支持文件上传和文件夹管理
  • 可以开发便于使用的客户端
  • 允许绝对的私有

详细解释

可将 PCM API 地址作为一个“源”使用

可能有更多人使用且希望分享自己的云音乐给同样在使用这个应用的人,如果具备一个统一的“协议”,那么就可以将私有云音乐功能作为一个“源”来使用。另一方面,计划有开发一个通用的客户端便于用户使用,用户只要使用或兼容 PCM API 就可以直接使用客户端访问和使用自己的云音乐,于是需要确立一套明确的API标准。

保持简单

尽可能保持使用上的简单(Simple & Stupid),如此做会牺牲掉一些本身更惯用的做法。比如没有选则正宗的RESTful,使用 url 路由以避免需要额外的设置htaccess重定向,以及 web-app 的前端只使用了 Plain-JS 等。

因为设计上本身是以 API 为主的,尽量简单的 API 以便用户可以非常快速的使用其它语言实现对 PCM API 的支持而不仅仅局限于现有的 php 版本后端,于是 API 在设计上本身也应该在保持合理的情况下保持简单。

支持子文件夹

现有的版本只支持一层文件夹内的所有文件夹作为播放列表,而播放列表内如果存在子文件夹则直接忽略。虽然设计上本身是不允许扫子文件夹作为列表的(文件名即唯一键),但实际支持子文件夹似乎也是个不错的主意,待考虑。

文件上传和文件夹管理

如果开发客户端,文件上传和文件管理的确可以方便的省去每次都开 scp/ftp 上传管理文件的事。但如果用户本身不是源的所有者,应该不允许文件管理操作。如果实现,会通过密码参数区别。但对于基本的客户端,文件管理相关的 API 应该是可选实现的(作为存粹的源的“阅读”器)。

便于开发客户端

客户端本身为了解决用户每次都需要重新去服务器刷新和下载乐曲文件的问题,以便脱机工作。也可以增加文件管理和本地列表创建(播放列表不同于服务器端的文件夹内的文件列表)等特性以便于使用。另外需要确定 API 的合理性以便更新不会导致 API 变动而使得旧的源失效。另外, API 设计上也应该具备可拓展性以便于用户自身的需求,但基本功能的 API 应该一致。

允许绝对私有

因为是私有云音乐,或许有得用户不希望所有人都能看到里面的内容,于是可以允许用户访问云音乐时输入密码,如果正确才能加载列表使用功能。

待讨论内容

基本API内容

现有的 API 使用一个接口处理所有的行为请求,使用 do 参数区别行为并做出响应。

任何 PCM API 兼容的后端实现应该至少兼容基本 API 内容。

作为最基础的功能, 取得文件夹列表取得文件夹内的音频文件列表 应该为 PCM 的最根本的 API 。分别为:

取得文件夹列表:

参数
do getfolders

返回:

{
	"status": 200,
	"message": "OK",
	"result":{
		"type": "folderList",
		"data": [
			"Folder1", "Folder2", "Folder3"
		]
	}
}

取得文件夹内的音频文件列表

参数
do getplaylist
folder 文件夹名称(uriencoded string, end with '/')

返回:

{
	"status": 200,
	"message": "OK",
	"result":{
		"type": "fileList",
		"data": [
			{
				"fileName": "FileName.mp3",
				"fileSize": 123123123,
				"modifiedTime": "1313065072"
			},
			{
				"fileName": "FileName2.wav",
				"fileSize": 123123123,
				"modifiedTime": "1313065072"
			}
		]
	}
}

待议:
(?) 对于多层文件夹,允许传递 “Folder/Subfolder/” 获得子文件夹的内容
(?) 返回的值应当怎样呈现该路径下存在的子文件夹和音频文件(对于getplaylist请求的响应是否合理)?
(?) 允许绝对私有的情况下,是否应当对于每个请求都传递一个 password (或叫 token) 参数?

扩展API内容

扩展 API 可以选择被实现或否, API 内容不影响最基础功能的使用。

以下 API 暂时均未且暂不打算在 v1 版本的php实现中实现。

文件夹创建

参数
do creatfolder
folder 文件夹名称(uriencoded string, end with '/')

文件上传

参数
do upload
folder 文件夹名称(uriencoded string, end with '/')
file 要上传的文件

文件删除

参数
do remove
folder 文件夹名称(uriencoded string, end with '/')
filename 要删除的文件名称(uriencoded string)

(?) 是否应该具备一个 API 查询该实现对 PCM API 的支持情况,比如当前API兼容的版本,是否支持文件管理等扩展API。
(?) 这些扩展 API 是否合理,应当怎样响应这些请求。

作为源

作为源,应该以怎样的形式允许添加源更合理?预想必须包含的信息内容可能有:

  • 源地址(处理所有请求的API地址)
  • 密码(本地维护,用于请求时传递)
  • API版本(便于兼容判断 ?)
  • 扩展API支持情况(是否与上一条重复?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.