Fix Suno browser downloads and metadata tags
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name ChatGPT to Suno Prompt Copier
|
// @name ChatGPT to Suno Prompt Copier
|
||||||
// @namespace local.suno-helper
|
// @namespace local.suno-helper
|
||||||
// @version 0.8.5
|
// @version 0.8.6
|
||||||
// @description Copy structured ChatGPT song prompt versions into Suno fields.
|
// @description Copy structured ChatGPT song prompt versions into Suno fields.
|
||||||
// @author local
|
// @author local
|
||||||
// @match https://chatgpt.com/*
|
// @match https://chatgpt.com/*
|
||||||
@@ -10,7 +10,9 @@
|
|||||||
// @match https://*.suno.com/*
|
// @match https://*.suno.com/*
|
||||||
// @updateURL https://git.mokaya.org/shkim/suno-helper/raw/branch/master/chatgpt-suno-tampermonkey.user.js
|
// @updateURL https://git.mokaya.org/shkim/suno-helper/raw/branch/master/chatgpt-suno-tampermonkey.user.js
|
||||||
// @downloadURL https://git.mokaya.org/shkim/suno-helper/raw/branch/master/chatgpt-suno-tampermonkey.user.js
|
// @downloadURL https://git.mokaya.org/shkim/suno-helper/raw/branch/master/chatgpt-suno-tampermonkey.user.js
|
||||||
// @connect cdn*.suno.ai
|
// @connect *.suno.ai
|
||||||
|
// @connect cdn1.suno.ai
|
||||||
|
// @connect cdn2.suno.ai
|
||||||
// @connect *.suno.com
|
// @connect *.suno.com
|
||||||
// @connect studio-api-prod.suno.com
|
// @connect studio-api-prod.suno.com
|
||||||
// @connect 127.0.0.1
|
// @connect 127.0.0.1
|
||||||
@@ -28,7 +30,7 @@
|
|||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const SCRIPT_VERSION = "0.8.5";
|
const SCRIPT_VERSION = "0.8.6";
|
||||||
const STORAGE_KEY = "chatgptSunoPromptSlots";
|
const STORAGE_KEY = "chatgptSunoPromptSlots";
|
||||||
const SLOT_COUNT = 2;
|
const SLOT_COUNT = 2;
|
||||||
const isChatGPT = location.hostname.includes("chatgpt.com") || location.hostname.includes("chat.openai.com");
|
const isChatGPT = location.hostname.includes("chatgpt.com") || location.hostname.includes("chat.openai.com");
|
||||||
@@ -904,6 +906,7 @@
|
|||||||
headers: options.headers || {},
|
headers: options.headers || {},
|
||||||
data: options.body,
|
data: options.body,
|
||||||
anonymous: false,
|
anonymous: false,
|
||||||
|
withCredentials: true,
|
||||||
timeout: 45000,
|
timeout: 45000,
|
||||||
onload: (response) => {
|
onload: (response) => {
|
||||||
resolve({
|
resolve({
|
||||||
@@ -927,6 +930,7 @@
|
|||||||
url,
|
url,
|
||||||
headers: options.headers || {},
|
headers: options.headers || {},
|
||||||
anonymous: false,
|
anonymous: false,
|
||||||
|
withCredentials: true,
|
||||||
timeout: 120000,
|
timeout: 120000,
|
||||||
responseType: "arraybuffer",
|
responseType: "arraybuffer",
|
||||||
onload: (response) => {
|
onload: (response) => {
|
||||||
|
|||||||
@@ -268,14 +268,14 @@ function Invoke-DownloadWithRetry {
|
|||||||
|
|
||||||
function Add-MetadataArg {
|
function Add-MetadataArg {
|
||||||
param(
|
param(
|
||||||
[System.Collections.Generic.List[string]]$Args,
|
[System.Collections.Generic.List[string]]$ArgList,
|
||||||
[string]$Key,
|
[string]$Key,
|
||||||
[string]$Value
|
[string]$Value
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($Value) {
|
if ($Value) {
|
||||||
$Args.Add("-metadata")
|
$ArgList.Add("-metadata")
|
||||||
$Args.Add("$Key=$Value")
|
$ArgList.Add("$Key=$Value")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,7 +456,7 @@ foreach ($track in $tracks) {
|
|||||||
if ($imageUrl) {
|
if ($imageUrl) {
|
||||||
$coverDownloaded = Invoke-Download $imageUrl $rawCoverFile
|
$coverDownloaded = Invoke-Download $imageUrl $rawCoverFile
|
||||||
if ($coverDownloaded) {
|
if ($coverDownloaded) {
|
||||||
& $ffmpeg -hide_banner -y -i $rawCoverFile -frames:v 1 $trackCoverFile
|
& $ffmpeg -hide_banner -y -i $rawCoverFile -frames:v 1 -update 1 $trackCoverFile
|
||||||
$coverOk = ($LASTEXITCODE -eq 0) -and (Test-Path -LiteralPath $trackCoverFile)
|
$coverOk = ($LASTEXITCODE -eq 0) -and (Test-Path -LiteralPath $trackCoverFile)
|
||||||
if (-not $coverOk) {
|
if (-not $coverOk) {
|
||||||
Copy-Item -LiteralPath $rawCoverFile -Destination $trackCoverFile -Force
|
Copy-Item -LiteralPath $rawCoverFile -Destination $trackCoverFile -Force
|
||||||
|
|||||||
Reference in New Issue
Block a user