Skip to content

Commit

Permalink
Add Japanese -> Romaji support
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraWebdev committed Jan 12, 2025
1 parent 41a915b commit 36aa712
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 8 deletions.
4 changes: 4 additions & 0 deletions server/modules/sanitizeFilename.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
const wanakana = require('wanakana');

function sanitizeFilename(title) {
title = wanakana.toRomaji(title, { upcaseKatakana: true });

return title.replace(/\s+/g, '_').replace(/[^\w\-_]/g, '');
}

Expand Down
12 changes: 11 additions & 1 deletion server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"ffmetadata": "^1.7.0",
"ffmpeg-static": "^5.2.0",
"jsdom": "^26.0.0",
"music-metadata": "^10.6.5"
"music-metadata": "^10.6.5",
"wanakana": "^5.3.1"
},
"devDependencies": {
"cross-env": "^7.0.3",
Expand Down
5 changes: 5 additions & 0 deletions ui/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const API_BASE_URL = process.env.NODE_ENV === "production" ? "" : "http://localhost:8080";

export {
API_BASE_URL
};
3 changes: 2 additions & 1 deletion ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {ref} from "vue";
import SoundtrackMetadataForm from "@/components/SoundtrackMetadataForm.vue";
import SoundtrackMetadata from "@/components/SoundtrackMetadata.vue";
import SoundtrackQueue from "@/components/SoundtrackQueue.vue";
import {API_BASE_URL} from "../env.js";
const soundtrack = ref(null);
Expand All @@ -37,7 +38,7 @@ function onSoundtrackLoaded(loadedSoundtrack) {
async function onSoundtrackAddToQueue(queueItem) {
soundtrack.value = null;
let response = await fetch('/api/queue/add', {
let response = await fetch(API_BASE_URL + '/api/queue/add', {
method: "POST",
headers: {
'Content-Type': 'application/json'
Expand Down
7 changes: 4 additions & 3 deletions ui/src/components/SoundtrackQueue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import {Badge} from "@/components/ui/badge/index.js";
import {onMounted, ref} from "vue";
import {Table, TableBody, TableCell, TableHead, TableHeader, TableRow} from "@/components/ui/table/index.js";
import {Progress} from "@/components/ui/progress/index.js";
import {API_BASE_URL} from "../../env.js";
const countTotal = ref(0);
const countQueued = ref(0);
Expand All @@ -83,21 +84,21 @@ onMounted(() => {
});
async function clearDone() {
let response = await fetch('/api/queue/clearDone');
let response = await fetch(API_BASE_URL + '/api/queue/clearDone');
let json = await response.json();
checkQueue();
}
async function retryFailed() {
let response = await fetch('/api/queue/retryFailed');
let response = await fetch(API_BASE_URL + '/api/queue/retryFailed');
let json = await response.json();
checkQueue();
}
async function checkQueue() {
let response = await fetch('/api/queue');
let response = await fetch(API_BASE_URL + '/api/queue');
let json = await response.json();
let data = json.data;
Expand Down
6 changes: 4 additions & 2 deletions ui/src/lib/getSoundtrackMeta.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {API_BASE_URL} from "../../env.js";

async function getSoundtrackMeta(urlOrSlug) {
let response = await fetch("/api/soundtrack/", {
method: "POST",
let response = await fetch(API_BASE_URL + '/api/soundtrack/', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
Expand Down

0 comments on commit 36aa712

Please sign in to comment.