40 lines
991 B
Python
Executable File
40 lines
991 B
Python
Executable File
#!/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:
|