Restore old Google auth behaviour
This commit is contained in:
parent
2245428465
commit
5d5bd605ea
1 changed files with 8 additions and 20 deletions
|
@ -12,14 +12,12 @@ if (!process.env.GOOGLE_EMAIL || !process.env.GOOGLE_PASSWORD) {
|
||||||
debug('GOOGLE_EMAIL or GOOGLE_PASSWORD environment variables not found, deactivating Google Play Music.');
|
debug('GOOGLE_EMAIL or GOOGLE_PASSWORD environment variables not found, deactivating Google Play Music.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let ready = pm.initAsync({email: process.env.GOOGLE_EMAIL, password: process.env.GOOGLE_PASSWORD}).catch(function(err) {
|
||||||
export function* lookupId(id, type) {
|
|
||||||
yield pm.initAsync({
|
|
||||||
email: process.env.GOOGLE_EMAIL,
|
|
||||||
password: process.env.GOOGLE_PASSWORD })
|
|
||||||
.catch((err) => {
|
|
||||||
debug(err);
|
debug(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export function* lookupId(id, type) {
|
||||||
|
yield ready;
|
||||||
if (type === 'album') {
|
if (type === 'album') {
|
||||||
const album = yield pm.getAlbumAsync(id, false);
|
const album = yield pm.getAlbumAsync(id, false);
|
||||||
return {
|
return {
|
||||||
|
@ -90,12 +88,7 @@ function looseMatch(needle, haystack, type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* search(data, original = {}, cleaned = false) {
|
export function* search(data, original = {}, cleaned = false) {
|
||||||
yield pm.initAsync({
|
yield ready;
|
||||||
email: process.env.GOOGLE_EMAIL,
|
|
||||||
password: process.env.GOOGLE_PASSWORD })
|
|
||||||
.catch((err) => {
|
|
||||||
debug(err);
|
|
||||||
});
|
|
||||||
let query;
|
let query;
|
||||||
let album;
|
let album;
|
||||||
const type = data.type;
|
const type = data.type;
|
||||||
|
@ -146,12 +139,7 @@ export function* search(data, original = {}, cleaned = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* parseUrl(url) {
|
export function* parseUrl(url) {
|
||||||
yield pm.initAsync({
|
yield ready;
|
||||||
email: process.env.GOOGLE_EMAIL,
|
|
||||||
password: process.env.GOOGLE_PASSWORD })
|
|
||||||
.catch((err) => {
|
|
||||||
debug(err);
|
|
||||||
});
|
|
||||||
const parsed = parse(url.replace(/\+/g, '%20'));
|
const parsed = parse(url.replace(/\+/g, '%20'));
|
||||||
const path = parsed.path;
|
const path = parsed.path;
|
||||||
const hash = parsed.hash;
|
const hash = parsed.hash;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue