test
This commit is contained in:
parent
7fb28c1860
commit
54edfcc7a4
54
remove_lonely_collections.py
Normal file
54
remove_lonely_collections.py
Normal file
@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
import pathlib
|
||||
import subprocess
|
||||
import requests
|
||||
from plexapi.server import PlexServer
|
||||
import urllib3
|
||||
urllib3.disable_warnings()
|
||||
|
||||
SCRIPT_DIR = pathlib.Path(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
# PLEX_URL = "http://127.0.0.1:32400"
|
||||
# PLEX_TOKEN = 'GfMXZTPscfvLazy_pyLP'
|
||||
|
||||
|
||||
class plex_info():
|
||||
|
||||
@property
|
||||
def address(self):
|
||||
return "127.0.0.1"
|
||||
|
||||
@property
|
||||
def port(self):
|
||||
return "32400"
|
||||
|
||||
@property
|
||||
def proto(self):
|
||||
return "http://"
|
||||
|
||||
@property
|
||||
def token(self):
|
||||
token_script = pathlib.Path(SCRIPT_DIR).joinpath('plex-token.sh')
|
||||
token = subprocess.run(['/bin/bash', token_script], capture_output=True, text=True).stdout
|
||||
return token
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
return '%s%s:%s' % (self.proto, self.address, str(self.port))
|
||||
|
||||
|
||||
print(plex_info.token)
|
||||
|
||||
#sess = requests.Session()
|
||||
#sess.verify = False
|
||||
#plex = PlexServer(plex_info.url, plex_info.token, session=sess)
|
||||
|
||||
#all_libraries = plex.library.sections()
|
||||
#for library in all_libraries:
|
||||
# for collection in library.search(libtype="collection"):
|
||||
# if collection.childCount == 0:
|
||||
# collection.delete()
|
||||
Loading…
Reference in New Issue
Block a user