• Stars
    star
    557
  • Rank 79,968 (Top 2 %)
  • Language
    PHP
  • License
    GNU Affero Genera...
  • Created over 11 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐ŸŽถ Music app for ownCloud

README

Scrutinizer Code Quality

logotype

Overview

Music player and server for ownCloud and Nextcloud. Shows audio files stored in your cloud categorized by artists and albums. Supports mp3, and depending on the browser, many other audio formats too. Supports shuffle play and playlists. The Music app also allows serving audio files from your cloud to external applications which are compatible either with Ampache or Subsonic.

The full-screen albums view: library view

Music player embedded into the files view: files view

Integration with the media control panel in Chrome: Chrome media control panel

Mobile layout and media control integration to the lock screen and notification center with Chrome on Android: Mobile layout Android lock screen Android notification center

Supported formats

  • MP3 (audio/mpeg)
  • FLAC (audio/flac)
  • Vorbis in OGG container (audio/ogg)
  • Opus in OGG container (audio/ogg or audio/opus)
  • WAV (audio/wav)
  • AAC in M4A container (audio/mp4)
  • ALAC in M4A container (audio/mp4)
  • M4B (audio/m4b)
  • AAC (audio/aac)
  • AIFF (audio/aiff)
  • AU (audio/basic)
  • CAF (audio/x-caf)

Note: The audio formats supported vary depending on the browser. Most recents versions of Chrome, Firefox and Edge should be able to play all the formats listed above. All browsers should be able to play at least the MP3 files.

Detail

The modern web browsers ship with a wide variety of built-in audio codecs which can be used directly via the standard HTML5 audio API. Still, there is no browser which could natively play all the formats listed above. For those formats not supported natively, the Music app utilizes the Aurora.js javascript library which is able to play most of the formats listed above, excluding only the OGG containers. On the other hand, Aurora.js may not be able to play all the individual files of the supported formats and is very limited in features (no seeking, no adjusting of playback speed).

