diff --git a/client/src/components/AlbumDetail.js b/client/src/components/AlbumDetail.js index 478ecd9b..e1eb778d 100644 --- a/client/src/components/AlbumDetail.js +++ b/client/src/components/AlbumDetail.js @@ -21,6 +21,9 @@ class AlbumDetail extends CellDetail { let data = this.state.detailData activeIndex = playlistIndex scPlayer.play({ playlistIndex }); + + document.getElementById(style.spotifyPreviewUrl) + .innerHTML = data.tracks.items[activeIndex].external_urls.spotify } nextIndex() { @@ -77,6 +80,9 @@ class AlbumDetail extends CellDetail { } activeIndex = 0 + var demo = document.getElementById(style.spotifyPreviewUrl) + if (demo != null) demo.innerHTML = '' + scPlayer.playlist(data, function (track) {}); var MusicPlayer = WithSoundCloudAudio(props => { return ( @@ -126,9 +132,9 @@ class AlbumDetail extends CellDetail {
- +
    {trackList} diff --git a/client/src/components/MovieDetail.js b/client/src/components/MovieDetail.js index 2c3ab0fc..76b3f4d1 100644 --- a/client/src/components/MovieDetail.js +++ b/client/src/components/MovieDetail.js @@ -22,7 +22,7 @@ class MovieDetail extends CellDetail {
    {title}
    diff --git a/client/src/style/AlbumDetail.css b/client/src/style/AlbumDetail.css index 3fb13494..1257ecd4 100644 --- a/client/src/style/AlbumDetail.css +++ b/client/src/style/AlbumDetail.css @@ -33,8 +33,8 @@ float: right; position: relative; overflow: auto; - background-color:transparent; - color:white; + background-color: transparent; + color: white; } .cell-detail-image { @@ -81,6 +81,10 @@ color: var(--description-color); } +#spotify-preview-url { + color: var(--title-color); +} + /* tracklist */ #plWrap { margin:0 auto; diff --git a/server.js b/server.js index 6308b014..caf05275 100644 --- a/server.js +++ b/server.js @@ -40,61 +40,4 @@ app.get('/api/tv/seasons/:id', function(req, res) { res.json(season); }); -app.get('/music/:album_id/:disc_number/:track_number', function(req, res) { - var album = _.find(musicData.music, {id: req.params.album_id}); // Get albums - var track_fs_path = _.where(album.tracks.items, {disc_number: parseInt(req.params.disc_number), track_number: parseInt(req.params.track_number)}); // Get track - track_fs_path = String(_.pluck(track_fs_path, 'fs_path')); // Get track.fs_path - - const path = track_fs_path - const stat = fs.statSync(path) - const head = { - 'Content-Type': 'audio/mpeg', - 'Content-Length': stat.size - } - res.writeHead(200, head); - fs.createReadStream(path).pipe(res); -}); - -app.get('/movies/:id', function(req, res) { - //var movie_fs_path = _.where(moviesData.movies, {id: parseInt(req.params.id)}); // Get movie - //movie_fs_path = String(_.pluck(movie_fs_path, 'fs_path')); // Get movie.fs_path - movie_fs_path = "./stock.mp4"; - const path = movie_fs_path - const stat = fs.statSync(path) - const fileSize = stat.size - const range = req.headers.range - if (range) { - const parts = range.replace(/bytes=/, "").split("-") - const start = parseInt(parts[0], 10) - const end = parts[1] - ? parseInt(parts[1], 10) - : fileSize-1 - const chunksize = (end-start)+1 - const file = fs.createReadStream(path, {start, end}) - const head = { - 'Content-Range': `bytes ${start}-${end}/${fileSize}`, - 'Accept-Ranges': 'bytes', - 'Content-Length': chunksize, - 'Content-Type': 'video/mp4', - } - res.writeHead(206, head); - file.pipe(res); - } else { - const head = { - 'Content-Length': fileSize, - 'Content-Type': 'video/mp4', - } - res.writeHead(200, head) - fs.createReadStream(path).pipe(res) - } -}); - -console.log(figlet.textSync('homehost', - { - font: 'Larry 3D', - horizontalLayout: 'default', - verticalLayout: 'default' - } -)); - app.listen(port, () => console.log(`Listening on port ${port}`)); \ No newline at end of file