soundcloud.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. import async from "async";
  2. import { useHasPermission } from "../hooks/hasPermission";
  3. // eslint-disable-next-line
  4. import moduleManager from "../../index";
  5. const DBModule = moduleManager.modules.db;
  6. const UtilsModule = moduleManager.modules.utils;
  7. const SoundcloudModule = moduleManager.modules.soundcloud;
  8. export default {
  9. /**
  10. * Fetches new SoundCloud API key
  11. *
  12. * @returns {{status: string, data: object}}
  13. */
  14. fetchNewApiKey: useHasPermission("admin.view.soundcloud", function fetchNewApiKey(session, cb) {
  15. SoundcloudModule.runJob("GENERATE_SOUNDCLOUD_API_KEY", {}, this)
  16. .then(response => {
  17. this.log("SUCCESS", "SOUNDCLOUD_FETCH_NEW_API_KEY", `Fetching new API key was successful.`);
  18. return cb({ status: "success", data: { status: response.status } });
  19. })
  20. .catch(async err => {
  21. err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
  22. this.log("ERROR", "SOUNDCLOUD_FETCH_NEW_API_KEY", `Fetching new API key failed. "${err}"`);
  23. return cb({ status: "error", message: err });
  24. });
  25. }),
  26. /**
  27. * Tests SoundCloud API key
  28. *
  29. * @returns {{status: string, data: object}}
  30. */
  31. testApiKey: useHasPermission("admin.view.soundcloud", function testApiKey(session, cb) {
  32. SoundcloudModule.runJob("TEST_SOUNDCLOUD_API_KEY", {}, this)
  33. .then(response => {
  34. this.log(
  35. "SUCCESS",
  36. "SOUNDCLOUD_TEST_API_KEY",
  37. `Testing API key was successful. Response: ${response}.`
  38. );
  39. return cb({ status: "success", data: { status: response.status } });
  40. })
  41. .catch(async err => {
  42. err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
  43. this.log("ERROR", "SOUNDCLOUD_TEST_API_KEY", `Testing API key failed. "${err}"`);
  44. return cb({ status: "error", message: err });
  45. });
  46. }),
  47. /**
  48. * Get a Soundcloud artist from ID
  49. *
  50. * @returns {{status: string, data: object}}
  51. */
  52. getArtist: useHasPermission("youtube.removeVideos", function getArtist(session, userPermalink, cb) {
  53. return SoundcloudModule.runJob("GET_ARTISTS_FROM_PERMALINKS", { userPermalinks: [userPermalink] }, this)
  54. .then(res => {
  55. if (res.artists.length === 0) {
  56. this.log("ERROR", "SOUNDCLOUD_GET_ARTISTS_FROM_PERMALINKS", `Fetching artist failed.`);
  57. return cb({ status: "error", message: "Failed to get artist" });
  58. }
  59. this.log("SUCCESS", "SOUNDCLOUD_GET_ARTISTS_FROM_PERMALINKS", `Fetching artist was successful.`);
  60. return cb({
  61. status: "success",
  62. message: "Successfully fetched Soundcloud artist",
  63. data: res.artists[0]
  64. });
  65. })
  66. .catch(async err => {
  67. err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
  68. this.log("ERROR", "SOUNDCLOUD_GET_ARTISTS_FROM_PERMALINKS", `Fetching artist failed. "${err}"`);
  69. return cb({ status: "error", message: err });
  70. });
  71. }),
  72. // /**
  73. // * Returns details about the YouTube quota usage
  74. // *
  75. // * @returns {{status: string, data: object}}
  76. // */
  77. // getQuotaStatus: useHasPermission("admin.view.youtube", function getQuotaStatus(session, fromDate, cb) {
  78. // YouTubeModule.runJob("GET_QUOTA_STATUS", { fromDate }, this)
  79. // .then(response => {
  80. // this.log("SUCCESS", "YOUTUBE_GET_QUOTA_STATUS", `Getting quota status was successful.`);
  81. // return cb({ status: "success", data: { status: response.status } });
  82. // })
  83. // .catch(async err => {
  84. // err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
  85. // this.log("ERROR", "YOUTUBE_GET_QUOTA_STATUS", `Getting quota status failed. "${err}"`);
  86. // return cb({ status: "error", message: err });
  87. // });
  88. // }),
  89. // /**
  90. // * Returns YouTube quota chart data
  91. // *
  92. // * @param {object} session - the session object automatically added by the websocket
  93. // * @param timePeriod - either hours or days
  94. // * @param startDate - beginning date
  95. // * @param endDate - end date
  96. // * @param dataType - either usage or count
  97. // * @returns {{status: string, data: object}}
  98. // */
  99. // getQuotaChartData: useHasPermission(
  100. // "admin.view.youtube",
  101. // function getQuotaChartData(session, timePeriod, startDate, endDate, dataType, cb) {
  102. // YouTubeModule.runJob(
  103. // "GET_QUOTA_CHART_DATA",
  104. // { timePeriod, startDate: new Date(startDate), endDate: new Date(endDate), dataType },
  105. // this
  106. // )
  107. // .then(data => {
  108. // this.log("SUCCESS", "YOUTUBE_GET_QUOTA_CHART_DATA", `Getting quota chart data was successful.`);
  109. // return cb({ status: "success", data });
  110. // })
  111. // .catch(async err => {
  112. // err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
  113. // this.log("ERROR", "YOUTUBE_GET_QUOTA_CHART_DATA", `Getting quota chart data failed. "${err}"`);
  114. // return cb({ status: "error", message: err });
  115. // });
  116. // }
  117. // ),
  118. // /**
  119. // * Gets api requests, used in the admin youtube page by the AdvancedTable component
  120. // *
  121. // * @param {object} session - the session object automatically added by the websocket
  122. // * @param page - the page
  123. // * @param pageSize - the size per page
  124. // * @param properties - the properties to return for each news item
  125. // * @param sort - the sort object
  126. // * @param queries - the queries array
  127. // * @param operator - the operator for queries
  128. // * @param cb
  129. // */
  130. // getApiRequests: useHasPermission(
  131. // "admin.view.youtube",
  132. // async function getApiRequests(session, page, pageSize, properties, sort, queries, operator, cb) {
  133. // async.waterfall(
  134. // [
  135. // next => {
  136. // DBModule.runJob(
  137. // "GET_DATA",
  138. // {
  139. // page,
  140. // pageSize,
  141. // properties,
  142. // sort,
  143. // queries,
  144. // operator,
  145. // modelName: "youtubeApiRequest",
  146. // blacklistedProperties: [],
  147. // specialProperties: {},
  148. // specialQueries: {}
  149. // },
  150. // this
  151. // )
  152. // .then(response => {
  153. // next(null, response);
  154. // })
  155. // .catch(err => {
  156. // next(err);
  157. // });
  158. // }
  159. // ],
  160. // async (err, response) => {
  161. // if (err && err !== true) {
  162. // err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
  163. // this.log("ERROR", "YOUTUBE_GET_API_REQUESTS", `Failed to get YouTube api requests. "${err}"`);
  164. // return cb({ status: "error", message: err });
  165. // }
  166. // this.log("SUCCESS", "YOUTUBE_GET_API_REQUESTS", `Fetched YouTube api requests successfully.`);
  167. // return cb({
  168. // status: "success",
  169. // message: "Successfully fetched YouTube api requests.",
  170. // data: response
  171. // });
  172. // }
  173. // );
  174. // }
  175. // ),
  176. // /**
  177. // * Returns a specific api request
  178. // *
  179. // * @returns {{status: string, data: object}}
  180. // */
  181. // getApiRequest: useHasPermission("youtube.getApiRequest", function getApiRequest(session, apiRequestId, cb) {
  182. // if (!mongoose.Types.ObjectId.isValid(apiRequestId))
  183. // return cb({ status: "error", message: "Api request id is not a valid ObjectId." });
  184. // return YouTubeModule.runJob("GET_API_REQUEST", { apiRequestId }, this)
  185. // .then(response => {
  186. // this.log(
  187. // "SUCCESS",
  188. // "YOUTUBE_GET_API_REQUEST",
  189. // `Getting api request with id ${apiRequestId} was successful.`
  190. // );
  191. // return cb({ status: "success", data: { apiRequest: response.apiRequest } });
  192. // })
  193. // .catch(async err => {
  194. // err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
  195. // this.log(
  196. // "ERROR",
  197. // "YOUTUBE_GET_API_REQUEST",
  198. // `Getting api request with id ${apiRequestId} failed. "${err}"`
  199. // );
  200. // return cb({ status: "error", message: err });
  201. // });
  202. // }),
  203. // /**
  204. // * Reset stored API requests
  205. // *
  206. // * @returns {{status: string, data: object}}
  207. // */
  208. // resetStoredApiRequests: useHasPermission(
  209. // "youtube.resetStoredApiRequests",
  210. // async function resetStoredApiRequests(session, cb) {
  211. // this.keepLongJob();
  212. // this.publishProgress({
  213. // status: "started",
  214. // title: "Reset stored API requests",
  215. // message: "Resetting stored API requests.",
  216. // id: this.toString()
  217. // });
  218. // await CacheModule.runJob("RPUSH", { key: `longJobs.${session.userId}`, value: this.toString() }, this);
  219. // await CacheModule.runJob(
  220. // "PUB",
  221. // {
  222. // channel: "longJob.added",
  223. // value: { jobId: this.toString(), userId: session.userId }
  224. // },
  225. // this
  226. // );
  227. // YouTubeModule.runJob("RESET_STORED_API_REQUESTS", {}, this)
  228. // .then(() => {
  229. // this.log(
  230. // "SUCCESS",
  231. // "YOUTUBE_RESET_STORED_API_REQUESTS",
  232. // `Resetting stored API requests was successful.`
  233. // );
  234. // this.publishProgress({
  235. // status: "success",
  236. // message: "Successfully reset stored YouTube API requests."
  237. // });
  238. // return cb({ status: "success", message: "Successfully reset stored YouTube API requests" });
  239. // })
  240. // .catch(async err => {
  241. // err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
  242. // this.log(
  243. // "ERROR",
  244. // "YOUTUBE_RESET_STORED_API_REQUESTS",
  245. // `Resetting stored API requests failed. "${err}"`
  246. // );
  247. // this.publishProgress({
  248. // status: "error",
  249. // message: err
  250. // });
  251. // return cb({ status: "error", message: err });
  252. // });
  253. // }
  254. // ),
  255. // /**
  256. // * Remove stored API requests
  257. // *
  258. // * @returns {{status: string, data: object}}
  259. // */
  260. // removeStoredApiRequest: useHasPermission(
  261. // "youtube.removeStoredApiRequest",
  262. // function removeStoredApiRequest(session, requestId, cb) {
  263. // YouTubeModule.runJob("REMOVE_STORED_API_REQUEST", { requestId }, this)
  264. // .then(() => {
  265. // this.log(
  266. // "SUCCESS",
  267. // "YOUTUBE_REMOVE_STORED_API_REQUEST",
  268. // `Removing stored API request "${requestId}" was successful.`
  269. // );
  270. // return cb({ status: "success", message: "Successfully removed stored YouTube API request" });
  271. // })
  272. // .catch(async err => {
  273. // err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
  274. // this.log(
  275. // "ERROR",
  276. // "YOUTUBE_REMOVE_STORED_API_REQUEST",
  277. // `Removing stored API request "${requestId}" failed. "${err}"`
  278. // );
  279. // return cb({ status: "error", message: err });
  280. // });
  281. // }
  282. // ),
  283. /**
  284. * Gets videos, used in the admin youtube page by the AdvancedTable component
  285. *
  286. * @param {object} session - the session object automatically added by the websocket
  287. * @param page - the page
  288. * @param pageSize - the size per page
  289. * @param properties - the properties to return for each news item
  290. * @param sort - the sort object
  291. * @param queries - the queries array
  292. * @param operator - the operator for queries
  293. * @param cb
  294. */
  295. getTracks: useHasPermission(
  296. "admin.view.soundcloudTracks",
  297. async function getTracks(session, page, pageSize, properties, sort, queries, operator, cb) {
  298. async.waterfall(
  299. [
  300. next => {
  301. DBModule.runJob(
  302. "GET_DATA",
  303. {
  304. page,
  305. pageSize,
  306. properties,
  307. sort,
  308. queries,
  309. operator,
  310. modelName: "soundcloudTrack",
  311. blacklistedProperties: [],
  312. specialProperties: {
  313. songId: [
  314. // Fetch songs from songs collection with a matching mediaSource
  315. {
  316. $lookup: {
  317. from: "songs", // TODO fix this to support mediasource, so start with youtube:, so add a new pipeline steps
  318. localField: "trackId",
  319. foreignField: "trackId",
  320. as: "song"
  321. }
  322. },
  323. // Turn the array of songs returned in the last step into one object, since only one song should have been returned maximum
  324. {
  325. $unwind: {
  326. path: "$song",
  327. preserveNullAndEmptyArrays: true
  328. }
  329. },
  330. // Add new field songId, which grabs the song object's _id and tries turning it into a string
  331. {
  332. $addFields: {
  333. songId: {
  334. $convert: {
  335. input: "$song._id",
  336. to: "string",
  337. onError: "",
  338. onNull: ""
  339. }
  340. }
  341. }
  342. },
  343. // Cleanup, don't return the song object for any further steps
  344. {
  345. $project: {
  346. song: 0
  347. }
  348. }
  349. ]
  350. },
  351. specialQueries: {},
  352. specialFilters: {
  353. // importJob: importJobId => [
  354. // {
  355. // $lookup: {
  356. // from: "importjobs",
  357. // let: { trackId: "$trackId" },
  358. // pipeline: [
  359. // {
  360. // $match: {
  361. // _id: mongoose.Types.ObjectId(importJobId)
  362. // }
  363. // },
  364. // {
  365. // $addFields: {
  366. // importJob: {
  367. // $in: ["$$trackId", "$response.successfulVideoIds"]
  368. // }
  369. // }
  370. // },
  371. // {
  372. // $project: {
  373. // importJob: 1,
  374. // _id: 0
  375. // }
  376. // }
  377. // ],
  378. // as: "importJob"
  379. // }
  380. // },
  381. // {
  382. // $unwind: "$importJob"
  383. // },
  384. // {
  385. // $set: {
  386. // importJob: "$importJob.importJob"
  387. // }
  388. // }
  389. // ]
  390. }
  391. },
  392. this
  393. )
  394. .then(response => {
  395. next(null, response);
  396. })
  397. .catch(err => {
  398. next(err);
  399. });
  400. }
  401. ],
  402. async (err, response) => {
  403. if (err && err !== true) {
  404. err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
  405. this.log("ERROR", "SOUNDCLOUD_GET_VIDEOS", `Failed to get SoundCloud tracks. "${err}"`);
  406. return cb({ status: "error", message: err });
  407. }
  408. this.log("SUCCESS", "SOUNDCLOUD_GET_VIDEOS", `Fetched SoundCloud tracks successfully.`);
  409. return cb({
  410. status: "success",
  411. message: "Successfully fetched SoundCloud tracks.",
  412. data: response
  413. });
  414. }
  415. );
  416. }
  417. )
  418. // /**
  419. // * Get a YouTube video
  420. // *
  421. // * @returns {{status: string, data: object}}
  422. // */
  423. // getVideo: isLoginRequired(function getVideo(session, identifier, createMissing, cb) {
  424. // return YouTubeModule.runJob("GET_VIDEO", { identifier, createMissing }, this)
  425. // .then(res => {
  426. // this.log("SUCCESS", "YOUTUBE_GET_VIDEO", `Fetching video was successful.`);
  427. // return cb({ status: "success", message: "Successfully fetched YouTube video", data: res.video });
  428. // })
  429. // .catch(async err => {
  430. // err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
  431. // this.log("ERROR", "YOUTUBE_GET_VIDEO", `Fetching video failed. "${err}"`);
  432. // return cb({ status: "error", message: err });
  433. // });
  434. // }),
  435. // /**
  436. // * Remove YouTube videos
  437. // *
  438. // * @returns {{status: string, data: object}}
  439. // */
  440. // removeVideos: useHasPermission("youtube.removeVideos", async function removeVideos(session, videoIds, cb) {
  441. // this.keepLongJob();
  442. // this.publishProgress({
  443. // status: "started",
  444. // title: "Bulk remove YouTube videos",
  445. // message: "Bulk removing YouTube videos.",
  446. // id: this.toString()
  447. // });
  448. // await CacheModule.runJob("RPUSH", { key: `longJobs.${session.userId}`, value: this.toString() }, this);
  449. // await CacheModule.runJob(
  450. // "PUB",
  451. // {
  452. // channel: "longJob.added",
  453. // value: { jobId: this.toString(), userId: session.userId }
  454. // },
  455. // this
  456. // );
  457. // YouTubeModule.runJob("REMOVE_VIDEOS", { videoIds }, this)
  458. // .then(() => {
  459. // this.log("SUCCESS", "YOUTUBE_REMOVE_VIDEOS", `Removing videos was successful.`);
  460. // this.publishProgress({
  461. // status: "success",
  462. // message: "Successfully removed YouTube videos."
  463. // });
  464. // return cb({ status: "success", message: "Successfully removed YouTube videos" });
  465. // })
  466. // .catch(async err => {
  467. // err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
  468. // this.log("ERROR", "YOUTUBE_REMOVE_VIDEOS", `Removing videos failed. "${err}"`);
  469. // this.publishProgress({
  470. // status: "error",
  471. // message: err
  472. // });
  473. // return cb({ status: "error", message: err });
  474. // });
  475. // }),
  476. // /**
  477. // * Requests a set of YouTube videos
  478. // *
  479. // * @param {object} session - the session object automatically added by the websocket
  480. // * @param {string} url - the url of the the YouTube playlist
  481. // * @param {boolean} musicOnly - whether to only get music from the playlist
  482. // * @param {boolean} musicOnly - whether to return videos
  483. // * @param {Function} cb - gets called with the result
  484. // */
  485. // requestSet: isLoginRequired(function requestSet(session, url, musicOnly, returnVideos, cb) {
  486. // YouTubeModule.runJob("REQUEST_SET", { url, musicOnly, returnVideos }, this)
  487. // .then(response => {
  488. // this.log(
  489. // "SUCCESS",
  490. // "REQUEST_SET",
  491. // `Successfully imported a YouTube playlist to be requested for user "${session.userId}".`
  492. // );
  493. // return cb({
  494. // status: "success",
  495. // message: `Playlist is done importing. ${response.successful} were added succesfully, ${response.failed} failed (${response.alreadyInDatabase} were already in database)`,
  496. // videos: returnVideos ? response.videos : null
  497. // });
  498. // })
  499. // .catch(async err => {
  500. // err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
  501. // this.log(
  502. // "ERROR",
  503. // "REQUEST_SET",
  504. // `Importing a YouTube playlist to be requested failed for user "${session.userId}". "${err}"`
  505. // );
  506. // return cb({ status: "error", message: err });
  507. // });
  508. // }),
  509. // /**
  510. // * Requests a set of YouTube videos as an admin
  511. // *
  512. // * @param {object} session - the session object automatically added by the websocket
  513. // * @param {string} url - the url of the the YouTube playlist
  514. // * @param {boolean} musicOnly - whether to only get music from the playlist
  515. // * @param {boolean} musicOnly - whether to return videos
  516. // * @param {Function} cb - gets called with the result
  517. // */
  518. // requestSetAdmin: useHasPermission(
  519. // "youtube.requestSetAdmin",
  520. // async function requestSetAdmin(session, url, musicOnly, returnVideos, cb) {
  521. // const importJobModel = await DBModule.runJob("GET_MODEL", { modelName: "importJob" }, this);
  522. // this.keepLongJob();
  523. // this.publishProgress({
  524. // status: "started",
  525. // title: "Import playlist",
  526. // message: "Importing playlist.",
  527. // id: this.toString()
  528. // });
  529. // await CacheModule.runJob("RPUSH", { key: `longJobs.${session.userId}`, value: this.toString() }, this);
  530. // await CacheModule.runJob(
  531. // "PUB",
  532. // {
  533. // channel: "longJob.added",
  534. // value: { jobId: this.toString(), userId: session.userId }
  535. // },
  536. // this
  537. // );
  538. // async.waterfall(
  539. // [
  540. // next => {
  541. // importJobModel.create(
  542. // {
  543. // type: "youtube",
  544. // query: {
  545. // url,
  546. // musicOnly
  547. // },
  548. // status: "in-progress",
  549. // response: {},
  550. // requestedBy: session.userId,
  551. // requestedAt: Date.now()
  552. // },
  553. // next
  554. // );
  555. // },
  556. // (importJob, next) => {
  557. // YouTubeModule.runJob("REQUEST_SET", { url, musicOnly, returnVideos }, this)
  558. // .then(response => {
  559. // next(null, importJob, response);
  560. // })
  561. // .catch(err => {
  562. // next(err, importJob);
  563. // });
  564. // },
  565. // (importJob, response, next) => {
  566. // importJobModel.updateOne(
  567. // { _id: importJob._id },
  568. // {
  569. // $set: {
  570. // status: "success",
  571. // response: {
  572. // failed: response.failed,
  573. // successful: response.successful,
  574. // alreadyInDatabase: response.alreadyInDatabase,
  575. // successfulVideoIds: response.successfulVideoIds,
  576. // failedVideoIds: response.failedVideoIds
  577. // }
  578. // }
  579. // },
  580. // err => {
  581. // if (err) next(err, importJob);
  582. // else
  583. // MediaModule.runJob("UPDATE_IMPORT_JOBS", { jobIds: importJob._id })
  584. // .then(() => next(null, importJob, response))
  585. // .catch(error => next(error, importJob));
  586. // }
  587. // );
  588. // }
  589. // ],
  590. // async (err, importJob, response) => {
  591. // if (err) {
  592. // err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
  593. // this.log(
  594. // "ERROR",
  595. // "REQUEST_SET_ADMIN",
  596. // `Importing a YouTube playlist to be requested failed for admin "${session.userId}". "${err}"`
  597. // );
  598. // importJobModel.updateOne({ _id: importJob._id }, { $set: { status: "error" } });
  599. // MediaModule.runJob("UPDATE_IMPORT_JOBS", { jobIds: importJob._id });
  600. // return cb({ status: "error", message: err });
  601. // }
  602. // this.log(
  603. // "SUCCESS",
  604. // "REQUEST_SET_ADMIN",
  605. // `Successfully imported a YouTube playlist to be requested for admin "${session.userId}".`
  606. // );
  607. // this.publishProgress({
  608. // status: "success",
  609. // message: `Playlist is done importing. ${response.successful} were added succesfully, ${response.failed} failed (${response.alreadyInDatabase} were already in database)`
  610. // });
  611. // return cb({
  612. // status: "success",
  613. // message: `Playlist is done importing. ${response.successful} were added succesfully, ${response.failed} failed (${response.alreadyInDatabase} were already in database)`,
  614. // videos: returnVideos ? response.videos : null
  615. // });
  616. // }
  617. // );
  618. // }
  619. // )
  620. };