2017-08-13 01:35:13 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
Plex-MarkWatched is a useful to always mark a show as watched. This comes in
|
|
|
|
handy when you have a show you keep downloaded, but do not religiously watch
|
|
|
|
every single episode that is downloaded. By marking everything watched, it
|
|
|
|
will keep the show out of your OnDeck list inside Plex.
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
Intended usage is to add the tak 'markwatched' to any show you want to have
|
|
|
|
this behaviour. Then simply add this script to run on a schedule and you
|
|
|
|
should be all set.
|
2017-08-15 02:55:54 +00:00
|
|
|
|
|
|
|
Example Crontab:
|
|
|
|
*/5 * * * * /home/atodd/plex-markwatched.py >> /home/atodd/plex-markwatched.log 2>&1
|
2017-08-13 01:35:13 +00:00
|
|
|
"""
|
2017-08-15 02:55:54 +00:00
|
|
|
from datetime import datetime
|
2017-08-13 01:35:13 +00:00
|
|
|
from plexapi.server import PlexServer
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2017-08-15 02:55:54 +00:00
|
|
|
datestr = lambda: datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
|
|
|
print('%s Starting plex-markwatched script..' % datestr())
|
2017-08-13 01:35:13 +00:00
|
|
|
plex = PlexServer()
|
|
|
|
for section in plex.library.sections():
|
2017-08-15 02:55:54 +00:00
|
|
|
if section.type in ('show',): # ('movie', 'artist', 'show'):
|
2017-08-13 01:35:13 +00:00
|
|
|
for item in section.search(collection='markwatched'):
|
2017-08-15 02:55:54 +00:00
|
|
|
print('%s Marking %s watched.' % (datestr(), item.title))
|
|
|
|
item.markWatched()
|