EditSong.vue 44 KB

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