123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105 |
- <script setup lang="ts">
- import { storeToRefs } from "pinia";
- import {
- defineAsyncComponent,
- ref,
- computed,
- watch,
- onMounted,
- onBeforeUnmount
- } from "vue";
- import Toast from "toasters";
- import aw from "@/aw";
- import ws from "@/ws";
- import validation from "@/validation";
- import keyboardShortcuts from "@/keyboardShortcuts";
- import { Song } from "@/types/song.js";
- import { useWebsocketsStore } from "@/stores/websockets";
- import { useModalsStore } from "@/stores/modals";
- import { useEditSongStore } from "@/stores/editSong";
- import { useStationStore } from "@/stores/station";
- const Modal = defineAsyncComponent(() => import("@/components/Modal.vue"));
- const FloatingBox = defineAsyncComponent(
- () => import("@/components/FloatingBox.vue")
- );
- const SaveButton = defineAsyncComponent(
- () => import("@/components/SaveButton.vue")
- );
- const AutoSuggest = defineAsyncComponent(
- () => import("@/components/AutoSuggest.vue")
- );
- const SongItem = defineAsyncComponent(
- () => import("@/components/SongItem.vue")
- );
- const Discogs = defineAsyncComponent(() => import("./Tabs/Discogs.vue"));
- const ReportsTab = defineAsyncComponent(() => import("./Tabs/Reports.vue"));
- const Youtube = defineAsyncComponent(() => import("./Tabs/Youtube.vue"));
- const MusareSongs = defineAsyncComponent(() => import("./Tabs/Songs.vue"));
- const SongThumbnail = defineAsyncComponent(
- () => import("@/components/SongThumbnail.vue")
- );
- const props = defineProps({
- modalUuid: { type: String, default: "" },
- modalModulePath: {
- type: String,
- default: "modals/editSong/MODAL_UUID"
- },
- discogsAlbum: { type: Object, default: null }
- });
- const editSongStore = useEditSongStore(props);
- const stationStore = useStationStore();
- const { socket } = useWebsocketsStore();
- const modalsStore = useModalsStore();
- const { modals, activeModals } = storeToRefs(modalsStore);
- const { openModal } = modalsStore;
- const {
- tab,
- video,
- song,
- youtubeId,
- prefillData,
- originalSong,
- reports,
- newSong,
- bulk,
- youtubeIds,
- songPrefillData
- } = storeToRefs(editSongStore);
- const songDataLoaded = ref(false);
- const songDeleted = ref(false);
- const youtubeError = ref(false);
- const youtubeErrorMessage = ref("");
- const youtubeVideoDuration = ref("0.000");
- const youtubeVideoCurrentTime = ref(<number | string>0);
- const youtubeVideoNote = ref("");
- const useHTTPS = ref(false);
- const muted = ref(false);
- const volumeSliderValue = ref(0);
- const artistInputValue = ref("");
- const genreInputValue = ref("");
- const tagInputValue = ref("");
- const activityWatchVideoDataInterval = ref(null);
- const activityWatchVideoLastStatus = ref("");
- const activityWatchVideoLastStartDuration = ref(0);
- const recommendedGenres = ref([
- "Blues",
- "Country",
- "Disco",
- "Funk",
- "Hip-Hop",
- "Jazz",
- "Metal",
- "Oldies",
- "Other",
- "Pop",
- "Rap",
- "Reggae",
- "Rock",
- "Techno",
- "Trance",
- "Classical",
- "Instrumental",
- "House",
- "Electronic",
- "Christian Rap",
- "Lo-Fi",
- "Musical",
- "Rock 'n' Roll",
- "Opera",
- "Drum & Bass",
- "Club-House",
- "Indie",
- "Heavy Metal",
- "Christian rock",
- "Dubstep"
- ]);
- const autosuggest = ref({
- allItems: {
- artists: [],
- genres: [],
- tags: []
- }
- });
- const songNotFound = ref(false);
- const showRateDropdown = ref(false);
- const thumbnailElement = ref();
- const thumbnailNotSquare = ref(false);
- const thumbnailWidth = ref(null);
- const thumbnailHeight = ref(null);
- const thumbnailLoadError = ref(false);
- const tabs = ref([]);
- const inputs = ref([]);
- const playerReady = ref(true);
- const interval = ref();
- const saveButtonRefs = ref(<any>[]);
- const canvasElement = ref();
- const genreHelper = ref();
- // EditSongs
- const items = ref([]);
- const currentSong = ref(<Song>{});
- const flagFilter = ref(false);
- const sidebarMobileActive = ref(false);
- const songItems = ref([]);
- // EditSongs end
- const isYoutubeThumbnail = computed(
- () =>
- songDataLoaded.value &&
- song.value.youtubeId &&
- song.value.thumbnail &&
- (song.value.thumbnail.lastIndexOf("i.ytimg.com") !== -1 ||
- song.value.thumbnail.lastIndexOf("img.youtube.com") !== -1)
- );
- // EditSongs
- const editingItemIndex = computed(() =>
- items.value.findIndex(
- item => item.song.youtubeId === currentSong.value.youtubeId
- )
- );
- const filteredItems = computed({
- get: () =>
- items.value.filter(item => (flagFilter.value ? item.flagged : true)),
- set: (newItem: any) => {
- const index = items.value.findIndex(
- item => item.song.youtubeId === newItem.youtubeId
- );
- items.value[index] = newItem;
- }
- });
- const filteredEditingItemIndex = computed(() =>
- filteredItems.value.findIndex(
- item => item.song.youtubeId === currentSong.value.youtubeId
- )
- );
- const currentSongFlagged = computed(
- () =>
- items.value.find(
- item => item.song.youtubeId === currentSong.value.youtubeId
- )?.flagged
- );
- // EditSongs end
- const {
- editSong,
- stopVideo,
- hardStopVideo,
- loadVideoById,
- pauseVideo,
- setSong,
- resetSong,
- updateOriginalSong,
- updateSongField,
- updateReports,
- setPlaybackRate
- } = editSongStore;
- const { updateMediaModalPlayingAudio } = stationStore;
- const showTab = payload => {
- if (tabs.value[`${payload}-tab`])
- tabs.value[`${payload}-tab`].scrollIntoView({ block: "nearest" });
- editSongStore.showTab(payload);
- };
- // EditSongs
- const toggleDone = (index, overwrite = null) => {
- const { status } = filteredItems.value[index];
- if (status === "done" && overwrite !== "done")
- filteredItems.value[index].status = "todo";
- else {
- filteredItems.value[index].status = "done";
- filteredItems.value[index].flagged = false;
- }
- };
- const toggleFlagFilter = () => {
- flagFilter.value = !flagFilter.value;
- };
- const toggleMobileSidebar = () => {
- sidebarMobileActive.value = !sidebarMobileActive.value;
- };
- const pickSong = song => {
- editSong({
- youtubeId: song.youtubeId,
- prefill: songPrefillData.value[song.youtubeId]
- });
- currentSong.value = song;
- if (
- songItems.value[`edit-songs-item-${song.youtubeId}`] &&
- songItems.value[`edit-songs-item-${song.youtubeId}`][0]
- )
- songItems.value[
- `edit-songs-item-${song.youtubeId}`
- ][0].scrollIntoView();
- };
- const editNextSong = () => {
- const currentlyEditingSongIndex = filteredEditingItemIndex.value;
- let newEditingSongIndex = -1;
- const index =
- currentlyEditingSongIndex + 1 === filteredItems.value.length
- ? 0
- : currentlyEditingSongIndex + 1;
- for (let i = index; i < filteredItems.value.length; i += 1) {
- if (!flagFilter.value || filteredItems.value[i].flagged) {
- newEditingSongIndex = i;
- break;
- }
- }
- if (newEditingSongIndex > -1) {
- const nextSong = filteredItems.value[newEditingSongIndex].song;
- if (nextSong.removed) editNextSong();
- else pickSong(nextSong);
- }
- };
- const toggleFlag = (songIndex = null) => {
- if (songIndex && songIndex > -1) {
- filteredItems.value[songIndex].flagged =
- !filteredItems.value[songIndex].flagged;
- new Toast(
- `Successfully ${
- filteredItems.value[songIndex].flagged ? "flagged" : "unflagged"
- } song.`
- );
- } else if (!songIndex && editingItemIndex.value > -1) {
- items.value[editingItemIndex.value].flagged =
- !items.value[editingItemIndex.value].flagged;
- new Toast(
- `Successfully ${
- items.value[editingItemIndex.value].flagged
- ? "flagged"
- : "unflagged"
- } song.`
- );
- }
- };
- const onSavedSuccess = youtubeId => {
- const itemIndex = items.value.findIndex(
- item => item.song.youtubeId === youtubeId
- );
- if (itemIndex > -1) {
- items.value[itemIndex].status = "done";
- items.value[itemIndex].flagged = false;
- }
- };
- const onSavedError = youtubeId => {
- const itemIndex = items.value.findIndex(
- item => item.song.youtubeId === youtubeId
- );
- if (itemIndex > -1) items.value[itemIndex].status = "error";
- };
- const onSaving = youtubeId => {
- const itemIndex = items.value.findIndex(
- item => item.song.youtubeId === youtubeId
- );
- if (itemIndex > -1) items.value[itemIndex].status = "saving";
- };
- // EditSongs end
- const onThumbnailLoad = () => {
- if (thumbnailElement.value) {
- const height = thumbnailElement.value.naturalHeight;
- const width = thumbnailElement.value.naturalWidth;
- thumbnailNotSquare.value = height !== width;
- thumbnailHeight.value = height;
- thumbnailWidth.value = width;
- } else {
- thumbnailNotSquare.value = false;
- thumbnailHeight.value = null;
- thumbnailWidth.value = null;
- }
- };
- const onThumbnailLoadError = error => {
- thumbnailLoadError.value = error !== 0;
- };
- const unloadSong = (_youtubeId, songId?) => {
- songDataLoaded.value = false;
- songDeleted.value = false;
- stopVideo();
- pauseVideo(true);
- resetSong(_youtubeId);
- thumbnailNotSquare.value = false;
- thumbnailWidth.value = null;
- thumbnailHeight.value = null;
- youtubeVideoCurrentTime.value = "0.000";
- youtubeVideoDuration.value = "0.000";
- youtubeVideoNote.value = "";
- if (songId) socket.dispatch("apis.leaveRoom", `edit-song.${songId}`);
- if (saveButtonRefs.value.saveButton)
- saveButtonRefs.value.saveButton.status = "default";
- };
- const loadSong = _youtubeId => {
- console.log(`LOAD SONG ${_youtubeId}`);
- songNotFound.value = false;
- socket.dispatch(`songs.getSongsFromYoutubeIds`, [_youtubeId], res => {
- const { songs } = res.data;
- if (res.status === "success" && songs.length > 0) {
- let _song = songs[0];
- _song = Object.assign(_song, prefillData.value);
- setSong(_song);
- songDataLoaded.value = true;
- if (_song._id) {
- socket.dispatch("apis.joinRoom", `edit-song.${_song._id}`);
- if (!newSong.value)
- socket.dispatch(
- "reports.getReportsForSong",
- _song._id,
- res => {
- console.log(222, res);
- updateReports(res.data.reports);
- }
- );
- }
- if (video.value.player && video.value.player.cueVideoById) {
- video.value.player.cueVideoById(_youtubeId, _song.skipDuration);
- }
- } else {
- new Toast("Song with that ID not found");
- if (bulk.value) songNotFound.value = true;
- if (!bulk.value) modalsStore.closeCurrentModal();
- }
- });
- };
- const drawCanvas = () => {
- if (!songDataLoaded.value || !canvasElement.value) return;
- const ctx = canvasElement.value.getContext("2d");
- const videoDuration = Number(youtubeVideoDuration.value);
- const skipDuration = Number(song.value.skipDuration);
- const duration = Number(song.value.duration);
- const afterDuration = videoDuration - (skipDuration + duration);
- const width = 530;
- const currentTime =
- video.value.player && video.value.player.getCurrentTime
- ? video.value.player.getCurrentTime()
- : 0;
- const widthSkipDuration = (skipDuration / videoDuration) * width;
- const widthDuration = (duration / videoDuration) * width;
- const widthAfterDuration = (afterDuration / videoDuration) * width;
- const widthCurrentTime = (currentTime / videoDuration) * width;
- const skipDurationColor = "#F42003";
- const durationColor = "#03A9F4";
- const afterDurationColor = "#41E841";
- const currentDurationColor = "#3b25e8";
- ctx.fillStyle = skipDurationColor;
- ctx.fillRect(0, 0, widthSkipDuration, 20);
- ctx.fillStyle = durationColor;
- ctx.fillRect(widthSkipDuration, 0, widthDuration, 20);
- ctx.fillStyle = afterDurationColor;
- ctx.fillRect(widthSkipDuration + widthDuration, 0, widthAfterDuration, 20);
- ctx.fillStyle = currentDurationColor;
- ctx.fillRect(widthCurrentTime, 0, 1, 20);
- };
- const seekTo = position => {
- pauseVideo(false);
- video.value.player.seekTo(position);
- };
- const init = () => {
- if (newSong.value && !youtubeId.value && !bulk.value) {
- setSong({
- youtubeId: "",
- title: "",
- artists: [],
- genres: [],
- tags: [],
- duration: 0,
- skipDuration: 0,
- thumbnail: "",
- verified: false
- });
- songDataLoaded.value = true;
- showTab("youtube");
- } else if (youtubeId.value) loadSong(youtubeId.value);
- else if (!bulk.value) {
- new Toast("You can't open EditSong without editing a song");
- return modalsStore.closeCurrentModal();
- }
- interval.value = setInterval(() => {
- if (
- song.value.duration !== -1 &&
- video.value.paused === false &&
- playerReady.value &&
- (video.value.player.getCurrentTime() - song.value.skipDuration >
- song.value.duration ||
- (video.value.player.getCurrentTime() > 0 &&
- video.value.player.getCurrentTime() >=
- video.value.player.getDuration()))
- ) {
- stopVideo();
- pauseVideo(true);
- drawCanvas();
- }
- if (
- playerReady.value &&
- video.value.player.getVideoData &&
- video.value.player.getVideoData() &&
- video.value.player.getVideoData().video_id === song.value.youtubeId
- ) {
- const currentTime = video.value.player.getCurrentTime();
- if (currentTime !== undefined)
- youtubeVideoCurrentTime.value = currentTime.toFixed(3);
- if (youtubeVideoDuration.value.indexOf(".000") !== -1) {
- const duration = video.value.player.getDuration();
- if (duration !== undefined) {
- if (
- `${youtubeVideoDuration.value}` ===
- `${Number(song.value.duration).toFixed(3)}`
- )
- song.value.duration = duration.toFixed(3);
- youtubeVideoDuration.value = duration.toFixed(3);
- if (youtubeVideoDuration.value.indexOf(".000") !== -1)
- youtubeVideoNote.value = "(~)";
- else youtubeVideoNote.value = "";
- drawCanvas();
- }
- }
- }
- if (video.value.paused === false) drawCanvas();
- }, 200);
- if (window.YT && window.YT.Player) {
- video.value.player = new window.YT.Player(
- `editSongPlayer-${props.modalUuid}`,
- {
- height: 298,
- width: 530,
- videoId: null,
- host: "https://www.youtube-nocookie.com",
- playerVars: {
- controls: 0,
- iv_load_policy: 3,
- rel: 0,
- showinfo: 0,
- autoplay: 0
- },
- startSeconds: song.value.skipDuration,
- events: {
- onReady: () => {
- let volume = parseFloat(localStorage.getItem("volume"));
- volume = typeof volume === "number" ? volume : 20;
- video.value.player.setVolume(volume);
- if (volume > 0) video.value.player.unMute();
- playerReady.value = true;
- if (song.value && song.value.youtubeId)
- video.value.player.cueVideoById(
- song.value.youtubeId,
- song.value.skipDuration
- );
- setPlaybackRate(null);
- drawCanvas();
- },
- onStateChange: event => {
- drawCanvas();
- if (event.data === 1) {
- video.value.paused = false;
- updateMediaModalPlayingAudio(true);
- let youtubeDuration =
- video.value.player.getDuration();
- const newYoutubeVideoDuration =
- youtubeDuration.toFixed(3);
- if (
- youtubeVideoDuration.value.indexOf(".000") !==
- -1 &&
- `${youtubeVideoDuration.value}` !==
- `${newYoutubeVideoDuration}`
- ) {
- const songDurationNumber = Number(
- song.value.duration
- );
- const songDurationNumber2 =
- Number(song.value.duration) + 1;
- const songDurationNumber3 =
- Number(song.value.duration) - 1;
- const fixedSongDuration =
- songDurationNumber.toFixed(3);
- const fixedSongDuration2 =
- songDurationNumber2.toFixed(3);
- const fixedSongDuration3 =
- songDurationNumber3.toFixed(3);
- if (
- `${youtubeVideoDuration.value}` ===
- `${Number(song.value.duration).toFixed(
- 3
- )}` &&
- (fixedSongDuration ===
- youtubeVideoDuration.value ||
- fixedSongDuration2 ===
- youtubeVideoDuration.value ||
- fixedSongDuration3 ===
- youtubeVideoDuration.value)
- )
- song.value.duration =
- newYoutubeVideoDuration;
- youtubeVideoDuration.value =
- newYoutubeVideoDuration;
- if (
- youtubeVideoDuration.value.indexOf(
- ".000"
- ) !== -1
- )
- youtubeVideoNote.value = "(~)";
- else youtubeVideoNote.value = "";
- }
- if (song.value.duration === -1)
- song.value.duration = Number.parseInt(
- youtubeVideoDuration.value
- );
- youtubeDuration -= song.value.skipDuration;
- if (song.value.duration > youtubeDuration + 1) {
- stopVideo();
- pauseVideo(true);
- return new Toast(
- "Video can't play. Specified duration is bigger than the YouTube song duration."
- );
- }
- if (song.value.duration <= 0) {
- stopVideo();
- pauseVideo(true);
- return new Toast(
- "Video can't play. Specified duration has to be more than 0 seconds."
- );
- }
- if (
- video.value.player.getCurrentTime() <
- song.value.skipDuration
- ) {
- return seekTo(song.value.skipDuration);
- }
- setPlaybackRate(null);
- } else if (event.data === 2) {
- video.value.paused = true;
- updateMediaModalPlayingAudio(false);
- }
- return false;
- }
- }
- }
- );
- } else {
- youtubeError.value = true;
- youtubeErrorMessage.value = "Player could not be loaded.";
- }
- ["artists", "genres", "tags"].forEach(type => {
- socket.dispatch(
- `songs.get${type.charAt(0).toUpperCase()}${type.slice(1)}`,
- res => {
- if (res.status === "success") {
- const { items } = res.data;
- if (type === "genres")
- autosuggest.value.allItems[type] = Array.from(
- new Set([...recommendedGenres.value, ...items])
- );
- else autosuggest.value.allItems[type] = items;
- } else {
- new Toast(res.message);
- }
- }
- );
- });
- return null;
- };
- const save = (songToCopy, closeOrNext, saveButtonRefName, _newSong = false) => {
- const _song = JSON.parse(JSON.stringify(songToCopy));
- if (!newSong.value || bulk.value) onSaving(_song.youtubeId);
- const saveButtonRef = saveButtonRefs.value[saveButtonRefName];
- if (!youtubeError.value && youtubeVideoDuration.value === "0.000") {
- saveButtonRef.handleFailedSave();
- if (!_newSong) onSavedError(_song.youtubeId);
- return new Toast("The video appears to not be working.");
- }
- if (!_song.title) {
- saveButtonRef.handleFailedSave();
- if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
- return new Toast("Please fill in all fields");
- }
- if (!_song.thumbnail) {
- saveButtonRef.handleFailedSave();
- if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
- return new Toast("Please fill in all fields");
- }
- // const thumbnailHeight = thumbnailElement.value.naturalHeight;
- // const thumbnailWidth = thumbnailElement.value.naturalWidth;
- // if (thumbnailHeight < 80 || thumbnailWidth < 80) {
- // saveButtonRef.handleFailedSave();
- // return new Toast(
- // "Thumbnail width and height must be at least 80px."
- // );
- // }
- // if (thumbnailHeight > 4000 || thumbnailWidth > 4000) {
- // saveButtonRef.handleFailedSave();
- // return new Toast(
- // "Thumbnail width and height must be less than 4000px."
- // );
- // }
- // if (thumbnailHeight - thumbnailWidth > 5) {
- // saveButtonRef.handleFailedSave();
- // return new Toast("Thumbnail cannot be taller than it is wide.");
- // }
- // Youtube Id
- if (
- !_newSong &&
- youtubeError.value &&
- originalSong.value.youtubeId !== _song.youtubeId
- ) {
- saveButtonRef.handleFailedSave();
- if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
- return new Toast(
- "You're not allowed to change the YouTube id while the player is not working"
- );
- }
- // Duration
- if (
- Number(_song.skipDuration) + Number(_song.duration) >
- Number.parseInt(youtubeVideoDuration.value) &&
- (((!_newSong || bulk.value) && !youtubeError.value) ||
- originalSong.value.duration !== _song.duration)
- ) {
- saveButtonRef.handleFailedSave();
- if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
- return new Toast(
- "Duration can't be higher than the length of the video"
- );
- }
- // Title
- if (!validation.isLength(_song.title, 1, 100)) {
- saveButtonRef.handleFailedSave();
- if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
- return new Toast("Title must have between 1 and 100 characters.");
- }
- // Artists
- if (
- (_song.verified && _song.artists.length < 1) ||
- _song.artists.length > 10
- ) {
- saveButtonRef.handleFailedSave();
- if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
- return new Toast(
- "Invalid artists. You must have at least 1 artist and a maximum of 10 artists."
- );
- }
- let error;
- _song.artists.forEach(artist => {
- if (!validation.isLength(artist, 1, 64)) {
- error = "Artist must have between 1 and 64 characters.";
- return error;
- }
- if (artist === "NONE") {
- error =
- 'Invalid artist format. Artists are not allowed to be named "NONE".';
- return error;
- }
- return false;
- });
- if (error) {
- saveButtonRef.handleFailedSave();
- if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
- return new Toast(error);
- }
- // Genres
- error = undefined;
- if (_song.verified && _song.genres.length < 1)
- _song.genres.forEach(genre => {
- if (!validation.isLength(genre, 1, 32)) {
- error = "Genre must have between 1 and 32 characters.";
- return error;
- }
- if (!validation.regex.ascii.test(genre)) {
- error =
- "Invalid genre format. Only ascii characters are allowed.";
- return error;
- }
- return false;
- });
- if ((_song.verified && _song.genres.length < 1) || _song.genres.length > 16)
- error = "You must have between 1 and 16 genres.";
- if (error) {
- saveButtonRef.handleFailedSave();
- if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
- return new Toast(error);
- }
- error = undefined;
- _song.tags.forEach(tag => {
- if (
- !/^[a-zA-Z0-9_]{1,64}$|^[a-zA-Z0-9_]{1,64}\[[a-zA-Z0-9_]{1,64}\]$/.test(
- tag
- )
- ) {
- error = "Invalid tag format.";
- return error;
- }
- return false;
- });
- if (error) {
- saveButtonRef.handleFailedSave();
- if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
- return new Toast(error);
- }
- // Thumbnail
- if (!validation.isLength(_song.thumbnail, 1, 256)) {
- saveButtonRef.handleFailedSave();
- if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
- return new Toast("Thumbnail must have between 8 and 256 characters.");
- }
- if (useHTTPS.value && _song.thumbnail.indexOf("https://") !== 0) {
- saveButtonRef.handleFailedSave();
- if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
- return new Toast('Thumbnail must start with "https://".');
- }
- if (
- !useHTTPS.value &&
- _song.thumbnail.indexOf("http://") !== 0 &&
- _song.thumbnail.indexOf("https://") !== 0
- ) {
- saveButtonRef.handleFailedSave();
- if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
- return new Toast('Thumbnail must start with "http://".');
- }
- saveButtonRef.status = "saving";
- if (_newSong)
- return socket.dispatch(`songs.create`, _song, res => {
- new Toast(res.message);
- if (res.status === "error") {
- saveButtonRef.handleFailedSave();
- onSavedError(_song.youtubeId);
- return;
- }
- saveButtonRef.handleSuccessfulSave();
- onSavedSuccess(_song.youtubeId);
- if (!closeOrNext) {
- loadSong(_song.youtubeId);
- return;
- }
- if (bulk.value) editNextSong();
- else modalsStore.closeCurrentModal();
- });
- return socket.dispatch(`songs.update`, _song._id, _song, res => {
- new Toast(res.message);
- if (res.status === "error") {
- saveButtonRef.handleFailedSave();
- onSavedError(_song.youtubeId);
- return;
- }
- updateOriginalSong(_song);
- saveButtonRef.handleSuccessfulSave();
- onSavedSuccess(_song.youtubeId);
- if (!closeOrNext) return;
- if (bulk.value) editNextSong();
- else modalsStore.closeCurrentModal();
- });
- };
- const getAlbumData = type => {
- if (!song.value.discogs) return;
- if (type === "title")
- updateSongField({
- field: "title",
- value: song.value.discogs.track.title
- });
- if (type === "albumArt")
- updateSongField({
- field: "thumbnail",
- value: song.value.discogs.album.albumArt
- });
- if (type === "genres")
- updateSongField({
- field: "genres",
- value: JSON.parse(JSON.stringify(song.value.discogs.album.genres))
- });
- if (type === "artists")
- updateSongField({
- field: "artists",
- value: JSON.parse(JSON.stringify(song.value.discogs.album.artists))
- });
- };
- const getYouTubeData = type => {
- if (type === "title") {
- try {
- const { title } = video.value.player.getVideoData();
- if (title)
- updateSongField({
- field: "title",
- value: title
- });
- else throw new Error("No title found");
- } catch (e) {
- new Toast(
- "Unable to fetch YouTube video title. Try starting the video."
- );
- }
- }
- if (type === "thumbnail")
- updateSongField({
- field: "thumbnail",
- value: `https://img.youtube.com/vi/${song.value.youtubeId}/mqdefault.jpg`
- });
- if (type === "author") {
- try {
- const { author } = video.value.player.getVideoData();
- if (author) artistInputValue.value = author;
- else throw new Error("No video author found");
- } catch (e) {
- new Toast(
- "Unable to fetch YouTube video author. Try starting the video."
- );
- }
- }
- };
- const fillDuration = () => {
- song.value.duration =
- Number.parseInt(youtubeVideoDuration.value) - song.value.skipDuration;
- };
- const settings = type => {
- switch (type) {
- case "stop":
- stopVideo();
- pauseVideo(true);
- break;
- case "hardStop":
- hardStopVideo();
- pauseVideo(true);
- break;
- case "pause":
- pauseVideo(true);
- break;
- case "play":
- pauseVideo(false);
- break;
- case "skipToLast10Secs":
- seekTo(song.value.duration - 10 + song.value.skipDuration);
- break;
- default:
- break;
- }
- };
- const play = () => {
- if (video.value.player.getVideoData().video_id !== song.value.youtubeId) {
- song.value.duration = -1;
- loadVideoById(song.value.youtubeId, song.value.skipDuration);
- }
- settings("play");
- };
- const changeVolume = () => {
- const volume = volumeSliderValue.value;
- localStorage.setItem("volume", `${volume}`);
- video.value.player.setVolume(volume);
- if (volume > 0) {
- video.value.player.unMute();
- muted.value = false;
- }
- };
- const toggleMute = () => {
- const previousVolume = parseFloat(localStorage.getItem("volume"));
- const volume = video.value.player.getVolume() <= 0 ? previousVolume : 0;
- muted.value = !muted.value;
- volumeSliderValue.value = volume;
- video.value.player.setVolume(volume);
- if (!muted.value) localStorage.setItem("volume", `${volume}`);
- };
- const addTag = (type, value?) => {
- if (type === "genres") {
- const genre = value || genreInputValue.value.trim();
- if (
- song.value.genres
- .map(genre => genre.toLowerCase())
- .indexOf(genre.toLowerCase()) !== -1
- )
- return new Toast("Genre already exists");
- if (genre) {
- song.value.genres.push(genre);
- genreInputValue.value = "";
- return false;
- }
- return new Toast("Genre cannot be empty");
- }
- if (type === "artists") {
- const artist = value || artistInputValue.value;
- if (song.value.artists.indexOf(artist) !== -1)
- return new Toast("Artist already exists");
- if (artist !== "") {
- song.value.artists.push(artist);
- artistInputValue.value = "";
- return false;
- }
- return new Toast("Artist cannot be empty");
- }
- if (type === "tags") {
- const tag = value || tagInputValue.value;
- if (song.value.tags.indexOf(tag) !== -1)
- return new Toast("Tag already exists");
- if (tag !== "") {
- song.value.tags.push(tag);
- tagInputValue.value = "";
- return false;
- }
- return new Toast("Tag cannot be empty");
- }
- return false;
- };
- const removeTag = (type, value) => {
- if (type === "genres")
- song.value.genres.splice(song.value.genres.indexOf(value), 1);
- else if (type === "artists")
- song.value.artists.splice(song.value.artists.indexOf(value), 1);
- else if (type === "tags")
- song.value.tags.splice(song.value.tags.indexOf(value), 1);
- };
- const setTrackPosition = event => {
- seekTo(
- Number(
- Number(video.value.player.getDuration()) *
- ((event.pageX - event.target.getBoundingClientRect().left) /
- 530)
- )
- );
- };
- const toggleGenreHelper = () => {
- genreHelper.value.toggleBox();
- };
- const resetGenreHelper = () => {
- genreHelper.value.resetBox();
- };
- const sendActivityWatchVideoData = () => {
- if (!video.value.paused) {
- if (activityWatchVideoLastStatus.value !== "playing") {
- activityWatchVideoLastStatus.value = "playing";
- if (
- song.value.skipDuration > 0 &&
- Number(youtubeVideoCurrentTime.value) === 0
- ) {
- activityWatchVideoLastStartDuration.value = Math.floor(
- song.value.skipDuration +
- Number(youtubeVideoCurrentTime.value)
- );
- } else {
- activityWatchVideoLastStartDuration.value = Math.floor(
- Number(youtubeVideoCurrentTime.value)
- );
- }
- }
- const videoData = {
- title: song.value.title,
- artists: song.value.artists ? song.value.artists.join(", ") : null,
- youtubeId: song.value.youtubeId,
- muted: muted.value,
- volume: volumeSliderValue.value,
- startedDuration:
- activityWatchVideoLastStartDuration.value <= 0
- ? 0
- : activityWatchVideoLastStartDuration.value,
- source: `editSong#${song.value.youtubeId}`,
- hostname: window.location.hostname
- };
- aw.sendVideoData(videoData);
- } else {
- activityWatchVideoLastStatus.value = "not_playing";
- }
- };
- const remove = id => {
- socket.dispatch("songs.remove", id, res => {
- new Toast(res.message);
- });
- };
- const handleConfirmed = ({ action, params }) => {
- if (typeof action === "function") {
- if (params) action(params);
- else action();
- }
- };
- const confirmAction = ({ message, action, params }) => {
- openModal({
- modal: "confirm",
- data: {
- message,
- action,
- params,
- onCompleted: handleConfirmed
- }
- });
- };
- const onCloseModal = () => {
- const songStringified = JSON.stringify({
- ...song.value,
- ...{
- duration: Number(song.value.duration).toFixed(3)
- }
- });
- const originalSongStringified = JSON.stringify({
- ...originalSong.value,
- ...{
- duration: Number(originalSong.value.duration).toFixed(3)
- }
- });
- const unsavedChanges = songStringified !== originalSongStringified;
- const confirmReasons = [];
- if (unsavedChanges) {
- confirmReasons.push(
- "You have unsaved changes. Are you sure you want to discard unsaved changes?"
- );
- }
- if (bulk.value) {
- const doneItems = items.value.filter(
- item => item.status === "done"
- ).length;
- const flaggedItems = items.value.filter(item => item.flagged).length;
- const notDoneItems = items.value.length - doneItems;
- if (doneItems > 0 && notDoneItems > 0)
- confirmReasons.push(
- "You have songs which are not done yet. Are you sure you want to stop editing songs?"
- );
- else if (flaggedItems > 0)
- confirmReasons.push(
- "You have songs which are flagged. Are you sure you want to stop editing songs?"
- );
- }
- if (confirmReasons.length > 0) {
- return confirmAction({
- message: confirmReasons,
- action: modalsStore.closeCurrentModal,
- params: null
- });
- }
- return modalsStore.closeCurrentModal();
- };
- watch(
- () => song.value.duration,
- () => drawCanvas()
- );
- watch(
- () => song.value.skipDuration,
- () => drawCanvas()
- );
- watch(youtubeId, (_youtubeId, _oldYoutubeId) => {
- console.log("NEW YOUTUBE ID", _youtubeId);
- unloadSong(_oldYoutubeId);
- loadSong(_youtubeId);
- });
- onMounted(async () => {
- activityWatchVideoDataInterval.value = setInterval(() => {
- sendActivityWatchVideoData();
- }, 1000);
- useHTTPS.value = await lofig.get("cookie.secure");
- ws.onConnect(init);
- let volume = parseFloat(localStorage.getItem("volume"));
- volume = typeof volume === "number" && !Number.isNaN(volume) ? volume : 20;
- localStorage.setItem("volume", `${volume}`);
- volumeSliderValue.value = volume;
- socket.on(
- "event:admin.song.removed",
- res => {
- if (res.data.songId === song.value._id) {
- songDeleted.value = true;
- }
- },
- { modalUuid: props.modalUuid }
- );
- if (bulk.value) {
- socket.dispatch("apis.joinRoom", "edit-songs");
- socket.dispatch(
- "songs.getSongsFromYoutubeIds",
- youtubeIds.value,
- res => {
- if (res.data.songs.length === 0) {
- modalsStore.closeCurrentModal();
- new Toast("You can't edit 0 songs.");
- } else {
- items.value = res.data.songs.map(song => ({
- status: "todo",
- flagged: false,
- song
- }));
- editNextSong();
- }
- }
- );
- socket.on(
- `event:admin.song.created`,
- res => {
- const index = items.value
- .map(item => item.song.youtubeId)
- .indexOf(res.data.song.youtubeId);
- if (index >= 0)
- items.value[index].song = {
- ...items.value[index].song,
- ...res.data.song,
- created: true
- };
- },
- { modalUuid: props.modalUuid }
- );
- socket.on(
- `event:admin.song.updated`,
- res => {
- const index = items.value
- .map(item => item.song.youtubeId)
- .indexOf(res.data.song.youtubeId);
- if (index >= 0)
- items.value[index].song = {
- ...items.value[index].song,
- ...res.data.song,
- updated: true
- };
- },
- { modalUuid: props.modalUuid }
- );
- socket.on(
- `event:admin.song.removed`,
- res => {
- const index = items.value
- .map(item => item.song._id)
- .indexOf(res.data.songId);
- if (index >= 0) items.value[index].song.removed = true;
- },
- { modalUuid: props.modalUuid }
- );
- socket.on(
- `event:admin.youtubeVideo.removed`,
- res => {
- const index = items.value
- .map(item => item.song.youtubeVideoId)
- .indexOf(res.videoId);
- if (index >= 0) items.value[index].song.removed = true;
- },
- { modalUuid: props.modalUuid }
- );
- }
- keyboardShortcuts.registerShortcut("editSong.pauseResumeVideo", {
- keyCode: 101,
- preventDefault: true,
- handler: () => {
- if (video.value.paused) play();
- else settings("pause");
- }
- });
- keyboardShortcuts.registerShortcut("editSong.stopVideo", {
- keyCode: 101,
- ctrl: true,
- preventDefault: true,
- handler: () => {
- settings("stop");
- }
- });
- keyboardShortcuts.registerShortcut("editSong.hardStopVideo", {
- keyCode: 101,
- ctrl: true,
- shift: true,
- preventDefault: true,
- handler: () => {
- settings("hardStop");
- }
- });
- keyboardShortcuts.registerShortcut("editSong.skipToLast10Secs", {
- keyCode: 102,
- preventDefault: true,
- handler: () => {
- settings("skipToLast10Secs");
- }
- });
- keyboardShortcuts.registerShortcut("editSong.lowerVolumeLarge", {
- keyCode: 98,
- preventDefault: true,
- handler: () => {
- volumeSliderValue.value = Math.max(0, volumeSliderValue.value - 10);
- changeVolume();
- }
- });
- keyboardShortcuts.registerShortcut("editSong.lowerVolumeSmall", {
- keyCode: 98,
- ctrl: true,
- preventDefault: true,
- handler: () => {
- volumeSliderValue.value = Math.max(0, volumeSliderValue.value - 1);
- changeVolume();
- }
- });
- keyboardShortcuts.registerShortcut("editSong.increaseVolumeLarge", {
- keyCode: 104,
- preventDefault: true,
- handler: () => {
- volumeSliderValue.value = Math.min(
- 100,
- volumeSliderValue.value + 10
- );
- changeVolume();
- }
- });
- keyboardShortcuts.registerShortcut("editSong.increaseVolumeSmall", {
- keyCode: 104,
- ctrl: true,
- preventDefault: true,
- handler: () => {
- volumeSliderValue.value = Math.min(
- 100,
- volumeSliderValue.value + 1
- );
- changeVolume();
- }
- });
- keyboardShortcuts.registerShortcut("editSong.save", {
- keyCode: 83,
- ctrl: true,
- preventDefault: true,
- handler: () => {
- save(song.value, false, "saveButton");
- }
- });
- keyboardShortcuts.registerShortcut("editSong.saveClose", {
- keyCode: 83,
- ctrl: true,
- alt: true,
- preventDefault: true,
- handler: () => {
- save(song.value, true, "saveAndCloseButton");
- }
- });
- keyboardShortcuts.registerShortcut("editSong.focusTitle", {
- keyCode: 36,
- preventDefault: true,
- handler: () => {
- inputs.value["title-input"].focus();
- }
- });
- keyboardShortcuts.registerShortcut("editSong.useAllDiscogs", {
- keyCode: 68,
- alt: true,
- ctrl: true,
- preventDefault: true,
- handler: () => {
- getAlbumData("title");
- getAlbumData("albumArt");
- getAlbumData("artists");
- getAlbumData("genres");
- }
- });
- keyboardShortcuts.registerShortcut("editSong.closeModal", {
- keyCode: 27,
- handler: () => {
- if (
- modals.value[
- activeModals.value[activeModals.value.length - 1]
- ] === "editSong"
- ) {
- onCloseModal();
- }
- }
- });
- /*
- editSong.pauseResume - Num 5 - Pause/resume song
- editSong.stopVideo - Ctrl - Num 5 - Stop
- editSong.hardStopVideo - Shift - Ctrl - Num 5 - Stop
- editSong.skipToLast10Secs - Num 6 - Skip to last 10 seconds
- editSong.lowerVolumeLarge - Num 2 - Volume down by 10
- editSong.lowerVolumeSmall - Ctrl - Num 2 - Volume down by 1
- editSong.increaseVolumeLarge - Num 8 - Volume up by 10
- editSong.increaseVolumeSmall - Ctrl - Num 8 - Volume up by 1
- editSong.focusTitle - Home - Focus the title input
- editSong.focusDicogs - End - Focus the discogs input
- editSong.save - Ctrl - S - Saves song
- editSong.save - Ctrl - Alt - S - Saves song and closes the modal
- editSong.save - Ctrl - Alt - V - Saves song, verifies songs and then closes the modal
- editSong.close - F4 - Closes modal without saving
- editSong.useAllDiscogs - Ctrl - Alt - D - Sets all fields to the Discogs data
- Inside Discogs inputs: Ctrl - D - Sets this field to the Discogs data
- */
- });
- onBeforeUnmount(() => {
- if (bulk.value) {
- socket.dispatch("apis.leaveRoom", "edit-songs");
- }
- unloadSong(youtubeId.value, song.value._id);
- playerReady.value = false;
- clearInterval(interval.value);
- clearInterval(activityWatchVideoDataInterval.value);
- const shortcutNames = [
- "editSong.pauseResume",
- "editSong.stopVideo",
- "editSong.hardStopVideo",
- "editSong.skipToLast10Secs",
- "editSong.lowerVolumeLarge",
- "editSong.lowerVolumeSmall",
- "editSong.increaseVolumeLarge",
- "editSong.increaseVolumeSmall",
- "editSong.focusTitle",
- "editSong.focusDicogs",
- "editSong.save",
- "editSong.saveClose",
- "editSong.useAllDiscogs",
- "editSong.closeModal"
- ];
- shortcutNames.forEach(shortcutName => {
- keyboardShortcuts.unregisterShortcut(shortcutName);
- });
- // Delete the Pinia store that was created for this modal, after all other cleanup tasks are performed
- editSongStore.$dispose();
- });
- </script>
- <template>
- <div>
- <modal
- :title="`${newSong ? 'Create' : 'Edit'} Song`"
- class="song-modal"
- :size="'wide'"
- :split="true"
- :intercept-close="true"
- @close="onCloseModal"
- >
- <template #toggleMobileSidebar v-if="bulk">
- <i
- class="material-icons toggle-sidebar-icon"
- :content="`${
- sidebarMobileActive ? 'Close' : 'Open'
- } Edit Queue`"
- v-tippy
- @click="toggleMobileSidebar()"
- >expand_circle_down</i
- >
- </template>
- <template #sidebar v-if="bulk">
- <div class="sidebar" :class="{ active: sidebarMobileActive }">
- <header class="sidebar-head">
- <h2 class="sidebar-title is-marginless">Edit Queue</h2>
- <i
- class="material-icons toggle-sidebar-icon"
- :content="`${
- sidebarMobileActive ? 'Close' : 'Open'
- } Edit Queue`"
- v-tippy
- @click="toggleMobileSidebar()"
- >expand_circle_down</i
- >
- </header>
- <section class="sidebar-body">
- <div
- v-show="filteredItems.length > 0"
- class="edit-songs-items"
- >
- <div
- class="item"
- v-for="(data, index) in filteredItems"
- :key="`edit-songs-item-${index}`"
- :ref="
- el =>
- (songItems[
- `edit-songs-item-${data.song.youtubeId}`
- ] = el)
- "
- >
- <song-item
- :song="data.song"
- :thumbnail="false"
- :duration="false"
- :disabled-actions="
- data.song.removed
- ? ['all']
- : ['report', 'edit']
- "
- :class="{
- updated: data.song.updated,
- removed: data.song.removed
- }"
- >
- <template #leftIcon>
- <i
- v-if="
- currentSong.youtubeId ===
- data.song.youtubeId &&
- !data.song.removed
- "
- class="material-icons item-icon editing-icon"
- content="Currently editing song"
- v-tippy="{ theme: 'info' }"
- @click="toggleDone(index)"
- >edit</i
- >
- <i
- v-else-if="data.song.removed"
- class="material-icons item-icon removed-icon"
- content="Song removed"
- v-tippy="{ theme: 'info' }"
- >delete_forever</i
- >
- <i
- v-else-if="data.status === 'error'"
- class="material-icons item-icon error-icon"
- content="Error saving song"
- v-tippy="{ theme: 'info' }"
- @click="toggleDone(index)"
- >error</i
- >
- <i
- v-else-if="data.status === 'saving'"
- class="material-icons item-icon saving-icon"
- content="Currently saving song"
- v-tippy="{ theme: 'info' }"
- >pending</i
- >
- <i
- v-else-if="data.flagged"
- class="material-icons item-icon flag-icon"
- content="Song flagged"
- v-tippy="{ theme: 'info' }"
- @click="toggleDone(index)"
- >flag_circle</i
- >
- <i
- v-else-if="data.status === 'done'"
- class="material-icons item-icon done-icon"
- content="Song marked complete"
- v-tippy="{ theme: 'info' }"
- @click="toggleDone(index)"
- >check_circle</i
- >
- <i
- v-else-if="data.status === 'todo'"
- class="material-icons item-icon todo-icon"
- content="Song marked todo"
- v-tippy="{ theme: 'info' }"
- @click="toggleDone(index)"
- >cancel</i
- >
- </template>
- <template
- v-if="!data.song.removed"
- #actions
- >
- <i
- class="material-icons edit-icon"
- content="Edit Song"
- v-tippy
- @click="pickSong(data.song)"
- >
- edit
- </i>
- </template>
- <template #tippyActions>
- <i
- class="material-icons flag-icon"
- :class="{
- flagged: data.flagged
- }"
- content="Toggle Flag"
- v-tippy
- @click="toggleFlag(index)"
- >
- flag_circle
- </i>
- </template>
- </song-item>
- </div>
- </div>
- <p v-if="filteredItems.length === 0" class="no-items">
- {{
- flagFilter
- ? "No flagged songs queued"
- : "No songs queued"
- }}
- </p>
- </section>
- <footer class="sidebar-foot">
- <button
- @click="toggleFlagFilter()"
- class="button is-primary"
- >
- {{
- flagFilter
- ? "Show All Songs"
- : "Show Only Flagged Songs"
- }}
- </button>
- </footer>
- </div>
- <div
- v-if="sidebarMobileActive"
- class="sidebar-overlay"
- @click="toggleMobileSidebar()"
- ></div>
- </template>
- <template #body>
- <div v-if="!youtubeId && !newSong" class="notice-container">
- <h4>No song has been selected</h4>
- </div>
- <div v-if="songDeleted" class="notice-container">
- <h4>The song you were editing has been deleted</h4>
- </div>
- <div
- v-if="
- youtubeId &&
- !songDataLoaded &&
- !songNotFound &&
- !newSong
- "
- class="notice-container"
- >
- <h4>Song hasn't loaded yet</h4>
- </div>
- <div
- v-if="youtubeId && songNotFound && !newSong"
- class="notice-container"
- >
- <h4>Song was not found</h4>
- </div>
- <div
- class="left-section"
- v-show="songDataLoaded && !songDeleted"
- >
- <div class="top-section">
- <div class="player-section">
- <div :id="`editSongPlayer-${modalUuid}`" />
- <div v-show="youtubeError" class="player-error">
- <h2>{{ youtubeErrorMessage }}</h2>
- </div>
- <canvas
- ref="canvasElement"
- class="duration-canvas"
- v-show="!youtubeError"
- height="20"
- width="530"
- @click="setTrackPosition($event)"
- />
- <div class="player-footer">
- <div class="player-footer-left">
- <button
- class="button is-primary"
- @click="play()"
- @keyup.enter="play()"
- v-if="video.paused"
- content="Resume Playback"
- v-tippy
- >
- <i class="material-icons">play_arrow</i>
- </button>
- <button
- class="button is-primary"
- @click="settings('pause')"
- @keyup.enter="settings('pause')"
- v-else
- content="Pause Playback"
- v-tippy
- >
- <i class="material-icons">pause</i>
- </button>
- <button
- class="button is-danger"
- @click.exact="settings('stop')"
- @click.shift="settings('hardStop')"
- @keyup.enter.exact="settings('stop')"
- @keyup.shift.enter="
- settings('hardStop')
- "
- content="Stop Playback"
- v-tippy
- >
- <i class="material-icons">stop</i>
- </button>
- <tippy
- class="playerRateDropdown"
- :touch="true"
- :interactive="true"
- placement="bottom"
- theme="dropdown"
- ref="dropdown"
- trigger="click"
- append-to="parent"
- @show="
- () => {
- showRateDropdown = true;
- }
- "
- @hide="
- () => {
- showRateDropdown = false;
- }
- "
- >
- <div
- ref="trigger"
- class="control has-addons"
- content="Set Playback Rate"
- v-tippy
- >
- <button class="button is-primary">
- <i class="material-icons"
- >fast_forward</i
- >
- </button>
- <button
- class="button dropdown-toggle"
- >
- <i class="material-icons">
- {{
- showRateDropdown
- ? "expand_more"
- : "expand_less"
- }}
- </i>
- </button>
- </div>
- <template #content>
- <div class="nav-dropdown-items">
- <button
- class="nav-item button"
- :class="{
- active:
- video.playbackRate ===
- 0.5
- }"
- title="0.5x"
- @click="
- setPlaybackRate(0.5)
- "
- >
- <p>0.5x</p>
- </button>
- <button
- class="nav-item button"
- :class="{
- active:
- video.playbackRate ===
- 1
- }"
- title="1x"
- @click="setPlaybackRate(1)"
- >
- <p>1x</p>
- </button>
- <button
- class="nav-item button"
- :class="{
- active:
- video.playbackRate ===
- 2
- }"
- title="2x"
- @click="setPlaybackRate(2)"
- >
- <p>2x</p>
- </button>
- </div>
- </template>
- </tippy>
- </div>
- <div class="player-footer-center">
- <span>
- <span>
- {{ youtubeVideoCurrentTime }}
- </span>
- /
- <span>
- {{ youtubeVideoDuration }}
- {{ youtubeVideoNote }}
- </span>
- </span>
- </div>
- <div class="player-footer-right">
- <p id="volume-control">
- <i
- class="material-icons"
- @click="toggleMute()"
- :content="`${
- muted ? 'Unmute' : 'Mute'
- }`"
- v-tippy
- >{{
- muted
- ? "volume_mute"
- : volumeSliderValue >= 50
- ? "volume_up"
- : "volume_down"
- }}</i
- >
- <input
- v-model="volumeSliderValue"
- type="range"
- min="0"
- max="100"
- class="volume-slider active"
- @change="changeVolume()"
- @input="changeVolume()"
- />
- </p>
- </div>
- </div>
- </div>
- <song-thumbnail
- v-if="songDataLoaded && !songDeleted"
- :song="song"
- :fallback="false"
- class="thumbnail-preview"
- @load-error="onThumbnailLoadError"
- />
- <img
- v-if="
- !isYoutubeThumbnail &&
- songDataLoaded &&
- !songDeleted
- "
- class="thumbnail-dummy"
- :src="song.thumbnail"
- ref="thumbnailElement"
- @load="onThumbnailLoad"
- />
- </div>
- <div
- class="edit-section"
- v-if="songDataLoaded && !songDeleted"
- >
- <div class="control is-grouped">
- <div class="title-container">
- <label class="label">Title</label>
- <p class="control has-addons">
- <input
- class="input"
- type="text"
- :ref="
- el => (inputs['title-input'] = el)
- "
- v-model="song.title"
- placeholder="Enter song title..."
- @keyup.shift.enter="
- getAlbumData('title')
- "
- />
- <button
- class="button youtube-get-button"
- @click="getYouTubeData('title')"
- >
- <div
- class="youtube-icon"
- v-tippy
- content="Fill from YouTube"
- ></div>
- </button>
- <button
- class="button album-get-button"
- @click="getAlbumData('title')"
- >
- <i
- class="material-icons"
- v-tippy
- content="Fill from Discogs"
- >album</i
- >
- </button>
- </p>
- </div>
- <div class="duration-container">
- <label class="label">Duration</label>
- <p class="control has-addons">
- <input
- class="input"
- type="text"
- placeholder="Enter song duration..."
- v-model.number="song.duration"
- @keyup.shift.enter="fillDuration()"
- />
- <button
- class="button duration-fill-button"
- @click="fillDuration()"
- >
- <i
- class="material-icons"
- v-tippy
- content="Sync duration with YouTube"
- >sync</i
- >
- </button>
- </p>
- </div>
- <div class="skip-duration-container">
- <label class="label">Skip duration</label>
- <p class="control">
- <input
- class="input"
- type="text"
- placeholder="Enter skip duration..."
- v-model.number="song.skipDuration"
- />
- </p>
- </div>
- </div>
- <div class="control is-grouped">
- <div class="album-art-container">
- <label class="label">
- Thumbnail
- <i
- v-if="
- thumbnailNotSquare &&
- !isYoutubeThumbnail
- "
- class="material-icons thumbnail-warning"
- content="Thumbnail not square, it will be stretched"
- v-tippy="{ theme: 'info' }"
- >
- warning
- </i>
- <i
- v-if="
- thumbnailLoadError &&
- !isYoutubeThumbnail
- "
- class="material-icons thumbnail-warning"
- content="Error loading thumbnail"
- v-tippy="{ theme: 'info' }"
- >
- warning
- </i>
- </label>
- <p class="control has-addons">
- <input
- class="input"
- type="text"
- v-model="song.thumbnail"
- placeholder="Enter link to thumbnail..."
- @keyup.shift.enter="
- getAlbumData('albumArt')
- "
- />
- <button
- class="button youtube-get-button"
- @click="getYouTubeData('thumbnail')"
- >
- <div
- class="youtube-icon"
- v-tippy
- content="Fill from YouTube"
- ></div>
- </button>
- <button
- class="button album-get-button"
- @click="getAlbumData('albumArt')"
- >
- <i
- class="material-icons"
- v-tippy
- content="Fill from Discogs"
- >album</i
- >
- </button>
- </p>
- </div>
- <div class="youtube-id-container">
- <label class="label">YouTube ID</label>
- <p class="control">
- <input
- class="input"
- type="text"
- placeholder="Enter YouTube ID..."
- v-model="song.youtubeId"
- />
- </p>
- </div>
- <div class="verified-container">
- <label class="label">Verified</label>
- <p class="is-expanded checkbox-control">
- <label class="switch">
- <input
- type="checkbox"
- id="verified"
- v-model="song.verified"
- />
- <span class="slider round"></span>
- </label>
- </p>
- </div>
- </div>
- <div class="control is-grouped">
- <div class="artists-container">
- <label class="label">Artists</label>
- <p class="control has-addons">
- <auto-suggest
- v-model="artistInputValue"
- ref="new-artist"
- placeholder="Add artist..."
- :all-items="
- autosuggest.allItems.artists
- "
- @submitted="addTag('artists')"
- @keyup.shift.enter="
- getAlbumData('artists')
- "
- />
- <button
- class="button youtube-get-button"
- @click="getYouTubeData('author')"
- >
- <div
- class="youtube-icon"
- v-tippy
- content="Fill from YouTube"
- ></div>
- </button>
- <button
- class="button album-get-button"
- @click="getAlbumData('artists')"
- >
- <i
- class="material-icons"
- v-tippy
- content="Fill from Discogs"
- >album</i
- >
- </button>
- <button
- class="button is-info add-button"
- @click="addTag('artists')"
- >
- <i class="material-icons">add</i>
- </button>
- </p>
- <div class="list-container">
- <div
- class="list-item"
- v-for="artist in song.artists"
- :key="artist"
- >
- <div
- class="list-item-circle"
- @click="
- removeTag('artists', artist)
- "
- >
- <i class="material-icons">close</i>
- </div>
- <p>{{ artist }}</p>
- </div>
- </div>
- </div>
- <div class="genres-container">
- <label class="label">
- <span>Genres</span>
- <i
- class="material-icons"
- @click="toggleGenreHelper"
- @dblclick="resetGenreHelper"
- v-tippy
- content="View list of genres"
- >info</i
- >
- </label>
- <p class="control has-addons">
- <auto-suggest
- v-model="genreInputValue"
- ref="new-genre"
- placeholder="Add genre..."
- :all-items="autosuggest.allItems.genres"
- @submitted="addTag('genres')"
- @keyup.shift.enter="
- getAlbumData('genres')
- "
- />
- <button
- class="button album-get-button"
- @click="getAlbumData('genres')"
- >
- <i
- class="material-icons"
- v-tippy
- content="Fill from Discogs"
- >album</i
- >
- </button>
- <button
- class="button is-info add-button"
- @click="addTag('genres')"
- >
- <i class="material-icons">add</i>
- </button>
- </p>
- <div class="list-container">
- <div
- class="list-item"
- v-for="genre in song.genres"
- :key="genre"
- >
- <div
- class="list-item-circle"
- @click="removeTag('genres', genre)"
- >
- <i class="material-icons">close</i>
- </div>
- <p>{{ genre }}</p>
- </div>
- </div>
- </div>
- <div class="tags-container">
- <label class="label">Tags</label>
- <p class="control has-addons">
- <auto-suggest
- v-model="tagInputValue"
- ref="new-tag"
- placeholder="Add tag..."
- :all-items="autosuggest.allItems.tags"
- @submitted="addTag('tags')"
- />
- <button
- class="button is-info add-button"
- @click="addTag('tags')"
- >
- <i class="material-icons">add</i>
- </button>
- </p>
- <div class="list-container">
- <div
- class="list-item"
- v-for="tag in song.tags"
- :key="tag"
- >
- <div
- class="list-item-circle"
- @click="removeTag('tags', tag)"
- >
- <i class="material-icons">close</i>
- </div>
- <p>{{ tag }}</p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div
- class="right-section"
- v-if="songDataLoaded && !songDeleted"
- >
- <div id="tabs-container">
- <div id="tab-selection">
- <button
- class="button is-default"
- :class="{ selected: tab === 'discogs' }"
- :ref="el => (tabs['discogs-tab'] = el)"
- @click="showTab('discogs')"
- >
- Discogs
- </button>
- <button
- v-if="!newSong"
- class="button is-default"
- :class="{ selected: tab === 'reports' }"
- :ref="el => (tabs['reports-tab'] = el)"
- @click="showTab('reports')"
- >
- Reports ({{ reports.length }})
- </button>
- <button
- class="button is-default"
- :class="{ selected: tab === 'youtube' }"
- :ref="el => (tabs['youtube-tab'] = el)"
- @click="showTab('youtube')"
- >
- YouTube
- </button>
- <button
- class="button is-default"
- :class="{ selected: tab === 'musare-songs' }"
- :ref="el => (tabs['musare-songs-tab'] = el)"
- @click="showTab('musare-songs')"
- >
- Songs
- </button>
- </div>
- <discogs
- class="tab"
- v-show="tab === 'discogs'"
- :bulk="bulk"
- :modal-uuid="modalUuid"
- :modal-module-path="modalModulePath"
- />
- <reports-tab
- v-if="!newSong"
- class="tab"
- v-show="tab === 'reports'"
- :modal-uuid="modalUuid"
- :modal-module-path="modalModulePath"
- />
- <youtube
- class="tab"
- v-show="tab === 'youtube'"
- :modal-uuid="modalUuid"
- :modal-module-path="modalModulePath"
- />
- <musare-songs
- class="tab"
- v-show="tab === 'musare-songs'"
- :modal-uuid="modalUuid"
- :modal-module-path="modalModulePath"
- />
- </div>
- </div>
- </template>
- <template #footer>
- <div v-if="bulk">
- <button class="button is-primary" @click="editNextSong()">
- Next
- </button>
- <button
- class="button is-primary"
- @click="toggleFlag()"
- v-if="youtubeId && !songDeleted"
- >
- {{ currentSongFlagged ? "Unflag" : "Flag" }}
- </button>
- </div>
- <div v-if="!newSong && !songDeleted">
- <save-button
- :ref="el => (saveButtonRefs['saveButton'] = el)"
- @clicked="save(song, false, 'saveButton')"
- />
- <save-button
- :ref="el => (saveButtonRefs['saveAndCloseButton'] = el)"
- :default-message="
- bulk ? `Save and next` : `Save and close`
- "
- @clicked="save(song, true, 'saveAndCloseButton')"
- />
- <div class="right">
- <button
- class="button is-danger icon-with-button material-icons"
- @click.prevent="
- confirmAction({
- message:
- 'Removing this song will remove it from all playlists and cause a ratings recalculation.',
- action: remove,
- params: song._id
- })
- "
- content="Delete Song"
- v-tippy
- >
- delete_forever
- </button>
- </div>
- </div>
- <div v-else-if="newSong">
- <save-button
- :ref="el => (saveButtonRefs['createButton'] = el)"
- default-message="Create Song"
- @clicked="save(song, false, 'createButton', true)"
- />
- <save-button
- :ref="
- el => (saveButtonRefs['createAndCloseButton'] = el)
- "
- :default-message="
- bulk ? `Create and next` : `Create and close`
- "
- @clicked="
- save(song, true, 'createAndCloseButton', true)
- "
- />
- </div>
- </template>
- </modal>
- <floating-box
- id="genreHelper"
- ref="genreHelper"
- :column="false"
- title="Song Genres List"
- >
- <template #body>
- <span
- v-for="item in autosuggest.allItems.genres"
- :key="`genre-helper-${item}`"
- >
- {{ item }}
- </span>
- </template>
- </floating-box>
- </div>
- </template>
- <style lang="less" scoped>
- .night-mode {
- .edit-section,
- .player-section,
- #tabs-container {
- background-color: var(--dark-grey-3) !important;
- border: 0 !important;
- .tab {
- border: 0 !important;
- }
- }
- #tabs-container #tab-selection .button {
- background: var(--dark-grey) !important;
- color: var(--white) !important;
- }
- .left-section {
- .edit-section {
- .album-get-button,
- .duration-fill-button,
- .youtube-get-button,
- .add-button {
- &:focus,
- &:hover {
- border: none !important;
- }
- }
- }
- }
- .duration-canvas {
- background-color: var(--dark-grey-2) !important;
- }
- .sidebar {
- .sidebar-head,
- .sidebar-foot {
- background-color: var(--dark-grey-3);
- border: none;
- }
- .sidebar-body {
- background-color: var(--dark-grey-4) !important;
- }
- .sidebar-head .toggle-sidebar-icon.material-icons,
- .sidebar-title {
- color: var(--white);
- }
- p,
- label,
- td,
- th {
- color: var(--light-grey-2) !important;
- }
- h1,
- h2,
- h3,
- h4,
- h5,
- h6 {
- color: var(--white) !important;
- }
- }
- }
- .modal-card-body {
- display: flex;
- }
- .notice-container {
- display: flex;
- flex: 1;
- justify-content: center;
- h4 {
- margin: auto;
- }
- }
- .left-section {
- height: 100%;
- display: flex;
- flex-direction: column;
- margin-right: 16px;
- .top-section {
- display: flex;
- .player-section {
- width: 530px;
- display: flex;
- flex-direction: column;
- border: 1px solid var(--light-grey-3);
- border-radius: @border-radius;
- overflow: hidden;
- .duration-canvas {
- background-color: var(--light-grey-2);
- }
- .player-error {
- display: flex;
- height: 318px;
- width: 530px;
- align-items: center;
- * {
- margin: 0;
- flex: 1;
- font-size: 30px;
- text-align: center;
- }
- }
- .player-footer {
- display: flex;
- justify-content: space-between;
- height: 54px;
- padding-left: 10px;
- padding-right: 10px;
- > * {
- width: 33.3%;
- display: flex;
- align-items: center;
- }
- .player-footer-left {
- flex: 1;
- & > .button:not(:first-child) {
- margin-left: 5px;
- }
- :deep(& > .playerRateDropdown) {
- margin-left: 5px;
- margin-bottom: unset !important;
- .control.has-addons {
- margin-bottom: unset !important;
- & > .button {
- font-size: 24px;
- }
- }
- }
- :deep(.tippy-box[data-theme~="dropdown"]) {
- max-width: 100px !important;
- .nav-dropdown-items .nav-item {
- justify-content: center !important;
- border-radius: @border-radius !important;
- &.active {
- background-color: var(--primary-color);
- color: var(--white);
- }
- }
- }
- }
- .player-footer-center {
- justify-content: center;
- align-items: center;
- flex: 2;
- font-size: 18px;
- font-weight: 400;
- width: 200px;
- margin: 0 5px;
- img {
- height: 21px;
- margin-right: 12px;
- filter: invert(26%) sepia(54%) saturate(6317%)
- hue-rotate(2deg) brightness(92%) contrast(115%);
- }
- }
- .player-footer-right {
- justify-content: right;
- flex: 1;
- #volume-control {
- margin: 3px;
- margin-top: 0;
- display: flex;
- align-items: center;
- cursor: pointer;
- .volume-slider {
- width: 100%;
- padding: 0 15px;
- background: transparent;
- min-width: 100px;
- }
- input[type="range"] {
- -webkit-appearance: none;
- margin: 7.3px 0;
- }
- input[type="range"]:focus {
- outline: none;
- }
- input[type="range"]::-webkit-slider-runnable-track {
- width: 100%;
- height: 5.2px;
- cursor: pointer;
- box-shadow: 0;
- background: var(--light-grey-3);
- border-radius: @border-radius;
- border: 0;
- }
- input[type="range"]::-webkit-slider-thumb {
- box-shadow: 0;
- border: 0;
- height: 19px;
- width: 19px;
- border-radius: 100%;
- background: var(--primary-color);
- cursor: pointer;
- -webkit-appearance: none;
- margin-top: -6.5px;
- }
- input[type="range"]::-moz-range-track {
- width: 100%;
- height: 5.2px;
- cursor: pointer;
- box-shadow: 0;
- background: var(--light-grey-3);
- border-radius: @border-radius;
- border: 0;
- }
- input[type="range"]::-moz-range-thumb {
- box-shadow: 0;
- border: 0;
- height: 19px;
- width: 19px;
- border-radius: 100%;
- background: var(--primary-color);
- cursor: pointer;
- -webkit-appearance: none;
- margin-top: -6.5px;
- }
- input[type="range"]::-ms-track {
- width: 100%;
- height: 5.2px;
- cursor: pointer;
- box-shadow: 0;
- background: var(--light-grey-3);
- border-radius: @border-radius;
- }
- input[type="range"]::-ms-fill-lower {
- background: var(--light-grey-3);
- border: 0;
- border-radius: 0;
- box-shadow: 0;
- }
- input[type="range"]::-ms-fill-upper {
- background: var(--light-grey-3);
- border: 0;
- border-radius: 0;
- box-shadow: 0;
- }
- input[type="range"]::-ms-thumb {
- box-shadow: 0;
- border: 0;
- height: 15px;
- width: 15px;
- border-radius: 100%;
- background: var(--primary-color);
- cursor: pointer;
- -webkit-appearance: none;
- margin-top: 1.5px;
- }
- }
- }
- }
- }
- :deep(.thumbnail-preview) {
- width: 189px;
- height: 189px;
- margin-left: 16px;
- }
- .thumbnail-dummy {
- opacity: 0;
- height: 10px;
- width: 10px;
- }
- }
- .edit-section {
- display: flex;
- flex-wrap: wrap;
- flex-grow: 1;
- border: 1px solid var(--light-grey-3);
- margin-top: 16px;
- border-radius: @border-radius;
- .album-get-button {
- background-color: var(--purple);
- color: var(--white);
- width: 32px;
- text-align: center;
- border-width: 0;
- }
- .duration-fill-button,
- .youtube-get-button {
- background-color: var(--dark-red);
- color: var(--white);
- width: 32px;
- text-align: center;
- border-width: 0;
- }
- .add-button {
- background-color: var(--primary-color) !important;
- width: 32px;
- i {
- font-size: 32px;
- }
- }
- .album-get-button,
- .duration-fill-button,
- .youtube-get-button,
- .add-button {
- &:focus,
- &:hover {
- filter: contrast(0.75);
- border: 1px solid var(--black) !important;
- }
- }
- .youtube-get-button {
- padding-left: 4px;
- padding-right: 4px;
- .youtube-icon {
- background: var(--white);
- }
- }
- > div {
- margin: 16px !important;
- width: 100%;
- }
- input {
- width: 100%;
- }
- .title-container {
- width: calc((100% - 32px) / 2);
- }
- .duration-container {
- margin-right: 16px;
- margin-left: 16px;
- width: calc((100% - 32px) / 4);
- }
- .skip-duration-container {
- width: calc((100% - 32px) / 4);
- }
- .album-art-container {
- margin-right: 16px;
- width: 100%;
- }
- .youtube-id-container {
- margin-right: 16px;
- width: calc((100% - 16px) / 8 * 3);
- }
- .verified-container {
- width: calc((100% - 16px) / 8);
- .checkbox-control {
- margin-top: 10px;
- }
- }
- .artists-container {
- width: calc((100% - 32px) / 3);
- position: relative;
- }
- .genres-container {
- width: calc((100% - 32px) / 3);
- margin-left: 16px;
- margin-right: 16px;
- position: relative;
- label {
- display: flex;
- i {
- font-size: 15px;
- align-self: center;
- margin-left: 5px;
- color: var(--primary-color);
- cursor: pointer;
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- }
- }
- }
- .tags-container {
- width: calc((100% - 32px) / 3);
- position: relative;
- }
- .list-item-circle {
- background-color: var(--primary-color);
- width: 16px;
- height: 16px;
- border-radius: 8px;
- cursor: pointer;
- margin-right: 8px;
- float: left;
- -webkit-touch-callout: none;
- -webkit-user-select: none;
- -khtml-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- i {
- color: var(--primary-color);
- font-size: 14px;
- margin-left: 1px;
- position: relative;
- top: -1px;
- }
- }
- .list-item-circle:hover,
- .list-item-circle:focus {
- i {
- color: var(--white);
- }
- }
- .list-item > p {
- line-height: 16px;
- word-wrap: break-word;
- width: calc(100% - 24px);
- left: 24px;
- float: left;
- margin-bottom: 8px;
- }
- .list-item:last-child > p {
- margin-bottom: 0;
- }
- .thumbnail-warning {
- color: var(--red);
- font-size: 18px;
- margin: auto 0 auto 5px;
- }
- }
- }
- .right-section {
- flex-basis: unset !important;
- flex-grow: 0 !important;
- display: flex;
- height: 100%;
- #tabs-container {
- width: 376px;
- #tab-selection {
- display: flex;
- overflow-x: auto;
- .button {
- border-radius: @border-radius @border-radius 0 0;
- border: 0;
- text-transform: uppercase;
- font-size: 14px;
- color: var(--dark-grey-3);
- background-color: var(--light-grey-2);
- flex-grow: 1;
- height: 32px;
- &:not(:first-of-type) {
- margin-left: 5px;
- }
- }
- .selected {
- background-color: var(--primary-color) !important;
- color: var(--white) !important;
- font-weight: 600;
- }
- }
- .tab {
- border: 1px solid var(--light-grey-3);
- border-radius: 0 0 @border-radius @border-radius;
- padding: 15px;
- height: calc(100% - 32px);
- overflow: auto;
- }
- }
- }
- @media screen and (max-width: 1100px) {
- .left-section,
- .right-section {
- height: unset;
- max-height: unset;
- }
- .left-section {
- margin-right: 0;
- }
- .right-section {
- flex-basis: 100% !important;
- #tabs-container {
- width: 100%;
- }
- }
- }
- .modal-card-foot .is-primary {
- width: 200px;
- }
- :deep(.autosuggest-container) {
- top: unset;
- }
- .toggle-sidebar-icon {
- display: none;
- }
- .sidebar {
- width: 100%;
- max-width: 350px;
- z-index: 2000;
- display: flex;
- flex-direction: column;
- position: relative;
- height: 100%;
- max-height: calc(100vh - 40px);
- overflow: auto;
- margin-right: 8px;
- border-radius: @border-radius;
- .sidebar-head,
- .sidebar-foot {
- display: flex;
- flex-shrink: 0;
- position: relative;
- justify-content: flex-start;
- align-items: center;
- padding: 20px;
- background-color: var(--light-grey);
- }
- .sidebar-head {
- border-bottom: 1px solid var(--light-grey-2);
- border-radius: @border-radius @border-radius 0 0;
- .sidebar-title {
- display: flex;
- flex: 1;
- margin: 0;
- font-size: 26px;
- font-weight: 600;
- }
- }
- .sidebar-body {
- background-color: var(--white);
- display: flex;
- flex-direction: column;
- row-gap: 8px;
- flex: 1;
- overflow: auto;
- padding: 10px;
- .edit-songs-items {
- display: flex;
- flex-direction: column;
- row-gap: 8px;
- .item {
- display: flex;
- flex-direction: row;
- align-items: center;
- column-gap: 8px;
- :deep(.song-item) {
- .item-icon {
- margin-right: 10px;
- cursor: pointer;
- }
- .removed-icon,
- .error-icon {
- color: var(--red);
- }
- .saving-icon,
- .todo-icon,
- .editing-icon {
- color: var(--primary-color);
- }
- .done-icon {
- color: var(--green);
- }
- .flag-icon {
- color: var(--orange);
- &.flagged {
- color: var(--grey);
- }
- }
- &.removed {
- filter: grayscale(100%);
- cursor: not-allowed;
- user-select: none;
- }
- }
- }
- }
- .no-items {
- text-align: center;
- font-size: 18px;
- }
- }
- .sidebar-foot {
- border-top: 1px solid var(--light-grey-2);
- border-radius: 0 0 @border-radius @border-radius;
- .button {
- flex: 1;
- }
- }
- .sidebar-overlay {
- display: none;
- }
- }
- @media only screen and (max-width: 1580px) {
- .toggle-sidebar-icon {
- display: flex;
- margin-right: 5px;
- transform: rotate(90deg);
- cursor: pointer;
- }
- .sidebar {
- display: none;
- &.active {
- display: flex;
- position: absolute;
- z-index: 2010;
- top: 20px;
- left: 20px;
- .sidebar-head .toggle-sidebar-icon {
- display: flex;
- margin-left: 5px;
- transform: rotate(-90deg);
- }
- }
- }
- .sidebar-overlay {
- display: flex;
- position: absolute;
- z-index: 2009;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: rgba(10, 10, 10, 0.85);
- }
- }
- </style>
|