EditSong.vue 45 KB

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