Skip to content

Commit

Permalink
Auto Rename v1 (#129)
Browse files Browse the repository at this point in the history
Co-authored-by: Evan Strat <[email protected]>
  • Loading branch information
evan10s and evan10s authored Oct 15, 2024
1 parent 95f4c0b commit 9392eec
Show file tree
Hide file tree
Showing 74 changed files with 3,728 additions and 686 deletions.
69 changes: 69 additions & 0 deletions .github/ISSUE_TEMPLATE/1-auto_rename.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Auto Rename association issues
description: Inaccurate or unexpected associations made by the Auto Rename feature
labels: ["area / auto rename", "type / bug", "status / grooming"]
body:
- type: dropdown
attributes:
label: Association problem type
options:
- Select a value...
- Strong association to the wrong match
- Association status unexpectedly weak
- Association was expected but not made
- Something else (describe in Additional Information)
- type: input
attributes:
label: Video file path
description: Relative path of the video file (within the videos directory) that was incorrectly associated. If multiple related instances, add more details in the Additional Information section below
validations:
required: false
- type: input
attributes:
label: Expected match key
description: The full match key (e.g., 2024gadal_qm1) of the match that should have been associated with the video file
validations:
required: true
- type: input
attributes:
label: Actual associated match key
description: The full match key (e.g., 2024gadal_qm1) of the match that Auto Rename associated with the video file. Enter N/A if no association was made, but you were expecting one.
validations:
required: false
- type: dropdown
attributes:
label: Association status
description: The full match key (e.g., 2024gadal_qm1) of the match that Auto Rename associated with the video file. Enter N/A if no association was made, but you were expecting one.
options:
- Select a value...
- Unmatched
- Strong
- Weak
- Failed
- Ignored
validations:
required: true
- type: textarea
attributes:
label: Additional information
description: For instance, a screenshot of the association review dialog, errors you saw, etc.
validations:
required: true
- type: input
attributes:
label: Match Uploader version
validations:
required: true
- type: dropdown
attributes:
label: Are you running Match Uploader using the official Docker Compose setup?
options:
- Select a value...
- "Yes"
- "No"
validations:
required: true
- type: textarea
attributes:
label: Relevant error or log output
description: If there are logs or errors related to this problem, include them here. Make sure to note which component the logs came from. This will be automatically formatted into code, so no need for backticks.
render: shell
File renamed without changes.
File renamed without changes.
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ COPY client/public ./public
COPY client/src ./src
COPY client/index.html .
COPY client/tsconfig*.json .
COPY client/vite.config.ts .
COPY client/vite.config.mts .

RUN yarn run build

Expand All @@ -47,6 +47,8 @@ COPY server/build.ts .

RUN yarn run build

COPY server/src/crontab.txt ./dist/crontab.txt

FROM base as run_server_prod

WORKDIR /home/node/app/server
Expand Down Expand Up @@ -86,5 +88,8 @@ RUN chown -R node:node /home/node/app/server/settings && \
chown -R node:node /home/node/app/server/env

USER node

# TODO: Allow customizing TZ
ENV TZ="America/New_York"
EXPOSE 8080
CMD ["yarn", "start"]
1 change: 1 addition & 0 deletions client/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ module.exports = {
"vue/no-multiple-template-root": "off",
"vue/singleline-html-element-content-newline": "off",
"vue/v-slot-style": "off",
"vue/valid-v-slot": "off",
},
};
16 changes: 8 additions & 8 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@
"@mdi/font": "7.2.96",
"@vueuse/core": "^10.9.0",
"dayjs": "^1.11.10",
"pinia": "^2.1.6",
"pinia": "^2.2.2",
"roboto-fontface": "*",
"socket.io-client": "^4.7.2",
"swrv": "^1.0.4",
"vue": "^3.3.4",
"vue-router": "^4.2.4",
"vuetify": "^3.3.11",
"vue": "^3.5.8",
"vue-router": "^4.4.5",
"vuetify": "^3.7.2",
"webfontloader": "^1.6.28"
},
"devDependencies": {
"@types/node": "^20.4.8",
"@types/webfontloader": "^1.6.35",
"@vitejs/plugin-vue": "^4.2.3",
"@vitejs/plugin-vue": "^5.1.4",
"@vue/eslint-config-typescript": "^11.0.3",
"eslint": "^8.46.0",
"eslint-plugin-vue": "^9.16.1",
"typescript": "^5.1.6",
"vite": "^4.4.8",
"vite-plugin-vuetify": "^1.0.2",
"vue-tsc": "^1.8.19"
"vite": "^5.4.7",
"vite-plugin-vuetify": "^2.0.4",
"vue-tsc": "^1.8.27"
},
"license": "GPL-3.0"
}
5 changes: 5 additions & 0 deletions client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@
import MainLayout from "@/layouts/Main.vue";
import {useWorkerStore} from "@/stores/worker";
import { socket } from "@/socket";
import { useAutoRenameStore } from "@/stores/autoRename";
// TODO: Should we pull out websocket logic into its own store?
const workerStore = useWorkerStore();
const autoRenameStore = useAutoRenameStore();
// Adapted from https://socket.io/how-to/use-with-vue#with-pinia
// remove any existing listeners (after a hot module replacement)
socket.off();
// TODO: Unify websocket connection monitoring in the future
workerStore.bindEvents();
autoRenameStore.bindEvents();
</script>

