Media Cleaner is a simple CLI tool to clean up your media library based on your Overseerr requests and Tautulli history, written in Rust.

Related tags

Video media-cleaner
Overview

Media Cleaner

Media Cleaner is a simple CLI tool to clean up your media library based on your Overseerr requests and Tautulli history, written in Rust.

It was written to help me clean up my Plex library, but it should work for anyone with a similar setup. It's not perfect, but it works for me. (This project was written partly to help me learn Rust, so please don't judge me too harshly, though feedback is always welcome.)

Installation

Just download the latest release for your platform from the releases page.

Usage

Warning: As of right now, this program does not support Overseerr 4k instances, and only works in the cases where you use the normal Sonarr/Radarr instances.

Config

Make sure you have a config file in the same directory as the executable (or more specifically the root of the working directory when you launch it). It should be named config.yaml and look something like this (this was chosen instead of CLI arguments to make it easier for repeated use):

# The number of items to show in the list of items to select.
# Useful to limit if your terminal is small, as it can be quite buggy if the list doesn't fit.
# Default to 5 if not specified.
items_shown: 5
plex:
    url: https://YOUR_PLEX_URL
    token: YOUR_PLEX_TOKEN
overseerr:
    url: https://YOUR_OVERSEERR_URL
    api_key: YOUR_API_KEY
tautulli:
    url: https://YOUR_TAUTULLI_URL
    api_key: YOUR_API_KEY
sonarr: # If you don't use Sonarr, just leave this section out
    url: https://YOUR_SONARR_URL
    api_key: YOUR_API_KEY
radarr: # If you don't use Radarr, just leave this section out
    url: https://YOUR_RADARR_URL
    api_key: YOUR_API_KEY

All fields have to be filled in, except for Sonarr or Radarr (though if their root is listed, all values have to be filled). If both Sonarr and Radarr are missing, the program will give you an error, as it requires at least one of them to be active.

You can get your api keys from the respective applications. A simple search should help you find it. For the Plex token, you can follow this guide.

ALSO MAKE SURE CSRF IS TURNED OFF IN OVERSEERR.

Running the program

Once you have your config file, you can run the program with ./media-cleaner (or .\media-cleaner.exe on Windows). If nothing is shown immediately, you have to wait for it to finish all the requests to gather the appropriate data. Afterwards it will bring up a list of possible sorting options for your requests. After that it will instead show a list of all your requests, sorted in the way chosen, with the media data associated with that item (watch history, space, etc.), simply select the ones you want to remove (with space) and press enter. This will (after a confirmations screen) remove the request from Overseerr and tell Sonarr and Radarr to remove the show and its files.

Arguments

You can also pass an argument to the program to skip the sorting screen and go straight to the requests screen. The argument is the sorting method you want to use, and can be one of the following:

  • -s: Sort by size
  • sd: Sort by size, in descending order
  • -n: Sort by name
  • -nd: Sort by name, in descending order
  • -t: Sort by media type

Issues and PRs

You are welcome to open issues, but please be aware that this is a hobby project written to help me learn Rust, and as such have no ambitions to a) implement features I don't want (though you are free to open a PR and I'll have a look at it), and b) fix issues that don't plague me personally (unless I feel it is large enough to warrant a fix).

When it comes to PRs, I'm happy to accept them, but please be aware that I'm not a professional programmer (yet), so I might not be able to give you the best feedback. Similarly, it may take some time while I take the time to look at it.

License

This project is licensed under the MIT license. See the LICENSE file for more details.

You might also like...
A not well-named youtube's videos downloader written in Rust 🦀

ytdl-rs A not well-named youtube's videos downloader written in Rust 🦀 For information about how to use, legal section, next steps in the project, co

High-level RTSP multimedia streaming library, in Rust

High-level RTSP multimedia streaming library, in Rust. Good support for ONVIF RTSP/1.0 IP surveillance cameras, as needed by Moonfire NVR. Works around brokenness in cheap closed-source cameras.

An audio playback library for Node.js

symphonia.js A "way too simple" cross-platform zero dependency audio playback library for Node.js Supported Platforms Windows (x64) macOS (x64) macOS

Play your favorite live streams from command line

Streamlib Streamlib is a meta-player for media streams. The streamlib CLI works against a curated library of video and audio streams, and enables quer

Pure-rust implementation of legacy H.263 video codec and associated color transforms

website | demo | nightly builds | wiki h263-rs h263-rs is a pure-Rust implementation of ITU-T Recommendation H.263 (2005/08), a video codec commonly u

The fastest and safest AV1 encoder.

rav1e The fastest and safest AV1 encoder. Table of Content Overview Features Documentation Releases Building Dependency: NASM Release binary Unstable

Lumiere is a proof-of-concept/example video player built with the Slint UI framework and libmpv
Lumiere is a proof-of-concept/example video player built with the Slint UI framework and libmpv

Lumiere is a proof-of-concept/example video player built with the Slint UI framework and libmpv. This was built quickly to try out Slint and it's new OpenGL underlay feature.

ffmpeg libraries precompiled for WebAsembly/WASI, as a Rust crate.

FFMPEG crate for WebAssembly/WASI This crate bundles FFMPEG's libraries, precompiled for WebAssembly. No native installation required. Compatible with

Rust high level RTSP client

RRTSP Client Currently works, but a lot of work to do. PRs welcome! Examples, crates.io, better Readme.md and other things coming soon.

Comments
  • Overseer API Error

    Overseer API Error

    Overseer version 1.32.5 media-cleaner-v0.1-linux-x64

    Error: 
       0: error decoding response body: missing field `pageInfo` at line 1 column 75
       1: missing field `pageInfo` at line 1 column 75
    
    Location:
       src/overseerr/api.rs:14
    
    Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
    Run with RUST_BACKTRACE=full to include source snippets.
    

    Thanks for putting this together, excited to get it working and clean up my library!

    bug 
    opened by brandonjones24 9
  • 0: Empty list of items given to `MultiSelect`

    0: Empty list of items given to `MultiSelect`

    Getting error

    `Error: 0: Empty list of items given to MultiSelect

    Location: src\main.rs:30

    Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it. Run with RUST_BACKTRACE=full to include source snippets.`

    image

    image

    potential bug 
    opened by bryceprutsos 8
  • Better error checking for API

    Better error checking for API

    The errors given by different response codes, should be given to the user in an appropriate way. That way it will be easier to debug/solve potential issues.

    enhancement 
    opened by Supergamer1337 1
Releases(v1.1.0)
Owner
Felix Bjerhem Aronsson
Just some 21 year old guy...
Felix Bjerhem Aronsson
Xiu - A simple and secure live media server in pure Rust (RTMP/HTTP-FLV/HLS/Relay).🦀

Xiu is a simple and secure live media server written by pure Rust, it now supports popular live protocols like RTMP/HLS/HTTP-FLV (and maybe other protocols in the future), you can deploy it as a stand-alone server or a cluster using the relay feature.

HarlanC 602 Jan 2, 2023
Dim, a media manager fueled by dark forces.

Dim, a media manager fueled by dark forces.

Dusk Labs 3.1k Jan 8, 2023
A CLI tool that converts videos to ASCII and displays them to the terminal on the fly

A CLI tool that converts videos to ASCII and displays them to the terminal on the fly

Luke T 19 Nov 15, 2022
A library for calculating simple moving averages

simple_moving_average This crate provides several algorithms for calculating the simple moving average (SMA) of a series of data samples. SMAs are com

Oskar Gustafsson 5 Oct 9, 2021
Rust-based video player for astrophotography

Astro Video Player Rust-based video player for astrophotography videos in SER and AVI format. Supports debayering of RAW color images. Status: Works w

Andy Grove 6 May 7, 2022
A ffmpeg/rust based HLS stream generator

hls-streamer Stream your heart's content with HLS. Movtivation I've got a CCTV camera from AliExpress, I know I can use ffmpeg hls demuxer to split up

null 16 Jan 9, 2023
AV1 encoding tool with fast VMAF sampling. Uses svt-av1, ffmpeg & vmaf

ab-av1 AV1 encoding tool with fast VMAF sampling. Uses svt-av1, ffmpeg & vmaf. Command: auto-encode Automatically determine the best crf to deliver th

Alex Butler 92 Jan 1, 2023
Simple playground project to explore the YUV4MPEG2 format.

2mpeg4yuv Simple playground project to explore the YUV4MPEG2 format. Quick Start Install the Rust Compiler Preview $ ./build.sh $ ./2mpeg4yuv preview

Tsoding 19 Dec 28, 2022
Plays back videos in your terminal in an insanely slow and inefficient way.

term-video I guess this is usable now... Compilation Since this project is built using Rust, install its toolchain first, for example using rustup. gi

Pascal Puffke 7 Feb 23, 2022
Gyroflow is an application that can stabilize your video by using motion data from a gyroscope and optionally an accelerometer

Gyroflow is an application that can stabilize your video by using motion data from a gyroscope and optionally an accelerometer. Modern cameras record that data internally (GoPro, Sony, Insta360 etc), and this application stabilizes the captured footage precisely by using them. It can also use gyro data from an external source (eg. from Betaflight blackbox).

Gyroflow 3.9k Jan 5, 2023