Merge branch 'develop'
This commit is contained in:
commit
f63d0efb32
162
CHANGELOG
162
CHANGELOG
|
@ -10,6 +10,168 @@ This changelog is viewable on the web at https://docs.funkwhale.audio/changelog.
|
||||||
|
|
||||||
.. towncrier
|
.. towncrier
|
||||||
|
|
||||||
|
1.1 (unreleased)
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Upgrade instructions are available at
|
||||||
|
https://docs.funkwhale.audio/admin/upgrading.html
|
||||||
|
|
||||||
|
Enhancements:
|
||||||
|
|
||||||
|
- Add number of tracks and discs of an album to API (#1238)
|
||||||
|
- Add spacing after "Play all" button in playlist view (!1271)
|
||||||
|
- Added a ListenBrainz plugin to submit listenings
|
||||||
|
- Added ability to choose fediverse addresses from channel subscription page/podcast screen (#1294)
|
||||||
|
- Added new search functions to allow users to more easily search for podcasts in the UI.
|
||||||
|
- Added padding to volume slider to ease mouse control (#1241)
|
||||||
|
- Logarithmic scale for volume slider (#1222)
|
||||||
|
- More user-friendly subsonic tokens (#1269)
|
||||||
|
- Remove manual entry of Import Reference on front-end import (#1284)
|
||||||
|
- Support AIFF file format (#1243)
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
|
||||||
|
- "Add check for empty/null covers (#1281)"
|
||||||
|
- Added an album filter to fix problem where channel entries would show up in the wrong series (#1282)
|
||||||
|
- Avoid broken Faker version (#1323)
|
||||||
|
- Changed audio format detection to happen via sniffing and not file extensions (#1274)
|
||||||
|
- Changed default behaviour of channel entries to use channel artwork if no entry artwork available (#1289)
|
||||||
|
- Fix delete library modal closing immediately (#1272)
|
||||||
|
- Fix public shared remote library radio button being disabled (#1292)
|
||||||
|
- Fixed an issue that prevented disabling plugins
|
||||||
|
- Fixed an issue where channel albums don't show up in the album search (#1300)
|
||||||
|
- Fixed an issue where modals would prevent users being able to interact with channels (#1295)
|
||||||
|
- Update MediaSession metadata for initially loaded track (#1252)
|
||||||
|
- Update playback position slider also when track is paused (#1266)
|
||||||
|
- Fixed follows from Pleroma with custom Emoji as Tag by ignoring not supported tag types #1342
|
||||||
|
- Update pleroma JSON-LD Schema (#1341)
|
||||||
|
- Pin twisted version to 20.3.0
|
||||||
|
|
||||||
|
Contributors to this release (development, documentation, reviews):
|
||||||
|
|
||||||
|
Adam Novak
|
||||||
|
Agate
|
||||||
|
alemairebe
|
||||||
|
Alicia Blasco Leon
|
||||||
|
anonymous
|
||||||
|
Amaranthe
|
||||||
|
appzer0
|
||||||
|
Arne
|
||||||
|
Asier Iturralde Sarasola
|
||||||
|
Christian Paul
|
||||||
|
Ciarán Ainsworth
|
||||||
|
Daniel
|
||||||
|
David
|
||||||
|
Dominik Danelski
|
||||||
|
Eorn le goéland
|
||||||
|
Eleos
|
||||||
|
Erik Duxstad
|
||||||
|
Esteban
|
||||||
|
Fred Uggla
|
||||||
|
Freyja Wildes
|
||||||
|
Georg Krause
|
||||||
|
ghose
|
||||||
|
hellekin
|
||||||
|
heyarne
|
||||||
|
interfect
|
||||||
|
Jess Jing
|
||||||
|
Johannes H.
|
||||||
|
jovuit
|
||||||
|
marzzzello
|
||||||
|
Meliurwen
|
||||||
|
Mehdi
|
||||||
|
Nitai Bezerra da Silva
|
||||||
|
Philipp Wolfer
|
||||||
|
Pierre Couy
|
||||||
|
Porrumentzio
|
||||||
|
Reg
|
||||||
|
Robert Kaye
|
||||||
|
Rubén Cabrera
|
||||||
|
Silver Fox
|
||||||
|
Snack Capt
|
||||||
|
SpcCw
|
||||||
|
Strom Lin
|
||||||
|
vicdorke
|
||||||
|
x
|
||||||
|
|
||||||
|
|
||||||
|
1.1-rc2 (2021-03-01)
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Upgrade instructions are available at
|
||||||
|
https://docs.funkwhale.audio/admin/upgrading.html
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
|
||||||
|
- Fixed follows from Pleroma with custom Emoji as Tag by ignoring not supported tag types #1342
|
||||||
|
- Update pleroma JSON-LD Schema (#1341)
|
||||||
|
- Revert fork replacement of http-signature since official package breaks federation
|
||||||
|
- Pin twisted version to 20.3.0
|
||||||
|
|
||||||
|
|
||||||
|
1.1-rc1 (2021-02-24)
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Upgrade instructions are available at
|
||||||
|
https://docs.funkwhale.audio/admin/upgrading.html
|
||||||
|
|
||||||
|
Enhancements:
|
||||||
|
|
||||||
|
- Add number of tracks and discs of an album to API (#1238)
|
||||||
|
- Add spacing after "Play all" button in playlist view (!1271)
|
||||||
|
- Added a ListenBrainz plugin to submit listenings
|
||||||
|
- Added ability to choose fediverse addresses from channel subscription page/podcast screen (#1294)
|
||||||
|
- Added new search functions to allow users to more easily search for podcasts in the UI.
|
||||||
|
- Added padding to volume slider to ease mouse control (#1241)
|
||||||
|
- Logarithmic scale for volume slider (#1222)
|
||||||
|
- More user-friendly subsonic tokens (#1269)
|
||||||
|
- Remove manual entry of Import Reference on front-end import (#1284)
|
||||||
|
- Replaced forked http-signature dependency with official package (#876)
|
||||||
|
- Support AIFF file format (#1243)
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
|
||||||
|
- "Add check for empty/null covers (#1281)"
|
||||||
|
- Added an album filter to fix problem where channel entries would show up in the wrong series (#1282)
|
||||||
|
- Avoid broken Faker version (#1323)
|
||||||
|
- Changed audio format detection to happen via sniffing and not file extensions (#1274)
|
||||||
|
- Changed default behaviour of channel entries to use channel artwork if no entry artwork available (#1289)
|
||||||
|
- Fix delete library modal closing immediately (#1272)
|
||||||
|
- Fix public shared remote library radio button being disabled (#1292)
|
||||||
|
- Fixed an issue that prevented disabling plugins
|
||||||
|
- Fixed an issue where channel albums don't show up in the album search (#1300)
|
||||||
|
- Fixed an issue where modals would prevent users being able to interact with channels (#1295)
|
||||||
|
- Update MediaSession metadata for initially loaded track (#1252)
|
||||||
|
- Update playback position slider also when track is paused (#1266)
|
||||||
|
|
||||||
|
Contributors to this release (development, documentation, reviews):
|
||||||
|
|
||||||
|
- Reg
|
||||||
|
- hellekin
|
||||||
|
- Esteban
|
||||||
|
- Freyja Wildes
|
||||||
|
- Amaranthe
|
||||||
|
- Eleos
|
||||||
|
- Johannes H.
|
||||||
|
- Mehdi
|
||||||
|
- Adam Novak
|
||||||
|
- Agate
|
||||||
|
- Christian Paul
|
||||||
|
- Ciarán Ainsworth
|
||||||
|
- Erik Duxstad
|
||||||
|
- Fred Uggla
|
||||||
|
- Georg Krause
|
||||||
|
- heyarne
|
||||||
|
- interfect
|
||||||
|
- jovuit
|
||||||
|
- Nitai Bezerra da Silva
|
||||||
|
- Philipp Wolfer
|
||||||
|
- Pierre Couy
|
||||||
|
- Robert Kaye
|
||||||
|
- Strom Lin
|
||||||
|
|
||||||
1.0.1 (2020-10-31)
|
1.0.1 (2020-10-31)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ Once everything is up, you can access the various funkwhale's components:
|
||||||
|
|
||||||
- The Vue webapp, on http://localhost:8000
|
- The Vue webapp, on http://localhost:8000
|
||||||
- The API, on http://localhost:8000/api/v1/
|
- The API, on http://localhost:8000/api/v1/
|
||||||
- The django admin, on http://localhost:800/api/admin/
|
- The django admin, on http://localhost:8000/api/admin/
|
||||||
|
|
||||||
Stopping everything
|
Stopping everything
|
||||||
^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -687,7 +687,7 @@ useful when testing components that depend on each other:
|
||||||
|
|
||||||
def test_downgrade_not_superuser_skips_email(factories, mocker):
|
def test_downgrade_not_superuser_skips_email(factories, mocker):
|
||||||
mocked_notify = mocker.patch('funkwhale_api.myapp.notifications.notify')
|
mocked_notify = mocker.patch('funkwhale_api.myapp.notifications.notify')
|
||||||
user = factories['users.User'](is_superuser=True)
|
user = factories['users.User'](is_superuser=False)
|
||||||
users.downgrade_user(user)
|
users.downgrade_user(user)
|
||||||
|
|
||||||
# here, we ensure no email was sent
|
# here, we ensure no email was sent
|
||||||
|
|
10
README.rst
10
README.rst
|
@ -12,15 +12,7 @@ LICENSE: AGPL3
|
||||||
Getting help
|
Getting help
|
||||||
------------
|
------------
|
||||||
|
|
||||||
We offer various Matrix.org rooms to discuss about Funkwhale:
|
There are several places to get help or get in touch with other members of the community: https://funkwhale.audio/community/
|
||||||
|
|
||||||
- `#funkwhale:matrix.org <https://matrix.to/#/#funkwhale:matrix.org>`_ for general questions about funkwhale
|
|
||||||
- `#funkwhale-dev:matrix.org <https://matrix.to/#/#funkwhale-dev:matrix.org>`_ for development-focused discussion
|
|
||||||
|
|
||||||
Please join those rooms if you have any questions!
|
|
||||||
|
|
||||||
You can also contact `@funkwhale@mastodon.eliotberriot.com <https://mastodon.eliotberriot.com/@funkwhale>`_ on the fediverse.
|
|
||||||
|
|
||||||
|
|
||||||
Contribute
|
Contribute
|
||||||
----------
|
----------
|
||||||
|
|
|
@ -94,6 +94,7 @@ Path to a directory containing Funkwhale plugins. These will be imported at runt
|
||||||
sys.path.append(FUNKWHALE_PLUGINS_PATH)
|
sys.path.append(FUNKWHALE_PLUGINS_PATH)
|
||||||
CORE_PLUGINS = [
|
CORE_PLUGINS = [
|
||||||
"funkwhale_api.contrib.scrobbler",
|
"funkwhale_api.contrib.scrobbler",
|
||||||
|
"funkwhale_api.contrib.listenbrainz",
|
||||||
]
|
]
|
||||||
|
|
||||||
LOAD_CORE_PLUGINS = env.bool("FUNKWHALE_LOAD_CORE_PLUGINS", default=True)
|
LOAD_CORE_PLUGINS = env.bool("FUNKWHALE_LOAD_CORE_PLUGINS", default=True)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
__version__ = "1.0.1"
|
__version__ = "1.1"
|
||||||
__version_info__ = tuple(
|
__version_info__ = tuple(
|
||||||
[
|
[
|
||||||
int(num) if num.isdigit() else num
|
int(num) if num.isdigit() else num
|
||||||
|
|
|
@ -11,7 +11,7 @@ class APIAutenticationRequired(types.BooleanPreference):
|
||||||
verbose_name = "API Requires authentication"
|
verbose_name = "API Requires authentication"
|
||||||
default = True
|
default = True
|
||||||
help_text = (
|
help_text = (
|
||||||
"If disabled, anonymous users will be able to query the API"
|
"If disabled, anonymous users will be able to query the API "
|
||||||
"and access music data (as well as other data exposed in the API "
|
"and access music data (as well as other data exposed in the API "
|
||||||
"without specific permissions)."
|
"without specific permissions)."
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,168 @@
|
||||||
|
# Copyright (c) 2018 Philipp Wolfer <ph.wolfer@gmail.com>
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
# a copy of this software and associated documentation files (the
|
||||||
|
# "Software"), to deal in the Software without restriction, including
|
||||||
|
# without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
# permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
# the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be
|
||||||
|
# included in all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
import json
|
||||||
|
import logging
|
||||||
|
import ssl
|
||||||
|
import time
|
||||||
|
from http.client import HTTPSConnection
|
||||||
|
|
||||||
|
HOST_NAME = "api.listenbrainz.org"
|
||||||
|
PATH_SUBMIT = "/1/submit-listens"
|
||||||
|
SSL_CONTEXT = ssl.create_default_context()
|
||||||
|
|
||||||
|
|
||||||
|
class Track:
|
||||||
|
"""
|
||||||
|
Represents a single track to submit.
|
||||||
|
|
||||||
|
See https://listenbrainz.readthedocs.io/en/latest/dev/json.html
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, artist_name, track_name, release_name=None, additional_info={}):
|
||||||
|
"""
|
||||||
|
Create a new Track instance
|
||||||
|
@param artist_name as str
|
||||||
|
@param track_name as str
|
||||||
|
@param release_name as str
|
||||||
|
@param additional_info as dict
|
||||||
|
"""
|
||||||
|
self.artist_name = artist_name
|
||||||
|
self.track_name = track_name
|
||||||
|
self.release_name = release_name
|
||||||
|
self.additional_info = additional_info
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_dict(data):
|
||||||
|
return Track(
|
||||||
|
data["artist_name"],
|
||||||
|
data["track_name"],
|
||||||
|
data.get("release_name", None),
|
||||||
|
data.get("additional_info", {}),
|
||||||
|
)
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
return {
|
||||||
|
"artist_name": self.artist_name,
|
||||||
|
"track_name": self.track_name,
|
||||||
|
"release_name": self.release_name,
|
||||||
|
"additional_info": self.additional_info,
|
||||||
|
}
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "Track(%s, %s)" % (self.artist_name, self.track_name)
|
||||||
|
|
||||||
|
|
||||||
|
class ListenBrainzClient:
|
||||||
|
"""
|
||||||
|
Submit listens to ListenBrainz.org.
|
||||||
|
|
||||||
|
See https://listenbrainz.readthedocs.io/en/latest/dev/api.html
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, user_token, logger=logging.getLogger(__name__)):
|
||||||
|
self.__next_request_time = 0
|
||||||
|
self.user_token = user_token
|
||||||
|
self.logger = logger
|
||||||
|
|
||||||
|
def listen(self, listened_at, track):
|
||||||
|
"""
|
||||||
|
Submit a listen for a track
|
||||||
|
@param listened_at as int
|
||||||
|
@param entry as Track
|
||||||
|
"""
|
||||||
|
payload = _get_payload(track, listened_at)
|
||||||
|
return self._submit("single", [payload])
|
||||||
|
|
||||||
|
def playing_now(self, track):
|
||||||
|
"""
|
||||||
|
Submit a playing now notification for a track
|
||||||
|
@param track as Track
|
||||||
|
"""
|
||||||
|
payload = _get_payload(track)
|
||||||
|
return self._submit("playing_now", [payload])
|
||||||
|
|
||||||
|
def import_tracks(self, tracks):
|
||||||
|
"""
|
||||||
|
Import a list of tracks as (listened_at, Track) pairs
|
||||||
|
@param track as [(int, Track)]
|
||||||
|
"""
|
||||||
|
payload = _get_payload_many(tracks)
|
||||||
|
return self._submit("import", payload)
|
||||||
|
|
||||||
|
def _submit(self, listen_type, payload, retry=0):
|
||||||
|
self._wait_for_ratelimit()
|
||||||
|
self.logger.debug("ListenBrainz %s: %r", listen_type, payload)
|
||||||
|
data = {"listen_type": listen_type, "payload": payload}
|
||||||
|
headers = {
|
||||||
|
"Authorization": "Token %s" % self.user_token,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
}
|
||||||
|
body = json.dumps(data)
|
||||||
|
conn = HTTPSConnection(HOST_NAME, context=SSL_CONTEXT)
|
||||||
|
conn.request("POST", PATH_SUBMIT, body, headers)
|
||||||
|
response = conn.getresponse()
|
||||||
|
response_text = response.read()
|
||||||
|
try:
|
||||||
|
response_data = json.loads(response_text)
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
response_data = response_text
|
||||||
|
|
||||||
|
self._handle_ratelimit(response)
|
||||||
|
log_msg = "Response %s: %r" % (response.status, response_data)
|
||||||
|
if response.status == 429 and retry < 5: # Too Many Requests
|
||||||
|
self.logger.warning(log_msg)
|
||||||
|
return self._submit(listen_type, payload, retry + 1)
|
||||||
|
elif response.status == 200:
|
||||||
|
self.logger.debug(log_msg)
|
||||||
|
else:
|
||||||
|
self.logger.error(log_msg)
|
||||||
|
return response
|
||||||
|
|
||||||
|
def _wait_for_ratelimit(self):
|
||||||
|
now = time.time()
|
||||||
|
if self.__next_request_time > now:
|
||||||
|
delay = self.__next_request_time - now
|
||||||
|
self.logger.debug("Rate limit applies, delay %d", delay)
|
||||||
|
time.sleep(delay)
|
||||||
|
|
||||||
|
def _handle_ratelimit(self, response):
|
||||||
|
remaining = int(response.getheader("X-RateLimit-Remaining", 0))
|
||||||
|
reset_in = int(response.getheader("X-RateLimit-Reset-In", 0))
|
||||||
|
self.logger.debug("X-RateLimit-Remaining: %i", remaining)
|
||||||
|
self.logger.debug("X-RateLimit-Reset-In: %i", reset_in)
|
||||||
|
if remaining == 0:
|
||||||
|
self.__next_request_time = time.time() + reset_in
|
||||||
|
|
||||||
|
|
||||||
|
def _get_payload_many(tracks):
|
||||||
|
payload = []
|
||||||
|
for (listened_at, track) in tracks:
|
||||||
|
data = _get_payload(track, listened_at)
|
||||||
|
payload.append(data)
|
||||||
|
return payload
|
||||||
|
|
||||||
|
|
||||||
|
def _get_payload(track, listened_at=None):
|
||||||
|
data = {"track_metadata": track.to_dict()}
|
||||||
|
if listened_at is not None:
|
||||||
|
data["listened_at"] = listened_at
|
||||||
|
return data
|
|
@ -0,0 +1,41 @@
|
||||||
|
from config import plugins
|
||||||
|
from .funkwhale_startup import PLUGIN
|
||||||
|
from .client import ListenBrainzClient, Track
|
||||||
|
|
||||||
|
|
||||||
|
@plugins.register_hook(plugins.LISTENING_CREATED, PLUGIN)
|
||||||
|
def submit_listen(listening, conf, **kwargs):
|
||||||
|
user_token = conf["user_token"]
|
||||||
|
if not user_token:
|
||||||
|
return
|
||||||
|
|
||||||
|
logger = PLUGIN["logger"]
|
||||||
|
logger.info("Submitting listen to ListenBrainz")
|
||||||
|
client = ListenBrainzClient(user_token=user_token, logger=logger)
|
||||||
|
track = get_track(listening.track)
|
||||||
|
client.listen(int(listening.creation_date.timestamp()), track)
|
||||||
|
|
||||||
|
|
||||||
|
def get_track(track):
|
||||||
|
artist = track.artist.name
|
||||||
|
title = track.title
|
||||||
|
album = None
|
||||||
|
additional_info = {
|
||||||
|
"listening_from": "Funkwhale",
|
||||||
|
"tracknumber": track.position,
|
||||||
|
"discnumber": track.disc_number,
|
||||||
|
}
|
||||||
|
|
||||||
|
if track.mbid:
|
||||||
|
additional_info["recording_mbid"] = str(track.mbid)
|
||||||
|
|
||||||
|
if track.album:
|
||||||
|
if track.album.title:
|
||||||
|
album = track.album.title
|
||||||
|
if track.album.mbid:
|
||||||
|
additional_info["release_mbid"] = str(track.album.mbid)
|
||||||
|
|
||||||
|
if track.artist.mbid:
|
||||||
|
additional_info["artist_mbids"] = [str(track.artist.mbid)]
|
||||||
|
|
||||||
|
return Track(artist, title, album, additional_info)
|
|
@ -0,0 +1,18 @@
|
||||||
|
from config import plugins
|
||||||
|
|
||||||
|
|
||||||
|
PLUGIN = plugins.get_plugin_config(
|
||||||
|
name="listenbrainz",
|
||||||
|
label="ListenBrainz",
|
||||||
|
description="A plugin that allows you to submit your listens to ListenBrainz.",
|
||||||
|
version="0.1",
|
||||||
|
user=True,
|
||||||
|
conf=[
|
||||||
|
{
|
||||||
|
"name": "user_token",
|
||||||
|
"type": "text",
|
||||||
|
"label": "Your ListenBrainz user token",
|
||||||
|
"help": "You can find your user token in your ListenBrainz profile at https://listenbrainz.org/profile/",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
|
@ -316,8 +316,8 @@ CONTEXTS = [
|
||||||
"shortId": "LITEPUB",
|
"shortId": "LITEPUB",
|
||||||
"contextUrl": None,
|
"contextUrl": None,
|
||||||
"documentUrl": "http://litepub.social/ns",
|
"documentUrl": "http://litepub.social/ns",
|
||||||
|
# from https://git.pleroma.social/pleroma/pleroma/-/blob/release/2.2.3/priv/static/schemas/litepub-0.1.jsonld
|
||||||
"document": {
|
"document": {
|
||||||
# from https://ap.thequietplace.social/schemas/litepub-0.1.jsonld
|
|
||||||
"@context": {
|
"@context": {
|
||||||
"Emoji": "toot:Emoji",
|
"Emoji": "toot:Emoji",
|
||||||
"Hashtag": "as:Hashtag",
|
"Hashtag": "as:Hashtag",
|
||||||
|
@ -326,6 +326,7 @@ CONTEXTS = [
|
||||||
"conversation": {"@id": "ostatus:conversation", "@type": "@id"},
|
"conversation": {"@id": "ostatus:conversation", "@type": "@id"},
|
||||||
"discoverable": "toot:discoverable",
|
"discoverable": "toot:discoverable",
|
||||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||||
|
"capabilities": "litepub:capabilities",
|
||||||
"ostatus": "http://ostatus.org#",
|
"ostatus": "http://ostatus.org#",
|
||||||
"schema": "http://schema.org#",
|
"schema": "http://schema.org#",
|
||||||
"toot": "http://joinmastodon.org/ns#",
|
"toot": "http://joinmastodon.org/ns#",
|
||||||
|
@ -340,6 +341,7 @@ CONTEXTS = [
|
||||||
"@type": "@id",
|
"@type": "@id",
|
||||||
},
|
},
|
||||||
"EmojiReact": "litepub:EmojiReact",
|
"EmojiReact": "litepub:EmojiReact",
|
||||||
|
"ChatMessage": "litepub:ChatMessage",
|
||||||
"alsoKnownAs": {"@id": "as:alsoKnownAs", "@type": "@id"},
|
"alsoKnownAs": {"@id": "as:alsoKnownAs", "@type": "@id"},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -258,9 +258,15 @@ class ActorSerializer(jsonld.JsonLdSerializer):
|
||||||
)
|
)
|
||||||
attributedTo = serializers.URLField(max_length=500, required=False)
|
attributedTo = serializers.URLField(max_length=500, required=False)
|
||||||
|
|
||||||
tags = serializers.ListField(
|
tags = serializers.ListField(min_length=0, required=False, allow_null=True)
|
||||||
child=TagSerializer(), min_length=0, required=False, allow_null=True
|
|
||||||
)
|
def validate_tags(self, tags):
|
||||||
|
valid_tags = []
|
||||||
|
for tag in tags:
|
||||||
|
s = TagSerializer(data=tag)
|
||||||
|
if s.is_valid():
|
||||||
|
valid_tags.append(s.validated_data)
|
||||||
|
return valid_tags
|
||||||
|
|
||||||
category = serializers.CharField(required=False)
|
category = serializers.CharField(required=False)
|
||||||
# languages = serializers.Char(
|
# languages = serializers.Char(
|
||||||
|
|
|
@ -27,7 +27,7 @@ class MusicCacheDuration(types.IntPreference):
|
||||||
default = 60 * 24 * 7
|
default = 60 * 24 * 7
|
||||||
verbose_name = "Transcoding cache duration"
|
verbose_name = "Transcoding cache duration"
|
||||||
help_text = (
|
help_text = (
|
||||||
"How much minutes do you want to keep a copy of transcoded tracks "
|
"How many minutes do you want to keep a copy of transcoded tracks "
|
||||||
"on the server? Transcoded files that were not listened in this interval "
|
"on the server? Transcoded files that were not listened in this interval "
|
||||||
"will be erased and retranscoded on the next listening."
|
"will be erased and retranscoded on the next listening."
|
||||||
)
|
)
|
||||||
|
|
|
@ -103,6 +103,7 @@ class ArtistFilter(
|
||||||
playable = filters.BooleanFilter(field_name="_", method="filter_playable")
|
playable = filters.BooleanFilter(field_name="_", method="filter_playable")
|
||||||
has_albums = filters.BooleanFilter(field_name="_", method="filter_has_albums")
|
has_albums = filters.BooleanFilter(field_name="_", method="filter_has_albums")
|
||||||
tag = TAG_FILTER
|
tag = TAG_FILTER
|
||||||
|
content_category = filters.CharFilter("content_category")
|
||||||
scope = common_filters.ActorScopeFilter(
|
scope = common_filters.ActorScopeFilter(
|
||||||
actor_field="tracks__uploads__library__actor",
|
actor_field="tracks__uploads__library__actor",
|
||||||
distinct=True,
|
distinct=True,
|
||||||
|
@ -257,6 +258,7 @@ class AlbumFilter(
|
||||||
search_fields=["title", "artist__name"],
|
search_fields=["title", "artist__name"],
|
||||||
fts_search_fields=["body_text", "artist__body_text"],
|
fts_search_fields=["body_text", "artist__body_text"],
|
||||||
)
|
)
|
||||||
|
content_category = filters.CharFilter("artist__content_category")
|
||||||
tag = TAG_FILTER
|
tag = TAG_FILTER
|
||||||
scope = common_filters.ActorScopeFilter(
|
scope = common_filters.ActorScopeFilter(
|
||||||
actor_field="tracks__uploads__library__actor",
|
actor_field="tracks__uploads__library__actor",
|
||||||
|
|
|
@ -17,6 +17,7 @@ from django.core.files import File
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
from django.db.utils import IntegrityError
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
@ -832,6 +833,13 @@ def check_upload(stdout, upload):
|
||||||
except serializers.ValidationError as e:
|
except serializers.ValidationError as e:
|
||||||
stdout.write(" Invalid metadata: {}".format(e))
|
stdout.write(" Invalid metadata: {}".format(e))
|
||||||
return
|
return
|
||||||
|
except IntegrityError:
|
||||||
|
stdout.write(
|
||||||
|
" Duplicate key violation for metadata. Skipping...\n{}".format(
|
||||||
|
upload.source
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
upload.checksum = checksum
|
upload.checksum = checksum
|
||||||
upload.save(update_fields=["checksum"])
|
upload.save(update_fields=["checksum"])
|
||||||
|
|
|
@ -253,7 +253,7 @@ CONF = {
|
||||||
"comment": {"field": "comment"},
|
"comment": {"field": "comment"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"MP3": {
|
"ID3": {
|
||||||
"getter": get_id3_tag,
|
"getter": get_id3_tag,
|
||||||
"clean_pictures": clean_id3_pictures,
|
"clean_pictures": clean_id3_pictures,
|
||||||
"fields": {
|
"fields": {
|
||||||
|
@ -331,6 +331,9 @@ CONF = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CONF["MP3"] = CONF["ID3"]
|
||||||
|
CONF["AIFF"] = CONF["ID3"]
|
||||||
|
|
||||||
ALL_FIELDS = [
|
ALL_FIELDS = [
|
||||||
"position",
|
"position",
|
||||||
"disc_number",
|
"disc_number",
|
||||||
|
|
|
@ -20,6 +20,7 @@ from django.db.models.signals import post_save, pre_save
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from django.db.models import Prefetch, Count
|
||||||
|
|
||||||
from funkwhale_api import musicbrainz
|
from funkwhale_api import musicbrainz
|
||||||
from funkwhale_api.common import fields
|
from funkwhale_api.common import fields
|
||||||
|
@ -420,7 +421,13 @@ def import_album(v):
|
||||||
class TrackQuerySet(common_models.LocalFromFidQuerySet, models.QuerySet):
|
class TrackQuerySet(common_models.LocalFromFidQuerySet, models.QuerySet):
|
||||||
def for_nested_serialization(self):
|
def for_nested_serialization(self):
|
||||||
return self.prefetch_related(
|
return self.prefetch_related(
|
||||||
"artist", "album__artist", "album__attachment_cover"
|
"artist",
|
||||||
|
Prefetch(
|
||||||
|
"album",
|
||||||
|
queryset=Album.objects.select_related(
|
||||||
|
"artist", "attachment_cover"
|
||||||
|
).annotate(_prefetched_tracks_count=Count("tracks")),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
def annotate_playable_by_actor(self, actor):
|
def annotate_playable_by_actor(self, actor):
|
||||||
|
@ -855,8 +862,7 @@ class Upload(models.Model):
|
||||||
if not input:
|
if not input:
|
||||||
return
|
return
|
||||||
|
|
||||||
input_format = utils.MIMETYPE_TO_EXTENSION[self.mimetype]
|
audio = pydub.AudioSegment.from_file(input)
|
||||||
audio = pydub.AudioSegment.from_file(input, format=input_format)
|
|
||||||
return audio
|
return audio
|
||||||
|
|
||||||
def save(self, **kwargs):
|
def save(self, **kwargs):
|
||||||
|
|
|
@ -227,6 +227,10 @@ class AlbumSerializer(OptionalDescriptionMixin, serializers.Serializer):
|
||||||
class TrackAlbumSerializer(serializers.ModelSerializer):
|
class TrackAlbumSerializer(serializers.ModelSerializer):
|
||||||
artist = serializers.SerializerMethodField()
|
artist = serializers.SerializerMethodField()
|
||||||
cover = cover_field
|
cover = cover_field
|
||||||
|
tracks_count = serializers.SerializerMethodField()
|
||||||
|
|
||||||
|
def get_tracks_count(self, o):
|
||||||
|
return getattr(o, "_prefetched_tracks_count", len(o.tracks.all()))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Album
|
model = models.Album
|
||||||
|
@ -240,6 +244,7 @@ class TrackAlbumSerializer(serializers.ModelSerializer):
|
||||||
"cover",
|
"cover",
|
||||||
"creation_date",
|
"creation_date",
|
||||||
"is_local",
|
"is_local",
|
||||||
|
"tracks_count",
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_artist(self, o):
|
def get_artist(self, o):
|
||||||
|
|
|
@ -59,6 +59,10 @@ AUDIO_EXTENSIONS_AND_MIMETYPE = [
|
||||||
("m4a", "audio/x-m4a"),
|
("m4a", "audio/x-m4a"),
|
||||||
("flac", "audio/x-flac"),
|
("flac", "audio/x-flac"),
|
||||||
("flac", "audio/flac"),
|
("flac", "audio/flac"),
|
||||||
|
("aif", "audio/aiff"),
|
||||||
|
("aif", "audio/x-aiff"),
|
||||||
|
("aiff", "audio/aiff"),
|
||||||
|
("aiff", "audio/x-aiff"),
|
||||||
]
|
]
|
||||||
|
|
||||||
EXTENSION_TO_MIMETYPE = {ext: mt for ext, mt in AUDIO_EXTENSIONS_AND_MIMETYPE}
|
EXTENSION_TO_MIMETYPE = {ext: mt for ext, mt in AUDIO_EXTENSIONS_AND_MIMETYPE}
|
||||||
|
@ -101,7 +105,7 @@ def get_actor_from_request(request):
|
||||||
return actor
|
return actor
|
||||||
|
|
||||||
|
|
||||||
def transcode_file(input, output, input_format, output_format, **kwargs):
|
def transcode_file(input, output, input_format=None, output_format="mp3", **kwargs):
|
||||||
with input.open("rb"):
|
with input.open("rb"):
|
||||||
audio = pydub.AudioSegment.from_file(input, format=input_format)
|
audio = pydub.AudioSegment.from_file(input, format=input_format)
|
||||||
return transcode_audio(audio, output, output_format, **kwargs)
|
return transcode_audio(audio, output, output_format, **kwargs)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import os
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
import uuid
|
import uuid
|
||||||
|
@ -29,9 +30,14 @@ from funkwhale_api.federation import models as federation_models
|
||||||
from funkwhale_api.federation import utils as federation_utils
|
from funkwhale_api.federation import utils as federation_utils
|
||||||
|
|
||||||
|
|
||||||
def get_token(length=30):
|
def get_token(length=5):
|
||||||
choices = string.ascii_lowercase + string.ascii_uppercase + "0123456789"
|
wordlist_path = os.path.join(
|
||||||
return "".join(random.choice(choices) for i in range(length))
|
os.path.dirname(os.path.abspath(__file__)), "wordlist.txt"
|
||||||
|
)
|
||||||
|
with open(wordlist_path, "r") as f:
|
||||||
|
words = f.readlines()
|
||||||
|
phrase = "".join(random.choice(words) for i in range(length))
|
||||||
|
return phrase.replace("\n", "-").rstrip("-")
|
||||||
|
|
||||||
|
|
||||||
PERMISSIONS_CONFIGURATION = {
|
PERMISSIONS_CONFIGURATION = {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -47,7 +47,7 @@ gunicorn~=20.0.0
|
||||||
cryptography~=2.9.0
|
cryptography~=2.9.0
|
||||||
# requests-http-signature==0.0.3
|
# requests-http-signature==0.0.3
|
||||||
# clone until the branch is merged and released upstream
|
# clone until the branch is merged and released upstream
|
||||||
git+https://github.com/EliotBerriot/requests-http-signature.git@signature-header-support
|
git+https://github.com/agateblue/requests-http-signature.git@signature-header-support
|
||||||
django-cleanup~=5.0.0
|
django-cleanup~=5.0.0
|
||||||
requests~=2.24.0
|
requests~=2.24.0
|
||||||
pyOpenSSL~=19.1.0
|
pyOpenSSL~=19.1.0
|
||||||
|
@ -70,5 +70,8 @@ click~=7.1.0
|
||||||
service_identity~=18.1.0
|
service_identity~=18.1.0
|
||||||
markdown~=3.2.0
|
markdown~=3.2.0
|
||||||
bleach~=3.1.0
|
bleach~=3.1.0
|
||||||
feedparser==6.0.0b3
|
feedparser~=6.0.0
|
||||||
watchdog~=0.10.0
|
watchdog~=1.0.2
|
||||||
|
|
||||||
|
## Pin third party dependency to avoid issue with latest version
|
||||||
|
twisted==20.3.0
|
||||||
|
|
|
@ -10,3 +10,4 @@ pytest-randomly~=3.4.0
|
||||||
pytest-sugar~=0.9.0
|
pytest-sugar~=0.9.0
|
||||||
requests-mock~=1.8.0
|
requests-mock~=1.8.0
|
||||||
#pytest-profiling<1.4
|
#pytest-profiling<1.4
|
||||||
|
faker!=5.5.0
|
||||||
|
|
|
@ -4,6 +4,75 @@ from funkwhale_api.federation import routes
|
||||||
from funkwhale_api.federation import serializers
|
from funkwhale_api.federation import serializers
|
||||||
|
|
||||||
|
|
||||||
|
def test_pleroma_actor_from_ap_with_tags(factories):
|
||||||
|
|
||||||
|
payload = {
|
||||||
|
"@context": [
|
||||||
|
"https://www.w3.org/ns/activitystreams",
|
||||||
|
"https://test.federation/schemas/litepub-0.1.jsonld",
|
||||||
|
{"@language": "und"},
|
||||||
|
],
|
||||||
|
"endpoints": {
|
||||||
|
"oauthAuthorizationEndpoint": "https://test.federation/oauth/authorize",
|
||||||
|
"oauthRegistrationEndpoint": "https://test.federation/api/v1/apps",
|
||||||
|
"oauthTokenEndpoint": "https://test.federation/oauth/token",
|
||||||
|
"sharedInbox": "https://test.federation/inbox",
|
||||||
|
"uploadMedia": "https://test.federation/api/ap/upload_media",
|
||||||
|
},
|
||||||
|
"followers": "https://test.federation/internal/fetch/followers",
|
||||||
|
"following": "https://test.federation/internal/fetch/following",
|
||||||
|
"id": "https://test.federation/internal/fetch",
|
||||||
|
"inbox": "https://test.federation/internal/fetch/inbox",
|
||||||
|
"invisible": True,
|
||||||
|
"manuallyApprovesFollowers": False,
|
||||||
|
"name": "Pleroma",
|
||||||
|
"preferredUsername": "internal.fetch",
|
||||||
|
"publicKey": {
|
||||||
|
"id": "https://test.federation/internal/fetch#main-key",
|
||||||
|
"owner": "https://test.federation/internal/fetch",
|
||||||
|
"publicKeyPem": "PEM",
|
||||||
|
},
|
||||||
|
"summary": "An internal service actor for this Pleroma instance. No user-serviceable parts inside.",
|
||||||
|
"type": "Application",
|
||||||
|
"url": "https://test.federation/internal/fetch",
|
||||||
|
"tag": [
|
||||||
|
{
|
||||||
|
"type": "Hashtag",
|
||||||
|
"href": "https://test.federation/explore/funkwhale",
|
||||||
|
"name": "#funkwhale",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Emoji",
|
||||||
|
"id": "https://test.federation/emoji/test/custom.png",
|
||||||
|
"name": ":custom:",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
serializer = serializers.ActorSerializer(data=payload)
|
||||||
|
assert serializer.is_valid(raise_exception=True)
|
||||||
|
actor = serializer.save()
|
||||||
|
|
||||||
|
assert actor.fid == payload["id"]
|
||||||
|
assert actor.url == payload["url"]
|
||||||
|
assert actor.inbox_url == payload["inbox"]
|
||||||
|
assert actor.shared_inbox_url == payload["endpoints"]["sharedInbox"]
|
||||||
|
assert actor.outbox_url is None
|
||||||
|
assert actor.following_url == payload["following"]
|
||||||
|
assert actor.followers_url == payload["followers"]
|
||||||
|
assert actor.followers_url == payload["followers"]
|
||||||
|
assert actor.type == payload["type"]
|
||||||
|
assert actor.preferred_username == payload["preferredUsername"]
|
||||||
|
assert actor.name == payload["name"]
|
||||||
|
assert actor.summary_obj.text == payload["summary"]
|
||||||
|
assert actor.summary_obj.content_type == "text/html"
|
||||||
|
assert actor.fid == payload["url"]
|
||||||
|
assert actor.manually_approves_followers is payload["manuallyApprovesFollowers"]
|
||||||
|
assert actor.private_key is None
|
||||||
|
assert actor.public_key == payload["publicKey"]["publicKeyPem"]
|
||||||
|
assert actor.domain_id == "test.federation"
|
||||||
|
|
||||||
|
|
||||||
def test_pleroma_actor_from_ap(factories):
|
def test_pleroma_actor_from_ap(factories):
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
|
|
Binary file not shown.
|
@ -150,10 +150,38 @@ def test_can_get_metadata_from_id3_mp3_file(field, value):
|
||||||
assert str(data.get(field)) == value
|
assert str(data.get(field)) == value
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"field,value",
|
||||||
|
[
|
||||||
|
("title", "Bend"),
|
||||||
|
("artist", "Binärpilot"),
|
||||||
|
("album_artist", "Binärpilot"),
|
||||||
|
# ("artists", "Binärpilot; Another artist"), # FW does not properly extract multi-value artists from ID3
|
||||||
|
("album", "You Can't Stop Da Funk"),
|
||||||
|
("date", "2006-02-07"),
|
||||||
|
("position", "2/4"),
|
||||||
|
("disc_number", "1/1"),
|
||||||
|
("musicbrainz_albumid", "ce40cdb1-a562-4fd8-a269-9269f98d4124"),
|
||||||
|
("mbid", "f269d497-1cc0-4ae4-a0c4-157ec7d73fcb"),
|
||||||
|
("musicbrainz_artistid", "9c6bddde-6228-4d9f-ad0d-03f6fcb19e13"),
|
||||||
|
("musicbrainz_albumartistid", "9c6bddde-6228-4d9f-ad0d-03f6fcb19e13"),
|
||||||
|
("license", "https://creativecommons.org/licenses/by-nc-nd/2.5/"),
|
||||||
|
("copyright", "Someone"),
|
||||||
|
("comment", "Hello there"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_can_get_metadata_from_id3_aiff_file(field, value):
|
||||||
|
path = os.path.join(DATA_DIR, "test.aiff")
|
||||||
|
data = metadata.Metadata(path)
|
||||||
|
|
||||||
|
assert str(data.get(field)) == value
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"name",
|
"name",
|
||||||
[
|
[
|
||||||
"test.mp3",
|
"test.mp3",
|
||||||
|
"test.aiff",
|
||||||
"with_other_picture.mp3",
|
"with_other_picture.mp3",
|
||||||
"sample.flac",
|
"sample.flac",
|
||||||
"with_cover.ogg",
|
"with_cover.ogg",
|
||||||
|
|
|
@ -196,6 +196,35 @@ def test_album_serializer(factories, to_api_date):
|
||||||
assert serializer.data == expected
|
assert serializer.data == expected
|
||||||
|
|
||||||
|
|
||||||
|
def test_track_album_serializer(factories, to_api_date):
|
||||||
|
actor = factories["federation.Actor"]()
|
||||||
|
track1 = factories["music.Track"](
|
||||||
|
position=2, album__attributed_to=actor, album__with_cover=True
|
||||||
|
)
|
||||||
|
factories["music.Track"](position=1, album=track1.album)
|
||||||
|
album = track1.album
|
||||||
|
expected = {
|
||||||
|
"id": album.id,
|
||||||
|
"fid": album.fid,
|
||||||
|
"mbid": str(album.mbid),
|
||||||
|
"title": album.title,
|
||||||
|
"artist": serializers.serialize_artist_simple(album.artist),
|
||||||
|
"creation_date": to_api_date(album.creation_date),
|
||||||
|
"is_playable": False,
|
||||||
|
"cover": common_serializers.AttachmentSerializer(album.attachment_cover).data,
|
||||||
|
"release_date": to_api_date(album.release_date),
|
||||||
|
"tracks_count": 2,
|
||||||
|
"is_local": album.is_local,
|
||||||
|
"tags": [],
|
||||||
|
"attributed_to": federation_serializers.APIActorSerializer(actor).data,
|
||||||
|
}
|
||||||
|
serializer = serializers.AlbumSerializer(
|
||||||
|
album.__class__.objects.with_tracks_count().get(pk=album.pk)
|
||||||
|
)
|
||||||
|
|
||||||
|
assert serializer.data == expected
|
||||||
|
|
||||||
|
|
||||||
def test_track_serializer(factories, to_api_date):
|
def test_track_serializer(factories, to_api_date):
|
||||||
actor = factories["federation.Actor"]()
|
actor = factories["federation.Actor"]()
|
||||||
upload = factories["music.Upload"](
|
upload = factories["music.Upload"](
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import pytest
|
import pytest
|
||||||
|
import tempfile
|
||||||
|
|
||||||
from funkwhale_api.music import utils
|
from funkwhale_api.music import utils
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ def test_guess_mimetype_try_using_extension_if_fail(wrong, factories, mocker):
|
||||||
("sample.flac", {"bitrate": 1608000, "length": 0.001}),
|
("sample.flac", {"bitrate": 1608000, "length": 0.001}),
|
||||||
("test.mp3", {"bitrate": 8000, "length": 267.70285714285717}),
|
("test.mp3", {"bitrate": 8000, "length": 267.70285714285717}),
|
||||||
("test.ogg", {"bitrate": 112000, "length": 1}),
|
("test.ogg", {"bitrate": 112000, "length": 1}),
|
||||||
|
("test.opus", {"bitrate": 0, "length": 1}), # This Opus file lacks a bitrate
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_get_audio_file_data(name, expected):
|
def test_get_audio_file_data(name, expected):
|
||||||
|
@ -109,3 +111,22 @@ def test_get_dirs_and_files(path, expected, tmpdir):
|
||||||
(root_path / "System" / "file.ogg").touch()
|
(root_path / "System" / "file.ogg").touch()
|
||||||
|
|
||||||
assert utils.browse_dir(root_path, path) == expected
|
assert utils.browse_dir(root_path, path) == expected
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"name, expected",
|
||||||
|
[
|
||||||
|
("sample.flac", {"bitrate": 128000, "length": 0}),
|
||||||
|
("test.mp3", {"bitrate": 16000, "length": 268}),
|
||||||
|
("test.ogg", {"bitrate": 128000, "length": 1}),
|
||||||
|
("test.opus", {"bitrate": 128000, "length": 1}),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_transcode_file(name, expected):
|
||||||
|
path = pathlib.Path(os.path.join(DATA_DIR, name))
|
||||||
|
with tempfile.NamedTemporaryFile() as dest:
|
||||||
|
utils.transcode_file(path, pathlib.Path(dest.name))
|
||||||
|
with open(dest.name, "rb") as f:
|
||||||
|
result = {k: round(v) for k, v in utils.get_audio_file_data(f).items()}
|
||||||
|
|
||||||
|
assert result == expected
|
||||||
|
|
|
@ -88,7 +88,7 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- "./nginx/funkwhale.template:/etc/nginx/conf.d/funkwhale.template:ro"
|
- "./nginx/funkwhale.template:/etc/nginx/conf.d/funkwhale.template:ro"
|
||||||
- "./nginx/funkwhale_proxy.conf:/etc/nginx/funkwhale_proxy.conf:ro"
|
- "./nginx/funkwhale_proxy.conf:/etc/nginx/funkwhale_proxy.conf:ro"
|
||||||
- "${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:ro"
|
- "${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:${MUSIC_DIRECTORY_PATH-/music}:ro"
|
||||||
- "${MEDIA_ROOT}:${MEDIA_ROOT}:ro"
|
- "${MEDIA_ROOT}:${MEDIA_ROOT}:ro"
|
||||||
- "${STATIC_ROOT}:${STATIC_ROOT}:ro"
|
- "${STATIC_ROOT}:${STATIC_ROOT}:ro"
|
||||||
- "${FUNKWHALE_FRONTEND_PATH}:/frontend:ro"
|
- "${FUNKWHALE_FRONTEND_PATH}:/frontend:ro"
|
||||||
|
|
2
dev.yml
2
dev.yml
|
@ -154,7 +154,7 @@ services:
|
||||||
- "8001:8001"
|
- "8001:8001"
|
||||||
|
|
||||||
api-docs:
|
api-docs:
|
||||||
image: swaggerapi/swagger-ui:v3.26.0
|
image: swaggerapi/swagger-ui:v3.37.2
|
||||||
environment:
|
environment:
|
||||||
- "API_URL=/swagger.yml"
|
- "API_URL=/swagger.yml"
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -67,7 +67,7 @@ get details::
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
At the moment, only Flac, OGG/Vorbis and MP3 files with ID3 tags are supported
|
At the moment, only Flac, OGG/Vorbis and MP3 or AIFF files with ID3 tags are supported
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -164,6 +164,7 @@ match what is described in :doc:`/installation/debian`:
|
||||||
sudo -u funkwhale unzip "api-$FUNKWHALE_VERSION.zip" -d extracted
|
sudo -u funkwhale unzip "api-$FUNKWHALE_VERSION.zip" -d extracted
|
||||||
sudo -u funkwhale rm -rf api/ && sudo -u funkwhale mv extracted/api .
|
sudo -u funkwhale rm -rf api/ && sudo -u funkwhale mv extracted/api .
|
||||||
sudo -u funkwhale rm -rf extracted
|
sudo -u funkwhale rm -rf extracted
|
||||||
|
sudo -u funkwhale rm api-$FUNKWHALE_VERSION.zip
|
||||||
|
|
||||||
# update os dependencies
|
# update os dependencies
|
||||||
sudo api/install_os_dependencies.sh install
|
sudo api/install_os_dependencies.sh install
|
||||||
|
|
|
@ -57,7 +57,7 @@ Attachment:
|
||||||
example: 2787000
|
example: 2787000
|
||||||
description: "Size of the file, in bytes"
|
description: "Size of the file, in bytes"
|
||||||
mimetype:
|
mimetype:
|
||||||
$ref: "./properties.yml#image_mimetype"
|
$ref: "./properties.yml#/image_mimetype"
|
||||||
creation_date:
|
creation_date:
|
||||||
type: "string"
|
type: "string"
|
||||||
format: "date-time"
|
format: "date-time"
|
||||||
|
@ -121,7 +121,7 @@ BaseArtist:
|
||||||
properties:
|
properties:
|
||||||
mbid:
|
mbid:
|
||||||
required: false
|
required: false
|
||||||
$ref: "./properties.yml#mbid"
|
$ref: "./properties.yml#/mbid"
|
||||||
id:
|
id:
|
||||||
type: "integer"
|
type: "integer"
|
||||||
format: "int64"
|
format: "int64"
|
||||||
|
@ -160,7 +160,7 @@ BaseAlbum:
|
||||||
properties:
|
properties:
|
||||||
mbid:
|
mbid:
|
||||||
required: false
|
required: false
|
||||||
$ref: "./properties.yml#mbid"
|
$ref: "./properties.yml#/mbid"
|
||||||
id:
|
id:
|
||||||
type: "integer"
|
type: "integer"
|
||||||
format: "int64"
|
format: "int64"
|
||||||
|
@ -249,11 +249,11 @@ ChannelCreate:
|
||||||
example: "aliceandbob"
|
example: "aliceandbob"
|
||||||
description: "The username to associate with the channel, for use over federation. This cannot be changed afterwards."
|
description: "The username to associate with the channel, for use over federation. This cannot be changed afterwards."
|
||||||
description:
|
description:
|
||||||
$ref: "./properties.yml#description"
|
$ref: "./properties.yml#/description"
|
||||||
tags:
|
tags:
|
||||||
$ref: "./properties.yml#tags"
|
$ref: "./properties.yml#/tags"
|
||||||
content_category:
|
content_category:
|
||||||
$ref: "./properties.yml#content_category"
|
$ref: "./properties.yml#/content_category"
|
||||||
cover:
|
cover:
|
||||||
type: string
|
type: string
|
||||||
format: uuid
|
format: uuid
|
||||||
|
@ -267,9 +267,9 @@ ChannelUpdate:
|
||||||
example: "A short, public name for the channel"
|
example: "A short, public name for the channel"
|
||||||
maxLength: 255
|
maxLength: 255
|
||||||
description:
|
description:
|
||||||
$ref: "./properties.yml#description"
|
$ref: "./properties.yml#/description"
|
||||||
tags:
|
tags:
|
||||||
$ref: "./properties.yml#tags"
|
$ref: "./properties.yml#/tags"
|
||||||
cover:
|
cover:
|
||||||
type: string
|
type: string
|
||||||
format: uuid
|
format: uuid
|
||||||
|
@ -283,7 +283,7 @@ Channel:
|
||||||
type: "string"
|
type: "string"
|
||||||
format: "uuid"
|
format: "uuid"
|
||||||
creation_date:
|
creation_date:
|
||||||
$ref: "./properties.yml#creation_date"
|
$ref: "./properties.yml#/creation_date"
|
||||||
artist:
|
artist:
|
||||||
$ref: "#/BaseArtist"
|
$ref: "#/BaseArtist"
|
||||||
attributed_to:
|
attributed_to:
|
||||||
|
@ -299,12 +299,12 @@ Subscription:
|
||||||
approved:
|
approved:
|
||||||
type: "string"
|
type: "string"
|
||||||
fid:
|
fid:
|
||||||
$ref: "./properties.yml#fid"
|
$ref: "./properties.yml#/fid"
|
||||||
uuid:
|
uuid:
|
||||||
type: "string"
|
type: "string"
|
||||||
format: "uuid"
|
format: "uuid"
|
||||||
creation_date:
|
creation_date:
|
||||||
$ref: "./properties.yml#creation_date"
|
$ref: "./properties.yml#/creation_date"
|
||||||
channel:
|
channel:
|
||||||
$ref: "#/Channel"
|
$ref: "#/Channel"
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ BaseTrack:
|
||||||
properties:
|
properties:
|
||||||
mbid:
|
mbid:
|
||||||
required: false
|
required: false
|
||||||
$ref: "./properties.yml#mbid"
|
$ref: "./properties.yml#/mbid"
|
||||||
id:
|
id:
|
||||||
type: "integer"
|
type: "integer"
|
||||||
format: "int64"
|
format: "int64"
|
||||||
|
@ -472,7 +472,7 @@ ListeningCreate:
|
||||||
format: "int64"
|
format: "int64"
|
||||||
example: 66
|
example: 66
|
||||||
creation_date:
|
creation_date:
|
||||||
$ref: "./properties.yml#creation_date"
|
$ref: "./properties.yml#/creation_date"
|
||||||
track:
|
track:
|
||||||
type: "integer"
|
type: "integer"
|
||||||
format: "int64"
|
format: "int64"
|
||||||
|
@ -486,7 +486,7 @@ Listening:
|
||||||
format: "int64"
|
format: "int64"
|
||||||
example: 66
|
example: 66
|
||||||
creation_date:
|
creation_date:
|
||||||
$ref: "./properties.yml#creation_date"
|
$ref: "./properties.yml#/creation_date"
|
||||||
track:
|
track:
|
||||||
$ref: "#/Track"
|
$ref: "#/Track"
|
||||||
actor:
|
actor:
|
||||||
|
@ -529,7 +529,7 @@ Upload:
|
||||||
example: 128000
|
example: 128000
|
||||||
description: "Bitrate of the file, in bytes/s"
|
description: "Bitrate of the file, in bytes/s"
|
||||||
mimetype:
|
mimetype:
|
||||||
$ref: "./properties.yml#audio_mimetype"
|
$ref: "./properties.yml#/audio_mimetype"
|
||||||
extension:
|
extension:
|
||||||
type: string
|
type: string
|
||||||
example: "ogg"
|
example: "ogg"
|
||||||
|
@ -556,7 +556,7 @@ OwnedLibraryCreate:
|
||||||
type: "string"
|
type: "string"
|
||||||
example: "Lots of interesting content"
|
example: "Lots of interesting content"
|
||||||
privacy_level:
|
privacy_level:
|
||||||
$ref: "./properties.yml#privacy_level"
|
$ref: "./properties.yml#/privacy_level"
|
||||||
|
|
||||||
OwnedLibrary:
|
OwnedLibrary:
|
||||||
type: "object"
|
type: "object"
|
||||||
|
@ -565,7 +565,7 @@ OwnedLibrary:
|
||||||
type: string
|
type: string
|
||||||
format: uuid
|
format: uuid
|
||||||
fid:
|
fid:
|
||||||
$ref: "./properties.yml#fid"
|
$ref: "./properties.yml#/fid"
|
||||||
name:
|
name:
|
||||||
type: "string"
|
type: "string"
|
||||||
example: "My Creative Commons library"
|
example: "My Creative Commons library"
|
||||||
|
@ -573,9 +573,9 @@ OwnedLibrary:
|
||||||
type: "string"
|
type: "string"
|
||||||
example: "All content is under CC-BY"
|
example: "All content is under CC-BY"
|
||||||
creation_date:
|
creation_date:
|
||||||
$ref: "./properties.yml#creation_date"
|
$ref: "./properties.yml#/creation_date"
|
||||||
privacy_level:
|
privacy_level:
|
||||||
$ref: "./properties.yml#privacy_level"
|
$ref: "./properties.yml#/privacy_level"
|
||||||
uploads_count:
|
uploads_count:
|
||||||
type: "integer"
|
type: "integer"
|
||||||
format: "int64"
|
format: "int64"
|
||||||
|
@ -593,7 +593,7 @@ OwnedUpload:
|
||||||
- type: "object"
|
- type: "object"
|
||||||
properties:
|
properties:
|
||||||
import_status:
|
import_status:
|
||||||
$ref: "./properties.yml#import_status"
|
$ref: "./properties.yml#/import_status"
|
||||||
track:
|
track:
|
||||||
$ref: "#/Track"
|
$ref: "#/Track"
|
||||||
library:
|
library:
|
||||||
|
@ -629,14 +629,14 @@ Playlist:
|
||||||
description: Number of tracks in the playlist
|
description: Number of tracks in the playlist
|
||||||
example: 76
|
example: 76
|
||||||
privacy_level:
|
privacy_level:
|
||||||
$ref: "./properties.yml#privacy_level"
|
$ref: "./properties.yml#/privacy_level"
|
||||||
actor:
|
actor:
|
||||||
$ref: "#/Actor"
|
$ref: "#/Actor"
|
||||||
description: Actor owning the playlist
|
description: Actor owning the playlist
|
||||||
creation_date:
|
creation_date:
|
||||||
$ref: "./properties.yml#creation_date"
|
$ref: "./properties.yml#/creation_date"
|
||||||
modification_date:
|
modification_date:
|
||||||
$ref: "./properties.yml#modification_date"
|
$ref: "./properties.yml#/modification_date"
|
||||||
|
|
||||||
|
|
||||||
PlaylistCreate:
|
PlaylistCreate:
|
||||||
|
@ -647,7 +647,7 @@ PlaylistCreate:
|
||||||
description: Name of the playlist
|
description: Name of the playlist
|
||||||
example: "Move your body"
|
example: "Move your body"
|
||||||
privacy_level:
|
privacy_level:
|
||||||
$ref: "./properties.yml#privacy_level"
|
$ref: "./properties.yml#/privacy_level"
|
||||||
|
|
||||||
PlaylistTrack:
|
PlaylistTrack:
|
||||||
type: "object"
|
type: "object"
|
||||||
|
@ -662,7 +662,7 @@ PlaylistTrack:
|
||||||
example: 16
|
example: 16
|
||||||
description: Position of the track in the playlist
|
description: Position of the track in the playlist
|
||||||
creation_date:
|
creation_date:
|
||||||
$ref: "./properties.yml#creation_date"
|
$ref: "./properties.yml#/creation_date"
|
||||||
track:
|
track:
|
||||||
$ref: "#/Track"
|
$ref: "#/Track"
|
||||||
|
|
||||||
|
@ -675,7 +675,7 @@ ImportMetadata:
|
||||||
example: "My Track"
|
example: "My Track"
|
||||||
required: true
|
required: true
|
||||||
mbid:
|
mbid:
|
||||||
$ref: "./properties.yml#mbid"
|
$ref: "./properties.yml#/mbid"
|
||||||
required: false
|
required: false
|
||||||
copyright:
|
copyright:
|
||||||
type: "string"
|
type: "string"
|
||||||
|
@ -688,7 +688,7 @@ ImportMetadata:
|
||||||
required: false
|
required: false
|
||||||
description: A license code, as returned by /api/v1/licenses
|
description: A license code, as returned by /api/v1/licenses
|
||||||
tags:
|
tags:
|
||||||
$ref: "./properties.yml#tags"
|
$ref: "./properties.yml#/tags"
|
||||||
required: false
|
required: false
|
||||||
position:
|
position:
|
||||||
description: "Position of the track in the album or channel"
|
description: "Position of the track in the album or channel"
|
||||||
|
@ -708,7 +708,7 @@ TrackFavorite:
|
||||||
user:
|
user:
|
||||||
$ref: "#/User"
|
$ref: "#/User"
|
||||||
creation_date:
|
creation_date:
|
||||||
$ref: "./properties.yml#creation_date"
|
$ref: "./properties.yml#/creation_date"
|
||||||
User:
|
User:
|
||||||
type: "object"
|
type: "object"
|
||||||
properties:
|
properties:
|
||||||
|
@ -750,7 +750,7 @@ Me:
|
||||||
type: "string"
|
type: "string"
|
||||||
format: "date-time"
|
format: "date-time"
|
||||||
privacy_level:
|
privacy_level:
|
||||||
$ref: "./properties.yml#privacy_level"
|
$ref: "./properties.yml#/privacy_level"
|
||||||
description: Default privacy-level associated with the user account
|
description: Default privacy-level associated with the user account
|
||||||
quota_status:
|
quota_status:
|
||||||
$ref: "#/QuotaStatus"
|
$ref: "#/QuotaStatus"
|
||||||
|
@ -771,7 +771,7 @@ Me:
|
||||||
|
|
||||||
The token expires after 3 days by default.
|
The token expires after 3 days by default.
|
||||||
|
|
||||||
QuotaStatus:
|
QuotaStatus:
|
||||||
type: "object"
|
type: "object"
|
||||||
properties:
|
properties:
|
||||||
max:
|
max:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
ChannelOrdering:
|
ChannelOrdering:
|
||||||
- $ref: "#/parameters/Ordering"
|
- $ref: "#/Ordering"
|
||||||
- default: "-creation_date"
|
- default: "-creation_date"
|
||||||
schema:
|
schema:
|
||||||
required: false
|
required: false
|
||||||
|
@ -118,6 +118,19 @@ Scope:
|
||||||
- "actor:alice@example.com"
|
- "actor:alice@example.com"
|
||||||
- "domain:example.com"
|
- "domain:example.com"
|
||||||
|
|
||||||
|
ContentCategory:
|
||||||
|
name: "content_category"
|
||||||
|
in: "query"
|
||||||
|
description: |
|
||||||
|
Limits the results to those whose artist content type matches the query.
|
||||||
|
|
||||||
|
schema:
|
||||||
|
required: false
|
||||||
|
type: "string"
|
||||||
|
enum:
|
||||||
|
- "podcast"
|
||||||
|
- "music"
|
||||||
|
|
||||||
Search:
|
Search:
|
||||||
name: "q"
|
name: "q"
|
||||||
in: "query"
|
in: "query"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash -eux
|
#!/bin/bash -eux
|
||||||
|
|
||||||
SWAGGER_VERSION="3.13.6"
|
SWAGGER_VERSION="3.37.2"
|
||||||
TARGET_PATH=${TARGET_PATH-"swagger"}
|
TARGET_PATH=${TARGET_PATH-"swagger"}
|
||||||
rm -rf $TARGET_PATH /tmp/swagger-ui
|
rm -rf $TARGET_PATH /tmp/swagger-ui
|
||||||
git clone --branch="v$SWAGGER_VERSION" --depth=1 "https://github.com/swagger-api/swagger-ui.git" /tmp/swagger-ui
|
git clone --branch="v$SWAGGER_VERSION" --depth=1 "https://github.com/swagger-api/swagger-ui.git" /tmp/swagger-ui
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
openapi: "3.0.2"
|
openapi: "3.0.3"
|
||||||
info:
|
info:
|
||||||
description: |
|
description: |
|
||||||
Interactive documentation for [Funkwhale](https://funkwhale.audio) API.
|
Interactive documentation for [Funkwhale](https://funkwhale.audio) API.
|
||||||
|
@ -140,7 +140,6 @@ components:
|
||||||
description: This API uses OAuth 2 with the Authorization Code flow. You can register an app using the /oauth/apps/ endpoint.
|
description: This API uses OAuth 2 with the Authorization Code flow. You can register an app using the /oauth/apps/ endpoint.
|
||||||
flows:
|
flows:
|
||||||
authorizationCode:
|
authorizationCode:
|
||||||
# Swagger doesn't support relative URLs yet (cf https://github.com/swagger-api/swagger-ui/pull/5244)
|
|
||||||
authorizationUrl: /authorize
|
authorizationUrl: /authorize
|
||||||
tokenUrl: /api/v1/oauth/token/
|
tokenUrl: /api/v1/oauth/token/
|
||||||
refreshUrl: /api/v1/oauth/token/
|
refreshUrl: /api/v1/oauth/token/
|
||||||
|
@ -408,6 +407,7 @@ paths:
|
||||||
- $ref: "./api/parameters.yml#/PageSize"
|
- $ref: "./api/parameters.yml#/PageSize"
|
||||||
- $ref: "./api/parameters.yml#/Related"
|
- $ref: "./api/parameters.yml#/Related"
|
||||||
- $ref: "./api/parameters.yml#/Scope"
|
- $ref: "./api/parameters.yml#/Scope"
|
||||||
|
- $ref: "./api/parameters.yml#/ContentCategory"
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
content:
|
content:
|
||||||
|
@ -506,6 +506,7 @@ paths:
|
||||||
- $ref: "./api/parameters.yml#/PageSize"
|
- $ref: "./api/parameters.yml#/PageSize"
|
||||||
- $ref: "./api/parameters.yml#/Related"
|
- $ref: "./api/parameters.yml#/Related"
|
||||||
- $ref: "./api/parameters.yml#/Scope"
|
- $ref: "./api/parameters.yml#/Scope"
|
||||||
|
- $ref: "./api/parameters.yml#/ContentCategory"
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -5,7 +5,7 @@
|
||||||
"description": "Funkwhale front-end",
|
"description": "Funkwhale front-end",
|
||||||
"author": "Eliot Berriot <contact@eliotberriot.com>",
|
"author": "Eliot Berriot <contact@eliotberriot.com>",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve --port ${VUE_PORT:-8000} --host ${VUE_HOST:-0.0.0.0}",
|
"serve": "[ ! -d src/translations ] && npm run i18n-compile; vue-cli-service serve --port ${VUE_PORT:-8080} --host ${VUE_HOST:-0.0.0.0}",
|
||||||
"build": "scripts/i18n-compile.sh && vue-cli-service build",
|
"build": "scripts/i18n-compile.sh && vue-cli-service build",
|
||||||
"test:unit": "vue-cli-service test:unit",
|
"test:unit": "vue-cli-service test:unit",
|
||||||
"lint": "vue-cli-service lint",
|
"lint": "vue-cli-service lint",
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
// Provides functions to convert between linear and logarithmic volume scales.
|
||||||
|
// The logarithmic volume from the UI is converted to a linear volume with a
|
||||||
|
// logarithmic function like exp(b*x)/a.
|
||||||
|
// Compare https://www.dr-lex.be/info-stuff/volumecontrols.html for how the
|
||||||
|
// values for a and b got derived.
|
||||||
|
|
||||||
|
const PARAM_A = 1000
|
||||||
|
const PARAM_B = Math.log(1000) // ~ 6.908
|
||||||
|
|
||||||
|
function toLinearVolumeScale(v) {
|
||||||
|
// Or as approximation:
|
||||||
|
// return Math.pow(v, 4)
|
||||||
|
if (v == 0.0) {
|
||||||
|
return 0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.min(Math.exp(PARAM_B * v) / PARAM_A, 1.0)
|
||||||
|
}
|
||||||
|
|
||||||
|
function toLogarithmicVolumeScale(v) {
|
||||||
|
// Or as approximation:
|
||||||
|
// return Math.exp(Math.log(v) / 4)
|
||||||
|
if (v == 0.0) {
|
||||||
|
return 0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.log(v * PARAM_A) / PARAM_B
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.toLinearVolumeScale = toLinearVolumeScale
|
||||||
|
exports.toLogarithmicVolumeScale = toLogarithmicVolumeScale
|
|
@ -88,7 +88,7 @@
|
||||||
<translate translate-context="Footer/*/Title/Short">About Funkwhale</translate>
|
<translate translate-context="Footer/*/Title/Short">About Funkwhale</translate>
|
||||||
</h3>
|
</h3>
|
||||||
<p v-translate translate-context="Content/Home/Paragraph">This pod runs Funkwhale, a community-driven project that lets you listen and share music and audio within a decentralized, open network.</p>
|
<p v-translate translate-context="Content/Home/Paragraph">This pod runs Funkwhale, a community-driven project that lets you listen and share music and audio within a decentralized, open network.</p>
|
||||||
<p v-translate translate-context="Content/Home/Paragraph">Funkwhale is free and developped by a friendly community of volunteers.</p>
|
<p v-translate translate-context="Content/Home/Paragraph">Funkwhale is free and developed by a friendly community of volunteers.</p>
|
||||||
<a target="_blank" rel="noopener" href="https://funkwhale.audio">
|
<a target="_blank" rel="noopener" href="https://funkwhale.audio">
|
||||||
<i class="external alternate icon"></i>
|
<i class="external alternate icon"></i>
|
||||||
<translate translate-context="Content/Home/Link">Visit funkwhale.audio</translate>
|
<translate translate-context="Content/Home/Link">Visit funkwhale.audio</translate>
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
{{ currentTrack.title }}
|
{{ currentTrack.title }}
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="sub header ellipsis">
|
<div class="sub header ellipsis">
|
||||||
<router-link class="discrete link artist" :to="{name: 'library.artists.detail', params: {id: currentTrack.artist.id }}">
|
<router-link class="discrete link artist" :to="{name: 'library.artists.detail', params: {id: currentTrack.artist.id }}">{{ currentTrack.artist.name }}</router-link>
|
||||||
{{ currentTrack.artist.name }}</router-link> <template v-if="currentTrack.album">/<router-link class="discrete link album" :to="{name: 'library.albums.detail', params: {id: currentTrack.album.id }}">
|
<template v-if="currentTrack.album"> /
|
||||||
{{ currentTrack.album.title }}
|
<router-link class="discrete link album" :to="{name: 'library.albums.detail', params: {id: currentTrack.album.id }}">{{ currentTrack.album.title }}</router-link>
|
||||||
</router-link></template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -128,7 +128,12 @@
|
||||||
<h2 class="ui header">
|
<h2 class="ui header">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<button
|
<button
|
||||||
class="ui right floated basic icon button"
|
class="ui right floated basic button"
|
||||||
|
@click="$store.commit('ui/queueFocused', null)">
|
||||||
|
<translate translate-context="*/Queue/*/Verb">Close</translate>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="ui right floated basic button danger"
|
||||||
@click="$store.dispatch('queue/clean')">
|
@click="$store.dispatch('queue/clean')">
|
||||||
<translate translate-context="*/Queue/*/Verb">Clear</translate>
|
<translate translate-context="*/Queue/*/Verb">Clear</translate>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div v-if="type === 'both' || type === undefined" class="two ui buttons">
|
||||||
|
<button class="ui left floated labeled icon button" @click.prevent="changeType('rss')"><i class="feed icon"></i>
|
||||||
|
<translate translate-context="Content/Search/Input.Label/Noun">RSS</translate>
|
||||||
|
</button>
|
||||||
|
<div class="or"></div>
|
||||||
|
<button class="ui right floated right labeled icon button" @click.prevent="changeType('artists')"><i class="globe icon"></i>
|
||||||
|
<translate translate-context="Content/Search/Input.Label/Noun">Fediverse</translate>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
<form id="remote-search" :class="['ui', {loading: isLoading}, 'form']" @submit.stop.prevent="submit">
|
<form id="remote-search" :class="['ui', {loading: isLoading}, 'form']" @submit.stop.prevent="submit">
|
||||||
<div v-if="errors.length > 0" role="alert" class="ui negative message">
|
<div v-if="errors.length > 0" role="alert" class="ui negative message">
|
||||||
<h3 class="header"><translate translate-context="Content/*/Error message.Title">Error while fetching object</translate></h3>
|
<h3 class="header"><translate translate-context="Content/*/Error message.Title">Error while fetching object</translate></h3>
|
||||||
|
@ -14,7 +23,7 @@
|
||||||
<p v-if="type === 'rss'">
|
<p v-if="type === 'rss'">
|
||||||
<translate translate-context="Content/Fetch/Paragraph">Paste here the RSS url or the fediverse address to subscribe to its feed.</translate>
|
<translate translate-context="Content/Fetch/Paragraph">Paste here the RSS url or the fediverse address to subscribe to its feed.</translate>
|
||||||
</p>
|
</p>
|
||||||
<p v-else>
|
<p v-else-if="type === 'artists'">
|
||||||
<translate translate-context="Content/Fetch/Paragraph">Use this form to retrieve an object hosted somewhere else in the fediverse.</translate>
|
<translate translate-context="Content/Fetch/Paragraph">Use this form to retrieve an object hosted somewhere else in the fediverse.</translate>
|
||||||
</p>
|
</p>
|
||||||
<input type="text" name="object-id" id="object-id" :placeholder="labels.fieldPlaceholder" v-model="id" required>
|
<input type="text" name="object-id" id="object-id" :placeholder="labels.fieldPlaceholder" v-model="id" required>
|
||||||
|
@ -54,7 +63,7 @@ export default {
|
||||||
if (this.type === 'rss') {
|
if (this.type === 'rss') {
|
||||||
this.rssSubscribe()
|
this.rssSubscribe()
|
||||||
|
|
||||||
} else {
|
} else if (this.type === 'artists') {
|
||||||
this.createFetch()
|
this.createFetch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,6 +118,9 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
changeType(newType) {
|
||||||
|
this.type = newType
|
||||||
|
},
|
||||||
submit () {
|
submit () {
|
||||||
if (this.type === 'rss') {
|
if (this.type === 'rss') {
|
||||||
return this.rssSubscribe()
|
return this.rssSubscribe()
|
||||||
|
|
|
@ -114,20 +114,22 @@
|
||||||
<div class="ui small hidden divider"></div>
|
<div class="ui small hidden divider"></div>
|
||||||
<section :class="['ui', 'bottom', 'attached', {active: selectedTab === 'library'}, 'tab']" :aria-label="labels.mainMenu">
|
<section :class="['ui', 'bottom', 'attached', {active: selectedTab === 'library'}, 'tab']" :aria-label="labels.mainMenu">
|
||||||
<nav class="ui vertical large fluid inverted menu" role="navigation" :aria-label="labels.mainMenu">
|
<nav class="ui vertical large fluid inverted menu" role="navigation" :aria-label="labels.mainMenu">
|
||||||
<div :class="[{collapsed: !exploreExpanded}, 'collaspable item']">
|
<div :class="[{collapsed: !exploreExpanded}, 'collapsible item']">
|
||||||
<h2 class="header" role="button" @click="exploreExpanded = true" tabindex="0" @focus="exploreExpanded = true">
|
<h2 class="header" role="button" @click="exploreExpanded = true" tabindex="0" @focus="exploreExpanded = true">
|
||||||
<translate translate-context="*/*/*/Verb">Explore</translate>
|
<translate translate-context="*/*/*/Verb">Explore</translate>
|
||||||
<i class="angle right icon" v-if="!exploreExpanded"></i>
|
<i class="angle right icon" v-if="!exploreExpanded"></i>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
|
<router-link class="item" :to="{name: 'search'}"><i class="search icon"></i><translate translate-context="Sidebar/Navigation/List item.Link/Verb">Search</translate></router-link>
|
||||||
<router-link class="item" :exact="true" :to="{name: 'library.index'}"><i class="music icon"></i><translate translate-context="Sidebar/Navigation/List item.Link/Verb">Browse</translate></router-link>
|
<router-link class="item" :exact="true" :to="{name: 'library.index'}"><i class="music icon"></i><translate translate-context="Sidebar/Navigation/List item.Link/Verb">Browse</translate></router-link>
|
||||||
|
<router-link class="item" :to="{name: 'library.podcasts.browse'}"><i class="podcast icon"></i><translate translate-context="*/*/*">Podcasts</translate></router-link>
|
||||||
<router-link class="item" :to="{name: 'library.albums.browse'}"><i class="compact disc icon"></i><translate translate-context="*/*/*">Albums</translate></router-link>
|
<router-link class="item" :to="{name: 'library.albums.browse'}"><i class="compact disc icon"></i><translate translate-context="*/*/*">Albums</translate></router-link>
|
||||||
<router-link class="item" :to="{name: 'library.artists.browse'}"><i class="user icon"></i><translate translate-context="*/*/*">Artists</translate></router-link>
|
<router-link class="item" :to="{name: 'library.artists.browse'}"><i class="user icon"></i><translate translate-context="*/*/*">Artists</translate></router-link>
|
||||||
<router-link class="item" :to="{name: 'library.playlists.browse'}"><i class="list icon"></i><translate translate-context="*/*/*">Playlists</translate></router-link>
|
<router-link class="item" :to="{name: 'library.playlists.browse'}"><i class="list icon"></i><translate translate-context="*/*/*">Playlists</translate></router-link>
|
||||||
<router-link class="item" :to="{name: 'library.radios.browse'}"><i class="feed icon"></i><translate translate-context="*/*/*">Radios</translate></router-link>
|
<router-link class="item" :to="{name: 'library.radios.browse'}"><i class="feed icon"></i><translate translate-context="*/*/*">Radios</translate></router-link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div :class="[{collapsed: !myLibraryExpanded}, 'collaspable item']" v-if="$store.state.auth.authenticated">
|
<div :class="[{collapsed: !myLibraryExpanded}, 'collapsible item']" v-if="$store.state.auth.authenticated">
|
||||||
<h3 class="header" role="button" @click="myLibraryExpanded = true" tabindex="0" @focus="myLibraryExpanded = true">
|
<h3 class="header" role="button" @click="myLibraryExpanded = true" tabindex="0" @focus="myLibraryExpanded = true">
|
||||||
<translate translate-context="*/*/*/Noun">My Library</translate>
|
<translate translate-context="*/*/*/Noun">My Library</translate>
|
||||||
<i class="angle right icon" v-if="!myLibraryExpanded"></i>
|
<i class="angle right icon" v-if="!myLibraryExpanded"></i>
|
||||||
|
@ -225,7 +227,9 @@ export default {
|
||||||
},
|
},
|
||||||
focusedMenu () {
|
focusedMenu () {
|
||||||
let mapping = {
|
let mapping = {
|
||||||
|
"search": 'exploreExpanded',
|
||||||
"library.index": 'exploreExpanded',
|
"library.index": 'exploreExpanded',
|
||||||
|
"library.podcasts.browse": 'exploreExpanded',
|
||||||
"library.albums.browse": 'exploreExpanded',
|
"library.albums.browse": 'exploreExpanded',
|
||||||
"library.albums.detail": 'exploreExpanded',
|
"library.albums.detail": 'exploreExpanded',
|
||||||
"library.artists.browse": 'exploreExpanded',
|
"library.artists.browse": 'exploreExpanded',
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<div v-if="isLoading" class="ui inverted active dimmer">
|
<div v-if="isLoading" class="ui inverted active dimmer">
|
||||||
<div class="ui loader"></div>
|
<div class="ui loader"></div>
|
||||||
</div>
|
</div>
|
||||||
<channel-entry-card v-for="entry in objects" :entry="entry" :key="entry.id" />
|
<channel-entry-card v-for="entry in objects" :default-cover="defaultCover" :entry="entry" :key="entry.id" />
|
||||||
<template v-if="count > limit">
|
<template v-if="count > limit">
|
||||||
<div class="ui hidden divider"></div>
|
<div class="ui hidden divider"></div>
|
||||||
<div class = "ui center aligned basic segment">
|
<div class = "ui center aligned basic segment">
|
||||||
|
@ -38,6 +38,7 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
filters: {type: Object, required: true},
|
filters: {type: Object, required: true},
|
||||||
limit: {type: Number, default: 10},
|
limit: {type: Number, default: 10},
|
||||||
|
defaultCover: {type: Object},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
ChannelEntryCard,
|
ChannelEntryCard,
|
||||||
|
|
|
@ -9,10 +9,11 @@
|
||||||
class="channel-image image"
|
class="channel-image image"
|
||||||
v-if="cover && cover.urls.original"
|
v-if="cover && cover.urls.original"
|
||||||
v-lazy="$store.getters['instance/absoluteUrl'](cover.urls.medium_square_crop)">
|
v-lazy="$store.getters['instance/absoluteUrl'](cover.urls.medium_square_crop)">
|
||||||
<span
|
<img
|
||||||
@click="$router.push({name: 'library.tracks.detail', params: {id: entry.id}})"
|
@click="$router.push({name: 'library.tracks.detail', params: {id: entry.id}})"
|
||||||
class="channel-image image"
|
class="channel-image image"
|
||||||
v-else-if="entry.artist.content_category === 'podcast'">#{{ entry.position }}</span>
|
v-else-if="entry.artist.content_category === 'podcast' && defaultCover != undefined"
|
||||||
|
v-lazy="$store.getters['instance/absoluteUrl'](defaultCover.urls.medium_square_crop)">
|
||||||
<img
|
<img
|
||||||
@click="$router.push({name: 'library.tracks.detail', params: {id: entry.id}})"
|
@click="$router.push({name: 'library.tracks.detail', params: {id: entry.id}})"
|
||||||
alt=""
|
alt=""
|
||||||
|
@ -53,7 +54,7 @@ import { mapGetters } from "vuex"
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['entry'],
|
props: ['entry', 'defaultCover'],
|
||||||
components: {
|
components: {
|
||||||
PlayButton,
|
PlayButton,
|
||||||
TrackFavoriteIcon,
|
TrackFavoriteIcon,
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="channel-serie-card">
|
<div class="channel-serie-card">
|
||||||
<div class="two-images">
|
<div class="two-images">
|
||||||
<img alt="" @click="$router.push({name: 'library.albums.detail', params: {id: serie.id}})" class="channel-image" v-if="cover.urls.original" v-lazy="$store.getters['instance/absoluteUrl'](cover.urls.medium_square_crop)">
|
<img alt="" @click="$router.push({name: 'library.albums.detail', params: {id: serie.id}})" class="channel-image" v-if="cover && cover.urls.original" v-lazy="$store.getters['instance/absoluteUrl'](cover.urls.medium_square_crop)">
|
||||||
<img alt="" @click="$router.push({name: 'library.albums.detail', params: {id: serie.id}})" class="channel-image" v-else src="../../assets/audio/default-cover.png">
|
<img alt="" @click="$router.push({name: 'library.albums.detail', params: {id: serie.id}})" class="channel-image" v-else src="../../assets/audio/default-cover.png">
|
||||||
<img alt="" @click="$router.push({name: 'library.albums.detail', params: {id: serie.id}})" class="channel-image" v-if="cover.urls.original" v-lazy="$store.getters['instance/absoluteUrl'](cover.urls.medium_square_crop)">
|
<img alt="" @click="$router.push({name: 'library.albums.detail', params: {id: serie.id}})" class="channel-image" v-if="cover && cover.urls.original" v-lazy="$store.getters['instance/absoluteUrl'](cover.urls.medium_square_crop)">
|
||||||
<img alt="" @click="$router.push({name: 'library.albums.detail', params: {id: serie.id}})" class="channel-image" v-else src="../../assets/audio/default-cover.png">
|
<img alt="" @click="$router.push({name: 'library.albums.detail', params: {id: serie.id}})" class="channel-image" v-else src="../../assets/audio/default-cover.png">
|
||||||
</div>
|
</div>
|
||||||
<div class="content ellipsis">
|
<div class="content ellipsis">
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
</router-link>
|
</router-link>
|
||||||
</strong>
|
</strong>
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
<router-link @click.stop.prevent="" class="discrete link" :to="{name: 'library.artists.detail', params: {id: currentTrack.artist.id }}">
|
<router-link @click.stop.prevent="" class="discrete link" :to="{name: 'library.artists.detail', params: {id: currentTrack.artist.id }}">{{ currentTrack.artist.name }}</router-link>
|
||||||
{{ currentTrack.artist.name }}</router-link><template v-if="currentTrack.album"> /<router-link @click.stop.prevent="" class="discrete link" :to="{name: 'library.albums.detail', params: {id: currentTrack.album.id }}">
|
<template v-if="currentTrack.album"> /
|
||||||
{{ currentTrack.album.title }}
|
<router-link @click.stop.prevent="" class="discrete link" :to="{name: 'library.albums.detail', params: {id: currentTrack.album.id }}">{{ currentTrack.album.title }}</router-link>
|
||||||
</router-link></template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -277,6 +277,7 @@ export default {
|
||||||
})
|
})
|
||||||
if (this.currentTrack) {
|
if (this.currentTrack) {
|
||||||
this.getSound(this.currentTrack)
|
this.getSound(this.currentTrack)
|
||||||
|
this.updateMetadata()
|
||||||
}
|
}
|
||||||
// Add controls for notification drawer
|
// Add controls for notification drawer
|
||||||
if ('mediaSession' in navigator) {
|
if ('mediaSession' in navigator) {
|
||||||
|
@ -550,6 +551,10 @@ export default {
|
||||||
this.updateProgressThrottled.cancel()
|
this.updateProgressThrottled.cancel()
|
||||||
}
|
}
|
||||||
this.currentSound.seek(t)
|
this.currentSound.seek(t)
|
||||||
|
// If player is paused update progress immediately to ensure updated UI
|
||||||
|
if (!this.$store.state.player.playing) {
|
||||||
|
this.updateProgress()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
ended: function () {
|
ended: function () {
|
||||||
let onlyTrack = this.$store.state.queue.tracks.length === 1
|
let onlyTrack = this.$store.state.queue.tracks.length === 1
|
||||||
|
@ -642,6 +647,28 @@ export default {
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
updateMetadata () {
|
||||||
|
// If the session is playing as a PWA, populate the notification
|
||||||
|
// with details from the track
|
||||||
|
if (this.currentTrack && 'mediaSession' in navigator) {
|
||||||
|
let metadata = {
|
||||||
|
title: this.currentTrack.title,
|
||||||
|
artist: this.currentTrack.artist.name,
|
||||||
|
}
|
||||||
|
if (this.currentTrack.album && this.currentTrack.album.cover) {
|
||||||
|
metadata.album = this.currentTrack.album.title
|
||||||
|
metadata.artwork = [
|
||||||
|
{ src: this.currentTrack.album.cover.urls.original, sizes: '96x96', type: 'image/png' },
|
||||||
|
{ src: this.currentTrack.album.cover.urls.original, sizes: '128x128', type: 'image/png' },
|
||||||
|
{ src: this.currentTrack.album.cover.urls.original, sizes: '192x192', type: 'image/png' },
|
||||||
|
{ src: this.currentTrack.album.cover.urls.original, sizes: '256x256', type: 'image/png' },
|
||||||
|
{ src: this.currentTrack.album.cover.urls.original, sizes: '384x384', type: 'image/png' },
|
||||||
|
{ src: this.currentTrack.album.cover.urls.original, sizes: '512x512', type: 'image/png' },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
navigator.mediaSession.metadata = new MediaMetadata(metadata)
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
|
@ -723,26 +750,7 @@ export default {
|
||||||
this.playTimeout = setTimeout(async () => {
|
this.playTimeout = setTimeout(async () => {
|
||||||
await self.loadSound(newValue, oldValue)
|
await self.loadSound(newValue, oldValue)
|
||||||
}, 500);
|
}, 500);
|
||||||
// If the session is playing as a PWA, populate the notification
|
this.updateMetadata()
|
||||||
// with details from the track
|
|
||||||
if (this.currentTrack && 'mediaSession' in navigator) {
|
|
||||||
let metadata = {
|
|
||||||
title: this.currentTrack.title,
|
|
||||||
artist: this.currentTrack.artist.name,
|
|
||||||
}
|
|
||||||
if (this.currentTrack.album && this.currentTrack.album.cover) {
|
|
||||||
metadata.album = this.currentTrack.album.title
|
|
||||||
metadata.artwork = [
|
|
||||||
{ src: this.currentTrack.album.cover.urls.original, sizes: '96x96', type: 'image/png' },
|
|
||||||
{ src: this.currentTrack.album.cover.urls.original, sizes: '128x128', type: 'image/png' },
|
|
||||||
{ src: this.currentTrack.album.cover.urls.original, sizes: '192x192', type: 'image/png' },
|
|
||||||
{ src: this.currentTrack.album.cover.urls.original, sizes: '256x256', type: 'image/png' },
|
|
||||||
{ src: this.currentTrack.album.cover.urls.original, sizes: '384x384', type: 'image/png' },
|
|
||||||
{ src: this.currentTrack.album.cover.urls.original, sizes: '512x512', type: 'image/png' },
|
|
||||||
]
|
|
||||||
}
|
|
||||||
navigator.mediaSession.metadata = new MediaMetadata(metadata);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
immediate: false
|
immediate: false
|
||||||
},
|
},
|
||||||
|
|
|
@ -29,15 +29,16 @@
|
||||||
<input
|
<input
|
||||||
id="volume-slider"
|
id="volume-slider"
|
||||||
type="range"
|
type="range"
|
||||||
step="0.05"
|
step="0.02"
|
||||||
min="0"
|
min="0"
|
||||||
max="1"
|
max="1"
|
||||||
v-model="sliderVolume" />
|
v-model="sliderVolume" />
|
||||||
</div>
|
</div>
|
||||||
</button class="circular control">
|
</button>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapGetters, mapActions } from "vuex"
|
import { mapState, mapGetters, mapActions } from "vuex"
|
||||||
|
import { toLinearVolumeScale, toLogarithmicVolumeScale } from '@/audio/volume'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
|
@ -49,10 +50,10 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
sliderVolume: {
|
sliderVolume: {
|
||||||
get () {
|
get () {
|
||||||
return this.$store.state.player.volume
|
return toLogarithmicVolumeScale(this.$store.state.player.volume)
|
||||||
},
|
},
|
||||||
set (v) {
|
set (v) {
|
||||||
this.$store.commit("player/volume", v)
|
this.$store.commit("player/volume", toLinearVolumeScale(v))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
labels () {
|
labels () {
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
<tags-list label-classes="tiny" :truncate-size="20" :limit="2" :show-more="false" :tags="artist.tags"></tags-list>
|
<tags-list label-classes="tiny" :truncate-size="20" :limit="2" :show-more="false" :tags="artist.tags"></tags-list>
|
||||||
</div>
|
</div>
|
||||||
<div class="extra content">
|
<div class="extra content">
|
||||||
<translate translate-context="*/*/*" :translate-params="{count: artist.tracks_count}" :translate-n="artist.tracks_count" translate-plural="%{ count } tracks">%{ count } track</translate>
|
<translate v-if="artist.content_category === 'music'" translate-context="*/*/*" :translate-params="{count: artist.tracks_count}" :translate-n="artist.tracks_count" translate-plural="%{ count } tracks">%{ count } track</translate>
|
||||||
|
<translate v-else translate-context="*/*/*" :translate-params="{count: artist.tracks_count}" :translate-n="artist.tracks_count" translate-plural="%{ count } episodes">%{ count } episode</translate>
|
||||||
<play-button class="right floated basic icon" :dropdown-only="true" :is-playable="artist.is_playable" :dropdown-icon-classes="['ellipsis', 'horizontal', 'large really discrete']" :artist="artist"></play-button>
|
<play-button class="right floated basic icon" :dropdown-only="true" :is-playable="artist.is_playable" :dropdown-icon-classes="['ellipsis', 'horizontal', 'large really discrete']" :artist="artist"></play-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -91,7 +91,7 @@ export default {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
this.errors = []
|
this.errors = []
|
||||||
let url = `plugins/${this.plugin.name}`
|
let url = `plugins/${this.plugin.name}`
|
||||||
let enableUrl = this.enabled ? `${url}/enable` : `${url}/enable`
|
let enableUrl = this.enabled ? `${url}/enable` : `${url}/disable`
|
||||||
await axios.post(enableUrl)
|
await axios.post(enableUrl)
|
||||||
try {
|
try {
|
||||||
await axios.post(url, this.values)
|
await axios.post(url, this.values)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<translate key="1" v-if="isSerie" translate-context="Content/Channels/*">Episodes</translate>
|
<translate key="1" v-if="isSerie" translate-context="Content/Channels/*">Episodes</translate>
|
||||||
<translate key="2" v-else translate-context="*/*/*">Tracks</translate>
|
<translate key="2" v-else translate-context="*/*/*">Tracks</translate>
|
||||||
</h2>
|
</h2>
|
||||||
<channel-entries v-if="artist.channel && isSerie" :limit="50" :filters="{channel: artist.channel.uuid, ordering: '-creation_date'}">
|
<channel-entries v-if="artist.channel && isSerie" :limit="50" :filters="{channel: artist.channel.uuid, album: object.id, ordering: '-creation_date'}">
|
||||||
</channel-entries>
|
</channel-entries>
|
||||||
<template v-else-if="discs && discs.length > 1">
|
<template v-else-if="discs && discs.length > 1">
|
||||||
<div v-for="tracks in discs" :key="tracks.disc_number">
|
<div v-for="tracks in discs" :key="tracks.disc_number">
|
||||||
|
|
|
@ -175,6 +175,8 @@ export default {
|
||||||
ordering: this.getOrderingAsString(),
|
ordering: this.getOrderingAsString(),
|
||||||
playable: "true",
|
playable: "true",
|
||||||
tag: this.tags,
|
tag: this.tags,
|
||||||
|
include_channels: "true",
|
||||||
|
content_category: "music"
|
||||||
}
|
}
|
||||||
logger.default.debug("Fetching albums")
|
logger.default.debug("Fetching albums")
|
||||||
axios.get(
|
axios.get(
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="fields">
|
<div class="fields">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="artist-search">
|
<label for="artist-search">
|
||||||
<translate translate-context="Content/Search/Input.Label/Noun">Search</translate>
|
<translate translate-context="Content/Search/Input.Label/Noun">Artist name</translate>
|
||||||
</label>
|
</label>
|
||||||
<div class="ui action input">
|
<div class="ui action input">
|
||||||
<input id="artist-search" type="text" name="search" v-model="query" :placeholder="labels.searchPlaceholder"/>
|
<input id="artist-search" type="text" name="search" v-model="query" :placeholder="labels.searchPlaceholder"/>
|
||||||
|
@ -138,7 +138,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
labels() {
|
labels() {
|
||||||
let searchPlaceholder = this.$pgettext('Content/Search/Input.Placeholder', "Enter artist name…")
|
let searchPlaceholder = this.$pgettext('Content/Search/Input.Placeholder', "Search…")
|
||||||
let title = this.$pgettext('*/*/*/Noun', "Artists")
|
let title = this.$pgettext('*/*/*/Noun', "Artists")
|
||||||
return {
|
return {
|
||||||
searchPlaceholder,
|
searchPlaceholder,
|
||||||
|
@ -157,7 +157,9 @@ export default {
|
||||||
page: this.page,
|
page: this.page,
|
||||||
tag: this.tags,
|
tag: this.tags,
|
||||||
paginateBy: this.paginateBy,
|
paginateBy: this.paginateBy,
|
||||||
ordering: this.getOrderingAsString()
|
ordering: this.getOrderingAsString(),
|
||||||
|
content_category: 'music',
|
||||||
|
include_channels: true,
|
||||||
}).toString()
|
}).toString()
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
@ -175,6 +177,7 @@ export default {
|
||||||
playable: "true",
|
playable: "true",
|
||||||
tag: this.tags,
|
tag: this.tags,
|
||||||
include_channels: "true",
|
include_channels: "true",
|
||||||
|
content_category: 'music',
|
||||||
}
|
}
|
||||||
logger.default.debug("Fetching artists")
|
logger.default.debug("Fetching artists")
|
||||||
axios.get(
|
axios.get(
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="component-file-upload">
|
<div class="component-file-upload">
|
||||||
<div class="ui top attached tabular menu">
|
<div class="ui top attached tabular menu">
|
||||||
<a href="" :class="['item', {active: currentTab === 'summary'}]" @click.prevent="currentTab = 'summary'"><translate translate-context="Content/Library/Tab.Title/Short">Summary</translate></a>
|
|
||||||
<a href="" :class="['item', {active: currentTab === 'uploads'}]" @click.prevent="currentTab = 'uploads'">
|
<a href="" :class="['item', {active: currentTab === 'uploads'}]" @click.prevent="currentTab = 'uploads'">
|
||||||
<translate translate-context="Content/Library/Tab.Title/Short">Uploading</translate>
|
<translate translate-context="Content/Library/Tab.Title/Short">Uploading</translate>
|
||||||
<div v-if="files.length === 0" class="ui label">
|
<div v-if="files.length === 0" class="ui label">
|
||||||
|
@ -27,8 +26,18 @@
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div :class="['ui', 'bottom', 'attached', 'segment', {hidden: currentTab != 'summary'}]">
|
<div :class="['ui', 'bottom', 'attached', 'segment', {hidden: currentTab != 'uploads'}]">
|
||||||
<h2 class="ui header"><translate translate-context="Content/Library/Title/Verb">Upload new tracks</translate></h2>
|
<div :class="['ui', {loading: isLoadingQuota}, 'container']">
|
||||||
|
<div :class="['ui', {red: remainingSpace === 0}, {warning: remainingSpace > 0 && remainingSpace <= 50}, 'small', 'statistic']">
|
||||||
|
<div class="label">
|
||||||
|
<translate translate-context="Content/Library/Paragraph">Remaining storage space</translate>
|
||||||
|
</div>
|
||||||
|
<div class="value">
|
||||||
|
{{ remainingSpace * 1000 * 1000 | humanSize}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ui divider"></div>
|
||||||
|
<h2 class="ui header"><translate translate-context="Content/Library/Title/Verb">Upload music from your local storage</translate></h2>
|
||||||
<div class="ui message">
|
<div class="ui message">
|
||||||
<p><translate translate-context="Content/Library/Paragraph">You are about to upload music to your library. Before proceeding, please ensure that:</translate></p>
|
<p><translate translate-context="Content/Library/Paragraph">You are about to upload music to your library. Before proceeding, please ensure that:</translate></p>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -40,67 +49,10 @@
|
||||||
<a href="http://picard.musicbrainz.org/" target='_blank'><translate translate-context="Content/Library/Link">We recommend using Picard for that purpose.</translate></a>
|
<a href="http://picard.musicbrainz.org/" target='_blank'><translate translate-context="Content/Library/Link">We recommend using Picard for that purpose.</translate></a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<translate translate-context="Content/Library/List item">The uploaded music files are in OGG, Flac or MP3 format</translate>
|
<translate translate-context="Content/Library/List item">The music files you are uploading are in OGG, Flac, MP3 or AIFF format</translate>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form class="ui form" @submit.prevent="currentTab = 'uploads'">
|
|
||||||
<div class="fields">
|
|
||||||
<div class="ui field">
|
|
||||||
<label for="import-reference"><translate translate-context="Content/Library/Input.Label/Noun">Import reference</translate></label>
|
|
||||||
<p><translate translate-context="Content/Library/Paragraph">This reference will be used to group imported files together.</translate></p>
|
|
||||||
<input id="import-reference" name="import-ref" type="text" v-model="importReference" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="submit" class="ui success button"><translate translate-context="Content/Library/Button.Label">Proceed</translate></button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<template v-if="$store.state.auth.availablePermissions['library']">
|
|
||||||
<div class="ui divider"></div>
|
|
||||||
<h2 class="ui header"><translate translate-context="Content/Library/Title/Verb">Import music from your server</translate></h2>
|
|
||||||
<div v-if="fsErrors.length > 0" role="alert" class="ui negative message">
|
|
||||||
<h3 class="header"><translate translate-context="Content/*/Error message.Title">Error while launching import</translate></h3>
|
|
||||||
<ul class="list">
|
|
||||||
<li v-for="error in fsErrors">{{ error }}</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<fs-browser
|
|
||||||
v-if="fsStatus"
|
|
||||||
v-model="fsPath"
|
|
||||||
@import="importFs"
|
|
||||||
:loading="isLoadingFs"
|
|
||||||
:data="fsStatus"></fs-browser>
|
|
||||||
|
|
||||||
<template v-if="fsStatus && fsStatus.import">
|
|
||||||
<h3 class="ui header"><translate translate-context="Content/Library/Title/Verb">Import status</translate></h3>
|
|
||||||
<p v-if="fsStatus.import.reference != importReference">
|
|
||||||
<translate translate-context="Content/Library/Paragraph">Results of your previous import:</translate>
|
|
||||||
</p>
|
|
||||||
<p v-else>
|
|
||||||
<translate translate-context="Content/Library/Paragraph">Results of your import:</translate>
|
|
||||||
</p>
|
|
||||||
<button
|
|
||||||
class="ui button"
|
|
||||||
@click="cancelFsScan"
|
|
||||||
v-if="fsStatus.import.status === 'started' || fsStatus.import.status === 'pending'">
|
|
||||||
<translate translate-context="*/*/Button.Label/Verb">Cancel</translate>
|
|
||||||
</button>
|
|
||||||
<fs-logs :data="fsStatus.import"></fs-logs>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
<div :class="['ui', 'bottom', 'attached', 'segment', {hidden: currentTab != 'uploads'}]">
|
|
||||||
<div :class="['ui', {loading: isLoadingQuota}, 'container']">
|
|
||||||
<div :class="['ui', {red: remainingSpace === 0}, {warning: remainingSpace > 0 && remainingSpace <= 50}, 'small', 'statistic']">
|
|
||||||
<div class="label">
|
|
||||||
<translate translate-context="Content/Library/Paragraph">Remaining storage space</translate>
|
|
||||||
</div>
|
|
||||||
<div class="value">
|
|
||||||
{{ remainingSpace * 1000 * 1000 | humanSize}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<file-upload-widget
|
<file-upload-widget
|
||||||
:class="['ui', 'icon', 'basic', 'button']"
|
:class="['ui', 'icon', 'basic', 'button']"
|
||||||
:post-action="uploadUrl"
|
:post-action="uploadUrl"
|
||||||
|
@ -178,6 +130,37 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ui divider"></div>
|
||||||
|
<h2 class="ui header"><translate translate-context="Content/Library/Title/Verb">Import music from your server</translate></h2>
|
||||||
|
<div v-if="fsErrors.length > 0" role="alert" class="ui negative message">
|
||||||
|
<h3 class="header"><translate translate-context="Content/*/Error message.Title">Error while launching import</translate></h3>
|
||||||
|
<ul class="list">
|
||||||
|
<li v-for="error in fsErrors">{{ error }}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<fs-browser
|
||||||
|
v-model="fsPath"
|
||||||
|
@import="importFs"
|
||||||
|
:loading="isLoadingFs"
|
||||||
|
:data="fsStatus"></fs-browser>
|
||||||
|
<template v-if="fsStatus && fsStatus.import">
|
||||||
|
<h3 class="ui header"><translate translate-context="Content/Library/Title/Verb">Import status</translate></h3>
|
||||||
|
<p v-if="fsStatus.import.reference != importReference">
|
||||||
|
<translate translate-context="Content/Library/Paragraph">Results of your previous import:</translate>
|
||||||
|
</p>
|
||||||
|
<p v-else>
|
||||||
|
<translate translate-context="Content/Library/Paragraph">Results of your import:</translate>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="ui button"
|
||||||
|
@click="cancelFsScan"
|
||||||
|
v-if="fsStatus.import.status === 'started' || fsStatus.import.status === 'pending'">
|
||||||
|
<translate translate-context="*/*/Button.Label/Verb">Cancel</translate>
|
||||||
|
</button>
|
||||||
|
<fs-logs :data="fsStatus.import"></fs-logs>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div :class="['ui', 'bottom', 'attached', 'segment', {hidden: currentTab != 'processing'}]">
|
<div :class="['ui', 'bottom', 'attached', 'segment', {hidden: currentTab != 'processing'}]">
|
||||||
|
@ -216,7 +199,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
files: [],
|
files: [],
|
||||||
needsRefresh: false,
|
needsRefresh: false,
|
||||||
currentTab: "summary",
|
currentTab: "uploads",
|
||||||
uploadUrl: this.$store.getters['instance/absoluteUrl']("/api/v1/uploads/"),
|
uploadUrl: this.$store.getters['instance/absoluteUrl']("/api/v1/uploads/"),
|
||||||
importReference,
|
importReference,
|
||||||
isLoadingQuota: false,
|
isLoadingQuota: false,
|
||||||
|
|
|
@ -0,0 +1,247 @@
|
||||||
|
<template>
|
||||||
|
<main v-title="labels.title">
|
||||||
|
<section class="ui vertical stripe segment">
|
||||||
|
<h2 class="ui header">
|
||||||
|
<translate translate-context="Content/Podcasts/Title">Browsing Podcasts</translate>
|
||||||
|
</h2>
|
||||||
|
<form :class="['ui', {'loading': isLoading}, 'form']" @submit.prevent="updatePage();updateQueryString();fetchData()">
|
||||||
|
<div class="fields">
|
||||||
|
<div class="field">
|
||||||
|
<label for="artist-search">
|
||||||
|
<translate translate-context="Content/Search/Input.Label/Noun">Podcast Title</translate>
|
||||||
|
</label>
|
||||||
|
<div class="ui action input">
|
||||||
|
<input id="artist-search" type="text" name="search" v-model="query" :placeholder="labels.searchPlaceholder"/>
|
||||||
|
<button class="ui icon button" type="submit" :aria-label="$pgettext('Content/Search/Input.Label/Noun', 'Search')">
|
||||||
|
<i class="search icon"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="tags-search"><translate translate-context="*/*/*/Noun">Tags</translate></label>
|
||||||
|
<tags-selector v-model="tags"></tags-selector>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="artist-ordering"><translate translate-context="Content/Search/Dropdown.Label/Noun">Ordering</translate></label>
|
||||||
|
<select id="artist-ordering" class="ui dropdown" v-model="ordering">
|
||||||
|
<option v-for="option in orderingOptions" :value="option[0]">
|
||||||
|
{{ sharedLabels.filters[option[1]] }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="artist-ordering-direction"><translate translate-context="Content/Search/Dropdown.Label/Noun">Ordering direction</translate></label>
|
||||||
|
<select id="artist-ordering-direction" class="ui dropdown" v-model="orderingDirection">
|
||||||
|
<option value="+"><translate translate-context="Content/Search/Dropdown">Ascending</translate></option>
|
||||||
|
<option value="-"><translate translate-context="Content/Search/Dropdown">Descending</translate></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="artist-results"><translate translate-context="Content/Search/Dropdown.Label/Noun">Results per page</translate></label>
|
||||||
|
<select id="artist-results" class="ui dropdown" v-model="paginateBy">
|
||||||
|
<option :value="parseInt(12)">12</option>
|
||||||
|
<option :value="parseInt(30)">30</option>
|
||||||
|
<option :value="parseInt(50)">50</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div class="ui hidden divider"></div>
|
||||||
|
<div v-if="result && result.results.length > 0" class="ui five app-cards cards">
|
||||||
|
<div v-if="isLoading" class="ui inverted active dimmer">
|
||||||
|
<div class="ui loader"></div>
|
||||||
|
</div>
|
||||||
|
<artist-card :artist="artist" v-for="artist in result.results" :key="artist.id"></artist-card>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="!isLoading" class="ui placeholder segment sixteen wide column" style="text-align: center; display: flex; align-items: center">
|
||||||
|
<div class="ui icon header">
|
||||||
|
<i class="podcast icon"></i>
|
||||||
|
<translate translate-context="Content/Artists/Placeholder">
|
||||||
|
No results matching your query
|
||||||
|
</translate>
|
||||||
|
</div>
|
||||||
|
<router-link
|
||||||
|
v-if="$store.state.auth.authenticated"
|
||||||
|
:to="{name: 'content.index'}"
|
||||||
|
class="ui success button labeled icon">
|
||||||
|
<i class="upload icon"></i>
|
||||||
|
<translate translate-context="Content/*/Verb">
|
||||||
|
Create a Channel
|
||||||
|
</translate>
|
||||||
|
</router-link>
|
||||||
|
<h1 v-if ="$store.state.auth.authenticated" class="ui with-actions header">
|
||||||
|
<div class="actions">
|
||||||
|
<a @click.stop.prevent="showSubscribeModal = true">
|
||||||
|
<i class="plus icon"></i>
|
||||||
|
<translate translate-context="Content/Profile/Button">Subscribe to feed</translate>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
<div class="ui center aligned basic segment">
|
||||||
|
<pagination
|
||||||
|
v-if="result && result.count > paginateBy"
|
||||||
|
@page-changed="selectPage"
|
||||||
|
:current="page"
|
||||||
|
:paginate-by="paginateBy"
|
||||||
|
:total="result.count"
|
||||||
|
></pagination>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<modal class="tiny" :show.sync="showSubscribeModal" :fullscreen="false">
|
||||||
|
<h2 class="header">
|
||||||
|
<translate translate-context="*/*/*/Noun">Subscription</translate>
|
||||||
|
</h2>
|
||||||
|
<div class="scrolling content" ref="modalContent">
|
||||||
|
<remote-search-form
|
||||||
|
type="both"
|
||||||
|
:show-submit="false"
|
||||||
|
:standalone="false"
|
||||||
|
@subscribed="showSubscribeModal = false; fetchData()"
|
||||||
|
:redirect="true"></remote-search-form>
|
||||||
|
</div>
|
||||||
|
<div class="actions">
|
||||||
|
<button class="ui basic deny button">
|
||||||
|
<translate translate-context="*/*/Button.Label/Verb">Cancel</translate>
|
||||||
|
</button>
|
||||||
|
<button form="remote-search" type="submit" class="ui primary button">
|
||||||
|
<i class="bookmark icon"></i>
|
||||||
|
<translate translate-context="*/*/*/Verb">Subscribe</translate>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</modal>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import qs from 'qs'
|
||||||
|
import axios from "axios"
|
||||||
|
import _ from "@/lodash"
|
||||||
|
import $ from "jquery"
|
||||||
|
|
||||||
|
import logger from "@/logging"
|
||||||
|
|
||||||
|
import OrderingMixin from "@/components/mixins/Ordering"
|
||||||
|
import PaginationMixin from "@/components/mixins/Pagination"
|
||||||
|
import TranslationsMixin from "@/components/mixins/Translations"
|
||||||
|
import ArtistCard from "@/components/audio/artist/Card"
|
||||||
|
import Pagination from "@/components/Pagination"
|
||||||
|
import TagsSelector from '@/components/library/TagsSelector'
|
||||||
|
import Modal from '@/components/semantic/Modal'
|
||||||
|
import RemoteSearchForm from "@/components/RemoteSearchForm"
|
||||||
|
|
||||||
|
const FETCH_URL = "artists/"
|
||||||
|
|
||||||
|
export default {
|
||||||
|
mixins: [OrderingMixin, PaginationMixin, TranslationsMixin],
|
||||||
|
props: {
|
||||||
|
defaultQuery: { type: String, required: false, default: "" },
|
||||||
|
defaultTags: { type: Array, required: false, default: () => { return [] } },
|
||||||
|
scope: { type: String, required: false, default: "all" },
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
ArtistCard,
|
||||||
|
Pagination,
|
||||||
|
TagsSelector,
|
||||||
|
RemoteSearchForm,
|
||||||
|
Modal,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isLoading: true,
|
||||||
|
result: null,
|
||||||
|
page: parseInt(this.defaultPage),
|
||||||
|
query: this.defaultQuery,
|
||||||
|
tags: (this.defaultTags || []).filter((t) => { return t.length > 0 }),
|
||||||
|
orderingOptions: [["creation_date", "creation_date"], ["name", "name"]],
|
||||||
|
showSubscribeModal: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
$(".ui.dropdown").dropdown()
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
labels() {
|
||||||
|
let searchPlaceholder = this.$pgettext('Content/Search/Input.Placeholder', "Search…")
|
||||||
|
let title = this.$pgettext('*/*/*/Noun', "Podcasts")
|
||||||
|
return {
|
||||||
|
searchPlaceholder,
|
||||||
|
title
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
updateQueryString: function() {
|
||||||
|
history.pushState(
|
||||||
|
{},
|
||||||
|
null,
|
||||||
|
this.$route.path + '?' + new URLSearchParams(
|
||||||
|
{
|
||||||
|
query: this.query,
|
||||||
|
page: this.page,
|
||||||
|
tag: this.tags,
|
||||||
|
paginateBy: this.paginateBy,
|
||||||
|
ordering: this.getOrderingAsString(),
|
||||||
|
include_channels: true,
|
||||||
|
content_category: 'podcast',
|
||||||
|
}).toString()
|
||||||
|
)
|
||||||
|
},
|
||||||
|
fetchData: function() {
|
||||||
|
var self = this
|
||||||
|
this.isLoading = true
|
||||||
|
let url = FETCH_URL
|
||||||
|
let params = {
|
||||||
|
scope: this.scope,
|
||||||
|
page: this.page,
|
||||||
|
page_size: this.paginateBy,
|
||||||
|
has_albums: this.excludeCompilation,
|
||||||
|
q: this.query,
|
||||||
|
ordering: this.getOrderingAsString(),
|
||||||
|
playable: "true",
|
||||||
|
tag: this.tags,
|
||||||
|
include_channels: "true",
|
||||||
|
content_category: 'podcast',
|
||||||
|
}
|
||||||
|
logger.default.debug("Fetching artists")
|
||||||
|
axios.get(
|
||||||
|
url,
|
||||||
|
{
|
||||||
|
params: params,
|
||||||
|
paramsSerializer: function(params) {
|
||||||
|
return qs.stringify(params, { indices: false })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).then(response => {
|
||||||
|
self.result = response.data
|
||||||
|
self.isLoading = false
|
||||||
|
}, error => {
|
||||||
|
self.result = null
|
||||||
|
self.isLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
selectPage: function(page) {
|
||||||
|
this.page = page
|
||||||
|
},
|
||||||
|
updatePage() {
|
||||||
|
this.page = this.defaultPage
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
page() {
|
||||||
|
this.updateQueryString()
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
"$store.state.moderation.lastUpdate": function () {
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
excludeCompilation() {
|
||||||
|
this.fetchData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -4,7 +4,7 @@
|
||||||
<i class="dropdown icon"></i>
|
<i class="dropdown icon"></i>
|
||||||
<input id="tags-search" type="text" class="search">
|
<input id="tags-search" type="text" class="search">
|
||||||
<div class="default text">
|
<div class="default text">
|
||||||
<translate translate-context="*/Dropdown/Placeholder/Verb">Search for tags…</translate>
|
<translate translate-context="*/Dropdown/Placeholder/Verb">Search…</translate>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -29,6 +29,7 @@ export default {
|
||||||
if (this.control) {
|
if (this.control) {
|
||||||
$(this.$el).modal('hide')
|
$(this.$el).modal('hide')
|
||||||
}
|
}
|
||||||
|
this.focusTrap.deactivate()
|
||||||
$(this.$el).remove()
|
$(this.$el).remove()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -637,6 +637,23 @@ export default new Router({
|
||||||
defaultPage: route.query.page
|
defaultPage: route.query.page
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "podcasts/",
|
||||||
|
name: "library.podcasts.browse",
|
||||||
|
component: () =>
|
||||||
|
import(
|
||||||
|
/* webpackChunkName: "podcasts" */ "@/components/library/Podcasts"
|
||||||
|
),
|
||||||
|
props: route => ({
|
||||||
|
defaultOrdering: route.query.ordering,
|
||||||
|
defaultQuery: route.query.query,
|
||||||
|
defaultTags: Array.isArray(route.query.tag || [])
|
||||||
|
? route.query.tag
|
||||||
|
: [route.query.tag],
|
||||||
|
defaultPaginateBy: route.query.paginateBy,
|
||||||
|
defaultPage: route.query.page
|
||||||
|
})
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "me/albums",
|
path: "me/albums",
|
||||||
name: "library.albums.me",
|
name: "library.albums.me",
|
||||||
|
|
|
@ -11,7 +11,7 @@ export default {
|
||||||
lastDate: new Date(),
|
lastDate: new Date(),
|
||||||
maxMessages: 100,
|
maxMessages: 100,
|
||||||
messageDisplayDuration: 5 * 1000,
|
messageDisplayDuration: 5 * 1000,
|
||||||
supportedExtensions: ["flac", "ogg", "mp3", "opus", "aac", "m4a"],
|
supportedExtensions: ["flac", "ogg", "mp3", "opus", "aac", "m4a", "aiff", "aif"],
|
||||||
messages: [],
|
messages: [],
|
||||||
theme: 'light',
|
theme: 'light',
|
||||||
window: {
|
window: {
|
||||||
|
@ -45,6 +45,11 @@ export default {
|
||||||
orderingDirection: "-",
|
orderingDirection: "-",
|
||||||
ordering: "creation_date",
|
ordering: "creation_date",
|
||||||
},
|
},
|
||||||
|
"library.podcasts.browse": {
|
||||||
|
paginateBy: 30,
|
||||||
|
orderingDirection: "-",
|
||||||
|
ordering: "creation_date",
|
||||||
|
},
|
||||||
"library.radios.browse": {
|
"library.radios.browse": {
|
||||||
paginateBy: 12,
|
paginateBy: 12,
|
||||||
orderingDirection: "-",
|
orderingDirection: "-",
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
|
|
||||||
.ui.wide.left.sidebar {
|
.ui.wide.left.sidebar {
|
||||||
@include media(">desktop") {
|
@include media(">desktop") {
|
||||||
width: $desktop-sidebar-width;
|
width: $desktop-sidebar-width;
|
||||||
}
|
}
|
||||||
|
|
||||||
@include media(">widedesktop") {
|
@include media(">widedesktop") {
|
||||||
width: $widedesktop-sidebar-width;
|
width: $widedesktop-sidebar-width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
.logo {
|
.logo {
|
||||||
&.bordered.icon {
|
&.bordered.icon {
|
||||||
|
@ -37,7 +34,6 @@
|
||||||
.ui.search .name {
|
.ui.search .name {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.sidebar {
|
&.sidebar {
|
||||||
overflow-y: visible !important;
|
overflow-y: visible !important;
|
||||||
background: var(--sidebar-background);
|
background: var(--sidebar-background);
|
||||||
|
@ -48,7 +44,7 @@
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding-bottom: 4em;
|
padding-bottom: 4em;
|
||||||
}
|
}
|
||||||
> nav {
|
>nav {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
@ -72,8 +68,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
>div {
|
||||||
> div {
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
background-color: var(--sidebar-background);
|
background-color: var(--sidebar-background);
|
||||||
}
|
}
|
||||||
|
@ -81,11 +76,10 @@
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui.vertical.menu {
|
.ui.vertical.menu {
|
||||||
.item .item {
|
.item .item {
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
> i.icon {
|
>i.icon {
|
||||||
float: none;
|
float: none;
|
||||||
margin: 0 0.5em 0 0;
|
margin: 0 0.5em 0 0;
|
||||||
}
|
}
|
||||||
|
@ -96,14 +90,14 @@
|
||||||
background: var(--sidebar-active-item-background) !important;
|
background: var(--sidebar-active-item-background) !important;
|
||||||
}
|
}
|
||||||
.item.collapsed {
|
.item.collapsed {
|
||||||
&:not(:focus) > .menu {
|
&:not(:focus)>.menu {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.header {
|
.header {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.collaspable.item .header {
|
.collapsible.item .header {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,11 +134,11 @@
|
||||||
.tab[data-tab="library"] {
|
.tab[data-tab="library"] {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
> .menu {
|
>.menu {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
> .player-wrapper {
|
>.player-wrapper {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,8 +146,7 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
.ui.menu .item.inline.admin-dropdown.dropdown>.menu {
|
||||||
.ui.menu .item.inline.admin-dropdown.dropdown > .menu {
|
|
||||||
left: 0;
|
left: 0;
|
||||||
right: auto;
|
right: auto;
|
||||||
}
|
}
|
||||||
|
@ -168,27 +161,25 @@
|
||||||
height: 4em;
|
height: 4em;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
nav {
|
nav {
|
||||||
> .item, > .menu > .item > .item {
|
>.item,
|
||||||
|
>.menu>.item>.item {
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.top.title-menu {
|
nav.top.title-menu {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
.item {
|
.item {
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.collapsed .search-wrapper {
|
&.collapsed .search-wrapper {
|
||||||
@include media("<desktop") {
|
@include media("<desktop") {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -200,20 +191,22 @@
|
||||||
.ui.message.black {
|
.ui.message.black {
|
||||||
background: var(--sidebar-background);
|
background: var(--sidebar-background);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui.mini.image {
|
.ui.mini.image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
nav.top {
|
nav.top {
|
||||||
align-items: self-end;
|
align-items: self-end;
|
||||||
padding: 0.5em 0;
|
padding: 0.5em 0;
|
||||||
> .item, > .right.menu > .item {
|
>.item,
|
||||||
|
>.right.menu>.item {
|
||||||
// color: rgba(255, 255, 255, 0.9) !important;
|
// color: rgba(255, 255, 255, 0.9) !important;
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
&:hover, > .dropdown > .icon {
|
&:hover,
|
||||||
|
>.dropdown>.icon {
|
||||||
// color: rgba(255, 255, 255, 0.9) !important;
|
// color: rgba(255, 255, 255, 0.9) !important;
|
||||||
}
|
}
|
||||||
> .label, > .dropdown > .label {
|
>.label,
|
||||||
|
>.dropdown>.label {
|
||||||
font-size: 0.5em;
|
font-size: 0.5em;
|
||||||
right: 1.7em;
|
right: 1.7em;
|
||||||
bottom: -0.5em;
|
bottom: -0.5em;
|
||||||
|
@ -221,7 +214,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.ui.user-dropdown > .text > .label {
|
.ui.user-dropdown>.text>.label {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
.logo-wrapper {
|
.logo-wrapper {
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
}
|
}
|
||||||
input {
|
input {
|
||||||
max-width: 8.5em;
|
max-width: 8.5em;
|
||||||
|
padding: 1em 0em;
|
||||||
}
|
}
|
||||||
&:not(:hover):not(.expanded) .popup {
|
&:not(:hover):not(.expanded) .popup {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
@ -39,10 +39,10 @@
|
||||||
<p>
|
<p>
|
||||||
<translate translate-context="Content/Notifications/Paragraph">We noticed you've been here for a while. If Funkwhale is useful to you, we could use your help to make it even better!</translate>
|
<translate translate-context="Content/Notifications/Paragraph">We noticed you've been here for a while. If Funkwhale is useful to you, we could use your help to make it even better!</translate>
|
||||||
</p>
|
</p>
|
||||||
<a href="https://funkwhale.audio/support-us" _target="blank" rel="noopener" class="ui primary inverted button">
|
<a href="https://funkwhale.audio/support-us" target="_blank" rel="noopener" class="ui primary inverted button">
|
||||||
<translate translate-context="Content/Notifications/Button.Label/Verb">Donate</translate>
|
<translate translate-context="Content/Notifications/Button.Label/Verb">Donate</translate>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://contribute.funkwhale.audio" _target="blank" rel="noopener" class="ui secondary inverted button">
|
<a href="https://contribute.funkwhale.audio" target="_blank" rel="noopener" class="ui secondary inverted button">
|
||||||
<translate translate-context="Content/Notifications/Button.Label/Verb">Discover other ways to help</translate>
|
<translate translate-context="Content/Notifications/Button.Label/Verb">Discover other ways to help</translate>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -43,11 +43,11 @@
|
||||||
|
|
||||||
<empty-state v-else-if="!currentResults || currentResults.count === 0" @refresh="search" :refresh="true"></empty-state>
|
<empty-state v-else-if="!currentResults || currentResults.count === 0" @refresh="search" :refresh="true"></empty-state>
|
||||||
|
|
||||||
<div v-else-if="type === 'artists'" class="ui five app-cards cards">
|
<div v-else-if="type === 'artists' || type === 'podcasts'" class="ui five app-cards cards">
|
||||||
<artist-card :artist="artist" v-for="artist in currentResults.results" :key="artist.id"></artist-card>
|
<artist-card :artist="artist" v-for="artist in currentResults.results" :key="artist.id"></artist-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="type === 'albums'" class="ui five app-cards cards">
|
<div v-else-if="type === 'albums' || type === 'series'" class="ui five app-cards cards">
|
||||||
<album-card
|
<album-card
|
||||||
v-for="album in currentResults.results"
|
v-for="album in currentResults.results"
|
||||||
:key="album.id"
|
:key="album.id"
|
||||||
|
@ -124,6 +124,8 @@ export default {
|
||||||
playlists: null,
|
playlists: null,
|
||||||
radios: null,
|
radios: null,
|
||||||
tags: null,
|
tags: null,
|
||||||
|
podcasts: null,
|
||||||
|
series: null,
|
||||||
},
|
},
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
paginateBy: 25,
|
paginateBy: 25,
|
||||||
|
@ -147,15 +149,28 @@ export default {
|
||||||
submitSearch
|
submitSearch
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
axiosParams() {
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
params.append('q', this.query);
|
||||||
|
params.append('page', this.page);
|
||||||
|
params.append('page_size', this.paginateBy);
|
||||||
|
if(this.currentType.contentCategory != undefined) {params.append('content_category', this.currentType.contentCategory)};
|
||||||
|
if(this.currentType.includeChannels != undefined) {params.append('include_channels', this.currentType.includeChannels)};
|
||||||
|
return params;
|
||||||
|
},
|
||||||
types () {
|
types () {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
id: 'artists',
|
id: 'artists',
|
||||||
label: this.$pgettext("*/*/*/Noun", "Artists"),
|
label: this.$pgettext("*/*/*/Noun", "Artists"),
|
||||||
|
includeChannels: true,
|
||||||
|
contentCategory: 'music',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'albums',
|
id: 'albums',
|
||||||
label: this.$pgettext("*/*/*", "Albums"),
|
label: this.$pgettext("*/*/*", "Albums"),
|
||||||
|
includeChannels: true,
|
||||||
|
contentCategory: 'music',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'tracks',
|
id: 'tracks',
|
||||||
|
@ -174,6 +189,20 @@ export default {
|
||||||
id: 'tags',
|
id: 'tags',
|
||||||
label: this.$pgettext("*/*/*", "Tags"),
|
label: this.$pgettext("*/*/*", "Tags"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'podcasts',
|
||||||
|
label: this.$pgettext("*/*/*", "Podcasts"),
|
||||||
|
endpoint: '/artists',
|
||||||
|
contentCategory: 'podcast',
|
||||||
|
includeChannels: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'series',
|
||||||
|
label: this.$pgettext("*/*/*", "Series"),
|
||||||
|
endpoint: '/albums',
|
||||||
|
includeChannels: true,
|
||||||
|
contentCategory: 'podcast',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
currentType () {
|
currentType () {
|
||||||
|
@ -197,13 +226,18 @@ export default {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
let response = await axios.get(
|
let response = await axios.get(
|
||||||
this.currentType.endpoint || this.currentType.id,
|
this.currentType.endpoint || this.currentType.id,
|
||||||
{params: {q: this.query, page: this.page, page_size: this.paginateBy}}
|
{params: this.axiosParams}
|
||||||
)
|
)
|
||||||
this.results[this.currentType.id] = response.data
|
this.results[this.currentType.id] = response.data
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
this.types.forEach(t => {
|
this.types.forEach(t => {
|
||||||
if (t.id != this.currentType.id) {
|
if (t.id != this.currentType.id) {
|
||||||
axios.get(t.endpoint || t.id, {params: {q: this.query, page_size: 1}}).then(response => {
|
axios.get(t.endpoint || t.id, {params: {
|
||||||
|
q: this.query,
|
||||||
|
page_size: 1,
|
||||||
|
content_category: t.contentCategory,
|
||||||
|
include_channels: t.includeChannels,
|
||||||
|
}}).then(response => {
|
||||||
this.results[t.id] = response.data
|
this.results[t.id] = response.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
:can-update="false"></rendered-description>
|
:can-update="false"></rendered-description>
|
||||||
<div class="ui hidden divider"></div>
|
<div class="ui hidden divider"></div>
|
||||||
</div>
|
</div>
|
||||||
<channel-entries :key="String(episodesKey) + 'entries'" :limit='25' :filters="{channel: object.uuid, ordering: '-creation_date', page_size: '25'}">
|
<channel-entries :key="String(episodesKey) + 'entries'" :default-cover='object.artist.cover' :limit='25' :filters="{channel: object.uuid, ordering: '-creation_date', page_size: '25'}">
|
||||||
<h2 class="ui header">
|
<h2 class="ui header">
|
||||||
<translate key="1" v-if="isPodcast" translate-context="Content/Channel/Paragraph">Latest episodes</translate>
|
<translate key="1" v-if="isPodcast" translate-context="Content/Channel/Paragraph">Latest episodes</translate>
|
||||||
<translate key="2" v-else translate-context="Content/Channel/Paragraph">Latest tracks</translate>
|
<translate key="2" v-else translate-context="Content/Channel/Paragraph">Latest tracks</translate>
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
</h2>
|
</h2>
|
||||||
<div class="scrolling content" ref="modalContent">
|
<div class="scrolling content" ref="modalContent">
|
||||||
<remote-search-form
|
<remote-search-form
|
||||||
type="rss"
|
type="both"
|
||||||
:show-submit="false"
|
:show-submit="false"
|
||||||
:standalone="false"
|
:standalone="false"
|
||||||
@subscribed="showSubscribeModal = false; reloadWidget()"
|
@subscribed="showSubscribeModal = false; reloadWidget()"
|
||||||
:redirect="false"></remote-search-form>
|
:redirect="true"></remote-search-form>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button class="ui basic deny button">
|
<button class="ui basic deny button">
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<translate translate-context="Content/Library/Title/Verb">Publish your work in a channel</translate>
|
<translate translate-context="Content/Library/Title/Verb">Publish your work in a channel</translate>
|
||||||
</h2>
|
</h2>
|
||||||
<p>
|
<p>
|
||||||
<translate translate-context="Content/Library/Paragraph">If you are a musician or a podcaster, channels are designed for you!</translate>
|
<translate translate-context="Content/Library/Paragraph">If you are a musician or a podcaster, channels are designed for you!</translate> 
|
||||||
<translate translate-context="Content/Library/Paragraph">Share your work publicly and get subscribers on Funkwhale, the Fediverse or any podcasting application.</translate>
|
<translate translate-context="Content/Library/Paragraph">Share your work publicly and get subscribers on Funkwhale, the Fediverse or any podcasting application.</translate>
|
||||||
</p>
|
</p>
|
||||||
<router-link :to="{name: 'profile.overview', params: {username: $store.state.auth.username}, hash: '#channels'}" class="ui primary button">
|
<router-link :to="{name: 'profile.overview', params: {username: $store.state.auth.username}, hash: '#channels'}" class="ui primary button">
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<translate translate-context="Content/Library/Button.Label/Verb" v-if="library">Update library</translate>
|
<translate translate-context="Content/Library/Button.Label/Verb" v-if="library">Update library</translate>
|
||||||
<translate translate-context="Content/Library/Button.Label/Verb" v-else>Create library</translate>
|
<translate translate-context="Content/Library/Button.Label/Verb" v-else>Create library</translate>
|
||||||
</button>
|
</button>
|
||||||
<dangerous-button v-if="library" class="ui right floated basic danger button" @confirm="remove()">
|
<dangerous-button v-if="library" type="button" class="ui right floated basic danger button" @confirm="remove()">
|
||||||
<translate translate-context="*/*/*/Verb">Delete</translate>
|
<translate translate-context="*/*/*/Verb">Delete</translate>
|
||||||
<p slot="modal-header">
|
<p slot="modal-header">
|
||||||
<translate translate-context="Popup/Library/Title">Delete this library?</translate>
|
<translate translate-context="Popup/Library/Title">Delete this library?</translate>
|
||||||
|
|
|
@ -194,7 +194,7 @@ export default {
|
||||||
isPlayable () {
|
isPlayable () {
|
||||||
return this.object.uploads_count > 0 && (
|
return this.object.uploads_count > 0 && (
|
||||||
this.isOwner ||
|
this.isOwner ||
|
||||||
this.object.privacy_level === 'public' ||
|
this.object.privacy_level === 'everyone' ||
|
||||||
(this.object.privacy_level === 'instance' && this.$store.state.auth.authenticated && this.object.actor.domain === this.$store.getters['instance/domain']) ||
|
(this.object.privacy_level === 'instance' && this.$store.state.auth.authenticated && this.object.actor.domain === this.$store.getters['instance/domain']) ||
|
||||||
(this.$store.getters['libraries/follow'](this.object.uuid) || {}).approved === true
|
(this.$store.getters['libraries/follow'](this.object.uuid) || {}).approved === true
|
||||||
)
|
)
|
||||||
|
|
|
@ -22,7 +22,11 @@
|
||||||
</div>
|
</div>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="ui hidden divider"></div>
|
<div class="ui hidden divider"></div>
|
||||||
|
<div class="header-buttons">
|
||||||
|
<div class="ui buttons">
|
||||||
<play-button class="vibrant" :is-playable="playlist.is_playable" :tracks="tracks"><translate translate-context="Content/Queue/Button.Label/Short, Verb">Play all</translate></play-button>
|
<play-button class="vibrant" :is-playable="playlist.is_playable" :tracks="tracks"><translate translate-context="Content/Queue/Button.Label/Short, Verb">Play all</translate></play-button>
|
||||||
|
</div>
|
||||||
|
<div class="ui buttons">
|
||||||
<button
|
<button
|
||||||
class="ui icon labeled button"
|
class="ui icon labeled button"
|
||||||
v-if="$store.state.auth.profile && playlist.user.id === $store.state.auth.profile.id"
|
v-if="$store.state.auth.profile && playlist.user.id === $store.state.auth.profile.id"
|
||||||
|
@ -31,6 +35,8 @@
|
||||||
<template v-if="edit"><translate translate-context="Content/Playlist/Button.Label/Verb">Stop Editing</translate></template>
|
<template v-if="edit"><translate translate-context="Content/Playlist/Button.Label/Verb">Stop Editing</translate></template>
|
||||||
<template v-else><translate translate-context="Content/*/Button.Label/Verb">Edit</translate></template>
|
<template v-else><translate translate-context="Content/*/Button.Label/Verb">Edit</translate></template>
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="ui buttons">
|
||||||
<button
|
<button
|
||||||
class="ui icon labeled button"
|
class="ui icon labeled button"
|
||||||
v-if="playlist.privacy_level === 'everyone' && playlist.is_playable"
|
v-if="playlist.privacy_level === 'everyone' && playlist.is_playable"
|
||||||
|
@ -38,7 +44,6 @@
|
||||||
<i class="code icon"></i>
|
<i class="code icon"></i>
|
||||||
<translate translate-context="Content/*/Button.Label/Verb">Embed</translate>
|
<translate translate-context="Content/*/Button.Label/Verb">Embed</translate>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<dangerous-button v-if="$store.state.auth.profile && playlist.user.id === $store.state.auth.profile.id" class="ui labeled danger icon button" :action="deletePlaylist">
|
<dangerous-button v-if="$store.state.auth.profile && playlist.user.id === $store.state.auth.profile.id" class="ui labeled danger icon button" :action="deletePlaylist">
|
||||||
<i class="trash icon"></i> <translate translate-context="*/*/*/Verb">Delete</translate>
|
<i class="trash icon"></i> <translate translate-context="*/*/*/Verb">Delete</translate>
|
||||||
<p slot="modal-header" v-translate="{playlist: playlist.name}" translate-context="Popup/Playlist/Title/Call to action" :translate-params="{playlist: playlist.name}">
|
<p slot="modal-header" v-translate="{playlist: playlist.name}" translate-context="Popup/Playlist/Title/Call to action" :translate-params="{playlist: playlist.name}">
|
||||||
|
@ -48,6 +53,7 @@
|
||||||
<div slot="modal-confirm"><translate translate-context="Popup/Playlist/Button.Label/Verb">Delete playlist</translate></div>
|
<div slot="modal-confirm"><translate translate-context="Popup/Playlist/Button.Label/Verb">Delete playlist</translate></div>
|
||||||
</dangerous-button>
|
</dangerous-button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<modal v-if="playlist.privacy_level === 'everyone' && playlist.is_playable" :show.sync="showEmbedModal">
|
<modal v-if="playlist.privacy_level === 'everyone' && playlist.is_playable" :show.sync="showEmbedModal">
|
||||||
<h4 class="header">
|
<h4 class="header">
|
||||||
<translate translate-context="Popup/Album/Title/Verb">Embed this playlist on your website</translate>
|
<translate translate-context="Popup/Album/Title/Verb">Embed this playlist on your website</translate>
|
||||||
|
@ -63,6 +69,7 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</modal>
|
</modal>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section class="ui vertical stripe segment">
|
<section class="ui vertical stripe segment">
|
||||||
<template v-if="edit">
|
<template v-if="edit">
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
import { expect } from 'chai'
|
||||||
|
|
||||||
|
import { toLinearVolumeScale, toLogarithmicVolumeScale } from '@/audio/volume'
|
||||||
|
|
||||||
|
describe('store/auth', () => {
|
||||||
|
describe('toLinearVolumeScale', () => {
|
||||||
|
describe('it should return real 0', () => {
|
||||||
|
expect(toLinearVolumeScale(0.0)).to.equal(0.0)
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('it should have logarithmic scale', () => {
|
||||||
|
expect(2 * toLinearVolumeScale(0.5)).to.be.closeTo(toLinearVolumeScale(0.6), 0.001)
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('it should return full volume', () => {
|
||||||
|
expect(toLogarithmicVolumeScale(1.0)).to.be.closeTo(1.0, 0.001)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('toLogarithmicVolumeScale', () => {
|
||||||
|
describe('it should return real 0', () => {
|
||||||
|
expect(toLogarithmicVolumeScale(0.0)).to.equal(0.0)
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('it should have logarithmic scale', () => {
|
||||||
|
expect(toLogarithmicVolumeScale(0.6)).to.be.closeTo(0.9261, 0.001)
|
||||||
|
expect(toLogarithmicVolumeScale(0.7)).to.be.closeTo(0.9483, 0.001)
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('it should return full volume', () => {
|
||||||
|
expect(toLogarithmicVolumeScale(1.0)).to.be.closeTo(1.0, 0.001)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
Loading…
Reference in New Issue