Use native esm
This commit is contained in:
parent
c4354a6600
commit
70bd12a4d6
37 changed files with 379 additions and 119 deletions
|
@ -1,7 +1,7 @@
|
|||
import { parse } from 'url';
|
||||
import request from 'superagent';
|
||||
import debuglog from 'debug';
|
||||
import urlMatch from './url';
|
||||
import urlMatch from './url.js';
|
||||
|
||||
const debug = debuglog('combine.fm:deezer');
|
||||
|
||||
|
@ -11,7 +11,7 @@ export function parseUrl(url) {
|
|||
const matches = parse(url).path.match(/\/(album|track)[/]+([^/]+)/);
|
||||
|
||||
if (matches && matches[2]) {
|
||||
return module.exports.lookupId(matches[2], matches[1]);
|
||||
return lookupId(matches[2], matches[1]);
|
||||
}
|
||||
throw new Error();
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ export async function search(data, original = {}) {
|
|||
match = looseMatch(name, response.body.data, data.type, various);
|
||||
}
|
||||
|
||||
return await module.exports.lookupId(response.body.data[0].id, type);
|
||||
return await lookupId(response.body.data[0].id, type);
|
||||
}
|
||||
const matches = album.match(/^[^([]+/);
|
||||
if (matches && matches[0] && matches[0] !== album) {
|
||||
|
@ -141,7 +141,7 @@ export async function search(data, original = {}) {
|
|||
} else if (type === 'track') {
|
||||
cleanedData.albumName = matches[0].trim();
|
||||
}
|
||||
return await module.exports.search(cleanedData, data);
|
||||
return await search(cleanedData, data);
|
||||
}
|
||||
return Promise.resolve({ service: 'deezer' });
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import { parse } from 'url';
|
|||
import bluebird from 'bluebird';
|
||||
import PlayMusic from 'playmusic';
|
||||
import debuglog from 'debug';
|
||||
import urlMatch from './url';
|
||||
import urlMatch from './url.js';
|
||||
|
||||
const debug = debuglog('combine.fm:google');
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { parse } from 'url';
|
||||
import querystring from 'querystring';
|
||||
import request from 'superagent';
|
||||
import urlMatch from './url';
|
||||
import urlMatch from './url.js';
|
||||
|
||||
const apiRoot = 'https://itunes.apple.com';
|
||||
|
||||
|
@ -22,7 +22,7 @@ export async function parseUrl(url) {
|
|||
}
|
||||
}
|
||||
|
||||
return await module.exports.lookupId(itunesId, type, matches[1] || 'us');
|
||||
return await lookupId(itunesId, type, matches[1] || 'us');
|
||||
}
|
||||
throw new Error();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { parse } from 'url';
|
||||
import SpotifyWebApi from 'spotify-web-api-node';
|
||||
import urlMatch from './url';
|
||||
import urlMatch from './url.js';
|
||||
|
||||
const spotify = new SpotifyWebApi({
|
||||
clientId: process.env.SPOTIFY_CLIENT_ID,
|
||||
|
|
|
@ -2,9 +2,9 @@ import { parse } from 'url';
|
|||
import querystring from 'querystring';
|
||||
import request from 'superagent';
|
||||
import Nodebrainz from 'nodebrainz';
|
||||
import { toSeconds, parse as ptParse } from 'iso8601-duration';
|
||||
import iso8601 from 'iso8601-duration';
|
||||
import debuglog from 'debug';
|
||||
import urlMatch from './url';
|
||||
import urlMatch from './url.js';
|
||||
|
||||
const debug = debuglog('combine.fm:youtube');
|
||||
|
||||
|
@ -32,7 +32,7 @@ export async function lookupId(id) {
|
|||
const result = await request.get(apiRoot + path);
|
||||
const item = result.body.items[0].snippet;
|
||||
|
||||
const duration = toSeconds(ptParse(result.body.items[0].contentDetails.duration));
|
||||
const duration = iso8601.toSeconds(iso8601.parse(result.body.items[0].contentDetails.duration));
|
||||
|
||||
const split = item.title.match(/([^-]+)-(.*)/);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue