Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Delete all movies that haven't been 'downloaded' in Radarr. Mass/bulk deleting.
// Go to Radarr and click 'settings' => 'general'.
// Open the JavaScript Console in Google Chrome (View => Developer => Javascript Console)
// Past the following in. Hit enter and away you go.
const key = document.getElementsByClassName('x-api-key')[0].value;
if (!key) {
alert('Navigate to /settings/general and run again');
}
let ids = [];
let _movies = [];
let index = 0;
const percent = () => {
return `[${(((index + 1) / _movies.length) * 100).toFixed(2)}%]`
}
const deleteMovie = (id) =>
fetch(`/api/movie/${id}`, {
method: 'DELETE',
headers: {
'X-Api-Key': key,
},
}).then(() => {
index++;
if (ids[index]) {
console.log(`${percent()} Deleting ${_movies.find(m => m.id === ids[index]).title}`);
deleteMovie(ids[index]);
} else {
console.log('Finished deleting movies')
alert('It looks like all movies were deleted');
}
})
console.log('Fetching list of your movies, this could take a while...');
console.log('Please don\'t refresh this page until finished');
fetch('/api/movie', {
headers: {
'X-Api-Key': key,
}
}).then(res => res.json()).then(movies => {
console.log('Movie list fetched');
_movies = movies;
const downloaded = movies.filter(movie => !movie.downloaded);
ids = downloaded.map(movie => movie.id);
if (ids.length) {
console.log(`${percent()} Deleting ${movies.find(m => m.id === ids[index]).title}`);
deleteMovie(ids[index]);
} else {
alert('There doesn`t seem to be any movies to delete');
}
});
@munrotm

This comment has been minimized.

Copy link

@munrotm munrotm commented May 27, 2018

Any chance this can be altered (or forked rather) to be able to delete all movies that have been downloaded? My database is messed up and I want to start again...

@ardean

This comment has been minimized.

Copy link

@ardean ardean commented May 20, 2019

delete all movies using API v2 (Radarr Version 2)

(async () => {
  const { apiKey } = window.Radarr;

  const res = await fetch("/api/v2/movie", {
    headers: {
      "X-Api-Key": apiKey
    }
  });
  const movies = await res.json();
  const ids = movies.map(movie => movie.id);

  console.info("Movie list fetched", ids);

  for (const id of ids) {
    await fetch(`/api/movie/${id}`, {
      method: "DELETE",
      headers: {
        "X-Api-Key": apiKey
      }
    });

    console.info(`deleted movie ${id}`);
  }
})();
@spmvoss

This comment has been minimized.

Copy link

@spmvoss spmvoss commented Oct 14, 2019

Awesome, this helped a lot thank you! For anyone else stumbling upon this, you can easily change it to delete all unmonitored by changing !movie.downloaded to !movie.monitored in line 49.

@Vengance09

This comment has been minimized.

Copy link

@Vengance09 Vengance09 commented Apr 4, 2020

Just wanted to pop in and say thank you! this was super helpful. I moved my setup from Couch Potato and SickBread to Sonarr+Radarr

@Fronix

This comment has been minimized.

Copy link

@Fronix Fronix commented Apr 7, 2020

Nice stuff!

I needed some extra functions like deleting never downloaded movies and never watched movies. So I expanded upon your script a little. Added some extra stuff, deleting X months old movies, blacklisting id's that you don't want to delete but get included anyway etc.

Link to gist: https://gist.github.com/Fronix/92dd3319845e61c7af063db5f6e8961b

code removed, please use the gist

@infamousjoeg

This comment has been minimized.

Copy link

@infamousjoeg infamousjoeg commented Jul 22, 2020

SO MUCH TIME SAVED! LOVE THIS!

For anyone avoiding Chrome, this also works in the Web Console of Firefox...

@abarber229

This comment has been minimized.

Copy link

@abarber229 abarber229 commented Dec 19, 2020

I tried running the delete.js code in the javascript console, but I am getting a "Uncaught TypeError: Cannot read property 'value' of undefined
at :1:60". Any thoughts on what I might be doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment