1
0

index.vue 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506
  1. <template>
  2. <div>
  3. <modal
  4. :title="`${newSong ? 'Create' : 'Edit'} Song`"
  5. class="song-modal"
  6. :size="'wide'"
  7. :split="true"
  8. :intercept-close="true"
  9. @close="onCloseModal"
  10. >
  11. <template #toggleMobileSidebar>
  12. <slot name="toggleMobileSidebar" />
  13. </template>
  14. <template #sidebar>
  15. <slot name="sidebar" />
  16. </template>
  17. <template #body>
  18. <div v-if="!songId && !newSong" class="notice-container">
  19. <h4>No song has been selected</h4>
  20. </div>
  21. <div v-if="songDeleted" class="notice-container">
  22. <h4>The song you were editing has been deleted</h4>
  23. </div>
  24. <div
  25. v-if="
  26. songId && !songDataLoaded && !songNotFound && !newSong
  27. "
  28. class="notice-container"
  29. >
  30. <h4>Song hasn't loaded yet</h4>
  31. </div>
  32. <div
  33. v-if="songId && songNotFound && !newSong"
  34. class="notice-container"
  35. >
  36. <h4>Song was not found</h4>
  37. </div>
  38. <div
  39. class="left-section"
  40. v-show="songDataLoaded && !songDeleted"
  41. >
  42. <div class="top-section">
  43. <div class="player-section">
  44. <div id="editSongPlayer" />
  45. <div v-show="youtubeError" class="player-error">
  46. <h2>{{ youtubeErrorMessage }}</h2>
  47. </div>
  48. <canvas
  49. ref="durationCanvas"
  50. id="durationCanvas"
  51. v-show="!youtubeError"
  52. height="20"
  53. width="530"
  54. @click="setTrackPosition($event)"
  55. />
  56. <div class="player-footer">
  57. <div class="player-footer-left">
  58. <button
  59. class="button is-primary"
  60. @click="play()"
  61. @keyup.enter="play()"
  62. v-if="video.paused"
  63. content="Resume Playback"
  64. v-tippy
  65. >
  66. <i class="material-icons">play_arrow</i>
  67. </button>
  68. <button
  69. class="button is-primary"
  70. @click="settings('pause')"
  71. @keyup.enter="settings('pause')"
  72. v-else
  73. content="Pause Playback"
  74. v-tippy
  75. >
  76. <i class="material-icons">pause</i>
  77. </button>
  78. <button
  79. class="button is-danger"
  80. @click.exact="settings('stop')"
  81. @click.shift="settings('hardStop')"
  82. @keyup.enter.exact="settings('stop')"
  83. @keyup.shift.enter="
  84. settings('hardStop')
  85. "
  86. content="Stop Playback"
  87. v-tippy
  88. >
  89. <i class="material-icons">stop</i>
  90. </button>
  91. <tippy
  92. class="playerRateDropdown"
  93. :touch="true"
  94. :interactive="true"
  95. placement="bottom"
  96. theme="dropdown"
  97. ref="dropdown"
  98. trigger="click"
  99. append-to="parent"
  100. @show="
  101. () => {
  102. showRateDropdown = true;
  103. }
  104. "
  105. @hide="
  106. () => {
  107. showRateDropdown = false;
  108. }
  109. "
  110. >
  111. <div
  112. ref="trigger"
  113. class="control has-addons"
  114. content="Set Playback Rate"
  115. v-tippy
  116. >
  117. <button class="button is-primary">
  118. <i class="material-icons"
  119. >fast_forward</i
  120. >
  121. </button>
  122. <button
  123. class="button dropdown-toggle"
  124. >
  125. <i class="material-icons">
  126. {{
  127. showRateDropdown
  128. ? "expand_more"
  129. : "expand_less"
  130. }}
  131. </i>
  132. </button>
  133. </div>
  134. <template #content>
  135. <div class="nav-dropdown-items">
  136. <button
  137. class="nav-item button"
  138. :class="{
  139. active:
  140. video.playbackRate ===
  141. 0.5
  142. }"
  143. title="0.5x"
  144. @click="
  145. setPlaybackRate(0.5)
  146. "
  147. >
  148. <p>0.5x</p>
  149. </button>
  150. <button
  151. class="nav-item button"
  152. :class="{
  153. active:
  154. video.playbackRate ===
  155. 1
  156. }"
  157. title="1x"
  158. @click="setPlaybackRate(1)"
  159. >
  160. <p>1x</p>
  161. </button>
  162. <button
  163. class="nav-item button"
  164. :class="{
  165. active:
  166. video.playbackRate ===
  167. 2
  168. }"
  169. title="2x"
  170. @click="setPlaybackRate(2)"
  171. >
  172. <p>2x</p>
  173. </button>
  174. </div>
  175. </template>
  176. </tippy>
  177. </div>
  178. <div class="player-footer-center">
  179. <span>
  180. <span>
  181. {{ youtubeVideoCurrentTime }}
  182. </span>
  183. /
  184. <span>
  185. {{ youtubeVideoDuration }}
  186. {{ youtubeVideoNote }}
  187. </span>
  188. </span>
  189. </div>
  190. <div class="player-footer-right">
  191. <p id="volume-control">
  192. <i
  193. class="material-icons"
  194. @click="toggleMute()"
  195. :content="`${
  196. muted ? 'Unmute' : 'Mute'
  197. }`"
  198. v-tippy
  199. >{{
  200. muted
  201. ? "volume_mute"
  202. : volumeSliderValue >= 50
  203. ? "volume_up"
  204. : "volume_down"
  205. }}</i
  206. >
  207. <input
  208. v-model="volumeSliderValue"
  209. type="range"
  210. min="0"
  211. max="100"
  212. class="volume-slider active"
  213. @change="changeVolume()"
  214. @input="changeVolume()"
  215. />
  216. </p>
  217. </div>
  218. </div>
  219. </div>
  220. <song-thumbnail
  221. v-if="songDataLoaded && !songDeleted"
  222. :song="song"
  223. :fallback="false"
  224. class="thumbnail-preview"
  225. @loadError="onThumbnailLoadError"
  226. />
  227. <img
  228. v-if="!isYoutubeThumbnail && !songDeleted"
  229. class="thumbnail-dummy"
  230. :src="song.thumbnail"
  231. ref="thumbnailElement"
  232. @load="onThumbnailLoad"
  233. />
  234. </div>
  235. <div
  236. class="edit-section"
  237. v-if="songDataLoaded && !songDeleted"
  238. >
  239. <div class="control is-grouped">
  240. <div class="title-container">
  241. <label class="label">Title</label>
  242. <p class="control has-addons">
  243. <input
  244. class="input"
  245. type="text"
  246. ref="title-input"
  247. v-model="song.title"
  248. placeholder="Enter song title..."
  249. @keyup.shift.enter="
  250. getAlbumData('title')
  251. "
  252. />
  253. <button
  254. class="button youtube-get-button"
  255. @click="getYouTubeData('title')"
  256. >
  257. <div
  258. class="youtube-icon"
  259. v-tippy
  260. content="Fill from YouTube"
  261. ></div>
  262. </button>
  263. <button
  264. class="button album-get-button"
  265. @click="getAlbumData('title')"
  266. >
  267. <i
  268. class="material-icons"
  269. v-tippy
  270. content="Fill from Discogs"
  271. >album</i
  272. >
  273. </button>
  274. </p>
  275. </div>
  276. <div class="duration-container">
  277. <label class="label">Duration</label>
  278. <p class="control has-addons">
  279. <input
  280. class="input"
  281. type="text"
  282. placeholder="Enter song duration..."
  283. v-model.number="song.duration"
  284. @keyup.shift.enter="fillDuration()"
  285. />
  286. <button
  287. class="button duration-fill-button"
  288. @click="fillDuration()"
  289. >
  290. <i
  291. class="material-icons"
  292. v-tippy
  293. content="Sync duration with YouTube"
  294. >sync</i
  295. >
  296. </button>
  297. </p>
  298. </div>
  299. <div class="skip-duration-container">
  300. <label class="label">Skip duration</label>
  301. <p class="control">
  302. <input
  303. class="input"
  304. type="text"
  305. placeholder="Enter skip duration..."
  306. v-model.number="song.skipDuration"
  307. />
  308. </p>
  309. </div>
  310. </div>
  311. <div class="control is-grouped">
  312. <div class="album-art-container">
  313. <label class="label">
  314. Thumbnail
  315. <i
  316. v-if="
  317. thumbnailNotSquare &&
  318. !isYoutubeThumbnail
  319. "
  320. class="material-icons thumbnail-warning"
  321. content="Thumbnail not square, it will be stretched"
  322. v-tippy="{ theme: 'info' }"
  323. >
  324. warning
  325. </i>
  326. <i
  327. v-if="
  328. thumbnailLoadError &&
  329. !isYoutubeThumbnail
  330. "
  331. class="material-icons thumbnail-warning"
  332. content="Error loading thumbnail"
  333. v-tippy="{ theme: 'info' }"
  334. >
  335. warning
  336. </i>
  337. </label>
  338. <p class="control has-addons">
  339. <input
  340. class="input"
  341. type="text"
  342. v-model="song.thumbnail"
  343. placeholder="Enter link to thumbnail..."
  344. @keyup.shift.enter="
  345. getAlbumData('albumArt')
  346. "
  347. />
  348. <button
  349. class="button youtube-get-button"
  350. @click="getYouTubeData('thumbnail')"
  351. >
  352. <div
  353. class="youtube-icon"
  354. v-tippy
  355. content="Fill from YouTube"
  356. ></div>
  357. </button>
  358. <button
  359. class="button album-get-button"
  360. @click="getAlbumData('albumArt')"
  361. >
  362. <i
  363. class="material-icons"
  364. v-tippy
  365. content="Fill from Discogs"
  366. >album</i
  367. >
  368. </button>
  369. </p>
  370. </div>
  371. <div class="youtube-id-container">
  372. <label class="label">YouTube ID</label>
  373. <p class="control">
  374. <input
  375. class="input"
  376. type="text"
  377. placeholder="Enter YouTube ID..."
  378. v-model="song.youtubeId"
  379. />
  380. </p>
  381. </div>
  382. <div class="verified-container">
  383. <label class="label">Verified</label>
  384. <p class="is-expanded checkbox-control">
  385. <label class="switch">
  386. <input
  387. type="checkbox"
  388. id="verified"
  389. v-model="song.verified"
  390. />
  391. <span class="slider round"></span>
  392. </label>
  393. </p>
  394. </div>
  395. </div>
  396. <div class="control is-grouped">
  397. <div class="artists-container">
  398. <label class="label">Artists</label>
  399. <p class="control has-addons">
  400. <auto-suggest
  401. v-model="artistInputValue"
  402. ref="new-artist"
  403. placeholder="Add artist..."
  404. :all-items="
  405. autosuggest.allItems.artists
  406. "
  407. @submitted="addTag('artists')"
  408. @keyup.shift.enter="
  409. getAlbumData('artists')
  410. "
  411. />
  412. <button
  413. class="button youtube-get-button"
  414. @click="getYouTubeData('author')"
  415. >
  416. <div
  417. class="youtube-icon"
  418. v-tippy
  419. content="Fill from YouTube"
  420. ></div>
  421. </button>
  422. <button
  423. class="button album-get-button"
  424. @click="getAlbumData('artists')"
  425. >
  426. <i
  427. class="material-icons"
  428. v-tippy
  429. content="Fill from Discogs"
  430. >album</i
  431. >
  432. </button>
  433. <button
  434. class="button is-info add-button"
  435. @click="addTag('artists')"
  436. >
  437. <i class="material-icons">add</i>
  438. </button>
  439. </p>
  440. <div class="list-container">
  441. <div
  442. class="list-item"
  443. v-for="artist in song.artists"
  444. :key="artist"
  445. >
  446. <div
  447. class="list-item-circle"
  448. @click="
  449. removeTag('artists', artist)
  450. "
  451. >
  452. <i class="material-icons">close</i>
  453. </div>
  454. <p>{{ artist }}</p>
  455. </div>
  456. </div>
  457. </div>
  458. <div class="genres-container">
  459. <label class="label">
  460. <span>Genres</span>
  461. <i
  462. class="material-icons"
  463. @click="toggleGenreHelper"
  464. @dblclick="resetGenreHelper"
  465. v-tippy
  466. content="View list of genres"
  467. >info</i
  468. >
  469. </label>
  470. <p class="control has-addons">
  471. <auto-suggest
  472. v-model="genreInputValue"
  473. ref="new-genre"
  474. placeholder="Add genre..."
  475. :all-items="autosuggest.allItems.genres"
  476. @submitted="addTag('genres')"
  477. @keyup.shift.enter="
  478. getAlbumData('genres')
  479. "
  480. />
  481. <button
  482. class="button album-get-button"
  483. @click="getAlbumData('genres')"
  484. >
  485. <i
  486. class="material-icons"
  487. v-tippy
  488. content="Fill from Discogs"
  489. >album</i
  490. >
  491. </button>
  492. <button
  493. class="button is-info add-button"
  494. @click="addTag('genres')"
  495. >
  496. <i class="material-icons">add</i>
  497. </button>
  498. </p>
  499. <div class="list-container">
  500. <div
  501. class="list-item"
  502. v-for="genre in song.genres"
  503. :key="genre"
  504. >
  505. <div
  506. class="list-item-circle"
  507. @click="removeTag('genres', genre)"
  508. >
  509. <i class="material-icons">close</i>
  510. </div>
  511. <p>{{ genre }}</p>
  512. </div>
  513. </div>
  514. </div>
  515. <div class="tags-container">
  516. <label class="label">Tags</label>
  517. <p class="control has-addons">
  518. <auto-suggest
  519. v-model="tagInputValue"
  520. ref="new-tag"
  521. placeholder="Add tag..."
  522. :all-items="autosuggest.allItems.tags"
  523. @submitted="addTag('tags')"
  524. />
  525. <button
  526. class="button is-info add-button"
  527. @click="addTag('tags')"
  528. >
  529. <i class="material-icons">add</i>
  530. </button>
  531. </p>
  532. <div class="list-container">
  533. <div
  534. class="list-item"
  535. v-for="tag in song.tags"
  536. :key="tag"
  537. >
  538. <div
  539. class="list-item-circle"
  540. @click="removeTag('tags', tag)"
  541. >
  542. <i class="material-icons">close</i>
  543. </div>
  544. <p>{{ tag }}</p>
  545. </div>
  546. </div>
  547. </div>
  548. </div>
  549. </div>
  550. </div>
  551. <div
  552. class="right-section"
  553. v-if="songDataLoaded && !songDeleted"
  554. >
  555. <div id="tabs-container">
  556. <div id="tab-selection">
  557. <button
  558. class="button is-default"
  559. :class="{ selected: tab === 'discogs' }"
  560. ref="discogs-tab"
  561. @click="showTab('discogs')"
  562. >
  563. Discogs
  564. </button>
  565. <button
  566. v-if="!newSong"
  567. class="button is-default"
  568. :class="{ selected: tab === 'reports' }"
  569. ref="reports-tab"
  570. @click="showTab('reports')"
  571. >
  572. Reports ({{ reports.length }})
  573. </button>
  574. <button
  575. class="button is-default"
  576. :class="{ selected: tab === 'youtube' }"
  577. ref="youtube-tab"
  578. @click="showTab('youtube')"
  579. >
  580. YouTube
  581. </button>
  582. <button
  583. class="button is-default"
  584. :class="{ selected: tab === 'musare-songs' }"
  585. ref="musare-songs-tab"
  586. @click="showTab('musare-songs')"
  587. >
  588. Songs
  589. </button>
  590. </div>
  591. <discogs
  592. class="tab"
  593. v-show="tab === 'discogs'"
  594. :bulk="bulk"
  595. :modal-uuid="modalUuid"
  596. :modal-module-path="modalModulePath"
  597. />
  598. <reports
  599. v-if="!newSong"
  600. class="tab"
  601. v-show="tab === 'reports'"
  602. :modal-uuid="modalUuid"
  603. :modal-module-path="modalModulePath"
  604. />
  605. <youtube
  606. class="tab"
  607. v-show="tab === 'youtube'"
  608. :modal-uuid="modalUuid"
  609. :modal-module-path="modalModulePath"
  610. />
  611. <musare-songs
  612. class="tab"
  613. v-show="tab === 'musare-songs'"
  614. :modal-uuid="modalUuid"
  615. :modal-module-path="modalModulePath"
  616. />
  617. </div>
  618. </div>
  619. </template>
  620. <template #footer>
  621. <div v-if="bulk">
  622. <button class="button is-primary" @click="editNextSong()">
  623. Next
  624. </button>
  625. <button
  626. class="button is-primary"
  627. @click="toggleFlag()"
  628. v-if="songId && !songDeleted"
  629. >
  630. {{ flagged ? "Unflag" : "Flag" }}
  631. </button>
  632. </div>
  633. <div v-if="!newSong && !songDeleted">
  634. <save-button
  635. ref="saveButton"
  636. @clicked="save(song, false, 'saveButton')"
  637. />
  638. <save-button
  639. ref="saveAndCloseButton"
  640. :default-message="
  641. bulk ? `Save and next` : `Save and close`
  642. "
  643. @clicked="save(song, true, 'saveAndCloseButton')"
  644. />
  645. <div class="right">
  646. <button
  647. class="button is-danger icon-with-button material-icons"
  648. @click.prevent="
  649. confirmAction({
  650. message:
  651. 'Removing this song will remove it from all playlists and cause a ratings recalculation.',
  652. action: 'remove',
  653. params: song._id
  654. })
  655. "
  656. content="Delete Song"
  657. v-tippy
  658. >
  659. delete_forever
  660. </button>
  661. </div>
  662. </div>
  663. <div v-else-if="newSong">
  664. <save-button
  665. ref="createButton"
  666. default-message="Create Song"
  667. @clicked="save(song, false, 'createButton', true)"
  668. />
  669. </div>
  670. </template>
  671. </modal>
  672. <floating-box id="genreHelper" ref="genreHelper" :column="false">
  673. <template #body>
  674. <span
  675. v-for="item in autosuggest.allItems.genres"
  676. :key="`genre-helper-${item}`"
  677. >
  678. {{ item }}
  679. </span>
  680. </template>
  681. </floating-box>
  682. </div>
  683. </template>
  684. <script>
  685. import { mapState, mapGetters, mapActions } from "vuex";
  686. import Toast from "toasters";
  687. import { mapModalState, mapModalActions } from "@/vuex_helpers";
  688. import aw from "@/aw";
  689. import ws from "@/ws";
  690. import validation from "@/validation";
  691. import keyboardShortcuts from "@/keyboardShortcuts";
  692. import FloatingBox from "../../FloatingBox.vue";
  693. import SaveButton from "../../SaveButton.vue";
  694. import AutoSuggest from "@/components/AutoSuggest.vue";
  695. import Discogs from "./Tabs/Discogs.vue";
  696. import Reports from "./Tabs/Reports.vue";
  697. import Youtube from "./Tabs/Youtube.vue";
  698. import MusareSongs from "./Tabs/Songs.vue";
  699. export default {
  700. components: {
  701. FloatingBox,
  702. SaveButton,
  703. AutoSuggest,
  704. Discogs,
  705. Reports,
  706. Youtube,
  707. MusareSongs
  708. },
  709. props: {
  710. // songId: { type: String, default: null },
  711. modalUuid: { type: String, default: "" },
  712. modalModulePath: {
  713. type: String,
  714. default: "modals/editSong/MODAL_UUID"
  715. },
  716. discogsAlbum: { type: Object, default: null },
  717. bulk: { type: Boolean, default: false },
  718. flagged: { type: Boolean, default: false }
  719. },
  720. emits: [
  721. "error",
  722. "savedSuccess",
  723. "savedError",
  724. "flagSong",
  725. "nextSong",
  726. "close"
  727. ],
  728. data() {
  729. return {
  730. songDataLoaded: false,
  731. songDeleted: false,
  732. youtubeError: false,
  733. youtubeErrorMessage: "",
  734. focusedElementBefore: null,
  735. youtubeVideoDuration: "0.000",
  736. youtubeVideoCurrentTime: 0,
  737. youtubeVideoNote: "",
  738. useHTTPS: false,
  739. muted: false,
  740. volumeSliderValue: 0,
  741. artistInputValue: "",
  742. genreInputValue: "",
  743. tagInputValue: "",
  744. activityWatchVideoDataInterval: null,
  745. activityWatchVideoLastStatus: "",
  746. activityWatchVideoLastStartDuration: "",
  747. recommendedGenres: [
  748. "Blues",
  749. "Country",
  750. "Disco",
  751. "Funk",
  752. "Hip-Hop",
  753. "Jazz",
  754. "Metal",
  755. "Oldies",
  756. "Other",
  757. "Pop",
  758. "Rap",
  759. "Reggae",
  760. "Rock",
  761. "Techno",
  762. "Trance",
  763. "Classical",
  764. "Instrumental",
  765. "House",
  766. "Electronic",
  767. "Christian Rap",
  768. "Lo-Fi",
  769. "Musical",
  770. "Rock 'n' Roll",
  771. "Opera",
  772. "Drum & Bass",
  773. "Club-House",
  774. "Indie",
  775. "Heavy Metal",
  776. "Christian rock",
  777. "Dubstep"
  778. ],
  779. autosuggest: {
  780. allItems: {
  781. artists: [],
  782. genres: [],
  783. tags: []
  784. }
  785. },
  786. songNotFound: false,
  787. showRateDropdown: false,
  788. thumbnailNotSquare: false,
  789. thumbnailWidth: null,
  790. thumbnailHeight: null,
  791. thumbnailLoadError: false
  792. };
  793. },
  794. computed: {
  795. isYoutubeThumbnail() {
  796. return (
  797. this.songDataLoaded &&
  798. this.song.youtubeId &&
  799. this.song.thumbnail &&
  800. (this.song.thumbnail.lastIndexOf("i.ytimg.com") !== -1 ||
  801. this.song.thumbnail.lastIndexOf("img.youtube.com") !== -1)
  802. );
  803. },
  804. ...mapModalState("MODAL_MODULE_PATH", {
  805. tab: state => state.tab,
  806. video: state => state.video,
  807. song: state => state.song,
  808. songId: state => state.songId,
  809. prefillData: state => state.prefillData,
  810. originalSong: state => state.originalSong,
  811. reports: state => state.reports,
  812. newSong: state => state.newSong
  813. }),
  814. ...mapState("modalVisibility", {
  815. activeModals: state => state.activeModals
  816. }),
  817. ...mapGetters({
  818. socket: "websockets/getSocket"
  819. })
  820. },
  821. watch: {
  822. /* eslint-disable */
  823. "song.duration": function () {
  824. this.drawCanvas();
  825. },
  826. "song.skipDuration": function () {
  827. this.drawCanvas();
  828. },
  829. /* eslint-enable */
  830. songId(songId, oldSongId) {
  831. console.log("NEW SONG ID", songId);
  832. this.unloadSong(oldSongId);
  833. this.loadSong(songId);
  834. }
  835. },
  836. async mounted() {
  837. console.log("MOUNTED");
  838. this.activityWatchVideoDataInterval = setInterval(() => {
  839. this.sendActivityWatchVideoData();
  840. }, 1000);
  841. this.useHTTPS = await lofig.get("cookie.secure");
  842. ws.onConnect(this.init);
  843. let volume = parseFloat(localStorage.getItem("volume"));
  844. volume =
  845. typeof volume === "number" && !Number.isNaN(volume) ? volume : 20;
  846. localStorage.setItem("volume", volume);
  847. this.volumeSliderValue = volume;
  848. if (!this.newSong) {
  849. this.socket.on(
  850. "event:admin.song.removed",
  851. res => {
  852. if (res.data.songId === this.song._id) {
  853. this.songDeleted = true;
  854. }
  855. },
  856. { modalUuid: this.modalUuid }
  857. );
  858. }
  859. keyboardShortcuts.registerShortcut("editSong.pauseResumeVideo", {
  860. keyCode: 101,
  861. preventDefault: true,
  862. handler: () => {
  863. if (this.video.paused) this.play();
  864. else this.settings("pause");
  865. }
  866. });
  867. keyboardShortcuts.registerShortcut("editSong.stopVideo", {
  868. keyCode: 101,
  869. ctrl: true,
  870. preventDefault: true,
  871. handler: () => {
  872. this.settings("stop");
  873. }
  874. });
  875. keyboardShortcuts.registerShortcut("editSong.hardStopVideo", {
  876. keyCode: 101,
  877. ctrl: true,
  878. shift: true,
  879. preventDefault: true,
  880. handler: () => {
  881. this.settings("hardStop");
  882. }
  883. });
  884. keyboardShortcuts.registerShortcut("editSong.skipToLast10Secs", {
  885. keyCode: 102,
  886. preventDefault: true,
  887. handler: () => {
  888. this.settings("skipToLast10Secs");
  889. }
  890. });
  891. keyboardShortcuts.registerShortcut("editSong.lowerVolumeLarge", {
  892. keyCode: 98,
  893. preventDefault: true,
  894. handler: () => {
  895. this.volumeSliderValue = Math.max(
  896. 0,
  897. this.volumeSliderValue - 10
  898. );
  899. this.changeVolume();
  900. }
  901. });
  902. keyboardShortcuts.registerShortcut("editSong.lowerVolumeSmall", {
  903. keyCode: 98,
  904. ctrl: true,
  905. preventDefault: true,
  906. handler: () => {
  907. this.volumeSliderValue = Math.max(
  908. 0,
  909. this.volumeSliderValue - 1
  910. );
  911. this.changeVolume();
  912. }
  913. });
  914. keyboardShortcuts.registerShortcut("editSong.increaseVolumeLarge", {
  915. keyCode: 104,
  916. preventDefault: true,
  917. handler: () => {
  918. this.volumeSliderValue = Math.min(
  919. 100,
  920. this.volumeSliderValue + 10
  921. );
  922. this.changeVolume();
  923. }
  924. });
  925. keyboardShortcuts.registerShortcut("editSong.increaseVolumeSmall", {
  926. keyCode: 104,
  927. ctrl: true,
  928. preventDefault: true,
  929. handler: () => {
  930. this.volumeSliderValue = Math.min(
  931. 100,
  932. this.volumeSliderValue + 1
  933. );
  934. this.changeVolume();
  935. }
  936. });
  937. keyboardShortcuts.registerShortcut("editSong.save", {
  938. keyCode: 83,
  939. ctrl: true,
  940. preventDefault: true,
  941. handler: () => {
  942. this.save(this.song, false, "saveButton");
  943. }
  944. });
  945. keyboardShortcuts.registerShortcut("editSong.saveClose", {
  946. keyCode: 83,
  947. ctrl: true,
  948. alt: true,
  949. preventDefault: true,
  950. handler: () => {
  951. this.save(this.song, true, "saveAndCloseButton");
  952. }
  953. });
  954. keyboardShortcuts.registerShortcut("editSong.focusTitle", {
  955. keyCode: 36,
  956. preventDefault: true,
  957. handler: () => {
  958. this.$refs["title-input"].focus();
  959. }
  960. });
  961. keyboardShortcuts.registerShortcut("editSong.useAllDiscogs", {
  962. keyCode: 68,
  963. alt: true,
  964. ctrl: true,
  965. preventDefault: true,
  966. handler: () => {
  967. this.getAlbumData("title");
  968. this.getAlbumData("albumArt");
  969. this.getAlbumData("artists");
  970. this.getAlbumData("genres");
  971. }
  972. });
  973. keyboardShortcuts.registerShortcut("editSong.closeModal", {
  974. keyCode: 27,
  975. handler: () => {
  976. if (
  977. this.modals[
  978. this.activeModals[this.activeModals.length - 1]
  979. ] === "editSong" ||
  980. this.modals[
  981. this.activeModals[this.activeModals.length - 1]
  982. ] === "editSongs"
  983. ) {
  984. this.onCloseModal();
  985. }
  986. }
  987. });
  988. /*
  989. editSong.pauseResume - Num 5 - Pause/resume song
  990. editSong.stopVideo - Ctrl - Num 5 - Stop
  991. editSong.hardStopVideo - Shift - Ctrl - Num 5 - Stop
  992. editSong.skipToLast10Secs - Num 6 - Skip to last 10 seconds
  993. editSong.lowerVolumeLarge - Num 2 - Volume down by 10
  994. editSong.lowerVolumeSmall - Ctrl - Num 2 - Volume down by 1
  995. editSong.increaseVolumeLarge - Num 8 - Volume up by 10
  996. editSong.increaseVolumeSmall - Ctrl - Num 8 - Volume up by 1
  997. editSong.focusTitle - Home - Focus the title input
  998. editSong.focusDicogs - End - Focus the discogs input
  999. editSong.save - Ctrl - S - Saves song
  1000. editSong.save - Ctrl - Alt - S - Saves song and closes the modal
  1001. editSong.save - Ctrl - Alt - V - Saves song, verifies songs and then closes the modal
  1002. editSong.close - F4 - Closes modal without saving
  1003. editSong.useAllDiscogs - Ctrl - Alt - D - Sets all fields to the Discogs data
  1004. Inside Discogs inputs: Ctrl - D - Sets this field to the Discogs data
  1005. */
  1006. },
  1007. beforeUnmount() {
  1008. console.log("UNMOUNT");
  1009. if (!this.newSong) this.unloadSong(this.songId);
  1010. this.playerReady = false;
  1011. clearInterval(this.interval);
  1012. clearInterval(this.activityWatchVideoDataInterval);
  1013. const shortcutNames = [
  1014. "editSong.pauseResume",
  1015. "editSong.stopVideo",
  1016. "editSong.hardStopVideo",
  1017. "editSong.skipToLast10Secs",
  1018. "editSong.lowerVolumeLarge",
  1019. "editSong.lowerVolumeSmall",
  1020. "editSong.increaseVolumeLarge",
  1021. "editSong.increaseVolumeSmall",
  1022. "editSong.focusTitle",
  1023. "editSong.focusDicogs",
  1024. "editSong.save",
  1025. "editSong.saveClose",
  1026. "editSong.useAllDiscogs",
  1027. "editSong.closeModal"
  1028. ];
  1029. shortcutNames.forEach(shortcutName => {
  1030. keyboardShortcuts.unregisterShortcut(shortcutName);
  1031. });
  1032. if (!this.bulk) {
  1033. // Delete the VueX module that was created for this modal, after all other cleanup tasks are performed
  1034. this.$store.unregisterModule([
  1035. "modals",
  1036. "editSong",
  1037. this.modalUuid
  1038. ]);
  1039. }
  1040. },
  1041. methods: {
  1042. onThumbnailLoad() {
  1043. if (this.$refs.thumbnailElement) {
  1044. const thumbnailHeight =
  1045. this.$refs.thumbnailElement.naturalHeight;
  1046. const thumbnailWidth = this.$refs.thumbnailElement.naturalWidth;
  1047. this.thumbnailNotSquare = thumbnailHeight !== thumbnailWidth;
  1048. this.thumbnailHeight = thumbnailHeight;
  1049. this.thumbnailWidth = thumbnailWidth;
  1050. } else {
  1051. this.thumbnailNotSquare = false;
  1052. this.thumbnailHeight = null;
  1053. this.thumbnailWidth = null;
  1054. }
  1055. },
  1056. onThumbnailLoadError(error) {
  1057. this.thumbnailLoadError = error !== 0;
  1058. },
  1059. init() {
  1060. if (this.newSong) {
  1061. this.setSong({
  1062. youtubeId: "",
  1063. title: "",
  1064. artists: [],
  1065. genres: [],
  1066. tags: [],
  1067. duration: 0,
  1068. skipDuration: 0,
  1069. thumbnail: "",
  1070. verified: false
  1071. });
  1072. this.songDataLoaded = true;
  1073. this.showTab("youtube");
  1074. } else if (this.songId) this.loadSong(this.songId);
  1075. else if (!this.bulk) {
  1076. new Toast("You can't open EditSong without editing a song");
  1077. return this.closeModal("editSong");
  1078. }
  1079. this.interval = setInterval(() => {
  1080. if (
  1081. this.song.duration !== -1 &&
  1082. this.video.paused === false &&
  1083. this.playerReady &&
  1084. (this.video.player.getCurrentTime() -
  1085. this.song.skipDuration >
  1086. this.song.duration ||
  1087. (this.video.player.getCurrentTime() > 0 &&
  1088. this.video.player.getCurrentTime() >=
  1089. this.video.player.getDuration()))
  1090. ) {
  1091. this.stopVideo();
  1092. this.pauseVideo(true);
  1093. this.drawCanvas();
  1094. }
  1095. if (
  1096. this.playerReady &&
  1097. this.video.player.getVideoData &&
  1098. this.video.player.getVideoData() &&
  1099. this.video.player.getVideoData().video_id ===
  1100. this.song.youtubeId
  1101. ) {
  1102. const currentTime = this.video.player.getCurrentTime();
  1103. if (currentTime !== undefined)
  1104. this.youtubeVideoCurrentTime = currentTime.toFixed(3);
  1105. if (this.youtubeVideoDuration.indexOf(".000") !== -1) {
  1106. const duration = this.video.player.getDuration();
  1107. if (duration !== undefined) {
  1108. if (
  1109. `${this.youtubeVideoDuration}` ===
  1110. `${Number(this.song.duration).toFixed(3)}`
  1111. )
  1112. this.song.duration = duration.toFixed(3);
  1113. this.youtubeVideoDuration = duration.toFixed(3);
  1114. if (
  1115. this.youtubeVideoDuration.indexOf(".000") !== -1
  1116. )
  1117. this.youtubeVideoNote = "(~)";
  1118. else this.youtubeVideoNote = "";
  1119. this.drawCanvas();
  1120. }
  1121. }
  1122. }
  1123. if (this.video.paused === false) this.drawCanvas();
  1124. }, 200);
  1125. if (window.YT && window.YT.Player) {
  1126. this.video.player = new window.YT.Player("editSongPlayer", {
  1127. height: 298,
  1128. width: 530,
  1129. videoId: null,
  1130. host: "https://www.youtube-nocookie.com",
  1131. playerVars: {
  1132. controls: 0,
  1133. iv_load_policy: 3,
  1134. rel: 0,
  1135. showinfo: 0,
  1136. autoplay: 0
  1137. },
  1138. startSeconds: this.song.skipDuration,
  1139. events: {
  1140. onReady: () => {
  1141. let volume = parseFloat(
  1142. localStorage.getItem("volume")
  1143. );
  1144. volume = typeof volume === "number" ? volume : 20;
  1145. this.video.player.setVolume(volume);
  1146. if (volume > 0) this.video.player.unMute();
  1147. this.playerReady = true;
  1148. if (this.song && this.song._id)
  1149. this.video.player.cueVideoById(
  1150. this.song.youtubeId,
  1151. this.song.skipDuration
  1152. );
  1153. this.setPlaybackRate(null);
  1154. this.drawCanvas();
  1155. },
  1156. onStateChange: event => {
  1157. this.drawCanvas();
  1158. if (event.data === 1) {
  1159. this.video.paused = false;
  1160. let youtubeDuration =
  1161. this.video.player.getDuration();
  1162. const newYoutubeVideoDuration =
  1163. youtubeDuration.toFixed(3);
  1164. if (
  1165. this.youtubeVideoDuration.indexOf(
  1166. ".000"
  1167. ) !== -1 &&
  1168. `${this.youtubeVideoDuration}` !==
  1169. `${newYoutubeVideoDuration}`
  1170. ) {
  1171. const songDurationNumber = Number(
  1172. this.song.duration
  1173. );
  1174. const songDurationNumber2 =
  1175. Number(this.song.duration) + 1;
  1176. const songDurationNumber3 =
  1177. Number(this.song.duration) - 1;
  1178. const fixedSongDuration =
  1179. songDurationNumber.toFixed(3);
  1180. const fixedSongDuration2 =
  1181. songDurationNumber2.toFixed(3);
  1182. const fixedSongDuration3 =
  1183. songDurationNumber3.toFixed(3);
  1184. if (
  1185. `${this.youtubeVideoDuration}` ===
  1186. `${Number(
  1187. this.song.duration
  1188. ).toFixed(3)}` &&
  1189. (fixedSongDuration ===
  1190. this.youtubeVideoDuration ||
  1191. fixedSongDuration2 ===
  1192. this.youtubeVideoDuration ||
  1193. fixedSongDuration3 ===
  1194. this.youtubeVideoDuration)
  1195. )
  1196. this.song.duration =
  1197. newYoutubeVideoDuration;
  1198. this.youtubeVideoDuration =
  1199. newYoutubeVideoDuration;
  1200. if (
  1201. this.youtubeVideoDuration.indexOf(
  1202. ".000"
  1203. ) !== -1
  1204. )
  1205. this.youtubeVideoNote = "(~)";
  1206. else this.youtubeVideoNote = "";
  1207. }
  1208. if (this.song.duration === -1)
  1209. this.song.duration =
  1210. this.youtubeVideoDuration;
  1211. youtubeDuration -= this.song.skipDuration;
  1212. if (this.song.duration > youtubeDuration + 1) {
  1213. this.stopVideo();
  1214. this.pauseVideo(true);
  1215. return new Toast(
  1216. "Video can't play. Specified duration is bigger than the YouTube song duration."
  1217. );
  1218. }
  1219. if (this.song.duration <= 0) {
  1220. this.stopVideo();
  1221. this.pauseVideo(true);
  1222. return new Toast(
  1223. "Video can't play. Specified duration has to be more than 0 seconds."
  1224. );
  1225. }
  1226. if (
  1227. this.video.player.getCurrentTime() <
  1228. this.song.skipDuration
  1229. ) {
  1230. return this.seekTo(this.song.skipDuration);
  1231. }
  1232. this.setPlaybackRate(null);
  1233. } else if (event.data === 2) {
  1234. this.video.paused = true;
  1235. }
  1236. return false;
  1237. }
  1238. }
  1239. });
  1240. } else {
  1241. this.youtubeError = true;
  1242. this.youtubeErrorMessage = "Player could not be loaded.";
  1243. }
  1244. ["artists", "genres", "tags"].forEach(type => {
  1245. this.socket.dispatch(
  1246. `songs.get${type.charAt(0).toUpperCase()}${type.slice(1)}`,
  1247. res => {
  1248. if (res.status === "success") {
  1249. const { items } = res.data;
  1250. if (type === "genres")
  1251. this.autosuggest.allItems[type] = Array.from(
  1252. new Set([
  1253. ...this.recommendedGenres,
  1254. ...items
  1255. ])
  1256. );
  1257. else this.autosuggest.allItems[type] = items;
  1258. } else {
  1259. new Toast(res.message);
  1260. }
  1261. }
  1262. );
  1263. });
  1264. return null;
  1265. },
  1266. unloadSong(songId) {
  1267. this.songDataLoaded = false;
  1268. this.songDeleted = false;
  1269. this.stopVideo();
  1270. this.pauseVideo(true);
  1271. this.resetSong(songId);
  1272. this.thumbnailNotSquare = false;
  1273. this.thumbnailWidth = null;
  1274. this.thumbnailHeight = null;
  1275. this.youtubeVideoCurrentTime = "0.000";
  1276. this.youtubeVideoDuration = "0.000";
  1277. this.youtubeVideoNote = "";
  1278. this.socket.dispatch("apis.leaveRoom", `edit-song.${songId}`);
  1279. if (this.$refs.saveButton) this.$refs.saveButton.status = "default";
  1280. },
  1281. loadSong(songId) {
  1282. console.log(`LOAD SONG ${songId}`);
  1283. this.songNotFound = false;
  1284. this.socket.dispatch(`songs.getSongFromSongId`, songId, res => {
  1285. if (res.status === "success") {
  1286. let { song } = res.data;
  1287. song = Object.assign(song, this.prefillData);
  1288. this.setSong(song);
  1289. this.songDataLoaded = true;
  1290. this.socket.dispatch(
  1291. "apis.joinRoom",
  1292. `edit-song.${this.song._id}`
  1293. );
  1294. if (this.video.player && this.video.player.cueVideoById) {
  1295. this.video.player.cueVideoById(
  1296. this.song.youtubeId,
  1297. this.song.skipDuration
  1298. );
  1299. }
  1300. } else {
  1301. new Toast("Song with that ID not found");
  1302. if (this.bulk) this.songNotFound = true;
  1303. if (!this.bulk) this.closeModal("editSong");
  1304. }
  1305. });
  1306. this.socket.dispatch("reports.getReportsForSong", songId, res => {
  1307. this.updateReports(res.data.reports);
  1308. });
  1309. },
  1310. importAlbum(result) {
  1311. this.selectDiscogsAlbum(result);
  1312. this.openModal("importAlbum");
  1313. this.closeModal("editSong");
  1314. },
  1315. save(songToCopy, closeOrNext, saveButtonRefName, newSong = false) {
  1316. const song = JSON.parse(JSON.stringify(songToCopy));
  1317. if (!newSong) this.$emit("saving", song._id);
  1318. const saveButtonRef = this.$refs[saveButtonRefName];
  1319. if (!this.youtubeError && this.youtubeVideoDuration === "0.000") {
  1320. saveButtonRef.handleFailedSave();
  1321. if (!newSong) this.$emit("savedError", song._id);
  1322. return new Toast("The video appears to not be working.");
  1323. }
  1324. if (!song.title) {
  1325. saveButtonRef.handleFailedSave();
  1326. if (!newSong) this.$emit("savedError", song._id);
  1327. return new Toast("Please fill in all fields");
  1328. }
  1329. if (!song.thumbnail) {
  1330. saveButtonRef.handleFailedSave();
  1331. if (!newSong) this.$emit("savedError", song._id);
  1332. return new Toast("Please fill in all fields");
  1333. }
  1334. // const thumbnailHeight = this.$refs.thumbnailElement.naturalHeight;
  1335. // const thumbnailWidth = this.$refs.thumbnailElement.naturalWidth;
  1336. // if (thumbnailHeight < 80 || thumbnailWidth < 80) {
  1337. // saveButtonRef.handleFailedSave();
  1338. // return new Toast(
  1339. // "Thumbnail width and height must be at least 80px."
  1340. // );
  1341. // }
  1342. // if (thumbnailHeight > 4000 || thumbnailWidth > 4000) {
  1343. // saveButtonRef.handleFailedSave();
  1344. // return new Toast(
  1345. // "Thumbnail width and height must be less than 4000px."
  1346. // );
  1347. // }
  1348. // if (thumbnailHeight - thumbnailWidth > 5) {
  1349. // saveButtonRef.handleFailedSave();
  1350. // return new Toast("Thumbnail cannot be taller than it is wide.");
  1351. // }
  1352. // Youtube Id
  1353. if (
  1354. !newSong &&
  1355. this.youtubeError &&
  1356. this.originalSong.youtubeId !== song.youtubeId
  1357. ) {
  1358. saveButtonRef.handleFailedSave();
  1359. if (!newSong) this.$emit("savedError", song._id);
  1360. return new Toast(
  1361. "You're not allowed to change the YouTube id while the player is not working"
  1362. );
  1363. }
  1364. // Duration
  1365. if (
  1366. Number(song.skipDuration) + Number(song.duration) >
  1367. this.youtubeVideoDuration &&
  1368. ((!newSong && !this.youtubeError) ||
  1369. this.originalSong.duration !== song.duration)
  1370. ) {
  1371. saveButtonRef.handleFailedSave();
  1372. if (!newSong) this.$emit("savedError", song._id);
  1373. return new Toast(
  1374. "Duration can't be higher than the length of the video"
  1375. );
  1376. }
  1377. // Title
  1378. if (!validation.isLength(song.title, 1, 100)) {
  1379. saveButtonRef.handleFailedSave();
  1380. if (!newSong) this.$emit("savedError", song._id);
  1381. return new Toast(
  1382. "Title must have between 1 and 100 characters."
  1383. );
  1384. }
  1385. // Artists
  1386. if (
  1387. (song.verified && song.artists.length < 1) ||
  1388. song.artists.length > 10
  1389. ) {
  1390. saveButtonRef.handleFailedSave();
  1391. if (!newSong) this.$emit("savedError", song._id);
  1392. return new Toast(
  1393. "Invalid artists. You must have at least 1 artist and a maximum of 10 artists."
  1394. );
  1395. }
  1396. let error;
  1397. song.artists.forEach(artist => {
  1398. if (!validation.isLength(artist, 1, 64)) {
  1399. error = "Artist must have between 1 and 64 characters.";
  1400. return error;
  1401. }
  1402. if (artist === "NONE") {
  1403. error =
  1404. 'Invalid artist format. Artists are not allowed to be named "NONE".';
  1405. return error;
  1406. }
  1407. return false;
  1408. });
  1409. if (error) {
  1410. saveButtonRef.handleFailedSave();
  1411. if (!newSong) this.$emit("savedError", song._id);
  1412. return new Toast(error);
  1413. }
  1414. // Genres
  1415. error = undefined;
  1416. song.genres.forEach(genre => {
  1417. if (!validation.isLength(genre, 1, 32)) {
  1418. error = "Genre must have between 1 and 32 characters.";
  1419. return error;
  1420. }
  1421. if (!validation.regex.ascii.test(genre)) {
  1422. error =
  1423. "Invalid genre format. Only ascii characters are allowed.";
  1424. return error;
  1425. }
  1426. return false;
  1427. });
  1428. if (
  1429. (song.verified && song.genres.length < 1) ||
  1430. song.genres.length > 16
  1431. )
  1432. error = "You must have between 1 and 16 genres.";
  1433. if (error) {
  1434. saveButtonRef.handleFailedSave();
  1435. if (!newSong) this.$emit("savedError", song._id);
  1436. return new Toast(error);
  1437. }
  1438. error = undefined;
  1439. song.tags.forEach(tag => {
  1440. if (
  1441. !/^[a-zA-Z0-9_]{1,64}$|^[a-zA-Z0-9_]{1,64}\[[a-zA-Z0-9_]{1,64}\]$/.test(
  1442. tag
  1443. )
  1444. ) {
  1445. error = "Invalid tag format.";
  1446. return error;
  1447. }
  1448. return false;
  1449. });
  1450. if (error) {
  1451. saveButtonRef.handleFailedSave();
  1452. if (!newSong) this.$emit("savedError", song._id);
  1453. return new Toast(error);
  1454. }
  1455. // Thumbnail
  1456. if (!validation.isLength(song.thumbnail, 1, 256)) {
  1457. saveButtonRef.handleFailedSave();
  1458. if (!newSong) this.$emit("savedError", song._id);
  1459. return new Toast(
  1460. "Thumbnail must have between 8 and 256 characters."
  1461. );
  1462. }
  1463. if (this.useHTTPS && song.thumbnail.indexOf("https://") !== 0) {
  1464. saveButtonRef.handleFailedSave();
  1465. if (!newSong) this.$emit("savedError", song._id);
  1466. return new Toast('Thumbnail must start with "https://".');
  1467. }
  1468. if (
  1469. !this.useHTTPS &&
  1470. song.thumbnail.indexOf("http://") !== 0 &&
  1471. song.thumbnail.indexOf("https://") !== 0
  1472. ) {
  1473. saveButtonRef.handleFailedSave();
  1474. if (!newSong) this.$emit("savedError", song._id);
  1475. return new Toast('Thumbnail must start with "http://".');
  1476. }
  1477. saveButtonRef.status = "saving";
  1478. if (newSong)
  1479. return this.socket.dispatch(`songs.create`, song, res => {
  1480. new Toast(res.message);
  1481. if (res.status === "error") {
  1482. saveButtonRef.handleFailedSave();
  1483. return;
  1484. }
  1485. saveButtonRef.handleSuccessfulSave();
  1486. this.closeModal("editSong");
  1487. });
  1488. return this.socket.dispatch(`songs.update`, song._id, song, res => {
  1489. new Toast(res.message);
  1490. if (res.status === "error") {
  1491. saveButtonRef.handleFailedSave();
  1492. this.$emit("savedError", song._id);
  1493. return;
  1494. }
  1495. this.updateOriginalSong(song);
  1496. saveButtonRef.handleSuccessfulSave();
  1497. this.$emit("savedSuccess", song._id);
  1498. if (!closeOrNext) return;
  1499. if (this.bulk) this.$emit("nextSong");
  1500. else this.closeModal("editSong");
  1501. });
  1502. },
  1503. editNextSong() {
  1504. this.$emit("nextSong");
  1505. },
  1506. toggleFlag() {
  1507. this.$emit("toggleFlag");
  1508. },
  1509. getAlbumData(type) {
  1510. if (!this.song.discogs) return;
  1511. if (type === "title")
  1512. this.updateSongField({
  1513. field: "title",
  1514. value: this.song.discogs.track.title
  1515. });
  1516. if (type === "albumArt")
  1517. this.updateSongField({
  1518. field: "thumbnail",
  1519. value: this.song.discogs.album.albumArt
  1520. });
  1521. if (type === "genres")
  1522. this.updateSongField({
  1523. field: "genres",
  1524. value: JSON.parse(
  1525. JSON.stringify(this.song.discogs.album.genres)
  1526. )
  1527. });
  1528. if (type === "artists")
  1529. this.updateSongField({
  1530. field: "artists",
  1531. value: JSON.parse(
  1532. JSON.stringify(this.song.discogs.album.artists)
  1533. )
  1534. });
  1535. },
  1536. getYouTubeData(type) {
  1537. if (type === "title") {
  1538. try {
  1539. const { title } = this.video.player.getVideoData();
  1540. if (title)
  1541. this.updateSongField({
  1542. field: "title",
  1543. value: title
  1544. });
  1545. else throw new Error("No title found");
  1546. } catch (e) {
  1547. new Toast("Unable to fetch YouTube video title");
  1548. }
  1549. }
  1550. if (type === "thumbnail")
  1551. this.updateSongField({
  1552. field: "thumbnail",
  1553. value: `https://img.youtube.com/vi/${this.song.youtubeId}/mqdefault.jpg`
  1554. });
  1555. if (type === "author") {
  1556. try {
  1557. const { author } = this.video.player.getVideoData();
  1558. if (author) this.artistInputValue = author;
  1559. else throw new Error("No video author found");
  1560. } catch (e) {
  1561. new Toast("Unable to fetch YouTube video author");
  1562. }
  1563. }
  1564. },
  1565. fillDuration() {
  1566. this.song.duration =
  1567. this.youtubeVideoDuration - this.song.skipDuration;
  1568. },
  1569. settings(type) {
  1570. switch (type) {
  1571. case "stop":
  1572. this.stopVideo();
  1573. this.pauseVideo(true);
  1574. break;
  1575. case "hardStop":
  1576. this.hardStopVideo();
  1577. this.pauseVideo(true);
  1578. break;
  1579. case "pause":
  1580. this.pauseVideo(true);
  1581. break;
  1582. case "play":
  1583. this.pauseVideo(false);
  1584. break;
  1585. case "skipToLast10Secs":
  1586. this.seekTo(
  1587. this.song.duration - 10 + this.song.skipDuration
  1588. );
  1589. break;
  1590. default:
  1591. break;
  1592. }
  1593. },
  1594. play() {
  1595. if (
  1596. this.video.player.getVideoData().video_id !==
  1597. this.song.youtubeId
  1598. ) {
  1599. this.song.duration = -1;
  1600. this.loadVideoById(this.song.youtubeId, this.song.skipDuration);
  1601. }
  1602. this.settings("play");
  1603. },
  1604. seekTo(position) {
  1605. this.settings("play");
  1606. this.video.player.seekTo(position);
  1607. },
  1608. changeVolume() {
  1609. const volume = this.volumeSliderValue;
  1610. localStorage.setItem("volume", volume);
  1611. this.video.player.setVolume(volume);
  1612. if (volume > 0) {
  1613. this.video.player.unMute();
  1614. this.muted = false;
  1615. }
  1616. },
  1617. toggleMute() {
  1618. const previousVolume = parseFloat(localStorage.getItem("volume"));
  1619. const volume =
  1620. this.video.player.getVolume() <= 0 ? previousVolume : 0;
  1621. this.muted = !this.muted;
  1622. this.volumeSliderValue = volume;
  1623. this.video.player.setVolume(volume);
  1624. if (!this.muted) localStorage.setItem("volume", volume);
  1625. },
  1626. increaseVolume() {
  1627. const previousVolume = parseFloat(localStorage.getItem("volume"));
  1628. let volume = previousVolume + 5;
  1629. this.muted = false;
  1630. if (volume > 100) volume = 100;
  1631. this.volumeSliderValue = volume;
  1632. this.video.player.setVolume(volume);
  1633. localStorage.setItem("volume", volume);
  1634. },
  1635. addTag(type, value) {
  1636. if (type === "genres") {
  1637. const genre = value || this.genreInputValue.trim();
  1638. if (
  1639. this.song.genres
  1640. .map(genre => genre.toLowerCase())
  1641. .indexOf(genre.toLowerCase()) !== -1
  1642. )
  1643. return new Toast("Genre already exists");
  1644. if (genre) {
  1645. this.song.genres.push(genre);
  1646. this.genreInputValue = "";
  1647. return false;
  1648. }
  1649. return new Toast("Genre cannot be empty");
  1650. }
  1651. if (type === "artists") {
  1652. const artist = value || this.artistInputValue;
  1653. if (this.song.artists.indexOf(artist) !== -1)
  1654. return new Toast("Artist already exists");
  1655. if (artist !== "") {
  1656. this.song.artists.push(artist);
  1657. this.artistInputValue = "";
  1658. return false;
  1659. }
  1660. return new Toast("Artist cannot be empty");
  1661. }
  1662. if (type === "tags") {
  1663. const tag = value || this.tagInputValue;
  1664. if (this.song.tags.indexOf(tag) !== -1)
  1665. return new Toast("Tag already exists");
  1666. if (tag !== "") {
  1667. this.song.tags.push(tag);
  1668. this.tagInputValue = "";
  1669. return false;
  1670. }
  1671. return new Toast("Tag cannot be empty");
  1672. }
  1673. return false;
  1674. },
  1675. removeTag(type, value) {
  1676. if (type === "genres")
  1677. this.song.genres.splice(this.song.genres.indexOf(value), 1);
  1678. else if (type === "artists")
  1679. this.song.artists.splice(this.song.artists.indexOf(value), 1);
  1680. else if (type === "tags")
  1681. this.song.tags.splice(this.song.tags.indexOf(value), 1);
  1682. },
  1683. drawCanvas() {
  1684. if (!this.songDataLoaded) return;
  1685. const canvasElement = this.$refs.durationCanvas;
  1686. const ctx = canvasElement.getContext("2d");
  1687. const videoDuration = Number(this.youtubeVideoDuration);
  1688. const skipDuration = Number(this.song.skipDuration);
  1689. const duration = Number(this.song.duration);
  1690. const afterDuration = videoDuration - (skipDuration + duration);
  1691. const width = 530;
  1692. const currentTime =
  1693. this.video.player && this.video.player.getCurrentTime
  1694. ? this.video.player.getCurrentTime()
  1695. : 0;
  1696. const widthSkipDuration = (skipDuration / videoDuration) * width;
  1697. const widthDuration = (duration / videoDuration) * width;
  1698. const widthAfterDuration = (afterDuration / videoDuration) * width;
  1699. const widthCurrentTime = (currentTime / videoDuration) * width;
  1700. const skipDurationColor = "#F42003";
  1701. const durationColor = "#03A9F4";
  1702. const afterDurationColor = "#41E841";
  1703. const currentDurationColor = "#3b25e8";
  1704. ctx.fillStyle = skipDurationColor;
  1705. ctx.fillRect(0, 0, widthSkipDuration, 20);
  1706. ctx.fillStyle = durationColor;
  1707. ctx.fillRect(widthSkipDuration, 0, widthDuration, 20);
  1708. ctx.fillStyle = afterDurationColor;
  1709. ctx.fillRect(
  1710. widthSkipDuration + widthDuration,
  1711. 0,
  1712. widthAfterDuration,
  1713. 20
  1714. );
  1715. ctx.fillStyle = currentDurationColor;
  1716. ctx.fillRect(widthCurrentTime, 0, 1, 20);
  1717. },
  1718. setTrackPosition(event) {
  1719. this.seekTo(
  1720. Number(
  1721. Number(this.video.player.getDuration()) *
  1722. ((event.pageX -
  1723. event.target.getBoundingClientRect().left) /
  1724. 530)
  1725. )
  1726. );
  1727. },
  1728. toggleGenreHelper() {
  1729. this.$refs.genreHelper.toggleBox();
  1730. },
  1731. resetGenreHelper() {
  1732. this.$refs.genreHelper.resetBox();
  1733. },
  1734. sendActivityWatchVideoData() {
  1735. if (!this.video.paused) {
  1736. if (this.activityWatchVideoLastStatus !== "playing") {
  1737. this.activityWatchVideoLastStatus = "playing";
  1738. if (
  1739. this.song.skipDuration > 0 &&
  1740. parseFloat(this.youtubeVideoCurrentTime) === 0
  1741. ) {
  1742. this.activityWatchVideoLastStartDuration = Math.floor(
  1743. this.song.skipDuration +
  1744. parseFloat(this.youtubeVideoCurrentTime)
  1745. );
  1746. } else {
  1747. this.activityWatchVideoLastStartDuration = Math.floor(
  1748. parseFloat(this.youtubeVideoCurrentTime)
  1749. );
  1750. }
  1751. }
  1752. const videoData = {
  1753. title: this.song.title,
  1754. artists: this.song.artists
  1755. ? this.song.artists.join(", ")
  1756. : null,
  1757. youtubeId: this.song.youtubeId,
  1758. muted: this.muted,
  1759. volume: this.volumeSliderValue,
  1760. startedDuration:
  1761. this.activityWatchVideoLastStartDuration <= 0
  1762. ? 0
  1763. : this.activityWatchVideoLastStartDuration,
  1764. source: `editSong#${this.song.youtubeId}`,
  1765. hostname: window.location.hostname
  1766. };
  1767. aw.sendVideoData(videoData);
  1768. } else {
  1769. this.activityWatchVideoLastStatus = "not_playing";
  1770. }
  1771. },
  1772. remove(id) {
  1773. this.socket.dispatch("songs.remove", id, res => {
  1774. new Toast(res.message);
  1775. });
  1776. },
  1777. confirmAction({ message, action, params }) {
  1778. this.openModal({
  1779. modal: "confirm",
  1780. data: {
  1781. message,
  1782. action,
  1783. params,
  1784. onCompleted: this.handleConfirmed
  1785. }
  1786. });
  1787. },
  1788. handleConfirmed({ action, params }) {
  1789. if (typeof this[action] === "function") {
  1790. if (params) this[action](params);
  1791. else this[action]();
  1792. }
  1793. },
  1794. onCloseModal() {
  1795. const songStringified = JSON.stringify({
  1796. ...this.song,
  1797. ...{
  1798. duration: Number(this.song.duration).toFixed(3)
  1799. }
  1800. });
  1801. const originalSongStringified = JSON.stringify({
  1802. ...this.originalSong,
  1803. ...{
  1804. duration: Number(this.originalSong.duration).toFixed(3)
  1805. }
  1806. });
  1807. const unsavedChanges = songStringified !== originalSongStringified;
  1808. if (unsavedChanges) {
  1809. return this.confirmAction({
  1810. message:
  1811. "You have unsaved changes. Are you sure you want to discard unsaved changes?",
  1812. action: "closeThisModal",
  1813. params: null
  1814. });
  1815. }
  1816. return this.closeThisModal();
  1817. },
  1818. closeThisModal() {
  1819. if (this.bulk) this.$emit("close");
  1820. else this.closeModal("editSong");
  1821. },
  1822. ...mapActions("modals/importAlbum", ["selectDiscogsAlbum"]),
  1823. ...mapActions({
  1824. showTab(dispatch, payload) {
  1825. if (this.$refs[`${payload}-tab`])
  1826. this.$refs[`${payload}-tab`].scrollIntoView({
  1827. block: "nearest"
  1828. });
  1829. return dispatch(
  1830. `${this.modalModulePath.replace(
  1831. "MODAL_UUID",
  1832. this.modalUuid
  1833. )}/showTab`,
  1834. payload
  1835. );
  1836. }
  1837. }),
  1838. ...mapModalActions("MODAL_MODULE_PATH", [
  1839. "stopVideo",
  1840. "hardStopVideo",
  1841. "loadVideoById",
  1842. "pauseVideo",
  1843. "getCurrentTime",
  1844. "setSong",
  1845. "resetSong",
  1846. "updateOriginalSong",
  1847. "updateSongField",
  1848. "updateReports",
  1849. "setPlaybackRate"
  1850. ]),
  1851. ...mapActions("modalVisibility", ["closeModal", "openModal"])
  1852. }
  1853. };
  1854. </script>
  1855. <style lang="less" scoped>
  1856. .night-mode {
  1857. .edit-section,
  1858. .player-section,
  1859. #tabs-container {
  1860. background-color: var(--dark-grey-3) !important;
  1861. border: 0 !important;
  1862. .tab {
  1863. border: 0 !important;
  1864. }
  1865. }
  1866. #tabs-container #tab-selection .button {
  1867. background: var(--dark-grey) !important;
  1868. color: var(--white) !important;
  1869. }
  1870. .left-section {
  1871. .edit-section {
  1872. .album-get-button,
  1873. .duration-fill-button,
  1874. .youtube-get-button,
  1875. .add-button {
  1876. &:focus,
  1877. &:hover {
  1878. border: none !important;
  1879. }
  1880. }
  1881. }
  1882. }
  1883. #durationCanvas {
  1884. background-color: var(--dark-grey-2) !important;
  1885. }
  1886. }
  1887. .modal-card-body {
  1888. display: flex;
  1889. }
  1890. .notice-container {
  1891. display: flex;
  1892. flex: 1;
  1893. justify-content: center;
  1894. h4 {
  1895. margin: auto;
  1896. }
  1897. }
  1898. .left-section {
  1899. height: 100%;
  1900. display: flex;
  1901. flex-direction: column;
  1902. margin-right: 16px;
  1903. .top-section {
  1904. display: flex;
  1905. .player-section {
  1906. width: 530px;
  1907. display: flex;
  1908. flex-direction: column;
  1909. border: 1px solid var(--light-grey-3);
  1910. border-radius: @border-radius;
  1911. overflow: hidden;
  1912. #durationCanvas {
  1913. background-color: var(--light-grey-2);
  1914. }
  1915. .player-error {
  1916. display: flex;
  1917. height: 318px;
  1918. width: 530px;
  1919. align-items: center;
  1920. * {
  1921. margin: 0;
  1922. flex: 1;
  1923. font-size: 30px;
  1924. text-align: center;
  1925. }
  1926. }
  1927. .player-footer {
  1928. display: flex;
  1929. justify-content: space-between;
  1930. height: 54px;
  1931. padding-left: 10px;
  1932. padding-right: 10px;
  1933. > * {
  1934. width: 33.3%;
  1935. display: flex;
  1936. align-items: center;
  1937. }
  1938. .player-footer-left {
  1939. flex: 1;
  1940. & > .button:not(:first-child) {
  1941. margin-left: 5px;
  1942. }
  1943. :deep(& > .playerRateDropdown) {
  1944. margin-left: 5px;
  1945. margin-bottom: unset !important;
  1946. .control.has-addons {
  1947. margin-bottom: unset !important;
  1948. & > .button {
  1949. font-size: 24px;
  1950. }
  1951. }
  1952. }
  1953. :deep(.tippy-box[data-theme~="dropdown"]) {
  1954. max-width: 100px !important;
  1955. .nav-dropdown-items .nav-item {
  1956. justify-content: center !important;
  1957. border-radius: @border-radius !important;
  1958. &.active {
  1959. background-color: var(--primary-color);
  1960. color: var(--white);
  1961. }
  1962. }
  1963. }
  1964. }
  1965. .player-footer-center {
  1966. justify-content: center;
  1967. align-items: center;
  1968. flex: 2;
  1969. font-size: 18px;
  1970. font-weight: 400;
  1971. width: 200px;
  1972. margin: 0 5px;
  1973. img {
  1974. height: 21px;
  1975. margin-right: 12px;
  1976. filter: invert(26%) sepia(54%) saturate(6317%)
  1977. hue-rotate(2deg) brightness(92%) contrast(115%);
  1978. }
  1979. }
  1980. .player-footer-right {
  1981. justify-content: right;
  1982. flex: 1;
  1983. #volume-control {
  1984. margin: 3px;
  1985. margin-top: 0;
  1986. display: flex;
  1987. align-items: center;
  1988. cursor: pointer;
  1989. .volume-slider {
  1990. width: 100%;
  1991. padding: 0 15px;
  1992. background: transparent;
  1993. min-width: 100px;
  1994. }
  1995. input[type="range"] {
  1996. -webkit-appearance: none;
  1997. margin: 7.3px 0;
  1998. }
  1999. input[type="range"]:focus {
  2000. outline: none;
  2001. }
  2002. input[type="range"]::-webkit-slider-runnable-track {
  2003. width: 100%;
  2004. height: 5.2px;
  2005. cursor: pointer;
  2006. box-shadow: 0;
  2007. background: var(--light-grey-3);
  2008. border-radius: @border-radius;
  2009. border: 0;
  2010. }
  2011. input[type="range"]::-webkit-slider-thumb {
  2012. box-shadow: 0;
  2013. border: 0;
  2014. height: 19px;
  2015. width: 19px;
  2016. border-radius: 100%;
  2017. background: var(--primary-color);
  2018. cursor: pointer;
  2019. -webkit-appearance: none;
  2020. margin-top: -6.5px;
  2021. }
  2022. input[type="range"]::-moz-range-track {
  2023. width: 100%;
  2024. height: 5.2px;
  2025. cursor: pointer;
  2026. box-shadow: 0;
  2027. background: var(--light-grey-3);
  2028. border-radius: @border-radius;
  2029. border: 0;
  2030. }
  2031. input[type="range"]::-moz-range-thumb {
  2032. box-shadow: 0;
  2033. border: 0;
  2034. height: 19px;
  2035. width: 19px;
  2036. border-radius: 100%;
  2037. background: var(--primary-color);
  2038. cursor: pointer;
  2039. -webkit-appearance: none;
  2040. margin-top: -6.5px;
  2041. }
  2042. input[type="range"]::-ms-track {
  2043. width: 100%;
  2044. height: 5.2px;
  2045. cursor: pointer;
  2046. box-shadow: 0;
  2047. background: var(--light-grey-3);
  2048. border-radius: @border-radius;
  2049. }
  2050. input[type="range"]::-ms-fill-lower {
  2051. background: var(--light-grey-3);
  2052. border: 0;
  2053. border-radius: 0;
  2054. box-shadow: 0;
  2055. }
  2056. input[type="range"]::-ms-fill-upper {
  2057. background: var(--light-grey-3);
  2058. border: 0;
  2059. border-radius: 0;
  2060. box-shadow: 0;
  2061. }
  2062. input[type="range"]::-ms-thumb {
  2063. box-shadow: 0;
  2064. border: 0;
  2065. height: 15px;
  2066. width: 15px;
  2067. border-radius: 100%;
  2068. background: var(--primary-color);
  2069. cursor: pointer;
  2070. -webkit-appearance: none;
  2071. margin-top: 1.5px;
  2072. }
  2073. }
  2074. }
  2075. }
  2076. }
  2077. :deep(.thumbnail-preview) {
  2078. width: 189px;
  2079. height: 189px;
  2080. margin-left: 16px;
  2081. }
  2082. .thumbnail-dummy {
  2083. opacity: 0;
  2084. height: 10px;
  2085. width: 10px;
  2086. }
  2087. }
  2088. .edit-section {
  2089. display: flex;
  2090. flex-wrap: wrap;
  2091. flex-grow: 1;
  2092. border: 1px solid var(--light-grey-3);
  2093. margin-top: 16px;
  2094. border-radius: @border-radius;
  2095. .album-get-button {
  2096. background-color: var(--purple);
  2097. color: var(--white);
  2098. width: 32px;
  2099. text-align: center;
  2100. border-width: 0;
  2101. }
  2102. .duration-fill-button,
  2103. .youtube-get-button {
  2104. background-color: var(--dark-red);
  2105. color: var(--white);
  2106. width: 32px;
  2107. text-align: center;
  2108. border-width: 0;
  2109. }
  2110. .add-button {
  2111. background-color: var(--primary-color) !important;
  2112. width: 32px;
  2113. i {
  2114. font-size: 32px;
  2115. }
  2116. }
  2117. .album-get-button,
  2118. .duration-fill-button,
  2119. .youtube-get-button,
  2120. .add-button {
  2121. &:focus,
  2122. &:hover {
  2123. filter: contrast(0.75);
  2124. border: 1px solid var(--black) !important;
  2125. }
  2126. }
  2127. .youtube-get-button {
  2128. padding-left: 4px;
  2129. padding-right: 4px;
  2130. .youtube-icon {
  2131. background: var(--white);
  2132. }
  2133. }
  2134. > div {
  2135. margin: 16px !important;
  2136. }
  2137. input {
  2138. width: 100%;
  2139. }
  2140. .title-container {
  2141. width: calc((100% - 32px) / 2);
  2142. }
  2143. .duration-container {
  2144. margin-right: 16px;
  2145. margin-left: 16px;
  2146. width: calc((100% - 32px) / 4);
  2147. }
  2148. .skip-duration-container {
  2149. width: calc((100% - 32px) / 4);
  2150. }
  2151. .album-art-container {
  2152. margin-right: 16px;
  2153. width: calc((100% - 16px) / 8 * 4);
  2154. }
  2155. .youtube-id-container {
  2156. margin-right: 16px;
  2157. width: calc((100% - 16px) / 8 * 3);
  2158. }
  2159. .verified-container {
  2160. width: calc((100% - 16px) / 8);
  2161. .checkbox-control {
  2162. margin-top: 10px;
  2163. }
  2164. }
  2165. .artists-container {
  2166. width: calc((100% - 32px) / 3);
  2167. position: relative;
  2168. }
  2169. .genres-container {
  2170. width: calc((100% - 32px) / 3);
  2171. margin-left: 16px;
  2172. margin-right: 16px;
  2173. position: relative;
  2174. label {
  2175. display: flex;
  2176. i {
  2177. font-size: 15px;
  2178. align-self: center;
  2179. margin-left: 5px;
  2180. color: var(--primary-color);
  2181. cursor: pointer;
  2182. -webkit-user-select: none;
  2183. -moz-user-select: none;
  2184. -ms-user-select: none;
  2185. user-select: none;
  2186. }
  2187. }
  2188. }
  2189. .tags-container {
  2190. width: calc((100% - 32px) / 3);
  2191. position: relative;
  2192. }
  2193. .list-item-circle {
  2194. background-color: var(--primary-color);
  2195. width: 16px;
  2196. height: 16px;
  2197. border-radius: 8px;
  2198. cursor: pointer;
  2199. margin-right: 8px;
  2200. float: left;
  2201. -webkit-touch-callout: none;
  2202. -webkit-user-select: none;
  2203. -khtml-user-select: none;
  2204. -moz-user-select: none;
  2205. -ms-user-select: none;
  2206. user-select: none;
  2207. i {
  2208. color: var(--primary-color);
  2209. font-size: 14px;
  2210. margin-left: 1px;
  2211. position: relative;
  2212. top: -1px;
  2213. }
  2214. }
  2215. .list-item-circle:hover,
  2216. .list-item-circle:focus {
  2217. i {
  2218. color: var(--white);
  2219. }
  2220. }
  2221. .list-item > p {
  2222. line-height: 16px;
  2223. word-wrap: break-word;
  2224. width: calc(100% - 24px);
  2225. left: 24px;
  2226. float: left;
  2227. margin-bottom: 8px;
  2228. }
  2229. .list-item:last-child > p {
  2230. margin-bottom: 0;
  2231. }
  2232. .thumbnail-warning {
  2233. color: var(--red);
  2234. font-size: 18px;
  2235. margin: auto 0 auto 5px;
  2236. }
  2237. }
  2238. }
  2239. .right-section {
  2240. flex-basis: unset !important;
  2241. flex-grow: 0 !important;
  2242. display: flex;
  2243. height: 100%;
  2244. #tabs-container {
  2245. width: 376px;
  2246. #tab-selection {
  2247. display: flex;
  2248. overflow-x: auto;
  2249. .button {
  2250. border-radius: @border-radius @border-radius 0 0;
  2251. border: 0;
  2252. text-transform: uppercase;
  2253. font-size: 14px;
  2254. color: var(--dark-grey-3);
  2255. background-color: var(--light-grey-2);
  2256. flex-grow: 1;
  2257. height: 32px;
  2258. &:not(:first-of-type) {
  2259. margin-left: 5px;
  2260. }
  2261. }
  2262. .selected {
  2263. background-color: var(--primary-color) !important;
  2264. color: var(--white) !important;
  2265. font-weight: 600;
  2266. }
  2267. }
  2268. .tab {
  2269. border: 1px solid var(--light-grey-3);
  2270. border-radius: 0 0 @border-radius @border-radius;
  2271. padding: 15px;
  2272. height: calc(100% - 32px);
  2273. overflow: auto;
  2274. }
  2275. }
  2276. }
  2277. @media screen and (max-width: 1100px) {
  2278. .left-section,
  2279. .right-section {
  2280. height: unset;
  2281. max-height: unset;
  2282. }
  2283. .left-section {
  2284. margin-right: 0;
  2285. }
  2286. .right-section {
  2287. flex-basis: 100% !important;
  2288. #tabs-container {
  2289. width: 100%;
  2290. }
  2291. }
  2292. }
  2293. .modal-card-foot .is-primary {
  2294. width: 200px;
  2295. }
  2296. :deep(.autosuggest-container) {
  2297. top: unset;
  2298. }
  2299. </style>