index.vue 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037
  1. <template>
  2. <div>
  3. <modal title="Edit Song" class="song-modal">
  4. <div slot="body">
  5. <div class="left-section">
  6. <div class="top-section">
  7. <div class="player-section">
  8. <div id="editSongPlayer"></div>
  9. <div v-show="youtubeError" class="player-error">
  10. <h2>{{ youtubeErrorMessage }}</h2>
  11. </div>
  12. <canvas
  13. ref="durationCanvas"
  14. v-show="!youtubeError"
  15. height="20"
  16. width="530"
  17. ></canvas>
  18. <div class="player-footer">
  19. <div class="player-footer-left">
  20. <i
  21. class="material-icons player-play-pause"
  22. @click="play()"
  23. @keyup.enter="play()"
  24. tabindex="0"
  25. v-if="video.paused"
  26. >play_arrow</i
  27. >
  28. <i
  29. class="material-icons player-play-pause"
  30. @click="settings('pause')"
  31. @keyup.enter="settings('pause')"
  32. tabindex="0"
  33. v-if="!video.paused"
  34. >pause</i
  35. >
  36. <i
  37. class="material-icons player-stop"
  38. @click="settings('stop')"
  39. @keyup.enter="settings('stop')"
  40. tabindex="0"
  41. >stop</i
  42. >
  43. <i
  44. class="material-icons player-fast-forward"
  45. @click="settings('skipToLast10Secs')"
  46. @keyup.enter="
  47. settings('skipToLast10Secs')
  48. "
  49. tabindex="0"
  50. >fast_forward</i
  51. >
  52. </div>
  53. <div class="player-footer-center">
  54. <img src="/assets/social/youtube.svg" />
  55. <span>
  56. <span>
  57. {{ youtubeVideoCurrentTime }}
  58. </span>
  59. /
  60. <span>
  61. {{ youtubeVideoDuration }}
  62. {{ youtubeVideoNote }}
  63. </span>
  64. </span>
  65. </div>
  66. <div class="player-footer-right">
  67. <input
  68. type="range"
  69. v-model="volumeSliderValue"
  70. min="0"
  71. max="10000"
  72. class="active"
  73. @change="changeVolume()"
  74. @input="changeVolume()"
  75. />
  76. </div>
  77. </div>
  78. </div>
  79. <img
  80. class="thumbnail-preview"
  81. :src="song.thumbnail"
  82. onerror="this.src='/assets/notes-transparent.png'"
  83. ref="thumbnailElement"
  84. v-if="songDataLoaded"
  85. />
  86. </div>
  87. <div class="edit-section" v-if="songDataLoaded">
  88. <div class="control is-grouped">
  89. <div class="title-container">
  90. <label class="label">Title</label>
  91. <p class="control has-addons">
  92. <input
  93. class="input"
  94. type="text"
  95. ref="title-input"
  96. v-model="song.title"
  97. @keyup.shift.enter="
  98. getAlbumData('title')
  99. "
  100. />
  101. <button
  102. class="button album-get-button"
  103. @click="getAlbumData('title')"
  104. >
  105. <i class="material-icons">album</i>
  106. </button>
  107. </p>
  108. </div>
  109. <div class="duration-container">
  110. <label class="label">Duration</label>
  111. <p class="control has-addons">
  112. <input
  113. class="input"
  114. type="text"
  115. v-model.number="song.duration"
  116. @keyup.shift.enter="fillDuration()"
  117. />
  118. <button
  119. class="button duration-fill-button"
  120. @click="fillDuration()"
  121. >
  122. <i class="material-icons">sync</i>
  123. </button>
  124. </p>
  125. </div>
  126. <div class="skip-duration-container">
  127. <label class="label">Skip duration</label>
  128. <p class="control">
  129. <input
  130. class="input"
  131. type="text"
  132. v-model.number="song.skipDuration"
  133. />
  134. </p>
  135. </div>
  136. </div>
  137. <div class="control is-grouped">
  138. <div class="album-art-container">
  139. <label class="label">Album art</label>
  140. <p class="control has-addons">
  141. <input
  142. class="input"
  143. type="text"
  144. v-model="song.thumbnail"
  145. @keyup.shift.enter="
  146. getAlbumData('albumArt')
  147. "
  148. />
  149. <button
  150. class="button album-get-button"
  151. @click="getAlbumData('albumArt')"
  152. >
  153. <i class="material-icons">album</i>
  154. </button>
  155. </p>
  156. </div>
  157. </div>
  158. <div class="control is-grouped">
  159. <div class="artists-container">
  160. <label class="label">Artists</label>
  161. <p class="control has-addons">
  162. <input
  163. class="input"
  164. type="text"
  165. ref="new-artist"
  166. v-model="artistInputValue"
  167. @blur="blurArtistInput()"
  168. @focus="focusArtistInput()"
  169. @keydown="keydownArtistInput()"
  170. @keyup.exact.enter="addTag('artists')"
  171. @keyup.shift.enter="
  172. getAlbumData('artists')
  173. "
  174. />
  175. <button
  176. class="button album-get-button"
  177. @click="getAlbumData('artists')"
  178. >
  179. <i class="material-icons">album</i>
  180. </button>
  181. <button
  182. class="button is-info add-button"
  183. @click="addTag('artists')"
  184. >
  185. <i class="material-icons">add</i>
  186. </button>
  187. </p>
  188. <div
  189. class="autosuggest-container"
  190. v-if="
  191. (artistInputFocussed ||
  192. artistAutosuggestContainerFocussed) &&
  193. artistAutosuggestItems.length > 0
  194. "
  195. @mouseover="focusArtistContainer()"
  196. @mouseleave="blurArtistContainer()"
  197. >
  198. <span
  199. class="autosuggest-item"
  200. tabindex="0"
  201. @click="selectArtistAutosuggest(item)"
  202. v-for="item in artistAutosuggestItems"
  203. :key="item"
  204. >{{ item }}</span
  205. >
  206. </div>
  207. <div class="list-container">
  208. <div
  209. class="list-item"
  210. v-for="artist in song.artists"
  211. :key="artist"
  212. >
  213. <div
  214. class="list-item-circle"
  215. @click="
  216. removeTag('artists', artist)
  217. "
  218. >
  219. <i class="material-icons">close</i>
  220. </div>
  221. <p>{{ artist }}</p>
  222. </div>
  223. </div>
  224. </div>
  225. <div class="genres-container">
  226. <label class="label">
  227. <span>Genres</span>
  228. <i
  229. class="material-icons"
  230. @click="toggleGenreHelper"
  231. @dblclick="resetGenreHelper"
  232. >info</i
  233. >
  234. </label>
  235. <p class="control has-addons">
  236. <input
  237. class="input"
  238. type="text"
  239. ref="new-genre"
  240. v-model="genreInputValue"
  241. @blur="blurGenreInput()"
  242. @focus="focusGenreInput()"
  243. @keydown="keydownGenreInput()"
  244. @keyup.exact.enter="addTag('genres')"
  245. @keyup.shift.enter="
  246. getAlbumData('genres')
  247. "
  248. />
  249. <button
  250. class="button album-get-button"
  251. @click="getAlbumData('genres')"
  252. >
  253. <i class="material-icons">album</i>
  254. </button>
  255. <button
  256. class="button is-info add-button"
  257. @click="addTag('genres')"
  258. >
  259. <i class="material-icons">add</i>
  260. </button>
  261. </p>
  262. <div
  263. class="autosuggest-container"
  264. v-if="
  265. (genreInputFocussed ||
  266. genreAutosuggestContainerFocussed) &&
  267. genreAutosuggestItems.length > 0
  268. "
  269. @mouseover="focusGenreContainer()"
  270. @mouseleave="blurGenreContainer()"
  271. >
  272. <span
  273. class="autosuggest-item"
  274. @click="selectGenreAutosuggest(item)"
  275. v-for="item in genreAutosuggestItems"
  276. :key="item"
  277. >{{ item }}</span
  278. >
  279. </div>
  280. <div class="list-container">
  281. <div
  282. class="list-item"
  283. v-for="genre in song.genres"
  284. :key="genre"
  285. >
  286. <div
  287. class="list-item-circle"
  288. @click="removeTag('genres', genre)"
  289. >
  290. <i class="material-icons">close</i>
  291. </div>
  292. <p>{{ genre }}</p>
  293. </div>
  294. </div>
  295. </div>
  296. <div class="youtube-id-container">
  297. <label class="label">YouTube ID</label>
  298. <p class="control">
  299. <input
  300. class="input"
  301. type="text"
  302. v-model="song.youtubeId"
  303. />
  304. </p>
  305. </div>
  306. </div>
  307. </div>
  308. </div>
  309. <div class="right-section" v-if="songDataLoaded">
  310. <div id="tabs-container">
  311. <div id="tab-selection">
  312. <button
  313. class="button is-default"
  314. :class="{ selected: tab === 'discogs' }"
  315. ref="discogs-tab"
  316. @click="showTab('discogs')"
  317. >
  318. Discogs
  319. </button>
  320. </div>
  321. <discogs class="tab" v-show="tab === 'discogs'" />
  322. </div>
  323. </div>
  324. </div>
  325. <div slot="footer">
  326. <save-button ref="saveButton" @clicked="save(song, false)" />
  327. <save-button
  328. ref="saveAndCloseButton"
  329. type="save-and-close"
  330. @clicked="save(song, true)"
  331. />
  332. <div class="right">
  333. <button
  334. v-if="song.status !== 'verified'"
  335. class="button is-success"
  336. @click="verify(song._id)"
  337. content="Verify Song"
  338. v-tippy
  339. >
  340. <i class="material-icons">check_circle</i>
  341. </button>
  342. <confirm
  343. v-if="song.status === 'verified'"
  344. placement="left"
  345. @confirm="unverify(song._id)"
  346. >
  347. <button
  348. class="button is-danger"
  349. content="Unverify Song"
  350. v-tippy
  351. >
  352. <i class="material-icons">cancel</i>
  353. </button>
  354. </confirm>
  355. <confirm
  356. v-if="song.status !== 'hidden'"
  357. placement="left"
  358. @confirm="hide(song._id)"
  359. >
  360. <button
  361. class="button is-danger"
  362. content="Hide Song"
  363. v-tippy
  364. >
  365. <i class="material-icons">visibility_off</i>
  366. </button>
  367. </confirm>
  368. <button
  369. v-if="song.status === 'hidden'"
  370. class="button is-success"
  371. @click="unhide(song._id)"
  372. content="Unhide Song"
  373. v-tippy
  374. >
  375. <i class="material-icons">visibility</i>
  376. </button>
  377. <!-- <confirm placement="left" @confirm="remove(song._id)">
  378. <button
  379. class="button is-danger"
  380. content="Remove Song"
  381. v-tippy
  382. >
  383. <i class="material-icons">delete</i>
  384. </button>
  385. </confirm> -->
  386. </div>
  387. </div>
  388. </modal>
  389. <floating-box id="genreHelper" ref="genreHelper">
  390. <template #body>
  391. <span>Blues</span><span>Country</span><span>Disco</span
  392. ><span>Funk</span><span>Hip-Hop</span><span>Jazz</span
  393. ><span>Metal</span><span>Oldies</span><span>Other</span
  394. ><span>Pop</span><span>Rap</span><span>Reggae</span
  395. ><span>Rock</span><span>Techno</span><span>Trance</span
  396. ><span>Classical</span><span>Instrumental</span
  397. ><span>House</span><span>Electronic</span
  398. ><span>Christian Rap</span><span>Lo-Fi</span><span>Musical</span
  399. ><span>Rock 'n' Roll</span><span>Opera</span
  400. ><span>Drum & Bass</span><span>Club-House</span
  401. ><span>Indie</span><span>Heavy Metal</span
  402. ><span>Christian rock</span><span>Dubstep</span>
  403. </template>
  404. </floating-box>
  405. </div>
  406. </template>
  407. <script>
  408. import { mapState, mapGetters, mapActions } from "vuex";
  409. import Toast from "toasters";
  410. import aw from "@/aw";
  411. import validation from "@/validation";
  412. import keyboardShortcuts from "@/keyboardShortcuts";
  413. import Confirm from "@/components/Confirm.vue";
  414. import Modal from "../../Modal.vue";
  415. import FloatingBox from "../../FloatingBox.vue";
  416. import SaveButton from "../../SaveButton.vue";
  417. import Discogs from "./Tabs/Discogs.vue";
  418. export default {
  419. components: { Modal, FloatingBox, SaveButton, Confirm, Discogs },
  420. props: {
  421. youtubeId: { type: String, default: null },
  422. // songType: { type: String, default: null },
  423. sector: { type: String, default: "admin" }
  424. },
  425. data() {
  426. return {
  427. songDataLoaded: false,
  428. youtubeError: false,
  429. youtubeErrorMessage: "",
  430. focusedElementBefore: null,
  431. youtubeVideoDuration: "0.000",
  432. youtubeVideoCurrentTime: 0,
  433. youtubeVideoNote: "",
  434. useHTTPS: false,
  435. volumeSliderValue: 0,
  436. skipToLast10SecsPressed: false,
  437. artistInputValue: "",
  438. genreInputValue: "",
  439. artistInputFocussed: false,
  440. genreInputFocussed: false,
  441. genreAutosuggestContainerFocussed: false,
  442. artistAutosuggestContainerFocussed: false,
  443. keydownArtistInputTimeout: 0,
  444. keydownGenreInputTimeout: 0,
  445. artistAutosuggestItems: [],
  446. genreAutosuggestItems: [],
  447. activityWatchVideoDataInterval: null,
  448. activityWatchVideoLastStatus: "",
  449. activityWatchVideoLastStartDuration: "",
  450. genres: [
  451. "Blues",
  452. "Country",
  453. "Disco",
  454. "Funk",
  455. "Hip-Hop",
  456. "Jazz",
  457. "Metal",
  458. "Oldies",
  459. "Other",
  460. "Pop",
  461. "Rap",
  462. "Reggae",
  463. "Rock",
  464. "Techno",
  465. "Trance",
  466. "Classical",
  467. "Instrumental",
  468. "House",
  469. "Electronic",
  470. "Christian Rap",
  471. "Lo-Fi",
  472. "Musical",
  473. "Rock 'n' Roll",
  474. "Opera",
  475. "Drum & Bass",
  476. "Club-House",
  477. "Indie",
  478. "Heavy Metal",
  479. "Christian rock",
  480. "Dubstep"
  481. ]
  482. };
  483. },
  484. computed: {
  485. ...mapState("modals/editSong", {
  486. tab: state => state.tab,
  487. video: state => state.video,
  488. song: state => state.song,
  489. originalSong: state => state.originalSong
  490. }),
  491. ...mapState("modalVisibility", {
  492. modals: state => state.modals
  493. }),
  494. ...mapGetters({
  495. socket: "websockets/getSocket"
  496. })
  497. },
  498. watch: {
  499. /* eslint-disable */
  500. "song.duration": function() {
  501. this.drawCanvas();
  502. },
  503. "song.skipDuration": function() {
  504. this.drawCanvas();
  505. }
  506. /* eslint-enable */
  507. },
  508. async mounted() {
  509. // if (this.modals.editSong = false) this.video.player.stopVideo();
  510. // this.loadVideoById(
  511. // this.song.youtubeId,
  512. // this.song.skipDuration
  513. // );
  514. this.activityWatchVideoDataInterval = setInterval(() => {
  515. this.sendActivityWatchVideoData();
  516. }, 1000);
  517. this.useHTTPS = await lofig.get("cookie.secure");
  518. this.socket.dispatch(`songs.getSongFromSongId`, this.song._id, res => {
  519. if (res.status === "success") {
  520. const { song } = res.data;
  521. // this.song = { ...song };
  522. // if (this.song.discogs === undefined)
  523. // this.song.discogs = null;
  524. this.editSong(song);
  525. this.songDataLoaded = true;
  526. this.socket.dispatch(
  527. "apis.joinRoom",
  528. `edit-song.${this.song._id}`
  529. );
  530. // this.edit(res.data.song);
  531. this.interval = setInterval(() => {
  532. if (
  533. this.song.duration !== -1 &&
  534. this.video.paused === false &&
  535. this.playerReady &&
  536. (this.video.player.getCurrentTime() -
  537. this.song.skipDuration >
  538. this.song.duration ||
  539. (this.video.player.getCurrentTime() > 0 &&
  540. this.video.player.getCurrentTime() >=
  541. this.video.player.getDuration()))
  542. ) {
  543. this.video.paused = true;
  544. this.video.player.stopVideo();
  545. this.drawCanvas();
  546. }
  547. if (this.playerReady) {
  548. this.youtubeVideoCurrentTime = this.video.player
  549. .getCurrentTime()
  550. .toFixed(3);
  551. }
  552. if (this.video.paused === false) this.drawCanvas();
  553. }, 200);
  554. if (window.YT && window.YT.Player) {
  555. this.video.player = new window.YT.Player("editSongPlayer", {
  556. height: 298,
  557. width: 530,
  558. videoId: this.song.youtubeId,
  559. host: "https://www.youtube-nocookie.com",
  560. playerVars: {
  561. controls: 0,
  562. iv_load_policy: 3,
  563. rel: 0,
  564. showinfo: 0,
  565. autoplay: 0
  566. },
  567. startSeconds: this.song.skipDuration,
  568. events: {
  569. onReady: () => {
  570. let volume = parseInt(
  571. localStorage.getItem("volume")
  572. );
  573. volume =
  574. typeof volume === "number" ? volume : 20;
  575. this.video.player.setVolume(volume);
  576. if (volume > 0) this.video.player.unMute();
  577. const duration = this.video.player.getDuration();
  578. this.youtubeVideoDuration = duration.toFixed(3);
  579. this.youtubeVideoNote = "(~)";
  580. this.playerReady = true;
  581. this.drawCanvas();
  582. },
  583. onStateChange: event => {
  584. this.drawCanvas();
  585. let skipToLast10SecsPressed = false;
  586. if (
  587. event.data === 1 &&
  588. this.skipToLast10SecsPressed
  589. ) {
  590. this.skipToLast10SecsPressed = false;
  591. skipToLast10SecsPressed = true;
  592. }
  593. if (
  594. event.data === 1 &&
  595. !skipToLast10SecsPressed
  596. ) {
  597. this.video.paused = false;
  598. let youtubeDuration = this.video.player.getDuration();
  599. const newYoutubeVideoDuration = youtubeDuration.toFixed(
  600. 3
  601. );
  602. const songDurationNumber = Number(
  603. this.song.duration
  604. );
  605. const songDurationNumber2 =
  606. Number(this.song.duration) + 1;
  607. const songDurationNumber3 =
  608. Number(this.song.duration) - 1;
  609. const fixedSongDuration = songDurationNumber.toFixed(
  610. 3
  611. );
  612. const fixedSongDuration2 = songDurationNumber2.toFixed(
  613. 3
  614. );
  615. const fixedSongDuration3 = songDurationNumber3.toFixed(
  616. 3
  617. );
  618. if (
  619. this.youtubeVideoDuration !==
  620. newYoutubeVideoDuration &&
  621. (fixedSongDuration ===
  622. this.youtubeVideoDuration ||
  623. fixedSongDuration2 ===
  624. this.youtubeVideoDuration ||
  625. fixedSongDuration3 ===
  626. this.youtubeVideoDuration)
  627. )
  628. this.song.duration = newYoutubeVideoDuration;
  629. this.youtubeVideoDuration = newYoutubeVideoDuration;
  630. this.youtubeVideoNote = "";
  631. if (this.song.duration === -1)
  632. this.song.duration = youtubeDuration;
  633. youtubeDuration -= this.song.skipDuration;
  634. if (
  635. this.song.duration >
  636. youtubeDuration + 1
  637. ) {
  638. this.video.player.stopVideo();
  639. this.video.paused = true;
  640. return new Toast(
  641. "Video can't play. Specified duration is bigger than the YouTube song duration."
  642. );
  643. }
  644. if (this.song.duration <= 0) {
  645. this.video.player.stopVideo();
  646. this.video.paused = true;
  647. return new Toast(
  648. "Video can't play. Specified duration has to be more than 0 seconds."
  649. );
  650. }
  651. if (
  652. this.video.player.getCurrentTime() <
  653. this.song.skipDuration
  654. ) {
  655. return this.video.player.seekTo(
  656. this.song.skipDuration
  657. );
  658. }
  659. } else if (event.data === 2) {
  660. this.video.paused = true;
  661. }
  662. return false;
  663. }
  664. }
  665. });
  666. } else {
  667. this.youtubeError = true;
  668. this.youtubeErrorMessage = "Player could not be loaded.";
  669. }
  670. } else {
  671. new Toast("Song with that ID not found");
  672. this.closeModal("editSong");
  673. }
  674. });
  675. this.socket.dispatch(
  676. "reports.getReportsForSong",
  677. this.song._id,
  678. res => {
  679. this.reports = res.data.reports;
  680. }
  681. );
  682. let volume = parseFloat(localStorage.getItem("volume"));
  683. volume =
  684. typeof volume === "number" && !Number.isNaN(volume) ? volume : 20;
  685. localStorage.setItem("volume", volume);
  686. this.volumeSliderValue = volume * 100;
  687. this.socket.on(
  688. "event:admin.hiddenSong.created",
  689. res => {
  690. this.song.status = res.data.song.status;
  691. },
  692. { modal: "editSong" }
  693. );
  694. this.socket.on(
  695. "event:admin.unverifiedSong.created",
  696. res => {
  697. this.song.status = res.data.song.status;
  698. },
  699. { modal: "editSong" }
  700. );
  701. this.socket.on(
  702. "event:admin.verifiedSong.created",
  703. res => {
  704. this.song.status = res.data.song.status;
  705. },
  706. { modal: "editSong" }
  707. );
  708. this.socket.on(
  709. "event:admin.hiddenSong.deleted",
  710. () => {
  711. new Toast("The song you were editing was removed");
  712. this.closeModal("editSong");
  713. },
  714. { modal: "editSong" }
  715. );
  716. this.socket.on(
  717. "event:admin.unverifiedSong.deleted",
  718. () => {
  719. new Toast("The song you were editing was removed");
  720. this.closeModal("editSong");
  721. },
  722. { modal: "editSong" }
  723. );
  724. this.socket.on(
  725. "event:admin.verifiedSong.deleted",
  726. () => {
  727. new Toast("The song you were editing was removed");
  728. this.closeModal("editSong");
  729. },
  730. { modal: "editSong" }
  731. );
  732. keyboardShortcuts.registerShortcut("editSong.pauseResumeVideo", {
  733. keyCode: 101,
  734. preventDefault: true,
  735. handler: () => {
  736. if (this.video.paused) this.play();
  737. else this.settings("pause");
  738. }
  739. });
  740. keyboardShortcuts.registerShortcut("editSong.stopVideo", {
  741. keyCode: 101,
  742. ctrl: true,
  743. preventDefault: true,
  744. handler: () => {
  745. this.settings("stop");
  746. }
  747. });
  748. keyboardShortcuts.registerShortcut("editSong.skipToLast10Secs", {
  749. keyCode: 102,
  750. preventDefault: true,
  751. handler: () => {
  752. this.settings("skipToLast10Secs");
  753. }
  754. });
  755. keyboardShortcuts.registerShortcut("editSong.lowerVolumeLarge", {
  756. keyCode: 98,
  757. preventDefault: true,
  758. handler: () => {
  759. this.volumeSliderValue = Math.max(
  760. 0,
  761. this.volumeSliderValue - 1000
  762. );
  763. this.changeVolume();
  764. }
  765. });
  766. keyboardShortcuts.registerShortcut("editSong.lowerVolumeSmall", {
  767. keyCode: 98,
  768. ctrl: true,
  769. preventDefault: true,
  770. handler: () => {
  771. this.volumeSliderValue = Math.max(
  772. 0,
  773. this.volumeSliderValue - 100
  774. );
  775. this.changeVolume();
  776. }
  777. });
  778. keyboardShortcuts.registerShortcut("editSong.increaseVolumeLarge", {
  779. keyCode: 104,
  780. preventDefault: true,
  781. handler: () => {
  782. this.volumeSliderValue = Math.min(
  783. 10000,
  784. this.volumeSliderValue + 1000
  785. );
  786. this.changeVolume();
  787. }
  788. });
  789. keyboardShortcuts.registerShortcut("editSong.increaseVolumeSmall", {
  790. keyCode: 104,
  791. ctrl: true,
  792. preventDefault: true,
  793. handler: () => {
  794. this.volumeSliderValue = Math.min(
  795. 10000,
  796. this.volumeSliderValue + 100
  797. );
  798. this.changeVolume();
  799. }
  800. });
  801. keyboardShortcuts.registerShortcut("editSong.save", {
  802. keyCode: 83,
  803. ctrl: true,
  804. preventDefault: true,
  805. handler: () => {
  806. this.save(this.song, false);
  807. }
  808. });
  809. keyboardShortcuts.registerShortcut("editSong.saveClose", {
  810. keyCode: 83,
  811. ctrl: true,
  812. alt: true,
  813. preventDefault: true,
  814. handler: () => {
  815. this.save(this.song, true);
  816. }
  817. });
  818. keyboardShortcuts.registerShortcut("editSong.saveVerifyClose", {
  819. keyCode: 86,
  820. ctrl: true,
  821. alt: true,
  822. preventDefault: true,
  823. handler: () => {
  824. // alert("not implemented yet");
  825. }
  826. });
  827. keyboardShortcuts.registerShortcut("editSong.close", {
  828. keyCode: 115,
  829. preventDefault: true,
  830. handler: () => {
  831. this.closeModal("editSong");
  832. setTimeout(() => {
  833. window.focusedElementBefore.focus();
  834. }, 500);
  835. }
  836. });
  837. keyboardShortcuts.registerShortcut("editSong.focusTitle", {
  838. keyCode: 36,
  839. preventDefault: true,
  840. handler: () => {
  841. this.$refs["title-input"].focus();
  842. }
  843. });
  844. keyboardShortcuts.registerShortcut("editSong.useAllDiscogs", {
  845. keyCode: 68,
  846. alt: true,
  847. ctrl: true,
  848. preventDefault: true,
  849. handler: () => {
  850. this.getAlbumData("title");
  851. this.getAlbumData("albumArt");
  852. this.getAlbumData("artists");
  853. this.getAlbumData("genres");
  854. }
  855. });
  856. /*
  857. editSong.pauseResume - Num 5 - Pause/resume song
  858. editSong.stopVideo - Ctrl - Num 5 - Stop
  859. editSong.skipToLast10Secs - Num 6 - Skip to last 10 seconds
  860. editSong.lowerVolumeLarge - Num 2 - Volume down by 10
  861. editSong.lowerVolumeSmall - Ctrl - Num 2 - Volume down by 1
  862. editSong.increaseVolumeLarge - Num 8 - Volume up by 10
  863. editSong.increaseVolumeSmall - Ctrl - Num 8 - Volume up by 1
  864. editSong.focusTitle - Home - Focus the title input
  865. editSong.focusDicogs - End - Focus the discogs input
  866. editSong.save - Ctrl - S - Saves song
  867. editSong.save - Ctrl - Alt - S - Saves song and closes the modal
  868. editSong.save - Ctrl - Alt - V - Saves song, verifies songs and then closes the modal
  869. editSong.close - F4 - Closes modal without saving
  870. editSong.useAllDiscogs - Ctrl - Alt - D - Sets all fields to the Discogs data
  871. Inside Discogs inputs: Ctrl - D - Sets this field to the Discogs data
  872. */
  873. },
  874. beforeDestroy() {
  875. this.playerReady = false;
  876. clearInterval(this.interval);
  877. clearInterval(this.activityWatchVideoDataInterval);
  878. this.socket.dispatch(
  879. "apis.leaveRoom",
  880. `edit-song.${this.song._id}`,
  881. () => {}
  882. );
  883. const shortcutNames = [
  884. "editSong.pauseResume",
  885. "editSong.stopVideo",
  886. "editSong.skipToLast10Secs",
  887. "editSong.lowerVolumeLarge",
  888. "editSong.lowerVolumeSmall",
  889. "editSong.increaseVolumeLarge",
  890. "editSong.increaseVolumeSmall",
  891. "editSong.focusTitle",
  892. "editSong.focusDicogs",
  893. "editSong.save",
  894. "editSong.saveClose",
  895. "editSong.saveVerifyClose",
  896. "editSong.close",
  897. "editSong.useAllDiscogs"
  898. ];
  899. shortcutNames.forEach(shortcutName => {
  900. keyboardShortcuts.unregisterShortcut(shortcutName);
  901. });
  902. },
  903. methods: {
  904. save(songToCopy, close) {
  905. const song = JSON.parse(JSON.stringify(songToCopy));
  906. let saveButtonRef = this.$refs.saveButton;
  907. if (close) saveButtonRef = this.$refs.saveAndCloseButton;
  908. if (!this.youtubeError && this.youtubeVideoDuration === "0.000") {
  909. saveButtonRef.handleFailedSave();
  910. return new Toast("The video appears to not be working.");
  911. }
  912. if (!song.title) {
  913. saveButtonRef.handleFailedSave();
  914. return new Toast("Please fill in all fields");
  915. }
  916. if (!song.thumbnail) {
  917. saveButtonRef.handleFailedSave();
  918. return new Toast("Please fill in all fields");
  919. }
  920. // const thumbnailHeight = this.$refs.thumbnailElement.naturalHeight;
  921. // const thumbnailWidth = this.$refs.thumbnailElement.naturalWidth;
  922. // if (thumbnailHeight < 80 || thumbnailWidth < 80) {
  923. // saveButtonRef.handleFailedSave();
  924. // return new Toast(
  925. // "Thumbnail width and height must be at least 80px."
  926. // );
  927. // }
  928. // if (thumbnailHeight > 4000 || thumbnailWidth > 4000) {
  929. // saveButtonRef.handleFailedSave();
  930. // return new Toast(
  931. // "Thumbnail width and height must be less than 4000px."
  932. // );
  933. // }
  934. // if (thumbnailHeight - thumbnailWidth > 5) {
  935. // saveButtonRef.handleFailedSave();
  936. // return new Toast("Thumbnail cannot be taller than it is wide.");
  937. // }
  938. // Youtube Id
  939. if (
  940. this.youtubeError &&
  941. this.originalSong.youtubeId !== song.youtubeId
  942. ) {
  943. saveButtonRef.handleFailedSave();
  944. return new Toast(
  945. "You're not allowed to change the YouTube id while the player is not working"
  946. );
  947. }
  948. // Duration
  949. if (
  950. Number(song.skipDuration) + Number(song.duration) >
  951. this.youtubeVideoDuration &&
  952. (!this.youtubeError ||
  953. this.originalSong.duration !== song.duration)
  954. ) {
  955. saveButtonRef.handleFailedSave();
  956. return new Toast(
  957. "Duration can't be higher than the length of the video"
  958. );
  959. }
  960. // Title
  961. if (!validation.isLength(song.title, 1, 100)) {
  962. saveButtonRef.handleFailedSave();
  963. return new Toast(
  964. "Title must have between 1 and 100 characters."
  965. );
  966. }
  967. // Artists
  968. if (song.artists.length < 1 || song.artists.length > 10) {
  969. saveButtonRef.handleFailedSave();
  970. return new Toast(
  971. "Invalid artists. You must have at least 1 artist and a maximum of 10 artists."
  972. );
  973. }
  974. let error;
  975. song.artists.forEach(artist => {
  976. if (!validation.isLength(artist, 1, 64)) {
  977. error = "Artist must have between 1 and 64 characters.";
  978. return error;
  979. }
  980. if (artist === "NONE") {
  981. error =
  982. 'Invalid artist format. Artists are not allowed to be named "NONE".';
  983. return error;
  984. }
  985. return false;
  986. });
  987. if (error) {
  988. saveButtonRef.handleFailedSave();
  989. return new Toast(error);
  990. }
  991. // Genres
  992. error = undefined;
  993. song.genres.forEach(genre => {
  994. if (!validation.isLength(genre, 1, 32)) {
  995. error = "Genre must have between 1 and 32 characters.";
  996. return error;
  997. }
  998. if (!validation.regex.ascii.test(genre)) {
  999. error =
  1000. "Invalid genre format. Only ascii characters are allowed.";
  1001. return error;
  1002. }
  1003. return false;
  1004. });
  1005. if (song.genres.length < 1 || song.genres.length > 16)
  1006. error = "You must have between 1 and 16 genres.";
  1007. if (error) {
  1008. saveButtonRef.handleFailedSave();
  1009. return new Toast(error);
  1010. }
  1011. // Thumbnail
  1012. if (!validation.isLength(song.thumbnail, 1, 256)) {
  1013. saveButtonRef.handleFailedSave();
  1014. return new Toast(
  1015. "Thumbnail must have between 8 and 256 characters."
  1016. );
  1017. }
  1018. if (this.useHTTPS && song.thumbnail.indexOf("https://") !== 0) {
  1019. saveButtonRef.handleFailedSave();
  1020. return new Toast('Thumbnail must start with "https://".');
  1021. }
  1022. if (
  1023. !this.useHTTPS &&
  1024. song.thumbnail.indexOf("http://") !== 0 &&
  1025. song.thumbnail.indexOf("https://") !== 0
  1026. ) {
  1027. saveButtonRef.handleFailedSave();
  1028. return new Toast('Thumbnail must start with "http://".');
  1029. }
  1030. saveButtonRef.status = "disabled";
  1031. return this.socket.dispatch(`songs.update`, song._id, song, res => {
  1032. new Toast(res.message);
  1033. if (res.status === "success")
  1034. saveButtonRef.handleSuccessfulSave();
  1035. else saveButtonRef.handleFailedSave();
  1036. if (close) this.closeModal("editSong");
  1037. });
  1038. },
  1039. getAlbumData(type) {
  1040. if (!this.song.discogs) return;
  1041. if (type === "title")
  1042. this.updateSongField({
  1043. field: "title",
  1044. value: this.song.discogs.track.title
  1045. });
  1046. if (type === "albumArt")
  1047. this.updateSongField({
  1048. field: "thumbnail",
  1049. value: this.song.discogs.album.albumArt
  1050. });
  1051. if (type === "genres")
  1052. this.updateSongField({
  1053. field: "genres",
  1054. value: JSON.parse(
  1055. JSON.stringify(this.song.discogs.album.genres)
  1056. )
  1057. });
  1058. if (type === "artists")
  1059. this.updateSongField({
  1060. field: "artists",
  1061. value: JSON.parse(
  1062. JSON.stringify(this.song.discogs.album.artists)
  1063. )
  1064. });
  1065. },
  1066. fillDuration() {
  1067. this.song.duration =
  1068. this.youtubeVideoDuration - this.song.skipDuration;
  1069. },
  1070. blurArtistInput() {
  1071. this.artistInputFocussed = false;
  1072. },
  1073. focusArtistInput() {
  1074. this.artistInputFocussed = true;
  1075. },
  1076. blurArtistContainer() {
  1077. this.artistAutosuggestContainerFocussed = false;
  1078. },
  1079. focusArtistContainer() {
  1080. this.artistAutosuggestContainerFocussed = true;
  1081. },
  1082. keydownArtistInput() {
  1083. clearTimeout(this.keydownArtistInputTimeout);
  1084. this.keydownArtistInputTimeout = setTimeout(() => {
  1085. // Do things here to query the artist
  1086. }, 1000);
  1087. },
  1088. selectArtistAutosuggest(value) {
  1089. this.artistInputValue = value;
  1090. },
  1091. blurGenreInput() {
  1092. this.genreInputFocussed = false;
  1093. },
  1094. focusGenreInput() {
  1095. this.genreInputFocussed = true;
  1096. },
  1097. blurGenreContainer() {
  1098. this.genreAutosuggestContainerFocussed = false;
  1099. },
  1100. focusGenreContainer() {
  1101. this.genreAutosuggestContainerFocussed = true;
  1102. },
  1103. keydownGenreInput() {
  1104. clearTimeout(this.keydownGenreInputTimeout);
  1105. this.keydownGenreInputTimeout = setTimeout(() => {
  1106. if (this.genreInputValue.length > 1) {
  1107. this.genreAutosuggestItems = this.genres.filter(genre => {
  1108. return genre
  1109. .toLowerCase()
  1110. .startsWith(this.genreInputValue.toLowerCase());
  1111. });
  1112. } else this.genreAutosuggestItems = [];
  1113. }, 1000);
  1114. },
  1115. selectGenreAutosuggest(value) {
  1116. this.genreInputValue = value;
  1117. },
  1118. settings(type) {
  1119. switch (type) {
  1120. default:
  1121. break;
  1122. case "stop":
  1123. this.stopVideo();
  1124. this.pauseVideo(true);
  1125. break;
  1126. case "pause":
  1127. this.pauseVideo(true);
  1128. break;
  1129. case "play":
  1130. this.pauseVideo(false);
  1131. break;
  1132. case "skipToLast10Secs":
  1133. this.skipToLast10SecsPressed = true;
  1134. if (this.video.paused) this.pauseVideo(false);
  1135. this.video.player.seekTo(
  1136. this.song.duration - 10 + this.song.skipDuration
  1137. );
  1138. break;
  1139. }
  1140. },
  1141. play() {
  1142. if (
  1143. this.video.player.getVideoData().video_id !==
  1144. this.song.youtubeId
  1145. ) {
  1146. this.song.duration = -1;
  1147. this.loadVideoById(this.song.youtubeId, this.song.skipDuration);
  1148. }
  1149. this.settings("play");
  1150. },
  1151. changeVolume() {
  1152. const volume = this.volumeSliderValue;
  1153. localStorage.setItem("volume", volume / 100);
  1154. this.video.player.setVolume(volume / 100);
  1155. if (volume > 0) this.video.player.unMute();
  1156. },
  1157. addTag(type) {
  1158. if (type === "genres") {
  1159. const genre = this.genreInputValue.trim();
  1160. if (
  1161. this.song.genres
  1162. .map(genre => genre.toLowerCase())
  1163. .indexOf(genre.toLowerCase()) !== -1
  1164. )
  1165. return new Toast("Genre already exists");
  1166. if (genre) {
  1167. this.song.genres.push(genre);
  1168. this.genreInputValue = "";
  1169. return false;
  1170. }
  1171. return new Toast("Genre cannot be empty");
  1172. }
  1173. if (type === "artists") {
  1174. const artist = this.artistInputValue;
  1175. if (this.song.artists.indexOf(artist) !== -1)
  1176. return new Toast("Artist already exists");
  1177. if (artist !== "") {
  1178. this.song.artists.push(artist);
  1179. this.artistInputValue = "";
  1180. return false;
  1181. }
  1182. return new Toast("Artist cannot be empty");
  1183. }
  1184. return false;
  1185. },
  1186. removeTag(type, value) {
  1187. if (type === "genres")
  1188. this.song.genres.splice(this.song.genres.indexOf(value), 1);
  1189. else if (type === "artists")
  1190. this.song.artists.splice(this.song.artists.indexOf(value), 1);
  1191. },
  1192. drawCanvas() {
  1193. const canvasElement = this.$refs.durationCanvas;
  1194. const ctx = canvasElement.getContext("2d");
  1195. const videoDuration = Number(this.youtubeVideoDuration);
  1196. const skipDuration = Number(this.song.skipDuration);
  1197. const duration = Number(this.song.duration);
  1198. const afterDuration = videoDuration - (skipDuration + duration);
  1199. const width = 530;
  1200. const currentTime =
  1201. this.video.player && this.video.player.getCurrentTime
  1202. ? this.video.player.getCurrentTime()
  1203. : 0;
  1204. const widthSkipDuration = (skipDuration / videoDuration) * width;
  1205. const widthDuration = (duration / videoDuration) * width;
  1206. const widthAfterDuration = (afterDuration / videoDuration) * width;
  1207. const widthCurrentTime = (currentTime / videoDuration) * width;
  1208. const skipDurationColor = "#F42003";
  1209. const durationColor = "#03A9F4";
  1210. const afterDurationColor = "#41E841";
  1211. const currentDurationColor = "#3b25e8";
  1212. ctx.fillStyle = skipDurationColor;
  1213. ctx.fillRect(0, 0, widthSkipDuration, 20);
  1214. ctx.fillStyle = durationColor;
  1215. ctx.fillRect(widthSkipDuration, 0, widthDuration, 20);
  1216. ctx.fillStyle = afterDurationColor;
  1217. ctx.fillRect(
  1218. widthSkipDuration + widthDuration,
  1219. 0,
  1220. widthAfterDuration,
  1221. 20
  1222. );
  1223. ctx.fillStyle = currentDurationColor;
  1224. ctx.fillRect(widthCurrentTime, 0, 1, 20);
  1225. },
  1226. toggleGenreHelper() {
  1227. this.$refs.genreHelper.toggleBox();
  1228. },
  1229. resetGenreHelper() {
  1230. this.$refs.genreHelper.resetBox();
  1231. },
  1232. sendActivityWatchVideoData() {
  1233. if (!this.video.paused) {
  1234. if (this.activityWatchVideoLastStatus !== "playing") {
  1235. this.activityWatchVideoLastStatus = "playing";
  1236. if (
  1237. this.song.skipDuration > 0 &&
  1238. parseFloat(this.youtubeVideoCurrentTime) === 0
  1239. ) {
  1240. this.activityWatchVideoLastStartDuration = Math.floor(
  1241. this.song.skipDuration +
  1242. parseFloat(this.youtubeVideoCurrentTime)
  1243. );
  1244. } else {
  1245. this.activityWatchVideoLastStartDuration = Math.floor(
  1246. parseFloat(this.youtubeVideoCurrentTime)
  1247. );
  1248. }
  1249. }
  1250. const videoData = {
  1251. title: this.song.title,
  1252. artists: this.song.artists
  1253. ? this.song.artists.join(", ")
  1254. : null,
  1255. youtubeId: this.song.youtubeId,
  1256. muted: this.muted,
  1257. volume: this.volumeSliderValue / 100,
  1258. startedDuration:
  1259. this.activityWatchVideoLastStartDuration <= 0
  1260. ? 0
  1261. : this.activityWatchVideoLastStartDuration,
  1262. source: `editSong#${this.song.youtubeId}`,
  1263. hostname: window.location.hostname
  1264. };
  1265. aw.sendVideoData(videoData);
  1266. } else {
  1267. this.activityWatchVideoLastStatus = "not_playing";
  1268. }
  1269. },
  1270. verify(id) {
  1271. this.socket.dispatch("songs.verify", id, res => {
  1272. new Toast(res.message);
  1273. });
  1274. },
  1275. unverify(id) {
  1276. this.socket.dispatch("songs.unverify", id, res => {
  1277. new Toast(res.message);
  1278. });
  1279. },
  1280. hide(id) {
  1281. this.socket.dispatch("songs.hide", id, res => {
  1282. new Toast(res.message);
  1283. });
  1284. },
  1285. unhide(id) {
  1286. this.socket.dispatch("songs.unhide", id, res => {
  1287. new Toast(res.message);
  1288. });
  1289. },
  1290. // remove(id) {
  1291. // this.socket.dispatch("songs.remove", id, res => {
  1292. // new Toast(res.message);
  1293. // });
  1294. // },
  1295. ...mapActions({
  1296. showTab(dispatch, payload) {
  1297. this.$refs[`${payload}-tab`].scrollIntoView();
  1298. return dispatch("modals/editSong/showTab", payload);
  1299. }
  1300. }),
  1301. ...mapActions("modals/editSong", [
  1302. "stopVideo",
  1303. "loadVideoById",
  1304. "pauseVideo",
  1305. "getCurrentTime",
  1306. "editSong",
  1307. "updateSongField"
  1308. ]),
  1309. ...mapActions("modalVisibility", ["closeModal"])
  1310. }
  1311. };
  1312. </script>
  1313. <style lang="scss">
  1314. .song-modal {
  1315. .modal-card-title {
  1316. text-align: center;
  1317. margin-left: 24px;
  1318. }
  1319. .modal-card {
  1320. width: 1160px;
  1321. height: 100%;
  1322. .modal-card-body {
  1323. padding: 16px;
  1324. }
  1325. .modal-card-foot {
  1326. .right {
  1327. display: flex;
  1328. margin-left: auto;
  1329. margin-right: 0;
  1330. }
  1331. }
  1332. }
  1333. }
  1334. </style>
  1335. <style lang="scss" scoped>
  1336. .night-mode {
  1337. .edit-section,
  1338. .api-section,
  1339. .api-result,
  1340. .player-footer {
  1341. background-color: var(--dark-grey-3) !important;
  1342. }
  1343. .api-result .tracks .track:hover,
  1344. .selected-discogs-info {
  1345. background-color: var(--dark-grey-2) !important;
  1346. }
  1347. .label,
  1348. p,
  1349. strong {
  1350. color: var(--light-grey-2);
  1351. }
  1352. }
  1353. .modal-card-body > div {
  1354. display: flex;
  1355. height: 100%;
  1356. }
  1357. .left-section {
  1358. display: flex;
  1359. flex-direction: column;
  1360. margin-right: 16px;
  1361. .top-section {
  1362. display: flex;
  1363. .player-section {
  1364. width: 530px;
  1365. display: flex;
  1366. flex-direction: column;
  1367. .player-error {
  1368. height: 318px;
  1369. width: 530px;
  1370. display: block;
  1371. border: 1px rgba(163, 224, 255, 0.75) solid;
  1372. border-radius: 5px 5px 0px 0px;
  1373. display: flex;
  1374. align-items: center;
  1375. * {
  1376. margin: 0;
  1377. flex: 1;
  1378. font-size: 30px;
  1379. text-align: center;
  1380. }
  1381. }
  1382. .player-footer {
  1383. background-color: var(--light-grey);
  1384. border: 1px rgba(163, 224, 255, 0.75) solid;
  1385. border-radius: 0px 0px 5px 5px;
  1386. display: flex;
  1387. justify-content: space-between;
  1388. height: 54px;
  1389. > * {
  1390. width: 33.3%;
  1391. display: flex;
  1392. align-items: center;
  1393. }
  1394. .player-footer-left {
  1395. flex: 1;
  1396. .material-icons {
  1397. font-size: 38px;
  1398. cursor: pointer;
  1399. }
  1400. .player-play-pause {
  1401. color: var(--primary-color);
  1402. }
  1403. .player-stop {
  1404. color: var(--red);
  1405. }
  1406. .player-fast-forward {
  1407. color: var(--green);
  1408. }
  1409. }
  1410. .player-footer-center {
  1411. justify-content: center;
  1412. align-items: center;
  1413. flex: 2;
  1414. font-size: 21px;
  1415. font-weight: 400;
  1416. img {
  1417. height: 21px;
  1418. margin-right: 12px;
  1419. filter: invert(26%) sepia(54%) saturate(6317%)
  1420. hue-rotate(2deg) brightness(92%) contrast(115%);
  1421. }
  1422. }
  1423. .player-footer-right {
  1424. justify-content: right;
  1425. flex: 1;
  1426. #volumeSlider {
  1427. width: 126px;
  1428. margin-right: 10px;
  1429. background-color: var(--light-grey);
  1430. }
  1431. }
  1432. }
  1433. }
  1434. .thumbnail-preview {
  1435. width: 189px;
  1436. height: 189px;
  1437. margin-left: 16px;
  1438. }
  1439. }
  1440. .edit-section {
  1441. width: 735px;
  1442. background-color: var(--light-grey);
  1443. border: 1px rgba(163, 224, 255, 0.75) solid;
  1444. margin-top: 16px;
  1445. flex: 1;
  1446. overflow: auto;
  1447. border-radius: 5px;
  1448. .album-get-button {
  1449. background-color: var(--purple);
  1450. color: var(--white);
  1451. width: 32px;
  1452. text-align: center;
  1453. border-width: 0;
  1454. }
  1455. .duration-fill-button {
  1456. background-color: var(--red);
  1457. color: var(--white);
  1458. width: 32px;
  1459. text-align: center;
  1460. border-width: 0;
  1461. }
  1462. .add-button {
  1463. background-color: var(--primary-color) !important;
  1464. width: 32px;
  1465. i {
  1466. font-size: 32px;
  1467. }
  1468. }
  1469. .album-get-button,
  1470. .duration-fill-button,
  1471. .add-button {
  1472. &:focus,
  1473. &:hover {
  1474. filter: contrast(0.75);
  1475. border: 1px solid var(--black) !important;
  1476. }
  1477. }
  1478. > div {
  1479. margin: 16px;
  1480. }
  1481. input {
  1482. width: 100%;
  1483. }
  1484. .title-container {
  1485. width: calc((100% - 32px) / 2);
  1486. }
  1487. .duration-container {
  1488. margin-right: 16px;
  1489. margin-left: 16px;
  1490. width: calc((100% - 32px) / 4);
  1491. }
  1492. .skip-duration-container {
  1493. width: calc((100% - 32px) / 4);
  1494. }
  1495. .album-art-container {
  1496. width: 100%;
  1497. }
  1498. .artists-container {
  1499. width: calc((100% - 32px) / 3);
  1500. position: relative;
  1501. }
  1502. .genres-container {
  1503. width: calc((100% - 32px) / 3);
  1504. margin-left: 16px;
  1505. margin-right: 16px;
  1506. position: relative;
  1507. label {
  1508. display: flex;
  1509. i {
  1510. font-size: 15px;
  1511. align-self: center;
  1512. margin-left: 5px;
  1513. color: var(--primary-color);
  1514. cursor: pointer;
  1515. -webkit-user-select: none;
  1516. -moz-user-select: none;
  1517. -ms-user-select: none;
  1518. user-select: none;
  1519. }
  1520. }
  1521. }
  1522. .youtube-id-container {
  1523. width: calc((100% - 32px) / 3);
  1524. }
  1525. .list-item-circle {
  1526. background-color: var(--primary-color);
  1527. width: 16px;
  1528. height: 16px;
  1529. border-radius: 8px;
  1530. cursor: pointer;
  1531. margin-right: 8px;
  1532. float: left;
  1533. -webkit-touch-callout: none;
  1534. -webkit-user-select: none;
  1535. -khtml-user-select: none;
  1536. -moz-user-select: none;
  1537. -ms-user-select: none;
  1538. user-select: none;
  1539. i {
  1540. color: var(--primary-color);
  1541. font-size: 14px;
  1542. margin-left: 1px;
  1543. }
  1544. }
  1545. .list-item-circle:hover,
  1546. .list-item-circle:focus {
  1547. i {
  1548. color: var(--white);
  1549. }
  1550. }
  1551. .list-item > p {
  1552. line-height: 16px;
  1553. word-wrap: break-word;
  1554. width: calc(100% - 24px);
  1555. left: 24px;
  1556. float: left;
  1557. margin-bottom: 8px;
  1558. }
  1559. .list-item:last-child > p {
  1560. margin-bottom: 0;
  1561. }
  1562. .autosuggest-container {
  1563. position: absolute;
  1564. background: var(--white);
  1565. width: calc(100% + 1px);
  1566. top: 57px;
  1567. z-index: 200;
  1568. overflow: auto;
  1569. max-height: 100%;
  1570. clear: both;
  1571. .autosuggest-item {
  1572. padding: 8px;
  1573. display: block;
  1574. border: 1px solid var(--light-grey-2);
  1575. margin-top: -1px;
  1576. line-height: 16px;
  1577. cursor: pointer;
  1578. -webkit-user-select: none;
  1579. -ms-user-select: none;
  1580. -moz-user-select: none;
  1581. user-select: none;
  1582. }
  1583. .autosuggest-item:hover,
  1584. .autosuggest-item:focus {
  1585. background-color: var(--light-grey);
  1586. }
  1587. .autosuggest-item:first-child {
  1588. border-top: none;
  1589. }
  1590. .autosuggest-item:last-child {
  1591. border-radius: 0 0 3px 3px;
  1592. }
  1593. }
  1594. }
  1595. }
  1596. .right-section {
  1597. display: flex;
  1598. flex-wrap: wrap;
  1599. #tabs-container {
  1600. width: 376px;
  1601. background-color: var(--light-grey);
  1602. border: 1px rgba(163, 224, 255, 0.75) solid;
  1603. border-radius: 5px;
  1604. // padding: 16px;
  1605. overflow: auto;
  1606. height: 100%;
  1607. #tab-selection {
  1608. display: flex;
  1609. overflow-x: auto;
  1610. .button {
  1611. border-radius: 5px 5px 0 0;
  1612. border: 0;
  1613. text-transform: uppercase;
  1614. font-size: 14px;
  1615. color: var(--dark-grey-3);
  1616. background-color: var(--light-grey-2);
  1617. flex-grow: 1;
  1618. height: 32px;
  1619. &:not(:first-of-type) {
  1620. margin-left: 5px;
  1621. }
  1622. }
  1623. .selected {
  1624. background-color: var(--primary-color) !important;
  1625. color: var(--white) !important;
  1626. font-weight: 600;
  1627. }
  1628. }
  1629. .tab {
  1630. // border: 1px solid var(--light-grey-3);
  1631. padding: 15px;
  1632. // border-radius: 0 0 5px 5px;
  1633. }
  1634. }
  1635. // .api-section {
  1636. // width: 376px;
  1637. // background-color: var(--light-grey);
  1638. // border: 1px rgba(163, 224, 255, 0.75) solid;
  1639. // border-radius: 5px;
  1640. // padding: 16px;
  1641. // overflow: auto;
  1642. // height: 100%;
  1643. // > label {
  1644. // margin-top: 12px;
  1645. // }
  1646. // .top-container {
  1647. // display: flex;
  1648. // img {
  1649. // height: 85px;
  1650. // width: 85px;
  1651. // }
  1652. // .right-container {
  1653. // padding: 8px;
  1654. // display: flex;
  1655. // flex-direction: column;
  1656. // flex: 1;
  1657. // .album-title {
  1658. // flex: 1;
  1659. // font-weight: 600;
  1660. // }
  1661. // .bottom-row {
  1662. // display: flex;
  1663. // flex-flow: row;
  1664. // line-height: 15px;
  1665. // img {
  1666. // height: 15px;
  1667. // align-self: end;
  1668. // flex: 1;
  1669. // user-select: none;
  1670. // -moz-user-select: none;
  1671. // -ms-user-select: none;
  1672. // -webkit-user-select: none;
  1673. // cursor: pointer;
  1674. // }
  1675. // p {
  1676. // text-align: right;
  1677. // }
  1678. // .type-year {
  1679. // font-size: 13px;
  1680. // align-self: end;
  1681. // }
  1682. // }
  1683. // }
  1684. // }
  1685. // .bottom-container {
  1686. // padding: 12px;
  1687. // .bottom-container-field {
  1688. // line-height: 16px;
  1689. // margin-bottom: 8px;
  1690. // font-weight: 600;
  1691. // span {
  1692. // font-weight: 400;
  1693. // }
  1694. // }
  1695. // .bottom-container-field:last-of-type {
  1696. // margin-bottom: 0;
  1697. // }
  1698. // }
  1699. // .selected-discogs-info {
  1700. // background-color: var(--white);
  1701. // border: 1px solid var(--purple);
  1702. // border-radius: 5px;
  1703. // margin-bottom: 16px;
  1704. // .selected-discogs-info-none {
  1705. // font-size: 18px;
  1706. // text-align: center;
  1707. // }
  1708. // .bottom-row > p {
  1709. // flex: 1;
  1710. // }
  1711. // }
  1712. // .api-result {
  1713. // background-color: var(--white);
  1714. // border: 0.5px solid var(--primary-color);
  1715. // border-radius: 5px;
  1716. // margin-bottom: 16px;
  1717. // }
  1718. // button {
  1719. // background-color: var(--primary-color) !important;
  1720. // &:focus,
  1721. // &:hover {
  1722. // filter: contrast(0.75);
  1723. // }
  1724. // }
  1725. // .tracks {
  1726. // margin-top: 12px;
  1727. // .track:first-child {
  1728. // margin-top: 0;
  1729. // border-radius: 3px 3px 0 0;
  1730. // }
  1731. // .track:last-child {
  1732. // border-radius: 0 0 3px 3px;
  1733. // }
  1734. // .track {
  1735. // border: 0.5px solid var(--black);
  1736. // margin-top: -1px;
  1737. // line-height: 16px;
  1738. // display: flex;
  1739. // cursor: pointer;
  1740. // span {
  1741. // font-weight: 600;
  1742. // display: inline-block;
  1743. // margin-top: 7px;
  1744. // margin-bottom: 7px;
  1745. // margin-left: 7px;
  1746. // }
  1747. // p {
  1748. // display: inline-block;
  1749. // margin: 7px;
  1750. // flex: 1;
  1751. // }
  1752. // }
  1753. // .track:hover,
  1754. // .track:focus {
  1755. // background-color: var(--light-grey);
  1756. // }
  1757. // }
  1758. // .discogs-load-more {
  1759. // margin-bottom: 8px;
  1760. // }
  1761. // }
  1762. }
  1763. .modal-card-foot .is-primary {
  1764. width: 200px;
  1765. }
  1766. input[type="range"] {
  1767. -webkit-appearance: none;
  1768. width: 100%;
  1769. margin: 8.5px 0;
  1770. }
  1771. input[type="range"]:focus {
  1772. outline-style: outset;
  1773. }
  1774. input[type="range"]::-webkit-slider-runnable-track {
  1775. width: 100%;
  1776. height: 3px;
  1777. cursor: pointer;
  1778. box-shadow: none;
  1779. background: var(--grey-3);
  1780. border-radius: none;
  1781. border: none;
  1782. }
  1783. input[type="range"]::-webkit-slider-thumb {
  1784. box-shadow: none;
  1785. border: none;
  1786. height: 20px;
  1787. width: 20px;
  1788. border-radius: 100px;
  1789. background: var(--primary-color);
  1790. cursor: pointer;
  1791. -webkit-appearance: none;
  1792. margin-top: -8.5px;
  1793. }
  1794. input[type="range"]:focus::-webkit-slider-runnable-track {
  1795. background: var(--grey-3);
  1796. }
  1797. input[type="range"]::-moz-range-track {
  1798. width: 100%;
  1799. height: 3px;
  1800. cursor: pointer;
  1801. box-shadow: none;
  1802. background: var(--grey-3);
  1803. border-radius: none;
  1804. border: none;
  1805. }
  1806. input[type="range"]::-moz-range-thumb {
  1807. box-shadow: none;
  1808. border: none;
  1809. height: 20px;
  1810. width: 20px;
  1811. border-radius: 100px;
  1812. background: var(--primary-color);
  1813. cursor: pointer;
  1814. }
  1815. input[type="range"]::-ms-track {
  1816. width: 100%;
  1817. height: 3px;
  1818. cursor: pointer;
  1819. background: transparent;
  1820. border-color: transparent;
  1821. color: transparent;
  1822. }
  1823. input[type="range"]::-ms-fill-lower {
  1824. background: var(--grey-2);
  1825. border: none;
  1826. border-radius: none;
  1827. box-shadow: none;
  1828. }
  1829. input[type="range"]::-ms-fill-upper {
  1830. background: var(--grey-3);
  1831. border: none;
  1832. border-radius: none;
  1833. box-shadow: none;
  1834. }
  1835. input[type="range"]::-ms-thumb {
  1836. box-shadow: none;
  1837. border: none;
  1838. height: 20px;
  1839. width: 20px;
  1840. border-radius: 100px;
  1841. background: var(--primary-color);
  1842. cursor: pointer;
  1843. height: 3px;
  1844. }
  1845. input[type="range"]:focus::-ms-fill-lower {
  1846. background: var(--grey-3);
  1847. }
  1848. input[type="range"]:focus::-ms-fill-upper {
  1849. background: var(--grey-3);
  1850. }
  1851. </style>