EditSong.vue 45 KB

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