Expand Down
25 changes: 25 additions & 0 deletions client/src/components/alerts/AutoRenameEnabled.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<template>
<VAlert v-if="!settingsStore.isFirstLoad && settingsStore.settings?.autoRenameEnabled"
color="success"
variant="tonal"
density="comfortable"
:rounded="props.rounded ?? 0"
icon="mdi-auto-mode"
>
<template v-slot:text>
<strong>Auto Rename is enabled.</strong> It triggers every 5 minutes and continues running until you disable it,
even if you close this page.
</template>
</VAlert>
</template>
<script lang="ts" setup>
import {useSettingsStore} from "@/stores/settings";
const settingsStore = useSettingsStore();
settingsStore.getSettings();
interface IProps {
rounded?: number;
}
const props = defineProps<IProps>();
</script>
4 changes: 4 additions & 0 deletions client/src/components/alerts/GlobalAlerts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<PrivateUploads />
<NoPlaylistMappings />
<FrcEventsWarning />
<LiveModeActivated />
<AutoRenameEnabled />
</div>
</template>

Expand All @@ -14,4 +16,6 @@ import YouTubeAuthIncompleteAlert from "@/components/alerts/YouTubeAuthIncomplet
import NoPlaylistMappings from "@/components/alerts/NoPlaylistMappings.vue";
import PrivateUploads from "@/components/alerts/PrivateUploads.vue";
import FrcEventsWarning from "@/components/alerts/FrcEventsWarning.vue";
import AutoRenameEnabled from "@/components/alerts/AutoRenameEnabled.vue";
import LiveModeActivated from "@/components/alerts/LiveModeActivated.vue";
</script>
23 changes: 23 additions & 0 deletions client/src/components/alerts/LiveModeActivated.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<VAlert v-if="liveModeStore.isActive"
color="purple"
variant="tonal"
density="comfortable"
:rounded="props.rounded ?? 0"
icon="mdi-auto-fix"
>
<template v-slot:text>
<strong>Live Mode is activated.</strong> Keep this tab open—Live Mode runs in your browser.
</template>
</VAlert>
</template>
<script lang="ts" setup>
import { useLiveModeStore } from "@/stores/liveMode";
const liveModeStore = useLiveModeStore();
interface IProps {
rounded?: number;
}
const props = defineProps<IProps>();
</script>
112 changes: 112 additions & 0 deletions client/src/components/autoRename/AutoRename.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<template>
<VRow>
<VCol>
<h1>Auto rename <VChip color="purple">Beta</VChip></h1>
<VAlert color="purple"
variant="tonal"
class="mb-4"
density="compact"
icon="mdi-bug-outline"
>
Report bugs and send feedback
<a target="_blank" href="https://github.com/gafirst/match-uploader/issues/new/choose">on GitHub</a>.
</VAlert>

<p class="mb-1">Enable auto rename</p>
<AutosavingBtnSelectGroup :choices="['On', 'Off']"
class="mb-2"
:default-value="settingsStore.settings?.autoRenameEnabled ? 'On' : 'Off'"
:loading="savingAutoRenameEnabled"
@on-choice-selected="saveAutoRenameEnabled"
/>

<VAlert v-if="autoRenameStore.confirmWeakAssociationError"
class="mb-2"
variant="tonal"
color="error"
>
Confirm weak association failed: {{ autoRenameStore.confirmWeakAssociationError }}
</VAlert>
<VAlert v-if="autoRenameStore.undoRenameError"
class="mb-2"
variant="tonal"
color="error"
>
Undo rename failed: {{ autoRenameStore.undoRenameError }}
</VAlert>
<VAlert v-if="autoRenameStore.ignoreAssociationError"
class="mb-2"
variant="tonal"
color="error"
>
Ignore association failed: {{ autoRenameStore.ignoreAssociationError }}
</VAlert>

<h2>Review required</h2>
<VAlert v-if="autoRenameStore.associationsError"
class="mt-2"
variant="tonal"
color="error"
>
{{ autoRenameStore.associationsError }}
</VAlert>
<AutoRenameAssociations :included-association-statuses="[
AutoRenameAssociationStatus.WEAK,
AutoRenameAssociationStatus.FAILED,
]"
/>
<h2>Recently associated</h2>
<AutoRenameAssociations :included-association-statuses="[
AutoRenameAssociationStatus.STRONG,
]"
/>
<h2>Unmatched</h2>
<AutoRenameAssociations :included-association-statuses="[
AutoRenameAssociationStatus.UNMATCHED,
]"
/>
<h2>Ignored</h2>
<AutoRenameAssociations :included-association-statuses="[
AutoRenameAssociationStatus.IGNORED,
]"
/>
</VCol>
</VRow>
</template>
<script lang="ts" setup>
import { useAutoRenameStore } from "@/stores/autoRename";
import { AutoRenameAssociationStatus } from "@/types/autoRename/AutoRenameAssociationStatus";
import AutoRenameAssociations from "@/components/autoRename/AutoRenameAssociations.vue";
import { useSettingsStore } from "@/stores/settings";
import AutosavingBtnSelectGroup from "@/components/form/AutosavingBtnSelectGroup.vue";
import { ref } from "vue";
const autoRenameStore = useAutoRenameStore();
autoRenameStore.getAssociations();
const settingsStore = useSettingsStore();
// TODO: Move into its own component
const savingAutoRenameEnabled = ref(false);
async function saveAutoRenameEnabled(value: string): Promise<void> {
savingAutoRenameEnabled.value = true;
await settingsStore.saveSetting("autoRenameEnabled", value.toLowerCase() === "on", "setting");
await settingsStore.getSettings(false);
savingAutoRenameEnabled.value = false;
}
</script>
<style scoped>
/* https://css-tricks.com/fluid-width-video/ */
video {
/* override other styles to make responsive */
width: 100% !important;
height: auto !important;
}
.association-card {
max-width: 30%;
min-height: 500px;
}
</style>
Loading

0 comments on commit 9392eec

Please sign in to comment.