soundcloud.js 21 KB

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