Note: In order to be playable in the Music app, the file type has to be mapped to a MIME type audio/* on your cloud instance. Neither ownCloud nor Nextcloud has these mappings by default for the file types AAC, AIFF, AU, or CAF. To add these mappings, run:

./occ music:register-mime-types

Usage hints

Normally, the Music app detects any new audio files in the filesystem on application start and scans metadata from those to its database tables when the user clicks the prompt. The Music app also detects file removals and modifications on the background and makes the required database changes automatically.

If the database would somehow get corrupted, the user can force it to be rebuilt from scratch by opening the Settings (at the bottom of the left pane) and clicking the option "Reset music collection".

Commands

If preferred, it is also possible to use the command line tool for the database maintenance as described below. This may be quicker than scanning via the web UI in case of large music library, and optionally allows targeting more than one user at once.

Following commands are available(see script occ in your ownCloud root folder):

Scan music files

Scan all audio files not already indexed in the database. Extract metadata from those and insert it to the database. Target either specified user(s) or user group(s) or all users.

./occ music:scan USERNAME1 USERNAME2 ...
./occ music:scan --group=USERGROUP1 --group==USERGROUP2 ...
./occ music:scan --all

All the above commands can be combined with the --debug switch, which enables debug output and shows the memory usage of each scan step.

You can also supply the option --rescan to scan also the files which are already part of the collection. This might be necessary, if some file update has been missed by the app because of some bug or because the admin has temporarily disabled the app.

Lastly, you can give option --clean-obsolete to make the process check all the previously scanned files, and clean up those which are no longer found. Again, this is usually handled automatically, but manually running the command could be necessary on some special cases.

Reset scanned metadata

Reset all data stored to the music database. Target either specified user(s) or user group(s) or all users.

Warning: This command will erase user-created data! It will remove all playlists as playlists are linked against the track metadata.

./occ music:reset-database USERNAME1 USERNAME2 ...
./occ music:reset-database --group=USERGROUP1 --group==USERGROUP2 ...
./occ music:reset-database --all

Reset cache

Music app caches some results for performance reasons. Normally, there should be no reason to reset this cache manually, but it might be desiredable e.g. when running performance tests. Target either specified user(s) or user group(s) or all users.

./occ music:reset-cache USERNAME1 USERNAME2 ...
./occ music:reset-cache --group=USERGROUP1 --group==USERGROUP2 ...
./occ music:reset-cache --all

Ampache and Subsonic

The URL you need to connect with an Ampache-compatible player is listed in the settings and looks like this:

https://cloud.domain.org/index.php/apps/music/ampache

This is the common path. Most clients append the last part (/server/xml.server.php) automatically. If you have connection problems, try the longer version of the URL with the /server/xml.server.php appended.

Similarly, the URL used to connect with a Subsonic-compatible player is listed in the settings and looks like this:

https://cloud.domain.org/index.php/apps/music/subsonic

Authentication

Ampache and Subsonic don't use your ownCloud password for authentication. Instead, you need to use a specifically generated APIKEY with them. The APIKEY is generated through the Music app settings accessible from the link at the bottom of the left pane within the app. The generated APIKEY is shown upon creation but it is impossible to retrieve it at later time. If you forget or misplace the key, you can always delete it and generate a new one.

When you create the APIKEY, the application shows also the username you should use on your Ampache/Subsonic client. Typically, this is your ownCloud login name but it may also be an UUID in case you have set up LDAP authentication.

Installation

The Music app can be installed using the App Management available on the web UI of ownCloud or Nextcloud for the admin user.

After installation, you may want to select a specific sub-folder containing your music files through the settings of the application. This can be useful to prevent unwanted audio files to be included in the music library.

Known issues

Huge music collections

The application's scalability for large music collections has gradually improved as new versions have been released. Still, if the collection is large enough, the application may fail to load. The maximum number of tracks supported depends on your server but should be more than 50'000. Also, when there are tens of thousands of tracks, you may notice slow down of the web UI.

Translations

There exist partial translations for the Music app for many languages, but most of them are very much incomplete. In the past, the application was translated at https://www.transifex.com/owncloud-org/owncloud/ and the resource still exists there. However, large majoriry of the strings used in the app have not been picked by Transifex for many years now, and hence the translations from Transifex cannot be actually used. The root cause is disparity in the localization mechanisms used in the Music app and on ownCloud in general, and bridging the gap would require some support from ownCloud core team. This is probably never going to happen, see https://central.owncloud.org/t/owncloud-music-app-translations/14881. For now, you may contribute translations as normal pull requests, by following the instructions from #671 (comment).

SMB shares

The Music app may be unable to extract metadata of the files residing on a SMB share. This is because, on some system configurations, it is not possible to use fseek() function to seek within the remote files on the SMB share. The getID3 library used for metadata extraction depends on fseek() and will fail on such systems. If the metadata extraction fails, the Music app falls back to deducing the track names from the file names and the album names from the folder names. Whether or not the probelm exists on a system, may depend on the details of the SMB support library on the host computer and the remote computer providing the share.

Development

Build frontend bundle

All the frontend javascript sources of the Music app, including the used vendor libraries, are bundled into a single file for deployment using webpack. This bundle file is dist/webpack.app.js. Similarly, all the style files of the Music app are bundled into dist/webpack.app.css. Downloading the vendor libraries and generating these bundles requires the npm utility, and happens by running:

cd build
npm install --deps
npm run build

The command above builds the minified production version of the bundle. To build the development version, use

npm run build-dev

To automatically regenerate the development mode bundles whenever the source .js/.css files change, use

npm run watch

Build delivery package

To build the release zip package, run the following commands. This requires the make and zip command line utilities.

cd build
make release

Install test dependencies

To install test dependencies, run the following command on the root level of the project:

composer install

Run tests

Static analysis with PHPStan

composer run-script analyze

PHP unit tests

composer run-script unit-tests

PHP integration tests

The integration tests require the music app to be installed under the apps folder of an ownCloud or Nextcloud installation. The following steps assume that the cloud installation in question has not been taken into use yet, e.g. it's a fresh clone from github.

cd ../..          # owncloud/nextcloud core
./occ maintenance:install --admin-user admin --admin-pass admin --database sqlite
./occ app:enable music
cd apps/music
composer run-script integration-tests

Behat acceptance tests

cd tests
cp behat.yml.dist behat.yml
# add cloud URL and credentials for Ampache and Subsonic APIs to behat.yml
../vendor/bin/behat

For the acceptance tests, you need to upload all the tracks from the following zip file to your cloud instance: https://github.com/paulijar/music/files/2364060/testcontent.zip

API

The Music app back-end implements the Shiva API except the resources /artists/<int:artist_id>/shows, /tracks/<int:track_id>/lyrics and the meta resources. You can use this API under https://own.cloud.example.org/index.php/apps/music/api/.

However, the front-end of the Music app nowadays doesn't use any part of the Shiva API. Instead, the following proprietary REST endpoints are used:

  • /api/log
  • /api/prepare_collection
  • /api/collection
  • /api/folders
  • /api/genres
  • /api/file/{fileId}
  • /api/file/{fileId}/download
  • /api/file/{fileId}/path
  • /api/file/{fileId}/info
  • /api/file/{fileId}/details
  • /api/scanstate
  • /api/scan
  • /api/resetscanned
  • /api/cover/{hash}
  • /api/artist/{artistId}/cover
  • /api/artist/{artistId}/details
  • /api/artist/{artistId}/similar
  • /api/album/{albumId}/cover
  • /api/album/{albumId}/details
  • /api/share/{token}/{fileId}/info
  • /api/share/{token}/{fileId}/parse
  • Playlist API at /api/playlists/*
  • Radio API at /api/radio/*
  • Podcast API at /api/podcasts/*
  • Settings API at /api/settings/*

To connect external client applications, partial implementations of the following APIs are available:

/api/log

Allows to log a message to ownCloud defined log system.

POST /api/log

Parameters:

{
	"message": "The message to log"
}

Response:

{
	"success": true
}

/api/collection

Returns all artists with nested albums and each album with nested tracks. Each track carries a file ID which can be used to obtain the file path with /api/file/{fileId}/path. The front-end converts the path into playable WebDAV link like this: OC.linkToRemoteBase('webdav') + path.

GET /api/collection

Response:

[
	{
		"id": 2,
		"name": "Blind Guardian",
		"albums": [
			{
				"name": "Nightfall in Middle-Earth",
				"year": 1998,
				"disk" : 1,
				"cover": "/index.php/apps/music/api/album/16/cover",
				"id": 16,
				"tracks": [
					{
						"title": "A Dark Passage",
						"number": 21,
						"artistName": "Blind Guardian",
						"artistId": 2,
						"files": {
							"audio/mpeg": 1001
						},
						"id": 202
					},
					{
						"title": "Battle of Sudden Flame",
						"number": 12,
						"artistName": "Blind Guardian",
						"artistId": 2,
						"files": {
							"audio/mpeg": 1002
						},
						"id": 212
					}
				]
			}
		]
	},
	{
		"id": 3,
		"name": "blink-182",
		"albums": [
			{
				"name": "Stay Together for the Kids",
				"year": 2002,
				"disk" : 1,
				"cover": "/index.php/apps/music/api/album/22/cover",
				"id": 22,
				"tracks": [
					{
						"title": "Stay Together for the Kids",
						"number": 1,
						"artistName": "blink-182",
						"artistId": 3,
						"files": {
							"audio/ogg": 1051
						},
						"id": 243
					},
					{
						"title": "The Rock Show (live)",
						"number": 2,
						"artistName": "blink-182",
						"artistId": 3,
						"files": {
							"audio/ogg": 1052
						},
						"id": 244
					}
				]
			}
		]
	}
]

Creating APIKEY for Subsonic/Ampache

The endpoint /api/settings/userkey/generate may be used to programatically generate a random password to be used with an Ampache or a Subsonic client. The endpoint expects two parameters, length and description (both optional) and returns a JSON response. Please note that the minimum password length is 10 characters. The HTTP return codes represent also the status of the request.

POST /api/settings/userkey/generate

Parameters:

{
	"length": <length>,
	"description": <description>
}

Response (success):

HTTP/1.1 201 Created

{
	"id": <userkey_id>,
	"password": <random_password>,
	"description": <description>
}

Response (error - no description provided):

HTTP/1.1 400 Bad request

{
	"message": "Please provide a description"
}

Response (error - error while saving password):

HTTP/1.1 500 Internal Server Error

{
	"message": "Error while saving the credentials"
}

More Repositories

1

core

โ˜๏ธ ownCloud web server core (Files, DAV, etc.)
PHP
8,113
star
2

android

โ˜Ž๏ธ The ownCloud Android App
Kotlin
3,834
star
3

client

๐Ÿ–ฅ๏ธ Desktop Syncing Client for ownCloud
C++
1,397
star
4

ocis

โš›๏ธ ownCloud Infinite Scale Stack
Go
1,344
star
5

ios-legacy

๐Ÿ“ฑ iOS app for ownCloud
Objective-C
628
star
6

web

๐Ÿฒ Next generation frontend for ownCloud Infinite Scale
TypeScript
432
star
7

pyocclient

ownCloud client library for Python
Python
280
star
8

ios-app

๐Ÿ“ฑThe all-new iOS app for ownCloud
Swift
214
star
9

notes

๐Ÿ“” Notes app for ownCloud
Starlark
196
star
10

tasks

โœ… Tasks app for ownCloud
JavaScript
183
star
11

calendar

Calendar app for ownCloud
JavaScript
121
star
12

richdocuments

๐Ÿ“” Collabora Online for ownCloud
JavaScript
116
star
13

android-library

โ˜Ž๏ธ The ownCloud Android Library
Kotlin
111
star
14

notes-iOS-App

๐Ÿ““
Swift
98
star
15

gallery

๐ŸŒ… Gallery app for ownCloud, which includes previews for all supported media files
JavaScript
88
star
16

ios-library

Objective-C
79
star
17

contacts

๐Ÿ‘ฅ Manage your CardDAV contacts from a feature-rich web-interface
JavaScript
75
star
18

owncloud-sdk

โ˜๏ธ ownCloud client library for JavaScript
JavaScript
75
star
19

news-iOS-App

The iOS News App
Objective-C
59
star
20

docs

ownCloud Documentation (v2)
JavaScript
55
star
21

administration

Some Administration tools for ownCloud
Shell
54
star
22

davclient.js

WebDAV, CalDAV and CardDAV client for javascript
JavaScript
51
star
23

files_antivirus

๐Ÿ‘พ virus scanner for ownCloud
JavaScript
47
star
24

ocis-charts

๐Ÿ“ˆ Helm Charts for ownCloud's OCIS
Mustache
45
star
25

files_external_gdrive

GDrive external storage for ownCloud
PHP
42
star
26

activity

โšก Activity app for ownCloud
PHP
33
star
27

oauth2

๐Ÿ” Application for using OAuth 2.0 in ownCloud
PHP
32
star
28

files_videoplayer

CSS
29
star
29

owncloud-design-system

๐ŸŽจ A pattern library for ownCloud for Vue.js
Vue
26
star
30

updater

PHP
25
star
31

files_mediaviewer

Viewer for pictures and videos integrated in the files app
JavaScript
22
star
32

encryption

๐Ÿ” server side encryption of files
PHP
19
star
33

theme-example

CSS
19
star
34

files_texteditor

JavaScript
18
star
35

files_pdfviewer

Starlark
17
star
36

user_ldap

๐Ÿ“’
PHP
17
star
37

OwncloudUniversal

Owncloud-Client for Windows Phones (Win10Mobile) or PCs
C#
16
star
38

files_primary_s3

๐Ÿ“ฆ S3 compatible Storage
Starlark
15
star
39

QA

๐Ÿ’ฅ public test plans for owncloud components and apps
Shell
14
star
40

announcementcenter

๐Ÿ“ข Announcement Center for ownCloud
PHP
13
star
41

files_external_dropbox

๐Ÿ“ฆ App for Integration of Dropbox
Starlark
13
star
42

market

๐Ÿช MarketPlace integration
JavaScript
13
star
43

impersonate

Allow administrators to become a different user
Starlark
12
star
44

owncloud.github.io

Developer documentation for ownCloud Infinite Scale
CSS
12
star
45

notifications

๐Ÿ”” Notifications app for ownCloud
PHP
12
star
46

docs-server

ownCloud Server Documentation
Shell
12
star
47

ios-sdk

๐Ÿ“ฑ ๐Ÿ“ฆ iOS SDK for ownCloud
Objective-C
10
star
48

ocis-hello

โš›๏ธ Example extension for oCIS
Go
10
star
49

cdperf

โš›๏ธ ownCloud cloud performance test
TypeScript
10
star
50

files_external_ftp

Flysystem based ftp backend for ownCloud
Starlark
10
star
51

twofactor_totp

๐Ÿ”‘ Second factor TOTP (Google Authenticator) provider for ownCloud
PHP
9
star
52

files_external_s3

Starlark
9
star
53

docs-ocis

ownCloud oCis Admin Documentation
JavaScript
8
star
54

customgroups

Let users create their own custom groups
PHP
8
star
55

security-advisories

PHP
8
star
56

search_elastic

Elasticsearch based full text search
PHP
8
star
57

docs-ui

Custom Antora UI theme for the official ownCloud documentation.
CSS
8
star
58

templateeditor

Mail Template Editor is discontinued. Use theming to customize mail templates.
Starlark
7
star
59

protoc-gen-microweb

Protoc generator for Micro web services
Go
7
star
60

data_exporter

Export/Import for ownCloud user data
PHP
7
star
61

guests

๐Ÿ‘ช Share with externals easily via email address
JavaScript
6
star
62

openidconnect

OpenId Connect (OIDC) Integration for ownCloud
PHP
6
star
63

diagnostics

๐Ÿฅ Collect request data and measure performance
Starlark
6
star
64

craft-blueprints-owncloud

Python
6
star
65

brute_force_protection

Brute-force protection app for ownCloud
PHP
6
star
66

password_policy

๐Ÿ›ก๏ธ Define password policies for user and public link passwords
Gherkin
6
star
67

firstrunwizard

JavaScript
5
star
68

docs-client-desktop

ownCloud Desktop Client Documentation
Shell
5
star
69

twofactor_email

PHP
5
star
70

docs-webui

ownCloud Server Documentation
Shell
5
star
71

file-picker

Integrate ownCloud into your own product
Vue
5
star
72

coding-standard

๐Ÿ“šProvides the ownCloud coding standard
PHP
4
star
73

docs-client-android

ownCloud Android Documentation
JavaScript
4
star
74

twofactor_backup_codes

Starlark
4
star
75

files_paperhive

PaperHive integration with ownCloud
Starlark
4
star
76

ocis-reva

๐Ÿ”„ reva integration for oCIS
Go
4
star
77

qnap-packaging

Shell
4
star
78

owncloud-client-binary

some precompiled desktop-client parts to simplify packaging. not intended for end-users
4
star
79

ocis-proxy

๐ŸŒ‰ Reverse proxy for oCIS
Go
4
star
80

testing

๐Ÿ”ง app for testing ownCloud
PHP
3
star
81

moodle-repository_ocis

PHP
3
star
82

external

This app allows to list external web sites in the navigation menu
JavaScript
3
star
83

docs-client-ios-app

ownCloud iOS App Documentation
JavaScript
3
star
84

example-files

Some example files for the user home skeleton
Makefile
3
star
85

helm-charts

3
star
86

test-data

A repository for test data to find bugs. Please only upload CC and free content.
PHP
3
star
87

user_external

User backend using IMAP, SMB or FTP
Starlark
3
star
88

ios-scenario-testing

๐Ÿ“ฑ โš™๏ธ iOS scenario testing using feature files. Gherkin language, Cucumber as tool and Appium interaction with devices/emulators
Java
3
star
89

ocis-wopiserver

โš›๏ธ ownCloud Infinite Scale WOPI server
Go
3
star
90

libre-graph-api

โ˜๏ธ Libre Graph Cloud Collaboration API
Mustache
3
star
91

ocis-ocs

โš›๏ธ Serve OCS API for oCIS
Go
3
star
92

ocis-phoenix

โš›๏ธ Serve Phoenix for oCIS
Go
3
star
93

web-app-dicom-viewer

ownCloud Web DICOM Viewer is an extension of ownCloud Web to preview DICOM files (medical images and their corresponding metadata)
TypeScript
3
star
94

ocis-php-sdk

PHP
3
star
95

client-desktop-shell-integration-nautilus

๐Ÿ–ฅ๏ธ๐Ÿš
Python
2
star
96

docs-main

Shell
2
star
97

docs-client-branding

ownCloud Branding Documentation
Shell
2
star
98

configreport

Starlark
2
star
99

screenshots

Screenshots of ownCloud software
2
star
100

libre-graph-api-go

generated go SDK for the open graph api
Shell
2
star