mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 20:52:06 +00:00
create cleanupArtistName() in song-info
This commit is contained in:
@ -16,7 +16,7 @@ let downloadLabel = defaultMenuDownloadLabel;
|
||||
let metadataURL = undefined;
|
||||
let callbackIsRegistered = false;
|
||||
|
||||
module.exports = (win, options, refreshMenu) => {
|
||||
module.exports = (win, options) => {
|
||||
if (!callbackIsRegistered) {
|
||||
const registerCallback = getSongInfo(win);
|
||||
registerCallback((info) => {
|
||||
@ -36,6 +36,7 @@ module.exports = (win, options, refreshMenu) => {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("trying to get playlist ID" +playlistID);
|
||||
const playlist = await ytpl(playlistID,
|
||||
{ limit: options.playlistMaxItems || Infinity }
|
||||
);
|
||||
|
||||
@ -14,7 +14,8 @@ const ytdl = require("ytdl-core");
|
||||
|
||||
const { triggerAction, triggerActionSync } = require("../utils");
|
||||
const { ACTIONS, CHANNEL } = require("./actions.js");
|
||||
const { defaultMenuDownloadLabel, getFolder } = require("./utils");
|
||||
const { getFolder } = require("./utils");
|
||||
const { cleanupArtistName } = require("../../providers/song-info");
|
||||
|
||||
const { createFFmpeg } = FFmpeg;
|
||||
const ffmpeg = createFFmpeg({
|
||||
@ -24,13 +25,6 @@ const ffmpeg = createFFmpeg({
|
||||
});
|
||||
const ffmpegMutex = new Mutex();
|
||||
|
||||
function noTopic(channelName) {
|
||||
if (channelName && channelName.endsWith(" - Topic")) {
|
||||
channelName = channelName.slice(0, -8);
|
||||
}
|
||||
return channelName;
|
||||
}
|
||||
|
||||
const downloadVideoToMP3 = async (
|
||||
videoUrl,
|
||||
sendFeedback,
|
||||
@ -46,7 +40,7 @@ const downloadVideoToMP3 = async (
|
||||
const info = await ytdl.getInfo(videoUrl);
|
||||
const thumbnails = info.videoDetails?.author?.thumbnails;
|
||||
metadata = {
|
||||
artist: info.videoDetails?.media?.artist || noTopic(info.videoDetails?.author?.name) || "",
|
||||
artist: info.videoDetails?.media?.artist || cleanupArtistName(info.videoDetails?.author?.name) || "",
|
||||
title: info.videoDetails?.media?.song || info.videoDetails?.title || "",
|
||||
imageSrc: thumbnails ? thumbnails[thumbnails.length - 1].url : ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user