0

I have a substantial amount of user-uploaded songs on Google Play. A good portion of these have ".mp3" at the end of the file name.

Is there any way that I can batch remove this ending from all of the songs I have in Google Play? Native is obviously better if possible, but selecting multiple tracks won't let me edit the track name.

I looked into this unofficial API but it doesn't seem to support this functionality. I also tried searching for ".mp3" in Play's search bar but this didn't even work to find tracks with this ending.

0

I was able to do this in JavaScript because all of the song data is in an IndexedDB that's stored on the client side. Here's the code:

(function () {
    console.log("Starting to update values...");
    indexedDB.databases().then(info => {
        const name = info.find(db => db.name.indexOf("music_") === 0).name;
        indexedDB.open(name).onsuccess = e => {
            const t = e.target.result.transaction("tracks", "readwrite"); 
            t.oncomplete = () => {
                console.log("Updating values completed.")
            }
            t.objectStore("tracks").openCursor().onsuccess = e => {
                if (e = e.target.result) { 
                    let data = JSON.parse(e.value);

                    Object.values(data).forEach(t => {
                        t[1] = t[1].replace(".mp3", ""); // Song name 
                        t[6] = t[6].replace("mp3", "");  // Something Play creates based on song name
                    });
                    e.update(JSON.stringify(data));
                    e.continue();
                }
            }
        }
    }).catch(e => console.log(e));
})()

Interestingly, this seems to only affect tracks on the "songs" section of Google Play - at least initially. When I go to a specific playlist the changes I made don't seem to be transferred over. I'll continue investigating...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.