index.vue 57 KB

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