Giter Club home page Giter Club logo

docker-plex-cleaner's Introduction

Plex-Cleaner Docker

Build docker image

Dokerized version of ngovil21/Plex-Cleaner

First run

docker pull nitrikx/plex-cleaner
docker run -ti -v /path/to/config/folder:/config nitrikx/plex-cleaner

Testing

docker run -ti -v /path/to/config/folder:/config nitrikx/plex-cleaner --test

Execution frequency

# Run every 4 hours
docker run -ti -v /path/to/config/folder:/config -e "EXECUTION_CRON_EXPRESSION=0 */4 * * *" nitrikx/plex-cleaner

# Run once
docker run -ti -v /path/to/config/folder:/config -e "EXECUTION_CRON_EXPRESSION=ONCE" nitrikx/plex-cleaner

--reload_encoding

If you need to pass the --reload_encoding parameter, you could do something like this

docker run -ti -v /path/to/config/folder:/config nitrikx/plex-cleaner --reload_encoding

plex_delete = false

If you want to delete the file without passing by the Plex Web API, you need to mount your plex data directory:

docker run -ti -v /path/to/config/folder:/config -v /path/to/plex/folder:/plexdata nitrikx/plex-cleaner

and then adjust your configuration:

...
    "default_location": "/plexdata",
...

Logs

You can also export the logs by mounting a volume on /logs:

docker run -ti -v /path/to/config/folder:/config -v /path/to/logs/folder:/logs nitrikx/plex-cleaner

docker-plex-cleaner's People

Contributors

nitrikx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

docker-plex-cleaner's Issues

Connection refused error

👋 Thank you very much for this script!

I'm sorry I've tried debugging this myself but it's been a few hours now and I can't manage to make things work, I hope posting an issue here is OK.

I'm struggling to get HTTP requests going through when running this script in my docker container: <urlopen error [Errno 111] Connection refused>. I'm not very familiar with docker and even less so with python.

I've successfully ran the script locally, and I successfully mount the docker image. The Cleaner.conf does have the right token, which I ensured was picked up by the .py script by printing it in the logs in the def getUrlX method.
I've also printed the URL the script tries to access and I've tried to access the URL from the browser, which DOES work, see images below.

Am I missing something obvious?

blissful_jennings - Container - Docker Desktop 2023-11-11 at 10 50 52 AM

127 0 0 132400librarysectionsX-Plex-Token=B7Njdg-ygC6ApMx1A-6y 2023-11-11 at 10 52 03 AM

Plex API Only via docker?

I Just started using Plex Cleaner (thanks to your docker). I think I'm starting to get a hang of it, but starting it with docker i think makes it a bit more difficult for a beginner.

my question is. Can this work in docker without plex_delete true?
Under my limited test time I got the following:
Plex_delete true can delete watched movies via web (Plex API), But if I set it to false, It can't. which is kinda makes sense. (I want to try the copy and move commands as well, and plex API probably doesn't support these)

They are in a seperate docker, this one doesn't have 'OS' access to the filesystem of the plex/media one.
can this be fixed? maybe i mount the same volume on this docker as well. could it work?

thank you!
btw I'm running unraid, not sure if it helps.

Configure log rotation

Currently, the plexcleaner.log continues to grow indefinitely. I just cleared mine where it had hit over 24gb of data. Where the cron job runs every 5 minutes by default and appends the log file it very quickly grows in size. It would be quite useful if that file were rotated on a daily basis and only a week's worth of logs kept by default.

Running on macOS

Running docker run -ti -v ~/Projects/plex-cleaner-test/config:/config -e "EXECUTION_CRON_EXPRESSION=ONCE" nitrikx/plex-cleaner --test on macOS High Sierra gives me the following output:

Executing the script once...
/app/run-plexcleaner.sh --test

====================================================
Mon May  7 12:30:30 UTC 2018 - Running script
Loading config file: /config/Cleaner.conf
Traceback (most recent call last):
  File "/app/PlexCleaner.py", line 1054, in <module>
    options = json.loads(opt_string)
  File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Am I doing something wrong?

Support armhf (Raspberry Pi)

Many linuxserver docker images provide multi arch support, allowing the images to be run on armhf processors, like those used on the raspberry pi.

Would it be possible for you to enable this docker image to support armhf processors so that I can use it on my raspberry pi?

UnicodeDecodeError

I'm getting an error when running your docker-compose on my library. I get something similar when I run PlexCleaner.py directly on my server with python 2.7, but I don't get the error on my server when running directly with python 3.6.

Here's the error (happening after many successful episode log entries):
The Late Show with Stephen Colbert - S05xE052 - LL Cool J, Jos? Andr?s | Viewed: 0 | Days Since Last Viewed: 0 | On Deck: False Traceback (most recent call last): File "/app/PlexCleaner.py", line 1274, in <module> changed += checkShow(DirectoryNode) File "/app/PlexCleaner.py", line 955, in checkShow log('[KEEPING] ' + getLocalPath(ep['file'])) File "/app/PlexCleaner.py", line 597, in getLocalPath if file.startswith(Settings['RemoteMount']): UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 117: ordinal not in range(128)

The problem appears to be the characters in guest name "Jos? Andr?s" (which should show as "José Andrés".

Is it possible to update the docker file to use python 3?
If not, I found the following suggestion on stack overflow that might work in the PlexCleaner.py source:
import sys reload(sys) sys.setdefaultencoding('utf-8')

Thanks for getting this docker file set up! My server is getting a bit bloated....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.