Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ridhwaans committed Jun 5, 2021
1 parent c85396c commit f6431ae
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 94 deletions.
7 changes: 2 additions & 5 deletions .gitignore
Expand Up @@ -2,10 +2,7 @@

# general
.env
config.yml
movies.json
music.json
tv.json
/server/data

# lock files
package-lock.json
Expand All @@ -18,7 +15,7 @@ node_modules/
/coverage

# production
/build
/client/build
/client/public/bundle.js
/client/public/bundle.js.LICENSE.txt

Expand Down
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -40,7 +40,7 @@ Create a `.env` file in the `client/` directory, if it does not exist
In `.env`, set the base url of the homehost server
###### **`client/.env`**
```env
REACT_APP_HOMEHOST_API = "http://localhost:5000/api"
REACT_APP_HOMEHOST_BASE = "http://localhost:5000"
REACT_APP_IMAGE_BASE = "https://image.tmdb.org/t/p/"
REACT_APP_TMDB_BASE = "https://www.imdb.com/title/"
```
Expand All @@ -61,7 +61,7 @@ MUSIC_API = 'api.spotify.com/v1'
MUSIC_CLIENT_ID = '<client_id>'
MUSIC_CLIENT_SECRET = '<client_secret>'
CLIENT_BASE = 'http://localhost:3000'
CLIENT_BASE_URL = 'http://localhost:3000'
```
If you dont have keys, you can request API authorization from Spotify at https://developer.spotify.com/documentation/web-api/, and TMDb at https://developers.themoviedb.org/3/getting-started/introduction

Expand Down Expand Up @@ -157,7 +157,7 @@ Works best in <img src="client/src/assets/logos/Chrome.svg" width="16" height="1

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE) file for details
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details

## Disclaimer

Expand Down
6 changes: 1 addition & 5 deletions client/package.json
Expand Up @@ -23,11 +23,7 @@
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
"build": "react-scripts build"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
44 changes: 22 additions & 22 deletions client/src/api.js
Expand Up @@ -2,7 +2,7 @@ import axios from "axios"

export async function searchMoviesBy(text, page = 1) {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/watch/search?q=${text}`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/watch/search?q=${text}`)
.then(function (response) {
return response.data

Expand All @@ -11,7 +11,7 @@ export async function searchMoviesBy(text, page = 1) {

export async function searchMusicBy(text, page = 1) {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/listen/search?q=${text}`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/listen/search?q=${text}`)
.then(function (response) {
return response.data

Expand All @@ -20,7 +20,7 @@ export async function searchMusicBy(text, page = 1) {

export async function getBillboardItem() {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/watch/billboard`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/watch/billboard`)
.then(function (response) {
return response.data

Expand All @@ -29,7 +29,7 @@ export async function getBillboardItem() {

export async function getMovieInformation(id) {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/movies/${id}`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/movies/${id}`)
.then(function (response) {
return response.data

Expand All @@ -38,7 +38,7 @@ export async function getMovieInformation(id) {

export async function getRandomMovie() {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/movies/random`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/movies/random`)
.then(function (response) {
return response.data

Expand All @@ -48,7 +48,7 @@ export async function getRandomMovie() {

export async function getMovieGenres() {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/movies/genres`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/movies/genres`)
.then(function (response) {
return response.data

Expand All @@ -57,7 +57,7 @@ export async function getMovieGenres() {

export async function getMoviesByGenre(genre) {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/movies/genres/${genre}`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/movies/genres/${genre}`)
.then(function (response) {
return response.data

Expand All @@ -71,13 +71,13 @@ export async function getMoviesBy(type) {

switch (type) {
case "most_popular":
discover = `${process.env.REACT_APP_HOMEHOST_API}/movies/most_popular`
discover = `${process.env.REACT_APP_HOMEHOST_BASE}/api/movies/most_popular`
break;
case "highest_rated":
discover = `${process.env.REACT_APP_HOMEHOST_API}/movies/highest_rated`
discover = `${process.env.REACT_APP_HOMEHOST_BASE}/api/movies/highest_rated`
break;
case "recently_added":
discover = `${process.env.REACT_APP_HOMEHOST_API}/movies/recently_added`
discover = `${process.env.REACT_APP_HOMEHOST_BASE}/api/movies/recently_added`
break;
default:

Expand All @@ -93,7 +93,7 @@ export async function getMoviesBy(type) {

export async function getTVShowInformation(id) {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/tv/${id}`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/tv/${id}`)
.then(function (response) {
return response.data

Expand All @@ -102,7 +102,7 @@ export async function getTVShowInformation(id) {

export async function getRandomTVShow() {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/tv/random`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/tv/random`)
.then(function (response) {
return response.data

Expand All @@ -112,7 +112,7 @@ export async function getRandomTVShow() {

export async function getTVShowGenres() {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/tv/genres`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/tv/genres`)
.then(function (response) {
return response.data

Expand All @@ -121,7 +121,7 @@ export async function getTVShowGenres() {

export async function getTVShowsByGenre(genre) {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/tv/genres/${genre}`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/tv/genres/${genre}`)
.then(function (response) {
return response.data

Expand All @@ -135,13 +135,13 @@ export async function getTVShowsBy(type) {

switch (type) {
case "most_popular":
discover = `${process.env.REACT_APP_HOMEHOST_API}/tv/most_popular`
discover = `${process.env.REACT_APP_HOMEHOST_BASE}/api/tv/most_popular`
break;
case "highest_rated":
discover = `${process.env.REACT_APP_HOMEHOST_API}/tv/highest_rated`
discover = `${process.env.REACT_APP_HOMEHOST_BASE}/api/tv/highest_rated`
break;
case "recently_added":
discover = `${process.env.REACT_APP_HOMEHOST_API}/tv/recently_added`
discover = `${process.env.REACT_APP_HOMEHOST_BASE}/api/tv/recently_added`
break;
default:

Expand All @@ -156,7 +156,7 @@ export async function getTVShowsBy(type) {

export async function getAllAlbums() {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/music/albums`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/music/albums`)
.then(function (response) {
return response.data

Expand All @@ -165,7 +165,7 @@ export async function getAllAlbums() {

export async function getAllArtists() {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/music/artists`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/music/artists`)
.then(function (response) {
return response.data

Expand All @@ -174,7 +174,7 @@ export async function getAllArtists() {

export async function getAllSongs() {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/music/songs`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/music/songs`)
.then(function (response) {
return response.data

Expand All @@ -183,7 +183,7 @@ export async function getAllSongs() {

export async function getAlbumInformation(id) {

return await axios.get(`${process.env.REACT_APP_HOMEHOST_API}/music/albums/${id}`)
return await axios.get(`${process.env.REACT_APP_HOMEHOST_BASE}/api/music/albums/${id}`)
.then(function (response) {
return response.data

Expand All @@ -196,7 +196,7 @@ export async function getMusicBy(type) {

switch (type) {
case "recently_added":
discover = `${process.env.REACT_APP_HOMEHOST_API}/music/recently_added`
discover = `${process.env.REACT_APP_HOMEHOST_BASE}/api/music/recently_added`
break;
default:

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/NowPlayingBar/NowPlayingBar.js
Expand Up @@ -113,7 +113,7 @@ const NowPlayingBar = ({ playPause, song, playing }) => {
</footer>
{ song.url_path && (
<Sound
url={song.url_path}
url={`${process.env.REACT_APP_HOMEHOST_BASE}${song.url_path}`}
playStatus={playing ? "PLAYING" : "PAUSED"}
onPlaying={({ position }) => {
setTime(position);
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Player/index.js
Expand Up @@ -51,7 +51,7 @@ const Player = () => {
{context.playerItem && (
<div id={"player"} >
<ReactNetflixPlayer
src={context.playerItem.type == "Movie" ? context.playerItem.url_path : episode.url_path}
src={`${process.env.REACT_APP_HOMEHOST_BASE}${context.playerItem.type == "Movie" ? context.playerItem.url_path : episode.url_path}`}
// Pause screen
// movie or show name
title={context.playerItem.type == "Movie" ? context.playerItem.title : context.playerItem.data.name}
Expand Down
Binary file modified media/movies_1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 8 additions & 6 deletions server/package.json
@@ -1,26 +1,28 @@
{
"name": "homehost-server",
"version": "1.5.0",
"private": true,
"author": "ridhwaans",
"license": "MIT",
"scripts": {
"dev": "NODE_ENV=dev nodemon server",
"client-dev": "cd ../client && npm start",
"start-dev": "concurrently --kill-others-on-fail \"npm run dev\" \"npm run client-dev\""
"start-dev": "concurrently --kill-others-on-fail \"npm run dev\" \"npm run client-dev\"",
"prestart": "cd ../client && npm install && npm run build",
"start": "NODE_ENV=prod node server"
},
"dependencies": {
"axios": "^0.21.1",
"chokidar": "^3.5.1",
"dotenv": "^9.0.2",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"figlet": "^1.5.0",
"qs": "^6.7.0",
"qs": "^6.10.1",
"universal-cookie": "^4.0.4"
},
"devDependencies": {
"concurrently": "^6.1.0",
"ncu": "^0.2.1",
"concurrently": "^6.2.0",
"nodemon": "^2.0.7",
"npm-check-updates": "^11.5.11"
"npm-check-updates": "^11.6.0"
}
}

0 comments on commit f6431ae

Please sign in to comment.