Code Monkey home page Code Monkey logo

perplex's Introduction

Perplex

A Movie Renamer for Plex Metadata

Overview

This is a simple script for renaming movie files based on Plex metadata. Plex is a software suite for organizing videos, music and photos. It can identify movies based on their file names and retrieve corresponding metadata. In practice, however, not all files are named appropriate and thus some movies usually need to be manually assigned to the corresponding movie title. Unfortunately, Plex is not able to rename these files and thus if the database is deleted or re-installed, these files need to be manually fixed again.

The script perplex.py solves this problem. Given an installation of Plex and the corresponding database of metadata, the script extracts all movies and renames the corresponding files according to the retrieved metadata. To avoid breaking the current installation, the renamed files are copied to another directory.

Usage

First, extract all the metadata from the Plex database and save it.

$ ./perplex.py --save movies.db --plex /var/plex
Analyzing Plex database: Found 335 movies and 365 files
Saving metadata to movies.db

Now start the renaming process. The renamed movies are written to the given directory.

$ ./perplex.py --load movies.db --dest ./output
Loading metadata from movies.db
Copying renamed files to ./output
100% |#################################################| Time: 0:00:00

Done.

perplex's People

Contributors

mlsec-crawl avatar rieck avatar windowslucker1121 avatar

Stargazers

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

Watchers

 avatar

perplex's Issues

Is this sill working?

I've just tried it and I've got this error:

Analyzing Plex database:
Traceback (most recent call last):
File "./perplex.py", line 125, in
movies = build_db(args.plex)
File "./perplex.py", line 34, in build_db
db = sqlite3.connect(dbfile)
ValueError: database parameter must be string or APSW Connection object

So I guess if is this project still in place or not working with latest Plex DBs.

Thanks

manual/special input directory?

hey.
this tool is really awesome. just what i looked for.
but my problem is, i plan to only rename a "unsorted"-directory, not matched by filebot. so this can be matched/reviewed inside plex and then let it move by perplex.
is this possible?

thank you

Not working...

./perplex.py --save movies.db --plex /var/plex

File "/scripts/./perplex.py", line 32
print "Analyzing Plex database:",
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Analyzing Plex database:", end=" ")?

Does not work with non-ascii characters in filenames

Unfortunately it seems that this script cannot handle non-ascii characters in filenames - in original name as well as in the new name.

Alway get similar messages to: "UnicodeEncodeError: 'ascii' codec can't encode character u'\u010d' in position 22: ordinal not in range(128)"

JustRename use first movie folder found as root for movies folder

Sample of dry run from "python3 perplex.py --load plex.db --justRename /movies/ --dry"
Start Renaming the files in their original path
/movies/Unsorted/12 Years A Slave/12 Years A Slave 1080p AC3.mkv
/movies/Unsorted/12 Years A Slave/12 Years a Slave (2013)/12 Years a Slave (2013).mkv
/movies/Unsorted/1917 (2019)/1917 (2019) 1080p AC3.mkv
/movies/Unsorted/12 Years A Slave/1917 (2020)/1917 (2020).mkv
/movies/Unsorted/2040 (2019)/2040 (2019) 1080p AC3.mkv
/movies/Unsorted/12 Years A Slave/2040 (2019)/2040 (2019).mkv

12 Years A Slave is part of root folder after.

Windows support?

Does this script work on databases in the Windows version of Plex? It took me a bit of troubleshooting/getting the progressbar and running everything with python2, but I am getting the below error running the script

Analyzing Plex database: Traceback (most recent call last): File "./perplex.py", line 125, in <module> movies = build_db(args.plex) File "./perplex.py", line 43, in build_db year = row[2].split('-')[0]
I copied the database onto a Raspberry pi and re-ran it, but I'm getting the same errors.

Output Issues

Is there a way to just rename the files where they are instead of putting them a separate output directory? I have several TBs of files split between hard drives and no single output folder is going to hold everything.

Thanks

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.