2019-06-21 06:55:11 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""Delete all playlists from Plex.
|
2017-07-12 18:16:19 +00:00
|
|
|
|
|
|
|
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:
|
2019-06-21 06:55:11 +00:00
|
|
|
r = requests.delete('{}/playlists/{}?X-Plex-Token={}'.format(baseurl, i, token))
|
2017-07-12 18:16:19 +00:00
|
|
|
print(r)
|
|
|
|
|
|
|
|
except Exception as e:
|
2019-06-21 06:55:11 +00:00
|
|
|
print(e)
|