EditSong.vue 46 KB

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