2be0e376f8
Adds a basic `setup.cfg` file with configurations for flake8 and pylama, fixes some basic issues with essentially every file including: * Many, many, whitespace line cleanups * Several unused variables and imports * Missing coding and shabang lines * Minor style fixes to more closely align with PEP8 * Turn `print` into function calls for Python 2/3 compat * A few minor bugs * Things like using an undefined `i` in `stream_limiter_ban_email.py`
31 lines
588 B
Python
31 lines
588 B
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""Delete all playlists from Plex.
|
|
|
|
https://github.com/mjs7231/python-plexapi
|
|
"""
|
|
|
|
from plexapi.server import PlexServer
|
|
import requests
|
|
|
|
baseurl = 'http://localhost:32400'
|
|
token = 'XXXXXXXX'
|
|
plex = PlexServer(baseurl, token)
|
|
|
|
tmp_lst = []
|
|
|
|
|
|
for playlist in plex.playlists():
|
|
tmp = playlist.key
|
|
split = tmp.split('/playlists/')
|
|
tmp_lst += [split[1]]
|
|
|
|
for i in tmp_lst:
|
|
try:
|
|
r = requests.delete('{}/playlists/{}?X-Plex-Token={}'.format(baseurl, i, token))
|
|
print(r)
|
|
|
|
except Exception as e:
|
|
print(e)
|