|
@@ -520,6 +520,8 @@ class _SongsModule extends CoreClass {
|
|
next => {
|
|
next => {
|
|
const { songIds } = payload;
|
|
const { songIds } = payload;
|
|
|
|
|
|
|
|
+ this.publishProgress({ status: "update", message: `Updating songs (stage 1)` });
|
|
|
|
+
|
|
SongsModule.SongModel.find({ _id: songIds }, next);
|
|
SongsModule.SongModel.find({ _id: songIds }, next);
|
|
},
|
|
},
|
|
|
|
|
|
@@ -527,6 +529,8 @@ class _SongsModule extends CoreClass {
|
|
(songs, next) => {
|
|
(songs, next) => {
|
|
const { songIds } = payload;
|
|
const { songIds } = payload;
|
|
|
|
|
|
|
|
+ this.publishProgress({ status: "update", message: `Updating songs (stage 2)` });
|
|
|
|
+
|
|
async.eachLimit(
|
|
async.eachLimit(
|
|
songIds,
|
|
songIds,
|
|
1,
|
|
1,
|
|
@@ -548,6 +552,8 @@ class _SongsModule extends CoreClass {
|
|
|
|
|
|
// Adds/updates all songs in the cache
|
|
// Adds/updates all songs in the cache
|
|
(songs, next) => {
|
|
(songs, next) => {
|
|
|
|
+ this.publishProgress({ status: "update", message: `Updating songs (stage 3)` });
|
|
|
|
+
|
|
async.eachLimit(
|
|
async.eachLimit(
|
|
songs,
|
|
songs,
|
|
1,
|
|
1,
|
|
@@ -574,6 +580,8 @@ class _SongsModule extends CoreClass {
|
|
|
|
|
|
// Updates all playlists that the songs are in by setting the new trimmed song
|
|
// Updates all playlists that the songs are in by setting the new trimmed song
|
|
(songs, next) => {
|
|
(songs, next) => {
|
|
|
|
+ this.publishProgress({ status: "update", message: `Updating songs (stage 4)` });
|
|
|
|
+
|
|
const trimmedSongs = songs.map(song => {
|
|
const trimmedSongs = songs.map(song => {
|
|
const { _id, youtubeId, title, artists, thumbnail, duration, verified } = song;
|
|
const { _id, youtubeId, title, artists, thumbnail, duration, verified } = song;
|
|
return {
|
|
return {
|
|
@@ -626,6 +634,8 @@ class _SongsModule extends CoreClass {
|
|
|
|
|
|
// Updates all playlists that the songs are in
|
|
// Updates all playlists that the songs are in
|
|
(songs, playlistsToUpdate, next) => {
|
|
(songs, playlistsToUpdate, next) => {
|
|
|
|
+ this.publishProgress({ status: "update", message: `Updating songs (stage 5)` });
|
|
|
|
+
|
|
async.eachLimit(
|
|
async.eachLimit(
|
|
playlistsToUpdate,
|
|
playlistsToUpdate,
|
|
1,
|
|
1,
|
|
@@ -652,6 +662,8 @@ class _SongsModule extends CoreClass {
|
|
|
|
|
|
// Updates all station queues that the songs are in by setting the new trimmed song
|
|
// Updates all station queues that the songs are in by setting the new trimmed song
|
|
(songs, next) => {
|
|
(songs, next) => {
|
|
|
|
+ this.publishProgress({ status: "update", message: `Updating songs (stage 6)` });
|
|
|
|
+
|
|
const stationsToUpdate = new Set();
|
|
const stationsToUpdate = new Set();
|
|
|
|
|
|
async.eachLimit(
|
|
async.eachLimit(
|
|
@@ -701,6 +713,8 @@ class _SongsModule extends CoreClass {
|
|
|
|
|
|
// Updates all playlists that the songs are in
|
|
// Updates all playlists that the songs are in
|
|
(songs, stationsToUpdate, next) => {
|
|
(songs, stationsToUpdate, next) => {
|
|
|
|
+ this.publishProgress({ status: "update", message: `Updating songs (stage 7)` });
|
|
|
|
+
|
|
async.eachLimit(
|
|
async.eachLimit(
|
|
stationsToUpdate,
|
|
stationsToUpdate,
|
|
1,
|
|
1,
|
|
@@ -727,6 +741,8 @@ class _SongsModule extends CoreClass {
|
|
|
|
|
|
// Autofill the genre playlists of all genres of all songs
|
|
// Autofill the genre playlists of all genres of all songs
|
|
(songs, next) => {
|
|
(songs, next) => {
|
|
|
|
+ this.publishProgress({ status: "update", message: `Updating songs (stage 8)` });
|
|
|
|
+
|
|
const genresToAutofill = new Set();
|
|
const genresToAutofill = new Set();
|
|
|
|
|
|
songs.forEach(song => {
|
|
songs.forEach(song => {
|
|
@@ -754,6 +770,8 @@ class _SongsModule extends CoreClass {
|
|
|
|
|
|
// Send event that the song was updated
|
|
// Send event that the song was updated
|
|
(songs, next) => {
|
|
(songs, next) => {
|
|
|
|
+ this.publishProgress({ status: "update", message: `Updating songs (stage 9)` });
|
|
|
|
+
|
|
async.eachLimit(
|
|
async.eachLimit(
|
|
songs,
|
|
songs,
|
|
1,
|
|
1,
|