Initial Commit
This commit is contained in:
commit
629e7a62cc
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Vim
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Single character files (used for testing)
|
||||
?.py
|
||||
?.sh
|
||||
|
||||
__pycache__
|
||||
apiconfig.py
|
2
apiconfig-default.py
Normal file
2
apiconfig-default.py
Normal file
|
@ -0,0 +1,2 @@
|
|||
url = 'http://radarr.host.ip:port'
|
||||
apikey = 'yourradarrapikey'
|
3
backup
Executable file
3
backup
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
rsync -a --delete /home/junior/PlexDev /backup/
|
2
radarr/apiconfig-default.py
Normal file
2
radarr/apiconfig-default.py
Normal file
|
@ -0,0 +1,2 @@
|
|||
url = 'http://radarr.host.ip:port'
|
||||
apikey = 'yourradarrapikey'
|
25
radarr/unmonitor.py
Normal file
25
radarr/unmonitor.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
import json
|
||||
import os
|
||||
from pyarr import RadarrAPI
|
||||
import sys
|
||||
|
||||
try:
|
||||
import apiconfig
|
||||
except:
|
||||
print("Error!")
|
||||
print(" \"apiconfig.py\" seems to be missing!")
|
||||
print(" Have you copied the default config to \"apiconfig.py\" and made appropriate edits?")
|
||||
print()
|
||||
sys.exit()
|
||||
|
||||
radarr = RadarrAPI(apiconfig.url, apiconfig.apikey)
|
||||
|
||||
movies = radarr.get_movie()
|
||||
|
||||
for movie in movies:
|
||||
if movie['monitored'] == True and movie['hasFile'] == True:
|
||||
print(f"Movie \"{movie['title']} id={movie['id']} has a file but is still monitored!")
|
||||
data = {"movieIds":[movie['id']], "monitored": False}
|
||||
radarr.upd_movies(data)
|
||||
|
||||
# vim: set ts=4 sw=4 et:
|
44
updatecoll.py
Normal file
44
updatecoll.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
from plexapi.myplex import MyPlexAccount
|
||||
from plexapi.server import PlexServer
|
||||
from plexapi.media import Media
|
||||
from pprint import pprint
|
||||
import sys
|
||||
|
||||
PLEX_URL = 'http://localhost:32400'
|
||||
PLEX_TOKEN = 'h3ffbZ4pDxgNtGuUDFys'
|
||||
PATH_FOLDER = '/videos/'
|
||||
LIBRARY = 'Junior Movies'
|
||||
|
||||
colmap = {
|
||||
"Action-Adventure": "Action/Adventure",
|
||||
"Animated": "Animated",
|
||||
"Christmas": "Christmas",
|
||||
"Comedy-Romantic": "Comedy/Romance",
|
||||
"Documentary": "Documentary",
|
||||
"Drama": "Drama",
|
||||
"Imports": "Imports",
|
||||
"Scary": "Scary",
|
||||
"Sci-Fi": "Sci-Fi"
|
||||
}
|
||||
|
||||
colcontents = {}
|
||||
for col in colmap.values():
|
||||
colcontents[col] = []
|
||||
|
||||
plex = PlexServer(PLEX_URL, PLEX_TOKEN)
|
||||
|
||||
print("Building collection contents lists...")
|
||||
for col in colmap.values():
|
||||
videos = plex.library.section(LIBRARY).search(collection=col)
|
||||
for video in videos: colcontents[col].append(video.title)
|
||||
|
||||
print("Checking collections for each movie...")
|
||||
videos = plex.library.section(LIBRARY).all()
|
||||
for video in videos:
|
||||
file = None
|
||||
for part in video.iterParts():
|
||||
if file == None: file = part.file
|
||||
[top_folder, junk] = file[len(PATH_FOLDER):].split("/", 1)
|
||||
if video.title not in colcontents[colmap[top_folder]]:
|
||||
print(f"Movie {video.title} is missing collection {colmap[top_folder]}")
|
||||
video.addCollection(colmap[top_folder])
|
Loading…
Reference in New Issue
Block a user