EditSong.vue 45 KB

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