index.vue 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521
  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-${modalUuid}`" />
  45. <div v-show="youtubeError" class="player-error">
  46. <h2>{{ youtubeErrorMessage }}</h2>
  47. </div>
  48. <canvas
  49. :ref="`durationCanvas-${modalUuid}`"
  50. class="duration-canvas"
  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
  673. id="genreHelper"
  674. ref="genreHelper"
  675. :column="false"
  676. title="Song Genres List"
  677. >
  678. <template #body>
  679. <span
  680. v-for="item in autosuggest.allItems.genres"
  681. :key="`genre-helper-${item}`"
  682. >
  683. {{ item }}
  684. </span>
  685. </template>
  686. </floating-box>
  687. </div>
  688. </template>
  689. <script>
  690. import { mapState, mapGetters, mapActions } from "vuex";
  691. import Toast from "toasters";
  692. import { mapModalState, mapModalActions } from "@/vuex_helpers";
  693. import aw from "@/aw";
  694. import ws from "@/ws";
  695. import validation from "@/validation";
  696. import keyboardShortcuts from "@/keyboardShortcuts";
  697. import FloatingBox from "../../FloatingBox.vue";
  698. import SaveButton from "../../SaveButton.vue";
  699. import AutoSuggest from "@/components/AutoSuggest.vue";
  700. import Discogs from "./Tabs/Discogs.vue";
  701. import Reports from "./Tabs/Reports.vue";
  702. import Youtube from "./Tabs/Youtube.vue";
  703. import MusareSongs from "./Tabs/Songs.vue";
  704. export default {
  705. components: {
  706. FloatingBox,
  707. SaveButton,
  708. AutoSuggest,
  709. Discogs,
  710. Reports,
  711. Youtube,
  712. MusareSongs
  713. },
  714. props: {
  715. // songId: { type: String, default: null },
  716. modalUuid: { type: String, default: "" },
  717. modalModulePath: {
  718. type: String,
  719. default: "modals/editSong/MODAL_UUID"
  720. },
  721. discogsAlbum: { type: Object, default: null },
  722. bulk: { type: Boolean, default: false },
  723. flagged: { type: Boolean, default: false }
  724. },
  725. emits: [
  726. "error",
  727. "savedSuccess",
  728. "savedError",
  729. "flagSong",
  730. "nextSong",
  731. "close"
  732. ],
  733. data() {
  734. return {
  735. songDataLoaded: false,
  736. songDeleted: false,
  737. youtubeError: false,
  738. youtubeErrorMessage: "",
  739. focusedElementBefore: null,
  740. youtubeVideoDuration: "0.000",
  741. youtubeVideoCurrentTime: 0,
  742. youtubeVideoNote: "",
  743. useHTTPS: false,
  744. muted: false,
  745. volumeSliderValue: 0,
  746. artistInputValue: "",
  747. genreInputValue: "",
  748. tagInputValue: "",
  749. activityWatchVideoDataInterval: null,
  750. activityWatchVideoLastStatus: "",
  751. activityWatchVideoLastStartDuration: "",
  752. recommendedGenres: [
  753. "Blues",
  754. "Country",
  755. "Disco",
  756. "Funk",
  757. "Hip-Hop",
  758. "Jazz",
  759. "Metal",
  760. "Oldies",
  761. "Other",
  762. "Pop",
  763. "Rap",
  764. "Reggae",
  765. "Rock",
  766. "Techno",
  767. "Trance",
  768. "Classical",
  769. "Instrumental",
  770. "House",
  771. "Electronic",
  772. "Christian Rap",
  773. "Lo-Fi",
  774. "Musical",
  775. "Rock 'n' Roll",
  776. "Opera",
  777. "Drum & Bass",
  778. "Club-House",
  779. "Indie",
  780. "Heavy Metal",
  781. "Christian rock",
  782. "Dubstep"
  783. ],
  784. autosuggest: {
  785. allItems: {
  786. artists: [],
  787. genres: [],
  788. tags: []
  789. }
  790. },
  791. songNotFound: false,
  792. showRateDropdown: false,
  793. thumbnailNotSquare: false,
  794. thumbnailWidth: null,
  795. thumbnailHeight: null,
  796. thumbnailLoadError: false
  797. };
  798. },
  799. computed: {
  800. isYoutubeThumbnail() {
  801. return (
  802. this.songDataLoaded &&
  803. this.song.youtubeId &&
  804. this.song.thumbnail &&
  805. (this.song.thumbnail.lastIndexOf("i.ytimg.com") !== -1 ||
  806. this.song.thumbnail.lastIndexOf("img.youtube.com") !== -1)
  807. );
  808. },
  809. ...mapModalState("MODAL_MODULE_PATH", {
  810. tab: state => state.tab,
  811. video: state => state.video,
  812. song: state => state.song,
  813. songId: state => state.songId,
  814. prefillData: state => state.prefillData,
  815. originalSong: state => state.originalSong,
  816. reports: state => state.reports,
  817. newSong: state => state.newSong
  818. }),
  819. ...mapState("modalVisibility", {
  820. activeModals: state => state.activeModals
  821. }),
  822. ...mapGetters({
  823. socket: "websockets/getSocket"
  824. })
  825. },
  826. watch: {
  827. /* eslint-disable */
  828. "song.duration": function () {
  829. this.drawCanvas();
  830. },
  831. "song.skipDuration": function () {
  832. this.drawCanvas();
  833. },
  834. /* eslint-enable */
  835. songId(songId, oldSongId) {
  836. console.log("NEW SONG ID", songId);
  837. this.unloadSong(oldSongId);
  838. this.loadSong(songId);
  839. }
  840. },
  841. async mounted() {
  842. console.log("MOUNTED");
  843. this.activityWatchVideoDataInterval = setInterval(() => {
  844. this.sendActivityWatchVideoData();
  845. }, 1000);
  846. this.useHTTPS = await lofig.get("cookie.secure");
  847. ws.onConnect(this.init);
  848. let volume = parseFloat(localStorage.getItem("volume"));
  849. volume =
  850. typeof volume === "number" && !Number.isNaN(volume) ? volume : 20;
  851. localStorage.setItem("volume", volume);
  852. this.volumeSliderValue = volume;
  853. if (!this.newSong) {
  854. this.socket.on(
  855. "event:admin.song.removed",
  856. res => {
  857. if (res.data.songId === this.song._id) {
  858. this.songDeleted = true;
  859. }
  860. },
  861. { modalUuid: this.modalUuid }
  862. );
  863. }
  864. keyboardShortcuts.registerShortcut("editSong.pauseResumeVideo", {
  865. keyCode: 101,
  866. preventDefault: true,
  867. handler: () => {
  868. if (this.video.paused) this.play();
  869. else this.settings("pause");
  870. }
  871. });
  872. keyboardShortcuts.registerShortcut("editSong.stopVideo", {
  873. keyCode: 101,
  874. ctrl: true,
  875. preventDefault: true,
  876. handler: () => {
  877. this.settings("stop");
  878. }
  879. });
  880. keyboardShortcuts.registerShortcut("editSong.hardStopVideo", {
  881. keyCode: 101,
  882. ctrl: true,
  883. shift: true,
  884. preventDefault: true,
  885. handler: () => {
  886. this.settings("hardStop");
  887. }
  888. });
  889. keyboardShortcuts.registerShortcut("editSong.skipToLast10Secs", {
  890. keyCode: 102,
  891. preventDefault: true,
  892. handler: () => {
  893. this.settings("skipToLast10Secs");
  894. }
  895. });
  896. keyboardShortcuts.registerShortcut("editSong.lowerVolumeLarge", {
  897. keyCode: 98,
  898. preventDefault: true,
  899. handler: () => {
  900. this.volumeSliderValue = Math.max(
  901. 0,
  902. this.volumeSliderValue - 10
  903. );
  904. this.changeVolume();
  905. }
  906. });
  907. keyboardShortcuts.registerShortcut("editSong.lowerVolumeSmall", {
  908. keyCode: 98,
  909. ctrl: true,
  910. preventDefault: true,
  911. handler: () => {
  912. this.volumeSliderValue = Math.max(
  913. 0,
  914. this.volumeSliderValue - 1
  915. );
  916. this.changeVolume();
  917. }
  918. });
  919. keyboardShortcuts.registerShortcut("editSong.increaseVolumeLarge", {
  920. keyCode: 104,
  921. preventDefault: true,
  922. handler: () => {
  923. this.volumeSliderValue = Math.min(
  924. 100,
  925. this.volumeSliderValue + 10
  926. );
  927. this.changeVolume();
  928. }
  929. });
  930. keyboardShortcuts.registerShortcut("editSong.increaseVolumeSmall", {
  931. keyCode: 104,
  932. ctrl: true,
  933. preventDefault: true,
  934. handler: () => {
  935. this.volumeSliderValue = Math.min(
  936. 100,
  937. this.volumeSliderValue + 1
  938. );
  939. this.changeVolume();
  940. }
  941. });
  942. keyboardShortcuts.registerShortcut("editSong.save", {
  943. keyCode: 83,
  944. ctrl: true,
  945. preventDefault: true,
  946. handler: () => {
  947. this.save(this.song, false, "saveButton");
  948. }
  949. });
  950. keyboardShortcuts.registerShortcut("editSong.saveClose", {
  951. keyCode: 83,
  952. ctrl: true,
  953. alt: true,
  954. preventDefault: true,
  955. handler: () => {
  956. this.save(this.song, true, "saveAndCloseButton");
  957. }
  958. });
  959. keyboardShortcuts.registerShortcut("editSong.focusTitle", {
  960. keyCode: 36,
  961. preventDefault: true,
  962. handler: () => {
  963. this.$refs["title-input"].focus();
  964. }
  965. });
  966. keyboardShortcuts.registerShortcut("editSong.useAllDiscogs", {
  967. keyCode: 68,
  968. alt: true,
  969. ctrl: true,
  970. preventDefault: true,
  971. handler: () => {
  972. this.getAlbumData("title");
  973. this.getAlbumData("albumArt");
  974. this.getAlbumData("artists");
  975. this.getAlbumData("genres");
  976. }
  977. });
  978. keyboardShortcuts.registerShortcut("editSong.closeModal", {
  979. keyCode: 27,
  980. handler: () => {
  981. if (
  982. this.modals[
  983. this.activeModals[this.activeModals.length - 1]
  984. ] === "editSong" ||
  985. this.modals[
  986. this.activeModals[this.activeModals.length - 1]
  987. ] === "editSongs"
  988. ) {
  989. this.onCloseModal();
  990. }
  991. }
  992. });
  993. /*
  994. editSong.pauseResume - Num 5 - Pause/resume song
  995. editSong.stopVideo - Ctrl - Num 5 - Stop
  996. editSong.hardStopVideo - Shift - Ctrl - Num 5 - Stop
  997. editSong.skipToLast10Secs - Num 6 - Skip to last 10 seconds
  998. editSong.lowerVolumeLarge - Num 2 - Volume down by 10
  999. editSong.lowerVolumeSmall - Ctrl - Num 2 - Volume down by 1
  1000. editSong.increaseVolumeLarge - Num 8 - Volume up by 10
  1001. editSong.increaseVolumeSmall - Ctrl - Num 8 - Volume up by 1
  1002. editSong.focusTitle - Home - Focus the title input
  1003. editSong.focusDicogs - End - Focus the discogs input
  1004. editSong.save - Ctrl - S - Saves song
  1005. editSong.save - Ctrl - Alt - S - Saves song and closes the modal
  1006. editSong.save - Ctrl - Alt - V - Saves song, verifies songs and then closes the modal
  1007. editSong.close - F4 - Closes modal without saving
  1008. editSong.useAllDiscogs - Ctrl - Alt - D - Sets all fields to the Discogs data
  1009. Inside Discogs inputs: Ctrl - D - Sets this field to the Discogs data
  1010. */
  1011. },
  1012. beforeUnmount() {
  1013. console.log("UNMOUNT");
  1014. if (!this.newSong) this.unloadSong(this.songId);
  1015. this.playerReady = false;
  1016. clearInterval(this.interval);
  1017. clearInterval(this.activityWatchVideoDataInterval);
  1018. const shortcutNames = [
  1019. "editSong.pauseResume",
  1020. "editSong.stopVideo",
  1021. "editSong.hardStopVideo",
  1022. "editSong.skipToLast10Secs",
  1023. "editSong.lowerVolumeLarge",
  1024. "editSong.lowerVolumeSmall",
  1025. "editSong.increaseVolumeLarge",
  1026. "editSong.increaseVolumeSmall",
  1027. "editSong.focusTitle",
  1028. "editSong.focusDicogs",
  1029. "editSong.save",
  1030. "editSong.saveClose",
  1031. "editSong.useAllDiscogs",
  1032. "editSong.closeModal"
  1033. ];
  1034. shortcutNames.forEach(shortcutName => {
  1035. keyboardShortcuts.unregisterShortcut(shortcutName);
  1036. });
  1037. if (!this.bulk) {
  1038. // Delete the VueX module that was created for this modal, after all other cleanup tasks are performed
  1039. this.$store.unregisterModule([
  1040. "modals",
  1041. "editSong",
  1042. this.modalUuid
  1043. ]);
  1044. }
  1045. },
  1046. methods: {
  1047. onThumbnailLoad() {
  1048. if (this.$refs.thumbnailElement) {
  1049. const thumbnailHeight =
  1050. this.$refs.thumbnailElement.naturalHeight;
  1051. const thumbnailWidth = this.$refs.thumbnailElement.naturalWidth;
  1052. this.thumbnailNotSquare = thumbnailHeight !== thumbnailWidth;
  1053. this.thumbnailHeight = thumbnailHeight;
  1054. this.thumbnailWidth = thumbnailWidth;
  1055. } else {
  1056. this.thumbnailNotSquare = false;
  1057. this.thumbnailHeight = null;
  1058. this.thumbnailWidth = null;
  1059. }
  1060. },
  1061. onThumbnailLoadError(error) {
  1062. this.thumbnailLoadError = error !== 0;
  1063. },
  1064. init() {
  1065. if (this.newSong) {
  1066. this.setSong({
  1067. youtubeId: "",
  1068. title: "",
  1069. artists: [],
  1070. genres: [],
  1071. tags: [],
  1072. duration: 0,
  1073. skipDuration: 0,
  1074. thumbnail: "",
  1075. verified: false
  1076. });
  1077. this.songDataLoaded = true;
  1078. this.showTab("youtube");
  1079. } else if (this.songId) this.loadSong(this.songId);
  1080. else if (!this.bulk) {
  1081. new Toast("You can't open EditSong without editing a song");
  1082. return this.closeModal("editSong");
  1083. }
  1084. this.interval = setInterval(() => {
  1085. if (
  1086. this.song.duration !== -1 &&
  1087. this.video.paused === false &&
  1088. this.playerReady &&
  1089. (this.video.player.getCurrentTime() -
  1090. this.song.skipDuration >
  1091. this.song.duration ||
  1092. (this.video.player.getCurrentTime() > 0 &&
  1093. this.video.player.getCurrentTime() >=
  1094. this.video.player.getDuration()))
  1095. ) {
  1096. this.stopVideo();
  1097. this.pauseVideo(true);
  1098. this.drawCanvas();
  1099. }
  1100. if (
  1101. this.playerReady &&
  1102. this.video.player.getVideoData &&
  1103. this.video.player.getVideoData() &&
  1104. this.video.player.getVideoData().video_id ===
  1105. this.song.youtubeId
  1106. ) {
  1107. const currentTime = this.video.player.getCurrentTime();
  1108. if (currentTime !== undefined)
  1109. this.youtubeVideoCurrentTime = currentTime.toFixed(3);
  1110. if (this.youtubeVideoDuration.indexOf(".000") !== -1) {
  1111. const duration = this.video.player.getDuration();
  1112. if (duration !== undefined) {
  1113. if (
  1114. `${this.youtubeVideoDuration}` ===
  1115. `${Number(this.song.duration).toFixed(3)}`
  1116. )
  1117. this.song.duration = duration.toFixed(3);
  1118. this.youtubeVideoDuration = duration.toFixed(3);
  1119. if (
  1120. this.youtubeVideoDuration.indexOf(".000") !== -1
  1121. )
  1122. this.youtubeVideoNote = "(~)";
  1123. else this.youtubeVideoNote = "";
  1124. this.drawCanvas();
  1125. }
  1126. }
  1127. }
  1128. if (this.video.paused === false) this.drawCanvas();
  1129. }, 200);
  1130. if (window.YT && window.YT.Player) {
  1131. this.video.player = new window.YT.Player(
  1132. `editSongPlayer-${this.modalUuid}`,
  1133. {
  1134. height: 298,
  1135. width: 530,
  1136. videoId: null,
  1137. host: "https://www.youtube-nocookie.com",
  1138. playerVars: {
  1139. controls: 0,
  1140. iv_load_policy: 3,
  1141. rel: 0,
  1142. showinfo: 0,
  1143. autoplay: 0
  1144. },
  1145. startSeconds: this.song.skipDuration,
  1146. events: {
  1147. onReady: () => {
  1148. let volume = parseFloat(
  1149. localStorage.getItem("volume")
  1150. );
  1151. volume =
  1152. typeof volume === "number" ? volume : 20;
  1153. this.video.player.setVolume(volume);
  1154. if (volume > 0) this.video.player.unMute();
  1155. this.playerReady = true;
  1156. if (this.song && this.song._id)
  1157. this.video.player.cueVideoById(
  1158. this.song.youtubeId,
  1159. this.song.skipDuration
  1160. );
  1161. this.setPlaybackRate(null);
  1162. this.drawCanvas();
  1163. },
  1164. onStateChange: event => {
  1165. this.drawCanvas();
  1166. if (event.data === 1) {
  1167. this.video.paused = false;
  1168. let youtubeDuration =
  1169. this.video.player.getDuration();
  1170. const newYoutubeVideoDuration =
  1171. youtubeDuration.toFixed(3);
  1172. if (
  1173. this.youtubeVideoDuration.indexOf(
  1174. ".000"
  1175. ) !== -1 &&
  1176. `${this.youtubeVideoDuration}` !==
  1177. `${newYoutubeVideoDuration}`
  1178. ) {
  1179. const songDurationNumber = Number(
  1180. this.song.duration
  1181. );
  1182. const songDurationNumber2 =
  1183. Number(this.song.duration) + 1;
  1184. const songDurationNumber3 =
  1185. Number(this.song.duration) - 1;
  1186. const fixedSongDuration =
  1187. songDurationNumber.toFixed(3);
  1188. const fixedSongDuration2 =
  1189. songDurationNumber2.toFixed(3);
  1190. const fixedSongDuration3 =
  1191. songDurationNumber3.toFixed(3);
  1192. if (
  1193. `${this.youtubeVideoDuration}` ===
  1194. `${Number(
  1195. this.song.duration
  1196. ).toFixed(3)}` &&
  1197. (fixedSongDuration ===
  1198. this.youtubeVideoDuration ||
  1199. fixedSongDuration2 ===
  1200. this.youtubeVideoDuration ||
  1201. fixedSongDuration3 ===
  1202. this.youtubeVideoDuration)
  1203. )
  1204. this.song.duration =
  1205. newYoutubeVideoDuration;
  1206. this.youtubeVideoDuration =
  1207. newYoutubeVideoDuration;
  1208. if (
  1209. this.youtubeVideoDuration.indexOf(
  1210. ".000"
  1211. ) !== -1
  1212. )
  1213. this.youtubeVideoNote = "(~)";
  1214. else this.youtubeVideoNote = "";
  1215. }
  1216. if (this.song.duration === -1)
  1217. this.song.duration =
  1218. this.youtubeVideoDuration;
  1219. youtubeDuration -= this.song.skipDuration;
  1220. if (
  1221. this.song.duration >
  1222. youtubeDuration + 1
  1223. ) {
  1224. this.stopVideo();
  1225. this.pauseVideo(true);
  1226. return new Toast(
  1227. "Video can't play. Specified duration is bigger than the YouTube song duration."
  1228. );
  1229. }
  1230. if (this.song.duration <= 0) {
  1231. this.stopVideo();
  1232. this.pauseVideo(true);
  1233. return new Toast(
  1234. "Video can't play. Specified duration has to be more than 0 seconds."
  1235. );
  1236. }
  1237. if (
  1238. this.video.player.getCurrentTime() <
  1239. this.song.skipDuration
  1240. ) {
  1241. return this.seekTo(
  1242. this.song.skipDuration
  1243. );
  1244. }
  1245. this.setPlaybackRate(null);
  1246. } else if (event.data === 2) {
  1247. this.video.paused = true;
  1248. }
  1249. return false;
  1250. }
  1251. }
  1252. }
  1253. );
  1254. } else {
  1255. this.youtubeError = true;
  1256. this.youtubeErrorMessage = "Player could not be loaded.";
  1257. }
  1258. ["artists", "genres", "tags"].forEach(type => {
  1259. this.socket.dispatch(
  1260. `songs.get${type.charAt(0).toUpperCase()}${type.slice(1)}`,
  1261. res => {
  1262. if (res.status === "success") {
  1263. const { items } = res.data;
  1264. if (type === "genres")
  1265. this.autosuggest.allItems[type] = Array.from(
  1266. new Set([
  1267. ...this.recommendedGenres,
  1268. ...items
  1269. ])
  1270. );
  1271. else this.autosuggest.allItems[type] = items;
  1272. } else {
  1273. new Toast(res.message);
  1274. }
  1275. }
  1276. );
  1277. });
  1278. return null;
  1279. },
  1280. unloadSong(songId) {
  1281. this.songDataLoaded = false;
  1282. this.songDeleted = false;
  1283. this.stopVideo();
  1284. this.pauseVideo(true);
  1285. this.resetSong(songId);
  1286. this.thumbnailNotSquare = false;
  1287. this.thumbnailWidth = null;
  1288. this.thumbnailHeight = null;
  1289. this.youtubeVideoCurrentTime = "0.000";
  1290. this.youtubeVideoDuration = "0.000";
  1291. this.youtubeVideoNote = "";
  1292. this.socket.dispatch("apis.leaveRoom", `edit-song.${songId}`);
  1293. if (this.$refs.saveButton) this.$refs.saveButton.status = "default";
  1294. },
  1295. loadSong(songId) {
  1296. console.log(`LOAD SONG ${songId}`);
  1297. this.songNotFound = false;
  1298. this.socket.dispatch(`songs.getSongFromSongId`, songId, res => {
  1299. if (res.status === "success") {
  1300. let { song } = res.data;
  1301. song = Object.assign(song, this.prefillData);
  1302. this.setSong(song);
  1303. this.songDataLoaded = true;
  1304. this.socket.dispatch(
  1305. "apis.joinRoom",
  1306. `edit-song.${this.song._id}`
  1307. );
  1308. if (this.video.player && this.video.player.cueVideoById) {
  1309. this.video.player.cueVideoById(
  1310. this.song.youtubeId,
  1311. this.song.skipDuration
  1312. );
  1313. }
  1314. } else {
  1315. new Toast("Song with that ID not found");
  1316. if (this.bulk) this.songNotFound = true;
  1317. if (!this.bulk) this.closeModal("editSong");
  1318. }
  1319. });
  1320. this.socket.dispatch("reports.getReportsForSong", songId, res => {
  1321. this.updateReports(res.data.reports);
  1322. });
  1323. },
  1324. importAlbum(result) {
  1325. this.selectDiscogsAlbum(result);
  1326. this.openModal("importAlbum");
  1327. this.closeModal("editSong");
  1328. },
  1329. save(songToCopy, closeOrNext, saveButtonRefName, newSong = false) {
  1330. const song = JSON.parse(JSON.stringify(songToCopy));
  1331. if (!newSong) this.$emit("saving", song._id);
  1332. const saveButtonRef = this.$refs[saveButtonRefName];
  1333. if (!this.youtubeError && this.youtubeVideoDuration === "0.000") {
  1334. saveButtonRef.handleFailedSave();
  1335. if (!newSong) this.$emit("savedError", song._id);
  1336. return new Toast("The video appears to not be working.");
  1337. }
  1338. if (!song.title) {
  1339. saveButtonRef.handleFailedSave();
  1340. if (!newSong) this.$emit("savedError", song._id);
  1341. return new Toast("Please fill in all fields");
  1342. }
  1343. if (!song.thumbnail) {
  1344. saveButtonRef.handleFailedSave();
  1345. if (!newSong) this.$emit("savedError", song._id);
  1346. return new Toast("Please fill in all fields");
  1347. }
  1348. // const thumbnailHeight = this.$refs.thumbnailElement.naturalHeight;
  1349. // const thumbnailWidth = this.$refs.thumbnailElement.naturalWidth;
  1350. // if (thumbnailHeight < 80 || thumbnailWidth < 80) {
  1351. // saveButtonRef.handleFailedSave();
  1352. // return new Toast(
  1353. // "Thumbnail width and height must be at least 80px."
  1354. // );
  1355. // }
  1356. // if (thumbnailHeight > 4000 || thumbnailWidth > 4000) {
  1357. // saveButtonRef.handleFailedSave();
  1358. // return new Toast(
  1359. // "Thumbnail width and height must be less than 4000px."
  1360. // );
  1361. // }
  1362. // if (thumbnailHeight - thumbnailWidth > 5) {
  1363. // saveButtonRef.handleFailedSave();
  1364. // return new Toast("Thumbnail cannot be taller than it is wide.");
  1365. // }
  1366. // Youtube Id
  1367. if (
  1368. !newSong &&
  1369. this.youtubeError &&
  1370. this.originalSong.youtubeId !== song.youtubeId
  1371. ) {
  1372. saveButtonRef.handleFailedSave();
  1373. if (!newSong) this.$emit("savedError", song._id);
  1374. return new Toast(
  1375. "You're not allowed to change the YouTube id while the player is not working"
  1376. );
  1377. }
  1378. // Duration
  1379. if (
  1380. Number(song.skipDuration) + Number(song.duration) >
  1381. this.youtubeVideoDuration &&
  1382. ((!newSong && !this.youtubeError) ||
  1383. this.originalSong.duration !== song.duration)
  1384. ) {
  1385. saveButtonRef.handleFailedSave();
  1386. if (!newSong) this.$emit("savedError", song._id);
  1387. return new Toast(
  1388. "Duration can't be higher than the length of the video"
  1389. );
  1390. }
  1391. // Title
  1392. if (!validation.isLength(song.title, 1, 100)) {
  1393. saveButtonRef.handleFailedSave();
  1394. if (!newSong) this.$emit("savedError", song._id);
  1395. return new Toast(
  1396. "Title must have between 1 and 100 characters."
  1397. );
  1398. }
  1399. // Artists
  1400. if (
  1401. (song.verified && song.artists.length < 1) ||
  1402. song.artists.length > 10
  1403. ) {
  1404. saveButtonRef.handleFailedSave();
  1405. if (!newSong) this.$emit("savedError", song._id);
  1406. return new Toast(
  1407. "Invalid artists. You must have at least 1 artist and a maximum of 10 artists."
  1408. );
  1409. }
  1410. let error;
  1411. song.artists.forEach(artist => {
  1412. if (!validation.isLength(artist, 1, 64)) {
  1413. error = "Artist must have between 1 and 64 characters.";
  1414. return error;
  1415. }
  1416. if (artist === "NONE") {
  1417. error =
  1418. 'Invalid artist format. Artists are not allowed to be named "NONE".';
  1419. return error;
  1420. }
  1421. return false;
  1422. });
  1423. if (error) {
  1424. saveButtonRef.handleFailedSave();
  1425. if (!newSong) this.$emit("savedError", song._id);
  1426. return new Toast(error);
  1427. }
  1428. // Genres
  1429. error = undefined;
  1430. song.genres.forEach(genre => {
  1431. if (!validation.isLength(genre, 1, 32)) {
  1432. error = "Genre must have between 1 and 32 characters.";
  1433. return error;
  1434. }
  1435. if (!validation.regex.ascii.test(genre)) {
  1436. error =
  1437. "Invalid genre format. Only ascii characters are allowed.";
  1438. return error;
  1439. }
  1440. return false;
  1441. });
  1442. if (
  1443. (song.verified && song.genres.length < 1) ||
  1444. song.genres.length > 16
  1445. )
  1446. error = "You must have between 1 and 16 genres.";
  1447. if (error) {
  1448. saveButtonRef.handleFailedSave();
  1449. if (!newSong) this.$emit("savedError", song._id);
  1450. return new Toast(error);
  1451. }
  1452. error = undefined;
  1453. song.tags.forEach(tag => {
  1454. if (
  1455. !/^[a-zA-Z0-9_]{1,64}$|^[a-zA-Z0-9_]{1,64}\[[a-zA-Z0-9_]{1,64}\]$/.test(
  1456. tag
  1457. )
  1458. ) {
  1459. error = "Invalid tag format.";
  1460. return error;
  1461. }
  1462. return false;
  1463. });
  1464. if (error) {
  1465. saveButtonRef.handleFailedSave();
  1466. if (!newSong) this.$emit("savedError", song._id);
  1467. return new Toast(error);
  1468. }
  1469. // Thumbnail
  1470. if (!validation.isLength(song.thumbnail, 1, 256)) {
  1471. saveButtonRef.handleFailedSave();
  1472. if (!newSong) this.$emit("savedError", song._id);
  1473. return new Toast(
  1474. "Thumbnail must have between 8 and 256 characters."
  1475. );
  1476. }
  1477. if (this.useHTTPS && song.thumbnail.indexOf("https://") !== 0) {
  1478. saveButtonRef.handleFailedSave();
  1479. if (!newSong) this.$emit("savedError", song._id);
  1480. return new Toast('Thumbnail must start with "https://".');
  1481. }
  1482. if (
  1483. !this.useHTTPS &&
  1484. song.thumbnail.indexOf("http://") !== 0 &&
  1485. song.thumbnail.indexOf("https://") !== 0
  1486. ) {
  1487. saveButtonRef.handleFailedSave();
  1488. if (!newSong) this.$emit("savedError", song._id);
  1489. return new Toast('Thumbnail must start with "http://".');
  1490. }
  1491. saveButtonRef.status = "saving";
  1492. if (newSong)
  1493. return this.socket.dispatch(`songs.create`, song, res => {
  1494. new Toast(res.message);
  1495. if (res.status === "error") {
  1496. saveButtonRef.handleFailedSave();
  1497. return;
  1498. }
  1499. saveButtonRef.handleSuccessfulSave();
  1500. this.closeModal("editSong");
  1501. });
  1502. return this.socket.dispatch(`songs.update`, song._id, song, res => {
  1503. new Toast(res.message);
  1504. if (res.status === "error") {
  1505. saveButtonRef.handleFailedSave();
  1506. this.$emit("savedError", song._id);
  1507. return;
  1508. }
  1509. this.updateOriginalSong(song);
  1510. saveButtonRef.handleSuccessfulSave();
  1511. this.$emit("savedSuccess", song._id);
  1512. if (!closeOrNext) return;
  1513. if (this.bulk) this.$emit("nextSong");
  1514. else this.closeModal("editSong");
  1515. });
  1516. },
  1517. editNextSong() {
  1518. this.$emit("nextSong");
  1519. },
  1520. toggleFlag() {
  1521. this.$emit("toggleFlag");
  1522. },
  1523. getAlbumData(type) {
  1524. if (!this.song.discogs) return;
  1525. if (type === "title")
  1526. this.updateSongField({
  1527. field: "title",
  1528. value: this.song.discogs.track.title
  1529. });
  1530. if (type === "albumArt")
  1531. this.updateSongField({
  1532. field: "thumbnail",
  1533. value: this.song.discogs.album.albumArt
  1534. });
  1535. if (type === "genres")
  1536. this.updateSongField({
  1537. field: "genres",
  1538. value: JSON.parse(
  1539. JSON.stringify(this.song.discogs.album.genres)
  1540. )
  1541. });
  1542. if (type === "artists")
  1543. this.updateSongField({
  1544. field: "artists",
  1545. value: JSON.parse(
  1546. JSON.stringify(this.song.discogs.album.artists)
  1547. )
  1548. });
  1549. },
  1550. getYouTubeData(type) {
  1551. if (type === "title") {
  1552. try {
  1553. const { title } = this.video.player.getVideoData();
  1554. if (title)
  1555. this.updateSongField({
  1556. field: "title",
  1557. value: title
  1558. });
  1559. else throw new Error("No title found");
  1560. } catch (e) {
  1561. new Toast("Unable to fetch YouTube video title");
  1562. }
  1563. }
  1564. if (type === "thumbnail")
  1565. this.updateSongField({
  1566. field: "thumbnail",
  1567. value: `https://img.youtube.com/vi/${this.song.youtubeId}/mqdefault.jpg`
  1568. });
  1569. if (type === "author") {
  1570. try {
  1571. const { author } = this.video.player.getVideoData();
  1572. if (author) this.artistInputValue = author;
  1573. else throw new Error("No video author found");
  1574. } catch (e) {
  1575. new Toast("Unable to fetch YouTube video author");
  1576. }
  1577. }
  1578. },
  1579. fillDuration() {
  1580. this.song.duration =
  1581. this.youtubeVideoDuration - this.song.skipDuration;
  1582. },
  1583. settings(type) {
  1584. switch (type) {
  1585. case "stop":
  1586. this.stopVideo();
  1587. this.pauseVideo(true);
  1588. break;
  1589. case "hardStop":
  1590. this.hardStopVideo();
  1591. this.pauseVideo(true);
  1592. break;
  1593. case "pause":
  1594. this.pauseVideo(true);
  1595. break;
  1596. case "play":
  1597. this.pauseVideo(false);
  1598. break;
  1599. case "skipToLast10Secs":
  1600. this.seekTo(
  1601. this.song.duration - 10 + this.song.skipDuration
  1602. );
  1603. break;
  1604. default:
  1605. break;
  1606. }
  1607. },
  1608. play() {
  1609. if (
  1610. this.video.player.getVideoData().video_id !==
  1611. this.song.youtubeId
  1612. ) {
  1613. this.song.duration = -1;
  1614. this.loadVideoById(this.song.youtubeId, this.song.skipDuration);
  1615. }
  1616. this.settings("play");
  1617. },
  1618. seekTo(position) {
  1619. this.settings("play");
  1620. this.video.player.seekTo(position);
  1621. },
  1622. changeVolume() {
  1623. const volume = this.volumeSliderValue;
  1624. localStorage.setItem("volume", volume);
  1625. this.video.player.setVolume(volume);
  1626. if (volume > 0) {
  1627. this.video.player.unMute();
  1628. this.muted = false;
  1629. }
  1630. },
  1631. toggleMute() {
  1632. const previousVolume = parseFloat(localStorage.getItem("volume"));
  1633. const volume =
  1634. this.video.player.getVolume() <= 0 ? previousVolume : 0;
  1635. this.muted = !this.muted;
  1636. this.volumeSliderValue = volume;
  1637. this.video.player.setVolume(volume);
  1638. if (!this.muted) localStorage.setItem("volume", volume);
  1639. },
  1640. increaseVolume() {
  1641. const previousVolume = parseFloat(localStorage.getItem("volume"));
  1642. let volume = previousVolume + 5;
  1643. this.muted = false;
  1644. if (volume > 100) volume = 100;
  1645. this.volumeSliderValue = volume;
  1646. this.video.player.setVolume(volume);
  1647. localStorage.setItem("volume", volume);
  1648. },
  1649. addTag(type, value) {
  1650. if (type === "genres") {
  1651. const genre = value || this.genreInputValue.trim();
  1652. if (
  1653. this.song.genres
  1654. .map(genre => genre.toLowerCase())
  1655. .indexOf(genre.toLowerCase()) !== -1
  1656. )
  1657. return new Toast("Genre already exists");
  1658. if (genre) {
  1659. this.song.genres.push(genre);
  1660. this.genreInputValue = "";
  1661. return false;
  1662. }
  1663. return new Toast("Genre cannot be empty");
  1664. }
  1665. if (type === "artists") {
  1666. const artist = value || this.artistInputValue;
  1667. if (this.song.artists.indexOf(artist) !== -1)
  1668. return new Toast("Artist already exists");
  1669. if (artist !== "") {
  1670. this.song.artists.push(artist);
  1671. this.artistInputValue = "";
  1672. return false;
  1673. }
  1674. return new Toast("Artist cannot be empty");
  1675. }
  1676. if (type === "tags") {
  1677. const tag = value || this.tagInputValue;
  1678. if (this.song.tags.indexOf(tag) !== -1)
  1679. return new Toast("Tag already exists");
  1680. if (tag !== "") {
  1681. this.song.tags.push(tag);
  1682. this.tagInputValue = "";
  1683. return false;
  1684. }
  1685. return new Toast("Tag cannot be empty");
  1686. }
  1687. return false;
  1688. },
  1689. removeTag(type, value) {
  1690. if (type === "genres")
  1691. this.song.genres.splice(this.song.genres.indexOf(value), 1);
  1692. else if (type === "artists")
  1693. this.song.artists.splice(this.song.artists.indexOf(value), 1);
  1694. else if (type === "tags")
  1695. this.song.tags.splice(this.song.tags.indexOf(value), 1);
  1696. },
  1697. drawCanvas() {
  1698. if (!this.songDataLoaded) return;
  1699. const canvasElement =
  1700. this.$refs[`durationCanvas-${this.modalUuid}`];
  1701. const ctx = canvasElement.getContext("2d");
  1702. const videoDuration = Number(this.youtubeVideoDuration);
  1703. const skipDuration = Number(this.song.skipDuration);
  1704. const duration = Number(this.song.duration);
  1705. const afterDuration = videoDuration - (skipDuration + duration);
  1706. const width = 530;
  1707. const currentTime =
  1708. this.video.player && this.video.player.getCurrentTime
  1709. ? this.video.player.getCurrentTime()
  1710. : 0;
  1711. const widthSkipDuration = (skipDuration / videoDuration) * width;
  1712. const widthDuration = (duration / videoDuration) * width;
  1713. const widthAfterDuration = (afterDuration / videoDuration) * width;
  1714. const widthCurrentTime = (currentTime / videoDuration) * width;
  1715. const skipDurationColor = "#F42003";
  1716. const durationColor = "#03A9F4";
  1717. const afterDurationColor = "#41E841";
  1718. const currentDurationColor = "#3b25e8";
  1719. ctx.fillStyle = skipDurationColor;
  1720. ctx.fillRect(0, 0, widthSkipDuration, 20);
  1721. ctx.fillStyle = durationColor;
  1722. ctx.fillRect(widthSkipDuration, 0, widthDuration, 20);
  1723. ctx.fillStyle = afterDurationColor;
  1724. ctx.fillRect(
  1725. widthSkipDuration + widthDuration,
  1726. 0,
  1727. widthAfterDuration,
  1728. 20
  1729. );
  1730. ctx.fillStyle = currentDurationColor;
  1731. ctx.fillRect(widthCurrentTime, 0, 1, 20);
  1732. },
  1733. setTrackPosition(event) {
  1734. this.seekTo(
  1735. Number(
  1736. Number(this.video.player.getDuration()) *
  1737. ((event.pageX -
  1738. event.target.getBoundingClientRect().left) /
  1739. 530)
  1740. )
  1741. );
  1742. },
  1743. toggleGenreHelper() {
  1744. this.$refs.genreHelper.toggleBox();
  1745. },
  1746. resetGenreHelper() {
  1747. this.$refs.genreHelper.resetBox();
  1748. },
  1749. sendActivityWatchVideoData() {
  1750. if (!this.video.paused) {
  1751. if (this.activityWatchVideoLastStatus !== "playing") {
  1752. this.activityWatchVideoLastStatus = "playing";
  1753. if (
  1754. this.song.skipDuration > 0 &&
  1755. parseFloat(this.youtubeVideoCurrentTime) === 0
  1756. ) {
  1757. this.activityWatchVideoLastStartDuration = Math.floor(
  1758. this.song.skipDuration +
  1759. parseFloat(this.youtubeVideoCurrentTime)
  1760. );
  1761. } else {
  1762. this.activityWatchVideoLastStartDuration = Math.floor(
  1763. parseFloat(this.youtubeVideoCurrentTime)
  1764. );
  1765. }
  1766. }
  1767. const videoData = {
  1768. title: this.song.title,
  1769. artists: this.song.artists
  1770. ? this.song.artists.join(", ")
  1771. : null,
  1772. youtubeId: this.song.youtubeId,
  1773. muted: this.muted,
  1774. volume: this.volumeSliderValue,
  1775. startedDuration:
  1776. this.activityWatchVideoLastStartDuration <= 0
  1777. ? 0
  1778. : this.activityWatchVideoLastStartDuration,
  1779. source: `editSong#${this.song.youtubeId}`,
  1780. hostname: window.location.hostname
  1781. };
  1782. aw.sendVideoData(videoData);
  1783. } else {
  1784. this.activityWatchVideoLastStatus = "not_playing";
  1785. }
  1786. },
  1787. remove(id) {
  1788. this.socket.dispatch("songs.remove", id, res => {
  1789. new Toast(res.message);
  1790. });
  1791. },
  1792. confirmAction({ message, action, params }) {
  1793. this.openModal({
  1794. modal: "confirm",
  1795. data: {
  1796. message,
  1797. action,
  1798. params,
  1799. onCompleted: this.handleConfirmed
  1800. }
  1801. });
  1802. },
  1803. handleConfirmed({ action, params }) {
  1804. if (typeof this[action] === "function") {
  1805. if (params) this[action](params);
  1806. else this[action]();
  1807. }
  1808. },
  1809. onCloseModal() {
  1810. const songStringified = JSON.stringify({
  1811. ...this.song,
  1812. ...{
  1813. duration: Number(this.song.duration).toFixed(3)
  1814. }
  1815. });
  1816. const originalSongStringified = JSON.stringify({
  1817. ...this.originalSong,
  1818. ...{
  1819. duration: Number(this.originalSong.duration).toFixed(3)
  1820. }
  1821. });
  1822. const unsavedChanges = songStringified !== originalSongStringified;
  1823. if (unsavedChanges) {
  1824. return this.confirmAction({
  1825. message:
  1826. "You have unsaved changes. Are you sure you want to discard unsaved changes?",
  1827. action: "closeThisModal",
  1828. params: null
  1829. });
  1830. }
  1831. return this.closeThisModal();
  1832. },
  1833. closeThisModal() {
  1834. if (this.bulk) this.$emit("close");
  1835. else this.closeModal("editSong");
  1836. },
  1837. ...mapActions("modals/importAlbum", ["selectDiscogsAlbum"]),
  1838. ...mapActions({
  1839. showTab(dispatch, payload) {
  1840. if (this.$refs[`${payload}-tab`])
  1841. this.$refs[`${payload}-tab`].scrollIntoView({
  1842. block: "nearest"
  1843. });
  1844. return dispatch(
  1845. `${this.modalModulePath.replace(
  1846. "MODAL_UUID",
  1847. this.modalUuid
  1848. )}/showTab`,
  1849. payload
  1850. );
  1851. }
  1852. }),
  1853. ...mapModalActions("MODAL_MODULE_PATH", [
  1854. "stopVideo",
  1855. "hardStopVideo",
  1856. "loadVideoById",
  1857. "pauseVideo",
  1858. "getCurrentTime",
  1859. "setSong",
  1860. "resetSong",
  1861. "updateOriginalSong",
  1862. "updateSongField",
  1863. "updateReports",
  1864. "setPlaybackRate"
  1865. ]),
  1866. ...mapActions("modalVisibility", ["closeModal", "openModal"])
  1867. }
  1868. };
  1869. </script>
  1870. <style lang="less" scoped>
  1871. .night-mode {
  1872. .edit-section,
  1873. .player-section,
  1874. #tabs-container {
  1875. background-color: var(--dark-grey-3) !important;
  1876. border: 0 !important;
  1877. .tab {
  1878. border: 0 !important;
  1879. }
  1880. }
  1881. #tabs-container #tab-selection .button {
  1882. background: var(--dark-grey) !important;
  1883. color: var(--white) !important;
  1884. }
  1885. .left-section {
  1886. .edit-section {
  1887. .album-get-button,
  1888. .duration-fill-button,
  1889. .youtube-get-button,
  1890. .add-button {
  1891. &:focus,
  1892. &:hover {
  1893. border: none !important;
  1894. }
  1895. }
  1896. }
  1897. }
  1898. .duration-canvas {
  1899. background-color: var(--dark-grey-2) !important;
  1900. }
  1901. }
  1902. .modal-card-body {
  1903. display: flex;
  1904. }
  1905. .notice-container {
  1906. display: flex;
  1907. flex: 1;
  1908. justify-content: center;
  1909. h4 {
  1910. margin: auto;
  1911. }
  1912. }
  1913. .left-section {
  1914. height: 100%;
  1915. display: flex;
  1916. flex-direction: column;
  1917. margin-right: 16px;
  1918. .top-section {
  1919. display: flex;
  1920. .player-section {
  1921. width: 530px;
  1922. display: flex;
  1923. flex-direction: column;
  1924. border: 1px solid var(--light-grey-3);
  1925. border-radius: @border-radius;
  1926. overflow: hidden;
  1927. .duration-canvas {
  1928. background-color: var(--light-grey-2);
  1929. }
  1930. .player-error {
  1931. display: flex;
  1932. height: 318px;
  1933. width: 530px;
  1934. align-items: center;
  1935. * {
  1936. margin: 0;
  1937. flex: 1;
  1938. font-size: 30px;
  1939. text-align: center;
  1940. }
  1941. }
  1942. .player-footer {
  1943. display: flex;
  1944. justify-content: space-between;
  1945. height: 54px;
  1946. padding-left: 10px;
  1947. padding-right: 10px;
  1948. > * {
  1949. width: 33.3%;
  1950. display: flex;
  1951. align-items: center;
  1952. }
  1953. .player-footer-left {
  1954. flex: 1;
  1955. & > .button:not(:first-child) {
  1956. margin-left: 5px;
  1957. }
  1958. :deep(& > .playerRateDropdown) {
  1959. margin-left: 5px;
  1960. margin-bottom: unset !important;
  1961. .control.has-addons {
  1962. margin-bottom: unset !important;
  1963. & > .button {
  1964. font-size: 24px;
  1965. }
  1966. }
  1967. }
  1968. :deep(.tippy-box[data-theme~="dropdown"]) {
  1969. max-width: 100px !important;
  1970. .nav-dropdown-items .nav-item {
  1971. justify-content: center !important;
  1972. border-radius: @border-radius !important;
  1973. &.active {
  1974. background-color: var(--primary-color);
  1975. color: var(--white);
  1976. }
  1977. }
  1978. }
  1979. }
  1980. .player-footer-center {
  1981. justify-content: center;
  1982. align-items: center;
  1983. flex: 2;
  1984. font-size: 18px;
  1985. font-weight: 400;
  1986. width: 200px;
  1987. margin: 0 5px;
  1988. img {
  1989. height: 21px;
  1990. margin-right: 12px;
  1991. filter: invert(26%) sepia(54%) saturate(6317%)
  1992. hue-rotate(2deg) brightness(92%) contrast(115%);
  1993. }
  1994. }
  1995. .player-footer-right {
  1996. justify-content: right;
  1997. flex: 1;
  1998. #volume-control {
  1999. margin: 3px;
  2000. margin-top: 0;
  2001. display: flex;
  2002. align-items: center;
  2003. cursor: pointer;
  2004. .volume-slider {
  2005. width: 100%;
  2006. padding: 0 15px;
  2007. background: transparent;
  2008. min-width: 100px;
  2009. }
  2010. input[type="range"] {
  2011. -webkit-appearance: none;
  2012. margin: 7.3px 0;
  2013. }
  2014. input[type="range"]:focus {
  2015. outline: none;
  2016. }
  2017. input[type="range"]::-webkit-slider-runnable-track {
  2018. width: 100%;
  2019. height: 5.2px;
  2020. cursor: pointer;
  2021. box-shadow: 0;
  2022. background: var(--light-grey-3);
  2023. border-radius: @border-radius;
  2024. border: 0;
  2025. }
  2026. input[type="range"]::-webkit-slider-thumb {
  2027. box-shadow: 0;
  2028. border: 0;
  2029. height: 19px;
  2030. width: 19px;
  2031. border-radius: 100%;
  2032. background: var(--primary-color);
  2033. cursor: pointer;
  2034. -webkit-appearance: none;
  2035. margin-top: -6.5px;
  2036. }
  2037. input[type="range"]::-moz-range-track {
  2038. width: 100%;
  2039. height: 5.2px;
  2040. cursor: pointer;
  2041. box-shadow: 0;
  2042. background: var(--light-grey-3);
  2043. border-radius: @border-radius;
  2044. border: 0;
  2045. }
  2046. input[type="range"]::-moz-range-thumb {
  2047. box-shadow: 0;
  2048. border: 0;
  2049. height: 19px;
  2050. width: 19px;
  2051. border-radius: 100%;
  2052. background: var(--primary-color);
  2053. cursor: pointer;
  2054. -webkit-appearance: none;
  2055. margin-top: -6.5px;
  2056. }
  2057. input[type="range"]::-ms-track {
  2058. width: 100%;
  2059. height: 5.2px;
  2060. cursor: pointer;
  2061. box-shadow: 0;
  2062. background: var(--light-grey-3);
  2063. border-radius: @border-radius;
  2064. }
  2065. input[type="range"]::-ms-fill-lower {
  2066. background: var(--light-grey-3);
  2067. border: 0;
  2068. border-radius: 0;
  2069. box-shadow: 0;
  2070. }
  2071. input[type="range"]::-ms-fill-upper {
  2072. background: var(--light-grey-3);
  2073. border: 0;
  2074. border-radius: 0;
  2075. box-shadow: 0;
  2076. }
  2077. input[type="range"]::-ms-thumb {
  2078. box-shadow: 0;
  2079. border: 0;
  2080. height: 15px;
  2081. width: 15px;
  2082. border-radius: 100%;
  2083. background: var(--primary-color);
  2084. cursor: pointer;
  2085. -webkit-appearance: none;
  2086. margin-top: 1.5px;
  2087. }
  2088. }
  2089. }
  2090. }
  2091. }
  2092. :deep(.thumbnail-preview) {
  2093. width: 189px;
  2094. height: 189px;
  2095. margin-left: 16px;
  2096. }
  2097. .thumbnail-dummy {
  2098. opacity: 0;
  2099. height: 10px;
  2100. width: 10px;
  2101. }
  2102. }
  2103. .edit-section {
  2104. display: flex;
  2105. flex-wrap: wrap;
  2106. flex-grow: 1;
  2107. border: 1px solid var(--light-grey-3);
  2108. margin-top: 16px;
  2109. border-radius: @border-radius;
  2110. .album-get-button {
  2111. background-color: var(--purple);
  2112. color: var(--white);
  2113. width: 32px;
  2114. text-align: center;
  2115. border-width: 0;
  2116. }
  2117. .duration-fill-button,
  2118. .youtube-get-button {
  2119. background-color: var(--dark-red);
  2120. color: var(--white);
  2121. width: 32px;
  2122. text-align: center;
  2123. border-width: 0;
  2124. }
  2125. .add-button {
  2126. background-color: var(--primary-color) !important;
  2127. width: 32px;
  2128. i {
  2129. font-size: 32px;
  2130. }
  2131. }
  2132. .album-get-button,
  2133. .duration-fill-button,
  2134. .youtube-get-button,
  2135. .add-button {
  2136. &:focus,
  2137. &:hover {
  2138. filter: contrast(0.75);
  2139. border: 1px solid var(--black) !important;
  2140. }
  2141. }
  2142. .youtube-get-button {
  2143. padding-left: 4px;
  2144. padding-right: 4px;
  2145. .youtube-icon {
  2146. background: var(--white);
  2147. }
  2148. }
  2149. > div {
  2150. margin: 16px !important;
  2151. }
  2152. input {
  2153. width: 100%;
  2154. }
  2155. .title-container {
  2156. width: calc((100% - 32px) / 2);
  2157. }
  2158. .duration-container {
  2159. margin-right: 16px;
  2160. margin-left: 16px;
  2161. width: calc((100% - 32px) / 4);
  2162. }
  2163. .skip-duration-container {
  2164. width: calc((100% - 32px) / 4);
  2165. }
  2166. .album-art-container {
  2167. margin-right: 16px;
  2168. width: calc((100% - 16px) / 8 * 4);
  2169. }
  2170. .youtube-id-container {
  2171. margin-right: 16px;
  2172. width: calc((100% - 16px) / 8 * 3);
  2173. }
  2174. .verified-container {
  2175. width: calc((100% - 16px) / 8);
  2176. .checkbox-control {
  2177. margin-top: 10px;
  2178. }
  2179. }
  2180. .artists-container {
  2181. width: calc((100% - 32px) / 3);
  2182. position: relative;
  2183. }
  2184. .genres-container {
  2185. width: calc((100% - 32px) / 3);
  2186. margin-left: 16px;
  2187. margin-right: 16px;
  2188. position: relative;
  2189. label {
  2190. display: flex;
  2191. i {
  2192. font-size: 15px;
  2193. align-self: center;
  2194. margin-left: 5px;
  2195. color: var(--primary-color);
  2196. cursor: pointer;
  2197. -webkit-user-select: none;
  2198. -moz-user-select: none;
  2199. -ms-user-select: none;
  2200. user-select: none;
  2201. }
  2202. }
  2203. }
  2204. .tags-container {
  2205. width: calc((100% - 32px) / 3);
  2206. position: relative;
  2207. }
  2208. .list-item-circle {
  2209. background-color: var(--primary-color);
  2210. width: 16px;
  2211. height: 16px;
  2212. border-radius: 8px;
  2213. cursor: pointer;
  2214. margin-right: 8px;
  2215. float: left;
  2216. -webkit-touch-callout: none;
  2217. -webkit-user-select: none;
  2218. -khtml-user-select: none;
  2219. -moz-user-select: none;
  2220. -ms-user-select: none;
  2221. user-select: none;
  2222. i {
  2223. color: var(--primary-color);
  2224. font-size: 14px;
  2225. margin-left: 1px;
  2226. position: relative;
  2227. top: -1px;
  2228. }
  2229. }
  2230. .list-item-circle:hover,
  2231. .list-item-circle:focus {
  2232. i {
  2233. color: var(--white);
  2234. }
  2235. }
  2236. .list-item > p {
  2237. line-height: 16px;
  2238. word-wrap: break-word;
  2239. width: calc(100% - 24px);
  2240. left: 24px;
  2241. float: left;
  2242. margin-bottom: 8px;
  2243. }
  2244. .list-item:last-child > p {
  2245. margin-bottom: 0;
  2246. }
  2247. .thumbnail-warning {
  2248. color: var(--red);
  2249. font-size: 18px;
  2250. margin: auto 0 auto 5px;
  2251. }
  2252. }
  2253. }
  2254. .right-section {
  2255. flex-basis: unset !important;
  2256. flex-grow: 0 !important;
  2257. display: flex;
  2258. height: 100%;
  2259. #tabs-container {
  2260. width: 376px;
  2261. #tab-selection {
  2262. display: flex;
  2263. overflow-x: auto;
  2264. .button {
  2265. border-radius: @border-radius @border-radius 0 0;
  2266. border: 0;
  2267. text-transform: uppercase;
  2268. font-size: 14px;
  2269. color: var(--dark-grey-3);
  2270. background-color: var(--light-grey-2);
  2271. flex-grow: 1;
  2272. height: 32px;
  2273. &:not(:first-of-type) {
  2274. margin-left: 5px;
  2275. }
  2276. }
  2277. .selected {
  2278. background-color: var(--primary-color) !important;
  2279. color: var(--white) !important;
  2280. font-weight: 600;
  2281. }
  2282. }
  2283. .tab {
  2284. border: 1px solid var(--light-grey-3);
  2285. border-radius: 0 0 @border-radius @border-radius;
  2286. padding: 15px;
  2287. height: calc(100% - 32px);
  2288. overflow: auto;
  2289. }
  2290. }
  2291. }
  2292. @media screen and (max-width: 1100px) {
  2293. .left-section,
  2294. .right-section {
  2295. height: unset;
  2296. max-height: unset;
  2297. }
  2298. .left-section {
  2299. margin-right: 0;
  2300. }
  2301. .right-section {
  2302. flex-basis: 100% !important;
  2303. #tabs-container {
  2304. width: 100%;
  2305. }
  2306. }
  2307. }
  2308. .modal-card-foot .is-primary {
  2309. width: 200px;
  2310. }
  2311. :deep(.autosuggest-container) {
  2312. top: unset;
  2313. }
  2314. </style>