2 Commits

Author SHA1 Message Date
GitBluub cfd4a8acec sort by rating and slug and normal title 2024-01-15 01:29:05 +01:00
GitBluub e63789cbc1 fix: skip if no artist or song name 2023-11-13 22:55:22 +01:00
10 changed files with 2367 additions and 152 deletions
+6 -7
View File
@@ -10,7 +10,7 @@ import {
} from '@nestjs/common';
import { RequestLogger, RequestLoggerOptions } from 'json-logger-service';
import { tap } from 'rxjs';
import { PrismaModel } from './_gen/prisma-class';
import { PrismaModel } from './_gen/prisma-class'
import { PrismaService } from './prisma/prisma.service';
@Injectable()
@@ -32,14 +32,15 @@ export class AspectLogger implements NestInterceptor {
};
return next.handle().pipe(
tap((/* data */) =>
tap((data) =>
console.log(
JSON.stringify({
...toPrint,
statusCode,
//data, //TODO: Data crashed with images
data,
}),
),),
),
),
);
}
}
@@ -58,9 +59,7 @@ async function bootstrap() {
.setDescription('The chromacase API')
.setVersion('1.0')
.build();
const document = SwaggerModule.createDocument(app, config, {
extraModels: [...PrismaModel.extraModels],
});
const document = SwaggerModule.createDocument(app, config, { extraModels: [...PrismaModel.extraModels]});
SwaggerModule.setup('api', app, document);
app.useGlobalPipes(new ValidationPipe());
+28 -1
View File
@@ -11,10 +11,12 @@
"dependencies": {
"crawlee": "^3.0.0",
"fs": "^0.0.1-security",
"playwright": "^1.28.0"
"playwright": "^1.28.0",
"slug": "^8.2.3"
},
"devDependencies": {
"@apify/tsconfig": "^0.1.0",
"@types/slug": "^5.0.5",
"ts-node": "^10.8.0",
"typescript": "^4.7.4"
}
@@ -778,6 +780,12 @@
"@types/node": "*"
}
},
"node_modules/@types/slug": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/@types/slug/-/slug-5.0.5.tgz",
"integrity": "sha512-vcHM79Xu5ALOC90kf5S1B4XGbRl8VW6f1+6jpBmK/FLHi4AyWKAVENgMOyHFyjHV5vDbNRPtjsNJuPRqrLBOxw==",
"dev": true
},
"node_modules/@types/tough-cookie": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.2.tgz",
@@ -2760,6 +2768,14 @@
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="
},
"node_modules/slug": {
"version": "8.2.3",
"resolved": "https://registry.npmjs.org/slug/-/slug-8.2.3.tgz",
"integrity": "sha512-fXjhAZszNecz855GUNIwW0+sFPi9WV4bMiEKDOCA4wcq1ts1UnUVNy/F78B0Aat7/W3rA+se//33ILKNMrbeYQ==",
"bin": {
"slug": "cli.js"
}
},
"node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
@@ -3848,6 +3864,12 @@
"@types/node": "*"
}
},
"@types/slug": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/@types/slug/-/slug-5.0.5.tgz",
"integrity": "sha512-vcHM79Xu5ALOC90kf5S1B4XGbRl8VW6f1+6jpBmK/FLHi4AyWKAVENgMOyHFyjHV5vDbNRPtjsNJuPRqrLBOxw==",
"dev": true
},
"@types/tough-cookie": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.2.tgz",
@@ -5233,6 +5255,11 @@
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="
},
"slug": {
"version": "8.2.3",
"resolved": "https://registry.npmjs.org/slug/-/slug-8.2.3.tgz",
"integrity": "sha512-fXjhAZszNecz855GUNIwW0+sFPi9WV4bMiEKDOCA4wcq1ts1UnUVNy/F78B0Aat7/W3rA+se//33ILKNMrbeYQ=="
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+3 -1
View File
@@ -6,10 +6,12 @@
"dependencies": {
"crawlee": "^3.0.0",
"fs": "^0.0.1-security",
"playwright": "^1.28.0"
"playwright": "^1.28.0",
"slug": "^8.2.3"
},
"devDependencies": {
"@apify/tsconfig": "^0.1.0",
"@types/slug": "^5.0.5",
"ts-node": "^10.8.0",
"typescript": "^4.7.4"
},
+1 -1
View File
@@ -17,5 +17,5 @@ const crawler = new PlaywrightCrawler({
// Add first URL to the queue and start the crawl.
await crawler.run([
"https://musescore.com/sheetmusic?complexity=1&instrument=2&license=to_modify_commercially%2Cto_use_commercially&recording_type=public-domain",
"https://musescore.com/sheetmusic?complexity=1&instrument=2&instrumentation=114&license=to_modify_commercially%2Cto_use_commercially&recording_type=public-domain&sort=rating",
]);
+8 -3
View File
@@ -2,6 +2,7 @@ import { Dataset, createPlaywrightRouter } from "crawlee";
import * as fs from "fs";
import { sleep } from "crawlee";
export const router = createPlaywrightRouter();
import slug from "slug";
router.addDefaultHandler(async ({ enqueueLinks }) => {
const songs = await enqueueLinks({
@@ -18,13 +19,17 @@ router.addDefaultHandler(async ({ enqueueLinks }) => {
router.addHandler("SONG", async ({ request, page }) => {
await Dataset.pushData({ url: request.loadedUrl });
await page.waitForSelector('aside div div section button[name="download"]');
const title = await page.locator("h1").textContent();
const artist = await page
let og_title = await page.locator("h1").textContent();
if (og_title == null) return
let title = slug(og_title);
let artist = await page
.locator(
"body > div.js-page.react-container > div > section > aside > div:nth-child(5) > div > section > h3:nth-child(2) > a"
)
.first()
.textContent();
if (artist == null) return
artist = slug(artist);
const genres = await page
.locator(
"body > div.js-page.react-container > div > section > aside > div:nth-child(6) > div > table > tbody > tr:nth-child(5) > td > div > a"
@@ -66,7 +71,7 @@ router.addHandler("SONG", async ({ request, page }) => {
`../musics/a/${title}/${title}.ini`,
`
[Metadata]
Name=${title}
Name=${og_title}
Artist=${artist}
Genre=${genres}
Album=
-1
View File
@@ -77,7 +77,6 @@ services:
depends_on:
- back
- front
- scorometer
volumes:
- "./front/assets:/assets:ro"
- "./front/nginx.conf.template.dev:/etc/nginx/templates/default.conf.template:ro"
+1 -2
View File
@@ -23,7 +23,6 @@ import { AccessTokenResponseHandler } from './models/AccessTokenResponse';
import * as yup from 'yup';
import { base64ToBlob } from './utils/base64ToBlob';
import { ImagePickerAsset } from 'expo-image-picker';
import Constant from 'expo-constants';
type AuthenticationInput = { username: string; password: string };
type RegistrationInput = AuthenticationInput & { email: string };
@@ -69,7 +68,7 @@ export default class API {
public static readonly baseUrl =
process.env.NODE_ENV != 'development' && Platform.OS === 'web'
? '/api'
: Constant.manifest?.extra?.apiUrl;
: 'https://nightly.chroma.octohub.app/api';
public static async fetch(
params: FetchParams,
handle: Pick<Required<HandleParams>, 'raw'>
+4
View File
@@ -1,6 +1,10 @@
# a Dockerfile to build the expo web app and serve it with nginx
#
# Build the app
FROM node:16-alpine as build
WORKDIR /app
# install expo cli
RUN yarn global add expo-cli@6.0.5
# add sharp-cli (^2.1.0) for faster image processing
RUN yarn global add sharp-cli@^2.1.0
+7
View File
@@ -4,6 +4,10 @@
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"pretty:check": "prettier --check .",
"pretty:write": "prettier --write .",
"lint": "eslint .",
@@ -28,7 +32,9 @@
"@types/react-query": "^1.2.9",
"@types/react-test-renderer": "^18.0.0",
"add": "^2.0.6",
"expo": "^47.0.8",
"expo-asset": "~8.7.0",
"expo-dev-client": "~2.0.1",
"expo-image-picker": "~14.0.2",
"expo-linear-gradient": "~12.0.1",
"expo-linking": "~3.3.1",
@@ -51,6 +57,7 @@
"react": "18.2.0",
"react-dom": "18.1.0",
"react-i18next": "^11.18.3",
"react-native": "0.70.5",
"react-native-chart-kit": "^6.12.0",
"react-native-paper": "^4.12.5",
"react-native-reanimated": "~2.12.0",
+2309 -136
View File
File diff suppressed because it is too large Load Diff