Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebuild most code #19

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore

This file was deleted.

63 changes: 61 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
# Setup process:

# Jukebox Redux
#### By Alex Wohlbruck
##### Maintained by: LaganYT

### Desctiption:

Jukebox: Elevate Your Music Experience with Seamless Listening and Downloading

Welcome to Jukebox, the ultimate destination for music lovers. Discover, stream, and download your favorite tunes effortlessly. Our intuitive interface immerses you in a world of melodious bliss, whether you're a casual listener or an audiophile.

Discover: Explore a vast music library, curated playlists, and hidden gems. Our passionate curators bring you the best of the best.

Listen: Enjoy crystal-clear audio quality with uninterrupted playback. Create playlists, save favorites, and rediscover beloved tracks.

Download: Take your music offline hassle-free. Enjoy your tunes wherever you go.

User-Friendly Experience: Find what you want easily with our streamlined design and intuitive navigation.

Join Jukebox today and unlock a world of musical wonders. Discover, rediscover, and build the perfect playlist. Let the melodies resonate, the rhythm flow, and the beats transport you to new heights of musical euphoria. Get ready for a unique musical journey with Jukebox.

*Jukebox is made for desktop devices, not supported by mobile.

# Paid Setup process:

Step 1: Go to [heroku](https://dashboard.heroku.com/apps) and create a new app.

Expand All @@ -19,7 +42,43 @@ Step 4: Go back to the settings and install the nodejs buildpack.

Step 5: Deploy the webapp.

# Free Setup process:

Step 1: Go to [Glitch]([https://dashboard.heroku.com/apps](https://glitch.com/dashboard)) and click 'import from github'

Step 2: There should be a popup asking what github repo to import from, insert this: `https://github.com/alexwohlbruck/jukebox`

Step 3: Go to the .env file, and fill out the following variables.

```
SPOTIFY_CLIENT_ID = xxxxxxxxxxxxxxxxxxxxx
SPOTIFY_CLIENT_SECRET = xxxxxxxxxxxxxxxxxxxxx
GOOGLE_SERVER_KEY = xxxxxxxxxxxxxxxxxxxxx
```
To get the Google server key, head to the [Google Cloud Platform website](https://console.cloud.google.com/), create a project and go to the APIs and Services page. Then Enable the `Youtube Data API V3`. You should be able to generate a server API key, which will be the value to put in your .env file.

Then, log in to the [Spotify Developer Console](https://developer.spotify.com/dashboard), and create a new app. Once created, you should get Client ID and Client Secret keys, which are the other two values for your `.env` file.

Step 4: Make sure everything installs and you should have a working version of the site.

Make an [issue](https://github.com/alexwohlbruck/jukebox/issues) if you have problems with anything.


This is a README.md file made by LaganYT for the self hosting of the Jukebox Redux project.
This is a README.md file made by LaganYT for the self hosting of the Jukebox project.

## Authors

- [@LaganYT](https://www.github.com/laganyt)
- [@alexwohlbruck](https://www.github.com/alexwohlbruck)


## License

[MIT](https://choosealicense.com/licenses/mit/)


## Used By

This project is used by/maintained the following companies:

- [LTunes](https://ltunes.gq/)
10 changes: 6 additions & 4 deletions app/routes/album.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ router.get('/:albumId', (req, res) => {
spotify.getAlbum(req.params.albumId)
.then(data => {
res.status(data.statusCode).json(data.body);
}, err => {
})
.catch(err => {
res.status(err.statusCode).json(err);
});
});

router.get('/:albumId/tracks', (req, res) => {
spotify.getAlbumTracks(req.params.albumId)
spotify.getAlbumTracks(req.params.albumId)
.then(data => {
res.status(data.statusCode).json(data.body);
}, err => {
})
.catch(err => {
res.status(err.statusCode).json(err);
});
});

module.exports = router;
module.exports = router;
185 changes: 185 additions & 0 deletions app/routes/artist.profile.routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
const express = require("express");
const router = express.Router();
const Spotify = require.main.require("./app/services/spotify");

router.get("/:artistId", (req, res) => {
Spotify.getArtist(req.params.artistId)
.then((data) => {
const html = `
<html>
<head>
<title>Artist Profile</title>
<style>
body {
background-color: #121212;
color: #FFFFFF;
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

.container {
background-color: #1E1E1E;
border-radius: 10px;
padding: 20px;
text-align: center;
}

h1 {
font-size: 32px;
margin-bottom: 10px;
}

img {
max-width: 200px;
border-radius: 10px;
margin-bottom: 20px;
}

p {
margin-bottom: 5px;
}

ul {
list-style-type: none;
padding: 0;
}

li {
margin-bottom: 5px;
}

a {
color: #FFFFFF;

}
.link {
text-decoration: underline;
cursor: pointer;
}

.link:hover {
text-decoration: none;
}
#popupContainer {
display: none;
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%);
width: 80px;
height: 80px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
pointer-events: none;
transition: opacity 0.3s ease-in-out;
}

#popupContent {
color: white;
font-size: 16px;
display: none;
}

.popupVisible {
opacity: 1;
pointer-events: auto;
}

.popupHidden {
opacity: 0;
pointer-events: none;
}




</style>
</head>
<body>
<div class="container">
<h1>${data.body.name}</h1>
<img src="${
data.body.images[0].url
}" alt="Artist Image">
<ul>
<li><strong>Followers:</strong> ${
data.body.followers.total
}</li>
<li><strong>Genres:</strong> ${data.body.genres.join(
", "
)}</li>
<li><strong><a href="${
data.body.external_urls.spotify
}" target="_blank">Spotify Profile</a></strong></li>
<li><strong><a class="link" id="shareButton">Share</a></strong></li>
<br><br>
<li><strong><a href="#" onclick="window.history.back();">Go back</a></strong></li>
</ul>
</div>
<!-- Popup container -->
<div id="popupContainer">
<div id="popupContent">
<span id="popupText"></span>
</div>
</div>
<script>
// Add an event listener to the share button
document.getElementById('shareButton').addEventListener('click', function() {
// Get the current URL
var currentUrl = window.location.href;

// Create a temporary input element
var tempInput = document.createElement('input');
tempInput.setAttribute('type', 'text');
tempInput.setAttribute('value', currentUrl);

// Append the temporary input element to the document
document.body.appendChild(tempInput);

// Select the value of the temporary input element
tempInput.select();

// Copy the selected value to the clipboard
document.execCommand('copy');

// Remove the temporary input element from the document
document.body.removeChild(tempInput);

// Show the popup with the copied text
var popupContainer = document.getElementById('popupContainer');
var popupContent = document.getElementById('popupContent');
popupContent.textContent = 'Copied';
popupContainer.classList.add('popupVisible');
popupContent.style.display = 'block';

// Hide the popup after 2 seconds
setTimeout(function() {
popupContainer.classList.remove('popupVisible');
popupContainer.classList.add('popupHidden');
popupContent.style.display = 'none';
setTimeout(function() {
popupContainer.classList.remove('popupHidden');
}, 300);
}, 2000);
});

</script>
</body>
</html>
`;
res.send(html);
})
.catch((err) => {
res.status(err.statusCode).json(err);
});
});

module.exports = router;
1 change: 1 addition & 0 deletions app/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var path = require('path');
router.use('/users', require('./user.routes'));
router.use('/search', require('./search.routes'));
router.use('/albums', require('./album.routes'));
router.use('/artist', require('./artist.profile.routes'));
router.use('/artists', require('./artist.routes'));
router.use('/tracks', require('./track.routes'));
router.use('/radio', require('./radio.routes'));
Expand Down
24 changes: 16 additions & 8 deletions app/routes/radio.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@ var router = express.Router();
var spotify = require.main.require('./app/services/spotify');

router.get('/', function(req, res) {
spotify.getRecommendations({
seed_artists: req.params.seed_artists || null,
seed_genres: req.params.seed_genres || null,
seed_tracks: req.params.seed_tracks || null
}).then(function(data) {
return res.status(200).json(data);
})
var seedArtists = req.query.seed_artists || null;
var seedGenres = req.query.seed_genres || null;
var seedTracks = req.query.seed_tracks || null;

spotify.getRecommendations({
seed_artists: seedArtists,
seed_genres: seedGenres,
seed_tracks: seedTracks
})
.then(function(data) {
return res.status(200).json(data);
})
.catch(function(err) {
return res.status(err.statusCode || 500).json(err);
});
});

module.exports = router;
module.exports = router;
29 changes: 15 additions & 14 deletions app/routes/search.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ var router = express.Router();
var spotify = require.main.require('./app/services/spotify');

router.get('/', function(req, res) {
spotify.search(
req.query.q,
['track', 'album', 'artist', 'playlist'],
{
limit: req.query.limit || 30,
offset: req.query.offset || 0
}
)
.then(function(data) {
res.status(200).json(data.body);
}, function(err) {
res.status(400).json(err);
});
var searchQuery = req.query.q;
var searchTypes = ['track', 'album', 'artist', 'playlist'];
var searchOptions = {
limit: req.query.limit || 30,
offset: req.query.offset || 0
};

spotify.search(searchQuery, searchTypes, searchOptions)
.then(function(data) {
res.status(200).json(data.body);
})
.catch(function(err) {
res.status(400).json(err);
});
});

module.exports = router;
module.exports = router;
Loading