Code Monkey home page Code Monkey logo

plex_top_playlists's Introduction

plex_top_playlists

A python script to get top weekly or top popular lists and put them in plex as playlists. It will make a playlist for each user on your server. This is my first time ever creating a python script. Also the first time really adding something useful to GitHub

Use at your own risk. I have it running nightly

Read This

This script is assuming you are using "Plex Movie" as your library check. If you are using TMDB, I can add the code here but I personally didnt need it.

The TV Shows playlists give the last episode in your library for the show. You can easily click the show name to go to it.

The playlists can be created for any of the following

  • All shared users
  • Specific users by username
  • Only the script running user

What lists this script currently retreives

  • Trakt Movie Watched (weekly)
  • Trakt Movie Popular
  • Trakt Show Watched (weekly)
  • Trakt Show Popular
  • IMDB top 250 list (http://www.imdb.com/chart/top)

Getting Started

Get initial information

Get plex token

This page will show you where your token is

https://support.plex.tv/hc/en-us/articles/204059436-Finding-an-authentication-token-X-Plex-Token

This page will show you how to view your xml to see that link you grab your token from

https://support.plex.tv/hc/en-us/articles/201998867

Get Trakt API key

To connect to Trakt you need to get an api key. You can easily create one. Here are the steps for that

  1. go to Trakt.tv
  2. create a user if you dont have one
  3. Sign in
  4. go here https://trakt.tv/oauth/applications/new
  • Name - call it what you want
  • Description - needed, put whatever you want
  • redirect url - put any websit
  • dont need anything else filled out
  1. grab the Client ID to use as your Trakt API Key

Setup

These instructions are for Ubuntu. Should also work with Debian or any debian based os. If you run the script python will yell at you what modules are missing and you can google what you need for your installation.

Install pip:

sudo apt-get install python-setuptools python-dev build-essential

Upgrade pip

sudo pip install --upgrade pip

Install needed pip modules:

sudo pip install plexapi

There are 2 more modules i dont have the install code for. If you encounter an error saying something like module missing, please let me know and I will add the correct instructions here.

Create the script file. Go to the folder location you want to put it

REPLACE user with your user

sudo mkdir /usr/scripts
sudo chown user:user /usr/scripts
cd /usr/scripts
cp settings.ini.example settings.ini
nano settings.ini

Copy conetents from the plex_playlist_update.py file into your new file

Required - Fill in Plex Token Not Needed - Trakt API key, keep blank for lists Options - Change folder names and who to sync with

Save and close (hit Ctrl+x, y, enter)

Make the Script executable.

sudo chmod +x plex_playlist_update.py

Run the script

./plex_playlist_update.py

Make script run nightly

crontab -e

Add this line to the bottom of the file (will run at 4:05 am every day)

5 4 * * * /usr/scripts/plex_playlist_update.py

Used references to create the script

Thank you JonnyWong16 for his amazing scripts which I heavily referenced.

https://gist.github.com/JonnyWong16/2607abf0e3431b6f133861bbe1bb694e https://gist.github.com/JonnyWong16/b1aa2c0f604ed92b9b3afaa6db18e5fd

plex_top_playlists's People

Contributors

desimaniac avatar gkspranger avatar pbrink231 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

Watchers

 avatar  avatar  avatar

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.