Skip to content

Commit

Permalink
fix: removed youtube as button provider
Browse files Browse the repository at this point in the history
  • Loading branch information
greendoescode committed May 22, 2024
1 parent 49783d7 commit c6fed60
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"discord-rpc": "^4.0.0",
"js-levenshtein": "^1.1.6",
"register-scheme": "^0.0.2",
"vlc.js": "^3.2.7",
"ytsr": "^3.8.0"
"vlc.js": "^3.2.7"
},
"devDependencies": {
"@types/node": "^18.11.3"
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/configs/default_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = {
// "apple", "bandcamp", "deezer", "qobuz", "spotify", "soundcloud", "tidal" and "coverartarchive"
whereToFetchOnline: "staticoverrides",

// Preferred provider of the rpc button (as above + "youtube")
// Preferred provider of the rpc button (as above)
changeButtonProvider: "staticoverrides",

// Whether to use persistent cache for MusicHoarders queries
Expand Down
23 changes: 2 additions & 21 deletions src/rpc/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const log = require('../helpers/lager.js');
const cl = require('../helpers/configLoader.js');
const config = cl.getOrInit('config.js');
const axios = require('axios');
const yt = require("ytsr");
const path = require("path");
const { debug } = require('console');

Expand Down Expand Up @@ -76,8 +75,7 @@ const fetchers = {
if ((metadata.MUSICBRAINZ_ALBUMID) && metadata.title)
{
const result = await axios.get("https://coverartarchive.org/release/" + metadata.MUSICBRAINZ_ALBUMID, {
headers: {"Accept-Encoding": "gzip,deflate,compress" }
})
headers: {"Accept-Encoding": "gzip,deflate,compress" }})
if (result.data.images[0] !== undefined)
{
return {
Expand Down Expand Up @@ -125,18 +123,6 @@ const fetchers = {
},
"tidal": async (metadata) => {
//return musichoardersFetcher.fetch("tidal", metadata);
},
"youtube": async (metadata) => {
const result = await yt(`${metadata.ALBUMARTIST || metadata.artist || ""} ${metadata.title || metadata.filename}`.trim(), { limit: 1 });
if (result.items.length > 0)
{
return {
artworkFrom: undefined,
artworkUrl: undefined,
joinFrom: "Youtube",
joinUrl: result.items[0].url
};
}
}
}

Expand All @@ -155,12 +141,7 @@ async function fetchSafely(fetcherName, metadata)
}
catch (err)
{
if(debug == 'true'){
console.log(err);
} else {
console.log("Attempting to switch provider, Error Occured.");
}

console.log(err);
}
finally
{
Expand Down

0 comments on commit c6fed60

Please sign in to comment.