Add option to download playlist
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import React from 'react'
|
||||
import { useDispatch } from 'react-redux'
|
||||
import {
|
||||
Button,
|
||||
sanitizeListRestProps,
|
||||
@@ -7,8 +9,6 @@ import {
|
||||
import PlayArrowIcon from '@material-ui/icons/PlayArrow'
|
||||
import ShuffleIcon from '@material-ui/icons/Shuffle'
|
||||
import CloudDownloadOutlinedIcon from '@material-ui/icons/CloudDownloadOutlined'
|
||||
import React from 'react'
|
||||
import { useDispatch } from 'react-redux'
|
||||
import { playTracks, shuffleTracks } from '../audioplayer'
|
||||
import subsonic from '../subsonic'
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import React from 'react'
|
||||
import { useDispatch } from 'react-redux'
|
||||
import {
|
||||
Button,
|
||||
sanitizeListRestProps,
|
||||
@@ -6,9 +8,9 @@ import {
|
||||
} from 'react-admin'
|
||||
import PlayArrowIcon from '@material-ui/icons/PlayArrow'
|
||||
import ShuffleIcon from '@material-ui/icons/Shuffle'
|
||||
import React from 'react'
|
||||
import { useDispatch } from 'react-redux'
|
||||
import CloudDownloadOutlinedIcon from '@material-ui/icons/CloudDownloadOutlined'
|
||||
import { playTracks, shuffleTracks } from '../audioplayer'
|
||||
import subsonic from '../subsonic'
|
||||
|
||||
const PlaylistActions = ({
|
||||
className,
|
||||
@@ -16,6 +18,7 @@ const PlaylistActions = ({
|
||||
data,
|
||||
exporter,
|
||||
permanentFilter,
|
||||
playlistId,
|
||||
...rest
|
||||
}) => {
|
||||
const dispatch = useDispatch()
|
||||
@@ -39,6 +42,14 @@ const PlaylistActions = ({
|
||||
>
|
||||
<ShuffleIcon />
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
subsonic.download(playlistId)
|
||||
}}
|
||||
label={translate('resources.album.actions.download')}
|
||||
>
|
||||
<CloudDownloadOutlinedIcon />
|
||||
</Button>
|
||||
</TopToolbar>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ const PlaylistShow = (props) => {
|
||||
playlistId={props.id}
|
||||
readOnly={isReadOnly(record && record.owner)}
|
||||
title={<Title subTitle={record && record.name} />}
|
||||
actions={<PlaylistActions />}
|
||||
actions={<PlaylistActions playlistId={props.id} />}
|
||||
filter={{ playlist_id: props.id }}
|
||||
resource={'playlistTrack'}
|
||||
exporter={false}
|
||||
|
||||
Reference in New Issue
Block a user