EditSong.vue 45 KB

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