EditSong.vue 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969
  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" class="footer-buttons">
  472. <button class="button is-success" @click="save(song, false)">
  473. <i class="material-icons save-changes">done</i>
  474. <span>&nbsp;Save</span>
  475. </button>
  476. <button class="button is-success" @click="save(song, true)">
  477. <i class="material-icons save-changes">done</i>
  478. <span>&nbsp;Save and close</span>
  479. </button>
  480. <button
  481. class="button is-danger"
  482. @click="closeModal({ sector: sector, modal: 'editSong' })"
  483. >
  484. <span>&nbsp;Close</span>
  485. </button>
  486. </div>
  487. </modal>
  488. <floating-box id="genreHelper" ref="genreHelper">
  489. <template #body>
  490. <span>Blues</span><span>Country</span><span>Disco</span
  491. ><span>Funk</span><span>Hip-Hop</span><span>Jazz</span
  492. ><span>Metal</span><span>Oldies</span><span>Other</span
  493. ><span>Pop</span><span>Rap</span><span>Reggae</span
  494. ><span>Rock</span><span>Techno</span><span>Trance</span
  495. ><span>Classical</span><span>Instrumental</span
  496. ><span>House</span><span>Electronic</span
  497. ><span>Christian Rap</span><span>Lo-Fi</span><span>Musical</span
  498. ><span>Rock 'n' Roll</span><span>Opera</span
  499. ><span>Drum & Bass</span><span>Club-House</span
  500. ><span>Indie</span><span>Heavy Metal</span
  501. ><span>Christian rock</span><span>Dubstep</span>
  502. </template>
  503. </floating-box>
  504. </div>
  505. </template>
  506. <script>
  507. import { mapState, mapActions } from "vuex";
  508. import Toast from "toasters";
  509. import io from "../../io";
  510. import keyboardShortcuts from "../../keyboardShortcuts";
  511. import validation from "../../validation";
  512. import Modal from "../Modal.vue";
  513. import FloatingBox from "../ui/FloatingBox.vue";
  514. export default {
  515. components: { Modal, FloatingBox },
  516. props: {
  517. songId: { type: String, default: null },
  518. songType: { type: String, default: null },
  519. sector: { type: String, default: "admin" }
  520. },
  521. data() {
  522. return {
  523. songDataLoaded: false,
  524. focusedElementBefore: null,
  525. discogsQuery: "",
  526. youtubeVideoDuration: 0.0,
  527. youtubeVideoCurrentTime: 0.0,
  528. youtubeVideoNote: "",
  529. useHTTPS: false,
  530. discogs: {
  531. apiResults: [],
  532. page: 1,
  533. pages: 1,
  534. disableLoadMore: false
  535. },
  536. volumeSliderValue: 0,
  537. artistInputValue: "",
  538. genreInputValue: "",
  539. artistInputFocussed: false,
  540. genreInputFocussed: false,
  541. genreAutosuggestContainerFocussed: false,
  542. artistAutosuggestContainerFocussed: false,
  543. keydownArtistInputTimeout: 0,
  544. keydownGenreInputTimeout: 0,
  545. artistAutosuggestItems: [],
  546. genreAutosuggestItems: [],
  547. genres: [
  548. "Blues",
  549. "Country",
  550. "Disco",
  551. "Funk",
  552. "Hip-Hop",
  553. "Jazz",
  554. "Metal",
  555. "Oldies",
  556. "Other",
  557. "Pop",
  558. "Rap",
  559. "Reggae",
  560. "Rock",
  561. "Techno",
  562. "Trance",
  563. "Classical",
  564. "Instrumental",
  565. "House",
  566. "Electronic",
  567. "Christian Rap",
  568. "Lo-Fi",
  569. "Musical",
  570. "Rock 'n' Roll",
  571. "Opera",
  572. "Drum & Bass",
  573. "Club-House",
  574. "Indie",
  575. "Heavy Metal",
  576. "Christian rock",
  577. "Dubstep"
  578. ]
  579. };
  580. },
  581. computed: {
  582. ...mapState("modals/editSong", {
  583. video: state => state.video,
  584. song: state => state.song
  585. }),
  586. ...mapState("modalVisibility", {
  587. modals: state => state.modals.admin
  588. })
  589. },
  590. watch: {
  591. /* eslint-disable */
  592. "song.duration": function () {
  593. this.drawCanvas();
  594. },
  595. "song.skipDuration": function () {
  596. this.drawCanvas();
  597. }
  598. /* eslint-enable */
  599. },
  600. async mounted() {
  601. // if (this.modals.editSong = false) this.video.player.stopVideo();
  602. // this.loadVideoById(
  603. // this.song.songId,
  604. // this.song.skipDuration
  605. // );
  606. this.useHTTPS = await lofig.get("cookie.secure");
  607. io.getSocket(socket => {
  608. this.socket = socket;
  609. this.socket.emit(
  610. `${this.songType}.getSongFromMusareId`,
  611. this.songId,
  612. res => {
  613. if (res.status === "success") {
  614. const { song } = res.data;
  615. // this.song = { ...song };
  616. // if (this.song.discogs === undefined)
  617. // this.song.discogs = null;
  618. this.editSong(song);
  619. this.songDataLoaded = true;
  620. // this.edit(res.data.song);
  621. this.discogsQuery = this.song.title;
  622. this.interval = setInterval(() => {
  623. if (
  624. this.song.duration !== -1 &&
  625. this.video.paused === false &&
  626. this.playerReady &&
  627. this.video.player.getCurrentTime() -
  628. this.song.skipDuration >
  629. this.song.duration
  630. ) {
  631. this.video.paused = false;
  632. this.video.player.stopVideo();
  633. this.drawCanvas();
  634. }
  635. if (this.playerReady) {
  636. this.youtubeVideoCurrentTime = this.video.player
  637. .getCurrentTime()
  638. .toFixed(3);
  639. }
  640. if (this.video.paused === false) this.drawCanvas();
  641. }, 200);
  642. this.video.player = new window.YT.Player(
  643. "editSongPlayer",
  644. {
  645. height: 298,
  646. width: 530,
  647. videoId: this.song.songId,
  648. host: "https://www.youtube-nocookie.com",
  649. playerVars: {
  650. controls: 0,
  651. iv_load_policy: 3,
  652. rel: 0,
  653. showinfo: 0,
  654. autoplay: 1
  655. },
  656. startSeconds: this.song.skipDuration,
  657. events: {
  658. onReady: () => {
  659. let volume = parseInt(
  660. localStorage.getItem("volume")
  661. );
  662. volume =
  663. typeof volume === "number"
  664. ? volume
  665. : 20;
  666. console.log(
  667. `Seekto: ${this.song.skipDuration}`
  668. );
  669. this.video.player.seekTo(
  670. this.song.skipDuration
  671. );
  672. this.video.player.setVolume(volume);
  673. if (volume > 0)
  674. this.video.player.unMute();
  675. this.youtubeVideoDuration = this.video.player
  676. .getDuration()
  677. .toFixed(3);
  678. this.youtubeVideoNote = "(~)";
  679. this.playerReady = true;
  680. this.drawCanvas();
  681. },
  682. onStateChange: event => {
  683. this.drawCanvas();
  684. if (event.data === 1) {
  685. if (!this.video.autoPlayed) {
  686. this.video.autoPlayed = true;
  687. return this.video.player.stopVideo();
  688. }
  689. this.video.paused = false;
  690. let youtubeDuration = this.video.player.getDuration();
  691. this.youtubeVideoDuration = youtubeDuration.toFixed(
  692. 3
  693. );
  694. this.youtubeVideoNote = "";
  695. if (this.song.duration === -1)
  696. this.song.duration = youtubeDuration;
  697. youtubeDuration -= this.song
  698. .skipDuration;
  699. if (
  700. this.song.duration >
  701. youtubeDuration + 1
  702. ) {
  703. this.video.player.stopVideo();
  704. this.video.paused = true;
  705. return new Toast({
  706. content:
  707. "Video can't play. Specified duration is bigger than the YouTube song duration.",
  708. timeout: 4000
  709. });
  710. }
  711. if (this.song.duration <= 0) {
  712. this.video.player.stopVideo();
  713. this.video.paused = true;
  714. return new Toast({
  715. content:
  716. "Video can't play. Specified duration has to be more than 0 seconds.",
  717. timeout: 4000
  718. });
  719. }
  720. if (
  721. this.video.player.getCurrentTime() <
  722. this.song.skipDuration
  723. ) {
  724. return this.video.player.seekTo(
  725. this.song.skipDuration
  726. );
  727. }
  728. } else if (event.data === 2) {
  729. this.video.paused = true;
  730. }
  731. return false;
  732. }
  733. }
  734. }
  735. );
  736. } else {
  737. new Toast({
  738. content: "Song with that ID not found",
  739. timeout: 3000
  740. });
  741. this.closeModal({
  742. sector: this.sector,
  743. modal: "editSong"
  744. });
  745. }
  746. }
  747. );
  748. });
  749. let volume = parseFloat(localStorage.getItem("volume"));
  750. volume =
  751. typeof volume === "number" && !Number.isNaN(volume) ? volume : 20;
  752. localStorage.setItem("volume", volume);
  753. this.volumeSliderValue = volume * 100;
  754. keyboardShortcuts.registerShortcut("editSong.pauseResumeVideo", {
  755. keyCode: 101,
  756. preventDefault: true,
  757. handler: () => {
  758. if (this.video.paused) this.settings("play");
  759. else this.settings("pause");
  760. }
  761. });
  762. keyboardShortcuts.registerShortcut("editSong.stopVideo", {
  763. keyCode: 101,
  764. ctrl: true,
  765. preventDefault: true,
  766. handler: () => {
  767. this.settings("stop");
  768. }
  769. });
  770. keyboardShortcuts.registerShortcut("editSong.skipToLast10Secs", {
  771. keyCode: 102,
  772. preventDefault: true,
  773. handler: () => {
  774. this.settings("skipToLast10Secs");
  775. }
  776. });
  777. keyboardShortcuts.registerShortcut("editSong.lowerVolumeLarge", {
  778. keyCode: 98,
  779. preventDefault: true,
  780. handler: () => {
  781. this.volumeSliderValue = Math.max(
  782. 0,
  783. this.volumeSliderValue - 1000
  784. );
  785. this.changeVolume();
  786. }
  787. });
  788. keyboardShortcuts.registerShortcut("editSong.lowerVolumeSmall", {
  789. keyCode: 98,
  790. ctrl: true,
  791. preventDefault: true,
  792. handler: () => {
  793. this.volumeSliderValue = Math.max(
  794. 0,
  795. this.volumeSliderValue - 100
  796. );
  797. this.changeVolume();
  798. }
  799. });
  800. keyboardShortcuts.registerShortcut("editSong.increaseVolumeLarge", {
  801. keyCode: 104,
  802. preventDefault: true,
  803. handler: () => {
  804. this.volumeSliderValue = Math.min(
  805. 10000,
  806. this.volumeSliderValue + 1000
  807. );
  808. this.changeVolume();
  809. }
  810. });
  811. keyboardShortcuts.registerShortcut("editSong.increaseVolumeSmall", {
  812. keyCode: 104,
  813. ctrl: true,
  814. preventDefault: true,
  815. handler: () => {
  816. this.volumeSliderValue = Math.min(
  817. 10000,
  818. this.volumeSliderValue + 100
  819. );
  820. this.changeVolume();
  821. }
  822. });
  823. keyboardShortcuts.registerShortcut("editSong.save", {
  824. keyCode: 83,
  825. ctrl: true,
  826. preventDefault: true,
  827. handler: () => {
  828. this.save(this.song, false);
  829. }
  830. });
  831. keyboardShortcuts.registerShortcut("editSong.close", {
  832. keyCode: 88,
  833. ctrl: true,
  834. preventDefault: true,
  835. handler: () => {
  836. this.closeModal({
  837. sector: this.sector,
  838. modal: "editSong"
  839. });
  840. setTimeout(() => {
  841. window.focusedElementBefore.focus();
  842. }, 500);
  843. }
  844. });
  845. keyboardShortcuts.registerShortcut("editSong.focusTitle", {
  846. keyCode: 36,
  847. preventDefault: true,
  848. handler: () => {
  849. document.getElementById("title-input").focus();
  850. }
  851. });
  852. keyboardShortcuts.registerShortcut("editSong.focusDiscogs", {
  853. keyCode: 35,
  854. preventDefault: true,
  855. handler: () => {
  856. document.getElementById("discogs-input").focus();
  857. }
  858. });
  859. keyboardShortcuts.registerShortcut("editSong.useAllDiscogs", {
  860. keyCode: 68,
  861. alt: true,
  862. ctrl: true,
  863. preventDefault: true,
  864. handler: () => {
  865. this.getAlbumData("title");
  866. this.getAlbumData("albumArt");
  867. this.getAlbumData("artists");
  868. this.getAlbumData("genres");
  869. }
  870. });
  871. keyboardShortcuts.registerShortcut("editSong.resetDuration", {
  872. keyCode: 82,
  873. alt: true,
  874. ctrl: true,
  875. preventDefault: true,
  876. handler: () => {
  877. this.fillDuration();
  878. }
  879. });
  880. /*
  881. editSong.pauseResume - Num 5 - Pause/resume song
  882. editSong.stopVideo - Ctrl - Num 5 - Stop
  883. editSong.skipToLast10Secs - Num 6 - Skip to last 10 seconds
  884. editSong.volumeDown5 - Num 2 - Volume down by 10
  885. editSong.volumeDown1 - Ctrl - Num 2 - Volume down by 1
  886. editSong.volumeUp5 - Num 8 - Volume up by 10
  887. editSong.volumeUp1 - Ctrl - Num 8 - Volume up by 1
  888. editSong.focusTitle - Home - Focus the title input
  889. editSong.focusDicogs - End - Focus the discogs input
  890. editSong.save - Ctrl - S - Saves song
  891. editSong.close - Ctrl - X - Closes modal
  892. editSong.useAllDiscogs - Ctrl - Alt - D - Sets all fields to the Discogs data
  893. editSong.resetDuration - Ctrl - Alt - R - Resets the duration
  894. Inside Discogs inputs: Ctrl - D - Sets this field to the Discogs data
  895. */
  896. },
  897. beforeDestroy() {
  898. this.playerReady = false;
  899. clearInterval(this.interval);
  900. const shortcutNames = [
  901. "editSong.pauseResume",
  902. "editSong.stopVideo",
  903. "editSong.skipToLast10Secs",
  904. "editSong.volumeDown5",
  905. "editSong.volumeDown1",
  906. "editSong.volumeUp5",
  907. "editSong.volumeUp1",
  908. "editSong.focusTitle",
  909. "editSong.focusDicogs",
  910. "editSong.save",
  911. "editSong.close",
  912. "editSong.useAllDiscogs",
  913. "editSong.resetDuration"
  914. ];
  915. shortcutNames.forEach(shortcutName => {
  916. keyboardShortcuts.unregisterShortcut(shortcutName);
  917. });
  918. },
  919. methods: {
  920. save(songToCopy, close) {
  921. const song = JSON.parse(JSON.stringify(songToCopy));
  922. if (!song.title)
  923. return new Toast({
  924. content: "Please fill in all fields",
  925. timeout: 8000
  926. });
  927. if (!song.thumbnail)
  928. return new Toast({
  929. content: "Please fill in all fields",
  930. timeout: 8000
  931. });
  932. // Duration
  933. if (
  934. Number(song.skipDuration) + Number(song.duration) >
  935. this.youtubeVideoDuration
  936. ) {
  937. return new Toast({
  938. content:
  939. "Duration can't be higher than the length of the video",
  940. timeout: 8000
  941. });
  942. }
  943. // Title
  944. if (!validation.isLength(song.title, 1, 100))
  945. return new Toast({
  946. content: "Title must have between 1 and 100 characters.",
  947. timeout: 8000
  948. });
  949. // Artists
  950. if (song.artists.length < 1 || song.artists.length > 10)
  951. return new Toast({
  952. content:
  953. "Invalid artists. You must have at least 1 artist and a maximum of 10 artists.",
  954. timeout: 8000
  955. });
  956. let error;
  957. song.artists.forEach(artist => {
  958. if (!validation.isLength(artist, 1, 64)) {
  959. error = "Artist must have between 1 and 64 characters.";
  960. return error;
  961. }
  962. if (artist === "NONE") {
  963. error =
  964. 'Invalid artist format. Artists are not allowed to be named "NONE".';
  965. return error;
  966. }
  967. return false;
  968. });
  969. if (error) return new Toast({ content: error, timeout: 8000 });
  970. // Genres
  971. error = undefined;
  972. song.genres.forEach(genre => {
  973. if (!validation.isLength(genre, 1, 32)) {
  974. error = "Genre must have between 1 and 32 characters.";
  975. return error;
  976. }
  977. if (!validation.regex.ascii.test(genre)) {
  978. error =
  979. "Invalid genre format. Only ascii characters are allowed.";
  980. return error;
  981. }
  982. return false;
  983. });
  984. if (song.genres.length < 1 || song.genres.length > 16)
  985. error = "You must have between 1 and 16 genres.";
  986. if (error) return new Toast({ content: error, timeout: 8000 });
  987. // Thumbnail
  988. if (!validation.isLength(song.thumbnail, 1, 256))
  989. return new Toast({
  990. content:
  991. "Thumbnail must have between 8 and 256 characters.",
  992. timeout: 8000
  993. });
  994. if (this.useHTTPS && song.thumbnail.indexOf("https://") !== 0) {
  995. return new Toast({
  996. content: 'Thumbnail must start with "https://".',
  997. timeout: 8000
  998. });
  999. }
  1000. if (
  1001. !this.useHTTPS &&
  1002. song.thumbnail.indexOf("http://") !== 0 &&
  1003. song.thumbnail.indexOf("https://") !== 0
  1004. ) {
  1005. return new Toast({
  1006. content: 'Thumbnail must start with "http://".',
  1007. timeout: 8000
  1008. });
  1009. }
  1010. return this.socket.emit(
  1011. `${this.songType}.update`,
  1012. song._id,
  1013. song,
  1014. res => {
  1015. new Toast({ content: res.message, timeout: 4000 });
  1016. if (res.status === "success") {
  1017. // this.songs.forEach(originalSong => {
  1018. // const updatedSong = song;
  1019. // if (originalSong._id === updatedSong._id) {
  1020. // Object.keys(originalSong).forEach(n => {
  1021. // updatedSong[n] = originalSong[n];
  1022. // return originalSong[n];
  1023. // });
  1024. // }
  1025. // });
  1026. }
  1027. if (close)
  1028. this.closeModal({
  1029. sector: this.sector,
  1030. modal: "editSong"
  1031. });
  1032. }
  1033. );
  1034. },
  1035. toggleAPIResult(index) {
  1036. const apiResult = this.discogs.apiResults[index];
  1037. if (apiResult.expanded === true) apiResult.expanded = false;
  1038. else if (apiResult.gotMoreInfo === true) apiResult.expanded = true;
  1039. else {
  1040. fetch(apiResult.album.resourceUrl)
  1041. .then(response => {
  1042. return response.json();
  1043. })
  1044. .then(data => {
  1045. apiResult.album.artists = [];
  1046. apiResult.album.artistIds = [];
  1047. const artistRegex = new RegExp(" \\([0-9]+\\)$");
  1048. apiResult.dataQuality = data.data_quality;
  1049. data.artists.forEach(artist => {
  1050. apiResult.album.artists.push(
  1051. artist.name.replace(artistRegex, "")
  1052. );
  1053. apiResult.album.artistIds.push(artist.id);
  1054. });
  1055. apiResult.tracks = data.tracklist.map(track => {
  1056. return {
  1057. position: track.position,
  1058. title: track.title
  1059. };
  1060. });
  1061. apiResult.expanded = true;
  1062. apiResult.gotMoreInfo = true;
  1063. });
  1064. }
  1065. },
  1066. fillDuration() {
  1067. this.song.duration =
  1068. this.youtubeVideoDuration - this.song.skipDuration;
  1069. },
  1070. getAlbumData(type) {
  1071. if (!this.song.discogs) return;
  1072. if (type === "title")
  1073. this.updateSongField({
  1074. field: "title",
  1075. value: this.song.discogs.track.title
  1076. });
  1077. if (type === "albumArt")
  1078. this.updateSongField({
  1079. field: "thumbnail",
  1080. value: this.song.discogs.album.albumArt
  1081. });
  1082. if (type === "genres")
  1083. this.updateSongField({
  1084. field: "genres",
  1085. value: JSON.parse(
  1086. JSON.stringify(this.song.discogs.album.genres)
  1087. )
  1088. });
  1089. if (type === "artists")
  1090. this.updateSongField({
  1091. field: "artists",
  1092. value: JSON.parse(
  1093. JSON.stringify(this.song.discogs.album.artists)
  1094. )
  1095. });
  1096. },
  1097. searchDiscogsForPage(page) {
  1098. const query = this.discogsQuery;
  1099. this.socket.emit("apis.searchDiscogs", query, page, res => {
  1100. if (res.status === "success") {
  1101. if (page === 1)
  1102. new Toast({
  1103. content: `Successfully searched. Got ${res.results.length} results.`,
  1104. timeout: 4000
  1105. });
  1106. else
  1107. new Toast({
  1108. content: `Successfully got ${res.results.length} more results.`,
  1109. timeout: 4000
  1110. });
  1111. if (page === 1) {
  1112. this.discogs.apiResults = [];
  1113. }
  1114. this.discogs.pages = res.pages;
  1115. this.discogs.apiResults = this.discogs.apiResults.concat(
  1116. res.results.map(result => {
  1117. const type =
  1118. result.type.charAt(0).toUpperCase() +
  1119. result.type.slice(1);
  1120. return {
  1121. expanded: false,
  1122. gotMoreInfo: false,
  1123. album: {
  1124. id: result.id,
  1125. title: result.title,
  1126. type,
  1127. year: result.year,
  1128. genres: result.genre,
  1129. albumArt: result.cover_image,
  1130. resourceUrl: result.resource_url
  1131. }
  1132. };
  1133. })
  1134. );
  1135. this.discogs.page = page;
  1136. this.discogs.disableLoadMore = false;
  1137. } else new Toast({ content: res.message, timeout: 8000 });
  1138. });
  1139. },
  1140. loadNextDiscogsPage() {
  1141. this.discogs.disableLoadMore = true;
  1142. this.searchDiscogsForPage(this.discogs.page + 1);
  1143. },
  1144. onDiscogsQueryChange() {
  1145. this.discogs.page = 1;
  1146. this.discogs.pages = 1;
  1147. this.discogs.apiResults = [];
  1148. this.discogs.disableLoadMore = false;
  1149. },
  1150. selectTrack(apiResultIndex, trackIndex) {
  1151. const apiResult = JSON.parse(
  1152. JSON.stringify(this.discogs.apiResults[apiResultIndex])
  1153. );
  1154. apiResult.track = apiResult.tracks[trackIndex];
  1155. delete apiResult.tracks;
  1156. delete apiResult.expanded;
  1157. delete apiResult.gotMoreInfo;
  1158. this.selectDiscogsInfo(apiResult);
  1159. },
  1160. blurArtistInput() {
  1161. this.artistInputFocussed = false;
  1162. },
  1163. focusArtistInput() {
  1164. this.artistInputFocussed = true;
  1165. },
  1166. blurArtistContainer() {
  1167. this.artistAutosuggestContainerFocussed = false;
  1168. },
  1169. focusArtistContainer() {
  1170. this.artistAutosuggestContainerFocussed = true;
  1171. },
  1172. keydownArtistInput() {
  1173. clearTimeout(this.keydownArtistInputTimeout);
  1174. this.keydownArtistInputTimeout = setTimeout(() => {
  1175. // Do things here to query the artist
  1176. }, 1000);
  1177. },
  1178. selectArtistAutosuggest(value) {
  1179. this.artistInputValue = value;
  1180. },
  1181. blurGenreInput() {
  1182. this.genreInputFocussed = false;
  1183. },
  1184. focusGenreInput() {
  1185. this.genreInputFocussed = true;
  1186. },
  1187. blurGenreContainer() {
  1188. this.genreAutosuggestContainerFocussed = false;
  1189. },
  1190. focusGenreContainer() {
  1191. this.genreAutosuggestContainerFocussed = true;
  1192. },
  1193. keydownGenreInput() {
  1194. clearTimeout(this.keydownGenreInputTimeout);
  1195. this.keydownGenreInputTimeout = setTimeout(() => {
  1196. if (this.genreInputValue.length > 1) {
  1197. this.genreAutosuggestItems = this.genres.filter(genre => {
  1198. return genre
  1199. .toLowerCase()
  1200. .startsWith(this.genreInputValue.toLowerCase());
  1201. });
  1202. } else this.genreAutosuggestItems = [];
  1203. }, 1000);
  1204. },
  1205. selectGenreAutosuggest(value) {
  1206. this.genreInputValue = value;
  1207. },
  1208. settings(type) {
  1209. switch (type) {
  1210. default:
  1211. break;
  1212. case "stop":
  1213. this.stopVideo();
  1214. this.pauseVideo(true);
  1215. break;
  1216. case "pause":
  1217. this.pauseVideo(true);
  1218. break;
  1219. case "play":
  1220. this.pauseVideo(false);
  1221. break;
  1222. case "skipToLast10Secs":
  1223. if (this.video.paused) this.pauseVideo(false);
  1224. this.video.player.seekTo(
  1225. this.song.duration - 10 + this.song.skipDuration
  1226. );
  1227. break;
  1228. }
  1229. },
  1230. changeVolume() {
  1231. const volume = this.volumeSliderValue;
  1232. localStorage.setItem("volume", volume / 100);
  1233. this.video.player.setVolume(volume / 100);
  1234. if (volume > 0) this.video.player.unMute();
  1235. },
  1236. addTag(type) {
  1237. if (type === "genres") {
  1238. const genre = document
  1239. .getElementById("new-genre")
  1240. .value.toLowerCase()
  1241. .trim();
  1242. if (this.song.genres.indexOf(genre) !== -1)
  1243. return new Toast({
  1244. content: "Genre already exists",
  1245. timeout: 3000
  1246. });
  1247. if (genre) {
  1248. this.song.genres.push(genre);
  1249. document.getElementById("new-genre").value = "";
  1250. return false;
  1251. }
  1252. return new Toast({
  1253. content: "Genre cannot be empty",
  1254. timeout: 3000
  1255. });
  1256. }
  1257. if (type === "artists") {
  1258. const artist = document.getElementById("new-artist").value;
  1259. if (this.song.artists.indexOf(artist) !== -1)
  1260. return new Toast({
  1261. content: "Artist already exists",
  1262. timeout: 3000
  1263. });
  1264. if (document.getElementById("new-artist").value !== "") {
  1265. this.song.artists.push(artist);
  1266. document.getElementById("new-artist").value = "";
  1267. return false;
  1268. }
  1269. return new Toast({
  1270. content: "Artist cannot be empty",
  1271. timeout: 3000
  1272. });
  1273. }
  1274. return false;
  1275. },
  1276. removeTag(type, index) {
  1277. if (type === "genres") this.song.genres.splice(index, 1);
  1278. else if (type === "artists") this.song.artists.splice(index, 1);
  1279. },
  1280. drawCanvas() {
  1281. const canvasElement = document.getElementById("durationCanvas");
  1282. const ctx = canvasElement.getContext("2d");
  1283. const videoDuration = Number(this.youtubeVideoDuration);
  1284. const skipDuration = Number(this.song.skipDuration);
  1285. const duration = Number(this.song.duration);
  1286. const afterDuration = videoDuration - (skipDuration + duration);
  1287. const width = 530;
  1288. const currentTime =
  1289. this.video.player && this.video.player.getCurrentTime
  1290. ? this.video.player.getCurrentTime()
  1291. : 0;
  1292. const widthSkipDuration = (skipDuration / videoDuration) * width;
  1293. const widthDuration = (duration / videoDuration) * width;
  1294. const widthAfterDuration = (afterDuration / videoDuration) * width;
  1295. const widthCurrentTime = (currentTime / videoDuration) * width;
  1296. const skipDurationColor = "#F42003";
  1297. const durationColor = "#03A9F4";
  1298. const afterDurationColor = "#41E841";
  1299. const currentDurationColor = "#3b25e8";
  1300. ctx.fillStyle = skipDurationColor;
  1301. ctx.fillRect(0, 0, widthSkipDuration, 20);
  1302. ctx.fillStyle = durationColor;
  1303. ctx.fillRect(widthSkipDuration, 0, widthDuration, 20);
  1304. ctx.fillStyle = afterDurationColor;
  1305. ctx.fillRect(
  1306. widthSkipDuration + widthDuration,
  1307. 0,
  1308. widthAfterDuration,
  1309. 20
  1310. );
  1311. ctx.fillStyle = currentDurationColor;
  1312. ctx.fillRect(widthCurrentTime, 0, 1, 20);
  1313. },
  1314. toggleGenreHelper() {
  1315. this.$refs.genreHelper.toggleBox();
  1316. },
  1317. resetGenreHelper() {
  1318. this.$refs.genreHelper.resetBox();
  1319. },
  1320. ...mapActions("modals/editSong", [
  1321. "stopVideo",
  1322. "loadVideoById",
  1323. "pauseVideo",
  1324. "getCurrentTime",
  1325. "editSong",
  1326. "updateSongField",
  1327. "selectDiscogsInfo"
  1328. ]),
  1329. ...mapActions("modalVisibility", ["closeModal"])
  1330. }
  1331. };
  1332. </script>
  1333. <style lang="scss">
  1334. .song-modal {
  1335. .modal-card-title {
  1336. text-align: center;
  1337. margin-left: 24px;
  1338. }
  1339. .modal-card {
  1340. width: 1160px;
  1341. height: 100%;
  1342. .modal-card-body {
  1343. padding: 16px;
  1344. }
  1345. }
  1346. }
  1347. </style>
  1348. <style lang="scss" scoped>
  1349. .night-mode {
  1350. .edit-section,
  1351. .api-section,
  1352. .api-result,
  1353. .player-footer {
  1354. background-color: var(--dark-grey-3) !important;
  1355. }
  1356. .api-result .tracks .track:hover,
  1357. .selected-discogs-info {
  1358. background-color: var(--dark-grey-2) !important;
  1359. }
  1360. .label,
  1361. p,
  1362. strong {
  1363. color: var(--light-grey-2);
  1364. }
  1365. }
  1366. .modal-card-body > div {
  1367. display: flex;
  1368. height: 100%;
  1369. }
  1370. .left-section {
  1371. display: flex;
  1372. flex-direction: column;
  1373. margin-right: 16px;
  1374. .top-section {
  1375. display: flex;
  1376. .player-section {
  1377. width: 530px;
  1378. display: flex;
  1379. flex-direction: column;
  1380. .player-footer {
  1381. background-color: var(--light-grey);
  1382. border: 1px rgba(163, 224, 255, 0.75) solid;
  1383. border-radius: 0px 0px 5px 5px;
  1384. display: flex;
  1385. justify-content: space-between;
  1386. height: 54px;
  1387. > * {
  1388. width: 33.3%;
  1389. display: flex;
  1390. align-items: center;
  1391. }
  1392. .player-footer-left {
  1393. flex: 1;
  1394. .material-icons {
  1395. font-size: 38px;
  1396. cursor: pointer;
  1397. }
  1398. .player-play-pause {
  1399. color: var(--primary-color);
  1400. }
  1401. .player-stop {
  1402. color: var(--red);
  1403. }
  1404. .player-fast-forward {
  1405. color: var(--green);
  1406. }
  1407. }
  1408. .player-footer-center {
  1409. justify-content: center;
  1410. align-items: center;
  1411. flex: 2;
  1412. font-size: 21px;
  1413. font-weight: 400;
  1414. img {
  1415. height: 21px;
  1416. margin-right: 12px;
  1417. filter: invert(26%) sepia(54%) saturate(6317%)
  1418. hue-rotate(2deg) brightness(92%) contrast(115%);
  1419. }
  1420. }
  1421. .player-footer-right {
  1422. justify-content: right;
  1423. flex: 1;
  1424. #volumeSlider {
  1425. width: 126px;
  1426. margin-right: 10px;
  1427. background-color: var(--light-grey);
  1428. }
  1429. }
  1430. }
  1431. }
  1432. .thumbnail-preview {
  1433. width: 189px;
  1434. height: 189px;
  1435. margin-left: 16px;
  1436. }
  1437. }
  1438. .edit-section {
  1439. width: 735px;
  1440. background-color: var(--light-grey);
  1441. border: 1px rgba(163, 224, 255, 0.75) solid;
  1442. margin-top: 16px;
  1443. flex: 1;
  1444. overflow: auto;
  1445. border-radius: 5px;
  1446. .album-get-button {
  1447. background-color: var(--purple);
  1448. color: var(--white);
  1449. width: 32px;
  1450. text-align: center;
  1451. border-width: 0;
  1452. }
  1453. .duration-fill-button {
  1454. background-color: var(--red);
  1455. color: var(--white);
  1456. width: 32px;
  1457. text-align: center;
  1458. border-width: 0;
  1459. }
  1460. .add-button {
  1461. background-color: var(--primary-color) !important;
  1462. width: 32px;
  1463. i {
  1464. font-size: 32px;
  1465. }
  1466. }
  1467. .album-get-button,
  1468. .duration-fill-button,
  1469. .add-button {
  1470. &:focus,
  1471. &:hover {
  1472. filter: contrast(0.75);
  1473. border: 1px solid var(--black) !important;
  1474. }
  1475. }
  1476. > div {
  1477. margin: 16px;
  1478. }
  1479. input {
  1480. width: 100%;
  1481. }
  1482. .title-container {
  1483. width: calc((100% - 32px) / 2);
  1484. }
  1485. .duration-container {
  1486. margin-right: 16px;
  1487. margin-left: 16px;
  1488. width: calc((100% - 32px) / 4);
  1489. }
  1490. .skip-duration-container {
  1491. width: calc((100% - 32px) / 4);
  1492. }
  1493. .album-art-container {
  1494. width: 100%;
  1495. }
  1496. .artists-container {
  1497. width: calc((100% - 32px) / 3);
  1498. position: relative;
  1499. }
  1500. .genres-container {
  1501. width: calc((100% - 32px) / 3);
  1502. margin-left: 16px;
  1503. margin-right: 16px;
  1504. position: relative;
  1505. label {
  1506. display: flex;
  1507. i {
  1508. font-size: 15px;
  1509. align-self: center;
  1510. margin-left: 5px;
  1511. color: var(--primary-color);
  1512. cursor: pointer;
  1513. -webkit-user-select: none;
  1514. -moz-user-select: none;
  1515. -ms-user-select: none;
  1516. user-select: none;
  1517. }
  1518. }
  1519. }
  1520. .youtube-id-container {
  1521. width: calc((100% - 32px) / 3);
  1522. }
  1523. .list-item-circle {
  1524. background-color: var(--primary-color);
  1525. width: 16px;
  1526. height: 16px;
  1527. border-radius: 8px;
  1528. cursor: pointer;
  1529. margin-right: 8px;
  1530. float: left;
  1531. -webkit-touch-callout: none;
  1532. -webkit-user-select: none;
  1533. -khtml-user-select: none;
  1534. -moz-user-select: none;
  1535. -ms-user-select: none;
  1536. user-select: none;
  1537. i {
  1538. color: var(--primary-color);
  1539. font-size: 14px;
  1540. margin-left: 1px;
  1541. }
  1542. }
  1543. .list-item-circle:hover,
  1544. .list-item-circle:focus {
  1545. i {
  1546. color: var(--white);
  1547. }
  1548. }
  1549. .list-item > p {
  1550. line-height: 16px;
  1551. word-wrap: break-word;
  1552. width: calc(100% - 24px);
  1553. left: 24px;
  1554. float: left;
  1555. margin-bottom: 8px;
  1556. }
  1557. .list-item:last-child > p {
  1558. margin-bottom: 0;
  1559. }
  1560. .autosuggest-container {
  1561. position: absolute;
  1562. background: var(--white);
  1563. width: calc(100% + 1px);
  1564. top: 57px;
  1565. z-index: 200;
  1566. overflow: auto;
  1567. max-height: 100%;
  1568. clear: both;
  1569. .autosuggest-item {
  1570. padding: 8px;
  1571. display: block;
  1572. border: 1px solid var(--light-grey-2);
  1573. margin-top: -1px;
  1574. line-height: 16px;
  1575. cursor: pointer;
  1576. -webkit-user-select: none;
  1577. -ms-user-select: none;
  1578. -moz-user-select: none;
  1579. user-select: none;
  1580. }
  1581. .autosuggest-item:hover,
  1582. .autosuggest-item:focus {
  1583. background-color: var(--light-grey);
  1584. }
  1585. .autosuggest-item:first-child {
  1586. border-top: none;
  1587. }
  1588. .autosuggest-item:last-child {
  1589. border-radius: 0 0 3px 3px;
  1590. }
  1591. }
  1592. }
  1593. }
  1594. .right-section {
  1595. display: flex;
  1596. flex-wrap: wrap;
  1597. .api-section {
  1598. width: 376px;
  1599. background-color: var(--light-grey);
  1600. border: 1px rgba(163, 224, 255, 0.75) solid;
  1601. border-radius: 5px;
  1602. padding: 16px;
  1603. overflow: auto;
  1604. height: 100%;
  1605. > label {
  1606. margin-top: 12px;
  1607. }
  1608. .top-container {
  1609. display: flex;
  1610. img {
  1611. height: 85px;
  1612. width: 85px;
  1613. }
  1614. .right-container {
  1615. padding: 8px;
  1616. display: flex;
  1617. flex-direction: column;
  1618. flex: 1;
  1619. .album-title {
  1620. flex: 1;
  1621. font-weight: 600;
  1622. }
  1623. .bottom-row {
  1624. display: flex;
  1625. flex-flow: row;
  1626. line-height: 15px;
  1627. img {
  1628. height: 15px;
  1629. align-self: end;
  1630. flex: 1;
  1631. user-select: none;
  1632. -moz-user-select: none;
  1633. -ms-user-select: none;
  1634. -webkit-user-select: none;
  1635. cursor: pointer;
  1636. }
  1637. p {
  1638. text-align: right;
  1639. }
  1640. .type-year {
  1641. font-size: 13px;
  1642. align-self: end;
  1643. }
  1644. }
  1645. }
  1646. }
  1647. .bottom-container {
  1648. padding: 12px;
  1649. .bottom-container-field {
  1650. line-height: 16px;
  1651. margin-bottom: 8px;
  1652. font-weight: 600;
  1653. span {
  1654. font-weight: 400;
  1655. }
  1656. }
  1657. .bottom-container-field:last-of-type {
  1658. margin-bottom: 0;
  1659. }
  1660. }
  1661. .selected-discogs-info {
  1662. background-color: var(--white);
  1663. border: 1px solid var(--purple);
  1664. border-radius: 5px;
  1665. margin-bottom: 16px;
  1666. .selected-discogs-info-none {
  1667. font-size: 18px;
  1668. text-align: center;
  1669. }
  1670. .bottom-row > p {
  1671. flex: 1;
  1672. }
  1673. }
  1674. .api-result {
  1675. background-color: var(--white);
  1676. border: 0.5px solid var(--primary-color);
  1677. border-radius: 5px;
  1678. margin-bottom: 16px;
  1679. }
  1680. button {
  1681. background-color: var(--primary-color) !important;
  1682. &:focus,
  1683. &:hover {
  1684. filter: contrast(0.75);
  1685. }
  1686. }
  1687. .tracks {
  1688. margin-top: 12px;
  1689. .track:first-child {
  1690. margin-top: 0;
  1691. border-radius: 3px 3px 0 0;
  1692. }
  1693. .track:last-child {
  1694. border-radius: 0 0 3px 3px;
  1695. }
  1696. .track {
  1697. border: 0.5px solid var(--black);
  1698. margin-top: -1px;
  1699. line-height: 16px;
  1700. display: flex;
  1701. cursor: pointer;
  1702. span {
  1703. font-weight: 600;
  1704. display: inline-block;
  1705. margin-top: 7px;
  1706. margin-bottom: 7px;
  1707. margin-left: 7px;
  1708. }
  1709. p {
  1710. display: inline-block;
  1711. margin: 7px;
  1712. flex: 1;
  1713. }
  1714. }
  1715. .track:hover,
  1716. .track:focus {
  1717. background-color: var(--light-grey);
  1718. }
  1719. }
  1720. .discogs-load-more {
  1721. margin-bottom: 8px;
  1722. }
  1723. }
  1724. }
  1725. .footer-buttons {
  1726. margin-left: auto;
  1727. margin-right: auto;
  1728. }
  1729. input[type="range"] {
  1730. -webkit-appearance: none;
  1731. width: 100%;
  1732. margin: 8.5px 0;
  1733. }
  1734. input[type="range"]:focus {
  1735. outline-style: outset;
  1736. }
  1737. input[type="range"]::-webkit-slider-runnable-track {
  1738. width: 100%;
  1739. height: 3px;
  1740. cursor: pointer;
  1741. box-shadow: none;
  1742. background: var(--grey-3);
  1743. border-radius: none;
  1744. border: none;
  1745. }
  1746. input[type="range"]::-webkit-slider-thumb {
  1747. box-shadow: none;
  1748. border: none;
  1749. height: 20px;
  1750. width: 20px;
  1751. border-radius: 100px;
  1752. background: var(--primary-color);
  1753. cursor: pointer;
  1754. -webkit-appearance: none;
  1755. margin-top: -8.5px;
  1756. }
  1757. input[type="range"]:focus::-webkit-slider-runnable-track {
  1758. background: var(--grey-3);
  1759. }
  1760. input[type="range"]::-moz-range-track {
  1761. width: 100%;
  1762. height: 3px;
  1763. cursor: pointer;
  1764. box-shadow: none;
  1765. background: var(--grey-3);
  1766. border-radius: none;
  1767. border: none;
  1768. }
  1769. input[type="range"]::-moz-range-thumb {
  1770. box-shadow: none;
  1771. border: none;
  1772. height: 20px;
  1773. width: 20px;
  1774. border-radius: 100px;
  1775. background: var(--primary-color);
  1776. cursor: pointer;
  1777. }
  1778. input[type="range"]::-ms-track {
  1779. width: 100%;
  1780. height: 3px;
  1781. cursor: pointer;
  1782. background: transparent;
  1783. border-color: transparent;
  1784. color: transparent;
  1785. }
  1786. input[type="range"]::-ms-fill-lower {
  1787. background: var(--grey-2);
  1788. border: none;
  1789. border-radius: none;
  1790. box-shadow: none;
  1791. }
  1792. input[type="range"]::-ms-fill-upper {
  1793. background: var(--grey-3);
  1794. border: none;
  1795. border-radius: none;
  1796. box-shadow: none;
  1797. }
  1798. input[type="range"]::-ms-thumb {
  1799. box-shadow: none;
  1800. border: none;
  1801. height: 20px;
  1802. width: 20px;
  1803. border-radius: 100px;
  1804. background: var(--primary-color);
  1805. cursor: pointer;
  1806. height: 3px;
  1807. }
  1808. input[type="range"]:focus::-ms-fill-lower {
  1809. background: var(--grey-3);
  1810. }
  1811. input[type="range"]:focus::-ms-fill-upper {
  1812. background: var(--grey-3);
  1813. }
  1814. </style>