Add a script to find movies by matching filename substring
This commit is contained in:
parent
a788f77f96
commit
185864a50b
39
findbyfile.py
Executable file
39
findbyfile.py
Executable file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import os
|
||||||
|
from plexapi.myplex import MyPlexAccount
|
||||||
|
from plexapi.server import PlexServer
|
||||||
|
from plexapi.media import Media
|
||||||
|
from pprint import pprint
|
||||||
|
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()
|
||||||
|
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
print("Error!")
|
||||||
|
print(" Usage: findbyfile.py <searchstring>")
|
||||||
|
print()
|
||||||
|
sys.exit()
|
||||||
|
search_for = sys.argv[1]
|
||||||
|
|
||||||
|
colcontents = {}
|
||||||
|
for col in apiconfig.colmap.values():
|
||||||
|
colcontents[col] = []
|
||||||
|
|
||||||
|
plex = PlexServer(apiconfig.url, apiconfig.apikey)
|
||||||
|
|
||||||
|
print("Looking for videos that match the search filter...")
|
||||||
|
videos = plex.library.section(apiconfig.libraryname).all()
|
||||||
|
for video in videos:
|
||||||
|
for part in video.iterParts():
|
||||||
|
if search_for in part.file.lower():
|
||||||
|
print(f"Matched: {video.title} ({part.file})")
|
||||||
|
|
||||||
|
# vim:sw=4 ts=4 et:
|
||||||
Loading…
Reference in New Issue
Block a user