Compare commits
1 commit
13b5d45a02
...
fa073aa5bf
Author | SHA1 | Date | |
---|---|---|---|
fa073aa5bf |
6 changed files with 673 additions and 280 deletions
|
@ -2,6 +2,3 @@
|
||||||
.git
|
.git
|
||||||
node_modules
|
node_modules
|
||||||
Dockerfile
|
Dockerfile
|
||||||
.forgejo
|
|
||||||
README.md
|
|
||||||
renovate.json
|
|
|
@ -39,15 +39,3 @@ jobs:
|
||||||
password: ${{ secrets.FORGEJO_REGISTRY_TOKEN }}
|
password: ${{ secrets.FORGEJO_REGISTRY_TOKEN }}
|
||||||
image: combinefm
|
image: combinefm
|
||||||
tags: latest ${{ github.sha }}
|
tags: latest ${{ github.sha }}
|
||||||
test-image:
|
|
||||||
runs-on: self-hosted
|
|
||||||
steps:
|
|
||||||
- name: Check out repository
|
|
||||||
uses: https://cremin.dev/actions/checkout@v4
|
|
||||||
- name: Test image
|
|
||||||
env:
|
|
||||||
YOUTUBE_KEY: ${{ secrets.YOUTUBE_KEY }}
|
|
||||||
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
|
|
||||||
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }}
|
|
||||||
run: |
|
|
||||||
podman run --rm --env-host -it cremin.dev/jonathan/combinefm:${{ github.sha }} yarn test
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode=production --config webpack.config.cjs && NODE_OPTIONS=--openssl-legacy-provider webpack --config webpack.config.server.cjs",
|
"build": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode=production --config webpack.config.cjs && NODE_OPTIONS=--openssl-legacy-provider webpack --config webpack.config.server.cjs",
|
||||||
"start": "node app.js",
|
"start": "node app.js",
|
||||||
"worker": "node worker.js",
|
"worker": "node worker.js",
|
||||||
"test": "mocha-esm test/services/deezer.js test/services/itunes.js test/services/spotify.js test/services/youtube.js test/lookup.js --timeout=15000",
|
"test": "mocha-esm test/**/*.js test/lookup.js --timeout=15000",
|
||||||
"watch": "concurrently -k \"npm:watch-js\" \"npm:watch-server\"",
|
"watch": "concurrently -k \"npm:watch-js\" \"npm:watch-server\"",
|
||||||
"watch-js": "NODE_OPTIONS=--openssl-legacy-provider concurrently -k -n webpack-frontend,webpack-server \"webpack -w -d --config webpack.config.cjs\" \"webpack -w --config webpack.config.server.cjs\"",
|
"watch-js": "NODE_OPTIONS=--openssl-legacy-provider concurrently -k -n webpack-frontend,webpack-server \"webpack -w -d --config webpack.config.cjs\" \"webpack -w --config webpack.config.server.cjs\"",
|
||||||
"watch-server": "nodemon -e js,vue -i node_modules -i chrome/ app.js",
|
"watch-server": "nodemon -e js,vue -i node_modules -i chrome/ app.js",
|
||||||
|
|
|
@ -1,63 +1,40 @@
|
||||||
import "should";
|
import 'should';
|
||||||
import * as spotify from "../../lib/services/spotify/index.js";
|
import * as spotify from '../../lib/services/spotify/index.js';
|
||||||
|
|
||||||
describe("Spotify", function() {
|
describe('Spotify', function(){
|
||||||
describe("init", function() {
|
describe('lookupId', function(){
|
||||||
it("should have secrets", async function() {
|
it('should find album by ID', async function (){
|
||||||
process.env.SPOTIFY_CLIENT_ID.should.exist;
|
const result = await spotify.lookupId('77UW17CZFyCaRLHdHeofZu', 'album');
|
||||||
|
result.name.should.equal('Listen');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should find track by ID', async function (){
|
||||||
|
const result = await spotify.lookupId('7dS5EaCoMnN7DzlpT6aRn2', 'track');
|
||||||
|
result.name.should.equal('Take Me To Church');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("lookupId", function() {
|
describe('search', function(){
|
||||||
it("should find album by ID", async function() {
|
it('should find album by search', async function (){
|
||||||
const result = await spotify.lookupId("77UW17CZFyCaRLHdHeofZu", "album");
|
const result = await spotify.search({type: 'album', artist: {name: 'David Guetta'}, name: 'Listen (Deluxe)'});
|
||||||
result.name.should.equal("Listen");
|
result.name.should.equal('Listen (Deluxe)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should find track by ID", async function() {
|
it('should find br album by search', async function (){
|
||||||
const result = await spotify.lookupId("7dS5EaCoMnN7DzlpT6aRn2", "track");
|
const result = await spotify.search({type: 'album', artist: {name: 'Anavitória'}, name: 'Fica'});
|
||||||
result.name.should.equal("Take Me To Church");
|
result.name.should.equal('Fica');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should find album by various artists by search', async function (){
|
||||||
|
const result = await spotify.search({type: 'album', artist: {name: 'Various Artists'}, name: 'The Get Down Part II: Original Soundtrack From The Netflix Original Series'});
|
||||||
|
result.name.should.equal('The Get Down Part II: Original Soundtrack From The Netflix Original Series');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("search", function() {
|
describe('parseUrl', function(){
|
||||||
it("should find album by search", async function() {
|
it('should parse url into ID', async function (){
|
||||||
const result = await spotify.search({
|
const result = await spotify.parseUrl('https://play.spotify.com/album/77UW17CZFyCaRLHdHeofZu');
|
||||||
type: "album",
|
result.id.should.equal('77UW17CZFyCaRLHdHeofZu');
|
||||||
artist: { name: "David Guetta" },
|
|
||||||
name: "Listen (Deluxe)"
|
|
||||||
});
|
|
||||||
result.name.should.equal("Listen (Deluxe)");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should find br album by search", async function() {
|
|
||||||
const result = await spotify.search({
|
|
||||||
type: "album",
|
|
||||||
artist: { name: "Anavitória" },
|
|
||||||
name: "Fica"
|
|
||||||
});
|
|
||||||
result.name.should.equal("Fica");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should find album by various artists by search", async function() {
|
|
||||||
const result = await spotify.search({
|
|
||||||
type: "album",
|
|
||||||
artist: { name: "Various Artists" },
|
|
||||||
name:
|
|
||||||
"The Get Down Part II: Original Soundtrack From The Netflix Original Series"
|
|
||||||
});
|
|
||||||
result.name.should.equal(
|
|
||||||
"The Get Down Part II: Original Soundtrack From The Netflix Original Series"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("parseUrl", function() {
|
|
||||||
it("should parse url into ID", async function() {
|
|
||||||
const result = await spotify.parseUrl(
|
|
||||||
"https://play.spotify.com/album/77UW17CZFyCaRLHdHeofZu"
|
|
||||||
);
|
|
||||||
result.id.should.equal("77UW17CZFyCaRLHdHeofZu");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,23 +1,18 @@
|
||||||
import "should";
|
import 'should';
|
||||||
import * as youtube from "../../lib/services/youtube/index.js";
|
import * as youtube from '../../lib/services/youtube/index.js';
|
||||||
|
|
||||||
describe("Youtube", function() {
|
describe('Youtube', function(){
|
||||||
describe("lookup", function() {
|
describe('lookup', function(){
|
||||||
it("should find album by lookup", async function() {
|
it('should find album by lookup', async function (){
|
||||||
const result = await youtube.lookupId("6JnGBs88sL0");
|
const result = await youtube.lookupId('6JnGBs88sL0');
|
||||||
result.name.should.equal("Say It Right");
|
result.name.should.equal('Say It Right');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("search", function() {
|
describe('search', function(){
|
||||||
it("should find album by search", async function() {
|
it('should find album by search', async function (){
|
||||||
const result = await youtube.search({
|
const result = await youtube.search({type: 'track', artist: {name: 'Aesop Rock'}, album: {name: 'Skeconsthon'}, name: 'Zero Dark Thirty'});
|
||||||
type: "track",
|
result.name.should.equal('Aesop Rock - Zero Dark Thirty (Official Video)');
|
||||||
artist: { name: "Aesop Rock" },
|
|
||||||
album: { name: "Skeconsthon" },
|
|
||||||
name: "Zero Dark Thirty"
|
|
||||||
});
|
|
||||||
result.name.should.startWith("Aesop Rock - Zero Dark Thirty");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue