Skip to content

Commit

Permalink
Fix problems with starting the program after architecture change, rel…
Browse files Browse the repository at this point in the history
…ated to #488
  • Loading branch information
nukeop committed Sep 30, 2019
1 parent 1448e63 commit 81de3d1
Show file tree
Hide file tree
Showing 30 changed files with 132 additions and 128 deletions.
4 changes: 2 additions & 2 deletions packages/app/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import ToastContainer from './containers/ToastContainer';
import ShortcutsContainer from './containers/ShortcutsContainer';
import ErrorBoundary from './containers/ErrorBoundary';

import ui from '@nuclear/ui';
import { Cover } from '@nuclear/ui';
import NavButtons from './components/NavButtons';
import PlayerControls from './components/PlayerControls';
import Seekbar from './components/Seekbar';
Expand Down Expand Up @@ -278,7 +278,7 @@ class App extends React.Component {

renderCover () {
return (
<ui.Cover
<Cover
cover={
this.props.queue.queueItems[this.props.queue.currentSong]
? this.props.queue.queueItems[this.props.queue.currentSong]
Expand Down
4 changes: 2 additions & 2 deletions packages/app/app/actions/dashboard.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import logger from 'electron-timber';
import core from '@nuclear/core';
import { LastFmApi } from '@nuclear/core';
import { getBestNewAlbums, getBestNewTracks } from 'pitchfork-bnm';

import globals from '../globals';
import { getNewsIndex, getNewsItem } from '../rest/Nuclear';
import {mapLastFMTrackToInternal} from './index';

const lastfm = new core.LastFmApi(
const lastfm = new LastFmApi(
globals.lastfmApiKey,
globals.lastfmApiSecret
);
Expand Down
2 changes: 1 addition & 1 deletion packages/app/app/actions/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import _ from 'lodash';

export const safeAddUuid = track => {
const clonedTrack = _.cloneDeep(track);
if(!_.has(track, 'uuid')) {
if (!_.has(track, 'uuid')) {
clonedTrack.uuid = uuidv4();
}
return clonedTrack;
Expand Down
4 changes: 2 additions & 2 deletions packages/app/app/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import logger from 'electron-timber';
import core from '@nuclear/core';
import { LastFmApi } from '@nuclear/core';
import _ from 'lodash';
import artPlaceholder from '../../resources/media/art_placeholder.png';
import globals from '../globals';

const discogs = require('../rest/Discogs');
const youtube = require('../rest/Youtube');

const lastfm = new core.LastFmApi(globals.lastfmApiKey, globals.lastfmApiSecret);
const lastfm = new LastFmApi(globals.lastfmApiKey, globals.lastfmApiSecret);

export const UNIFIED_SEARCH_START = 'UNIFIED_SEARCH_START';
export const UNIFIED_SEARCH_SUCCESS = 'UNIFIED_SEARCH_SUCCESS';
Expand Down
6 changes: 3 additions & 3 deletions packages/app/app/actions/scrobbling.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { store } from '../persistence/store';
import core from '@nuclear/core';
import { LastFmApi } from '@nuclear/core';
import globals from '../globals';
const electron = window.require('electron');
const lastfm = new core.LastFmApi(globals.lastfmApiKey, globals.lastfmApiSecret);
const lastfm = new LastFmApi(globals.lastfmApiKey, globals.lastfmApiSecret);

export const LASTFM_CONNECT = 'LASTFM_CONNECT';
export const LASTFM_LOGIN = 'LASTFM_LOGIN';
Expand Down Expand Up @@ -97,7 +97,7 @@ export function enableScrobbling() {

export function disableScrobbling() {
store.set('lastFm.lastFmScrobblingEnabled', false);

return {
type: LASTFM_DISABLE_SCROBBLING,
payload: null
Expand Down
6 changes: 3 additions & 3 deletions packages/app/app/actions/tag.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import logger from 'electron-timber';
import core from '@nuclear/core';
import { LastFmApi } from '@nuclear/core';
import globals from '../globals';

export const LOAD_TAG_INFO_START = 'LOAD_TAG_INFO_START';
export const LOAD_TAG_INFO_SUCCESS = 'LOAD_TAG_INFO_SUCCESS';
export const LOAD_TAG_INFO_ERROR = 'LOAD_TAG_INFO_ERROR';
const lastfm = new core.LastFmApi(globals.lastfmApiKey, globals.lastfmApiSecret);
const lastfm = new LastFmApi(globals.lastfmApiKey, globals.lastfmApiSecret);

export function loadTagInfoStart(tag) {
return {
Expand Down Expand Up @@ -34,7 +34,7 @@ export function loadTagInfoError(tag) {
export function loadTagInfo(tag) {
return dispatch => {
dispatch(loadTagInfoStart(tag));

Promise.all([
lastfm.getTagInfo(tag),
lastfm.getTagTracks(tag),
Expand Down
2 changes: 1 addition & 1 deletion packages/app/app/components/AlbumView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class AlbumView extends React.Component {
<Icon name='plus' /> {this.props.t('queue')}
</a>
<a
href="#"
href='#'
onClick={() => this.addAlbumToDownloads(album)}
>
<Icon name='download'/> {this.props.t('download')}
Expand Down
26 changes: 13 additions & 13 deletions packages/app/app/components/ArtistView/PopularTracks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@ class PopularTracks extends React.Component {
<tbody>
{
_.get(tracks, 'track', [])
.slice(0, this.state.expanded ? 15 : 5)
.map((track, index) => {
return (
<TrackRow
key={'popular-track-row-' + index}
track={track}
index={'popular-track-' + index}
artist={artist}
displayCover
displayPlayCount
/>
);
})
.slice(0, this.state.expanded ? 15 : 5)
.map((track, index) => {
return (
<TrackRow
key={'popular-track-row-' + index}
track={track}
index={'popular-track-' + index}
artist={artist}
displayCover
displayPlayCount
/>
);
})
}
</tbody>
</table>
Expand Down
2 changes: 1 addition & 1 deletion packages/app/app/components/InputDialog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const InputDialog = ({ initialString, trigger, header, placeholder, accept, onAc
setInputString(e.target.value);
onAccept(inputString);
handleClose();
}, [inputString, onAccept]);
}, [handleClose, inputString, onAccept]);

return (
<Modal
Expand Down
46 changes: 23 additions & 23 deletions packages/app/app/components/PlayQueue/QueueMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,29 @@ class QueueMenu extends React.Component {
{
!compact &&
<QueueMenuMore
clearQueue={clearQueue}
updatePlaylist={updatePlaylist}
addFavoriteTrack={addFavoriteTrack}
addToDownloads={addToDownloads}
playlists={playlists}
currentItem={_.head(items)}
savePlaylistDialog={
<InputDialog
header={<h4>Input playlist name:</h4>}
placeholder={t('dialog-placeholder')}
accept={t('dialog-accept')}
onAccept={this.handleAddPlaylist(addPlaylist, success, items, settings)}
trigger={
<Dropdown.Item>
<Icon name='save'/>
{t('dialog-trigger')}
</Dropdown.Item>
}
initialString={firstTitle}
/>
}
/>
}
clearQueue={clearQueue}
updatePlaylist={updatePlaylist}
addFavoriteTrack={addFavoriteTrack}
addToDownloads={addToDownloads}
playlists={playlists}
currentItem={_.head(items)}
savePlaylistDialog={
<InputDialog
header={<h4>Input playlist name:</h4>}
placeholder={t('dialog-placeholder')}
accept={t('dialog-accept')}
onAccept={this.handleAddPlaylist(addPlaylist, success, items, settings)}
trigger={
<Dropdown.Item>
<Icon name='save'/>
{t('dialog-trigger')}
</Dropdown.Item>
}
initialString={firstTitle}
/>
}
/>
}

</div>
<hr />
Expand Down
2 changes: 1 addition & 1 deletion packages/app/app/components/PlayQueue/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import _ from 'lodash';
import { safeAddUuid } from '../../actions/helpers';
import styles from './styles.scss';

import QueueItem from '@nuclear/ui/lib/components/QueueItem/';
import {QueueItem} from '@nuclear/ui';
import QueuePopup from '../QueuePopup';
import QueueMenu from './QueueMenu';

Expand Down
2 changes: 1 addition & 1 deletion packages/app/app/components/PluginsView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next';
const PluginsView = ({ actions, plugins, defaultMusicSource }) => {
const selectDefaultMusicSource = useCallback((e, data) => {
actions.selectDefaultMusicSource(data.value);
}, []);
}, [actions]);
const { t } = useTranslation('plugins');

const dropdownOptions = plugins.musicSources.map(s => {
Expand Down
4 changes: 2 additions & 2 deletions packages/app/app/components/ToastComponent/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
import ui from '@nuclear/ui';
import { ToastContainer } from '@nuclear/ui';

import './styles.scss';

const ToastComponent = ({ toasts }) => <ui.ToastContainer toasts={toasts} />;
const ToastComponent = ({ toasts }) => <ToastContainer toasts={toasts} />;

ToastComponent.propTypes = {
toasts: PropTypes.array
Expand Down
12 changes: 6 additions & 6 deletions packages/app/app/containers/FavoritesContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ class FavoritesContainer extends React.Component {
match
} = this.props;

if(match.path.endsWith(ALBUMS_PATH)) {
if (match.path.endsWith(ALBUMS_PATH)) {
return <FavoriteAlbumsView
albums={_.get(favorites, 'albums')}
removeFavoriteAlbum={favoritesActions.removeFavoriteAlbum}
albumInfoSearch={searchActions.albumInfoSearch}
/>;
albums={_.get(favorites, 'albums')}
removeFavoriteAlbum={favoritesActions.removeFavoriteAlbum}
albumInfoSearch={searchActions.albumInfoSearch}
/>;
}

if (match.path.endsWith(TRACKS_PATH)) {
Expand Down Expand Up @@ -67,7 +67,7 @@ FavoritesContainer.propTypes = {
FavoritesContainer.defaultProps = {
favorites: { tracks: [], albums: [], artists: [] },
favoritesActions: {},
searchActions: {},
searchActions: {}
};

function mapStateToProps (state) {
Expand Down
26 changes: 13 additions & 13 deletions packages/app/app/containers/SoundContainer/autoradio.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import _ from 'lodash';
import logger from 'electron-timber';

import globals from '../../globals';
import core from '@nuclear/core';
import { LastFmApi } from '@nuclear/core';

let lastfm = new core.LastFmApi(globals.lastfmApiKey, globals.lastfmApiSecret);
let lastfm = new LastFmApi(globals.lastfmApiKey, globals.lastfmApiSecret);

/*
* The following const will determine how random will be the next track compared to
* The following const will determine how random will be the next track compared to
* the previous ones.
* The biggest impact are :
* Very similar track < 0 --- AUTORADIO_TRACKS_DEVIATION --- 1 > Different track
* Small variety of track < 0 --- SIMILAR_TRACKS_RESULTS_LIMIT --- 1 > Large variety
*/

/*
/*
* Will determine wether when looking for similar tracks we stay close to the current tracks
* Min = 0 - Max = 1 (0 will only accept the most similar track / 1 will go further down the list)
* Example :
Expand All @@ -23,7 +23,7 @@ let lastfm = new core.LastFmApi(globals.lastfmApiKey, globals.lastfmApiSecret);
*/
let autoradioTracksDeviation = 0.15;

/*
/*
* No maximum
* Will determine how many tracks in the queue do we take into account to get a similar track
* Example :
Expand All @@ -32,19 +32,19 @@ let autoradioTracksDeviation = 0.15;
*/
let autoradioImpactingTrackNumber = 10;

/*
/*
* No maximum
* Will determine how many similar track we will be looking for each queue element.
* Will determine how many similar track we will be looking for each queue element.
* The higher, the highest is the chance of changing a lot the style of the future track
* Example :
* If set to 10 : for each element in the queue, we will look for 10 similar tracks
* The next track will be chosen pseudo randomly between
* The next track will be chosen pseudo randomly between
* AUTORADIO_IMPACTING_TRACK_NUMBER * SIMILAR_TRACKS_RESULTS_LIMIT tracks
* The more tracks, the more likely is the style to be changed
*/
let similarTracksResultsLimit = 10;

/*
/*
* Min = 0 - Max = 1 (0 will only accept the most similar artist / 1 will go further down the list)
* Will determine wether when looking for similar artists we stay close to the current artist
* This is only used in the case we cannot find similar tracks => we fall back to similar artist search
Expand All @@ -60,10 +60,10 @@ function computeParameters (crazinessScore = 10) {

let props;
/**
* addAutoradioTrackToQueue will first try to find tracks similar to the
* current queue.
* If no track is found, it will look for similar artists and choose a
* random track to play.
* addAutoradioTrackToQueue will first try to find tracks similar to the
* current queue.
* If no track is found, it will look for similar artists and choose a
* random track to play.
* It will remove all tracks which are already present in the queue.
*/
export function addAutoradioTrackToQueue (callProps) {
Expand Down
8 changes: 4 additions & 4 deletions packages/app/app/containers/SoundContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { filterFrequencies } from '../../components/Equalizer/chart';
import { getSelectedStream } from '../../utils';
import * as Autoradio from './autoradio';
import globals from '../../globals';
import core from '@nuclear/core';
import { LastFmApi } from '@nuclear/core';

let lastfm = new core.LastFmApi(globals.lastfmApiKey, globals.lastfmApiSecret);
let lastfm = new LastFmApi(globals.lastfmApiKey, globals.lastfmApiSecret);

class SoundContainer extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -49,7 +49,7 @@ class SoundContainer extends React.Component {
this.props.actions.lyricsSearch(currentSong);
}
}

handleAutoRadio () {
if (
this.props.settings.autoradio &&
Expand Down Expand Up @@ -146,7 +146,7 @@ class SoundContainer extends React.Component {

if (queue.queueItems.length > 0) {
const currentSong = queue.queueItems[queue.currentSong];

streamUrl = (
getSelectedStream(currentSong.streams, plugins.defaultMusicSource) || {}
).stream;
Expand Down
4 changes: 2 additions & 2 deletions packages/app/app/containers/TrackPopupContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const TrackPopupContainer = props => {
{
withAddToQueue &&
<PopupButton
onClick={ () => actions.addToQueue(musicSources, trackItem)}
onClick={() => actions.addToQueue(musicSources, trackItem)}
ariaLabel='Add track to queue'
icon='plus'
label='Add to queue'
Expand All @@ -57,7 +57,7 @@ const TrackPopupContainer = props => {
{
withPlayNow &&
<PopupButton
onClick={ () => actions.playTrack(musicSources, trackItem) }
onClick={() => actions.playTrack(musicSources, trackItem)}
ariaLabel='Play this track now'
icon='play'
label='Play now'
Expand Down
2 changes: 1 addition & 1 deletion packages/app/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import configureStore from './store/configureStore';

const store = configureStore();
logger.hookConsole({
renderer: true
renderer: true
});

// Sentry
Expand Down
Loading

0 comments on commit 81de3d1

Please sign in to comment.