Skip to content

Commit

Permalink
Merge pull request #26 from jakewaldron/dev
Browse files Browse the repository at this point in the history
Bug Fix
  • Loading branch information
jakewaldron committed Mar 3, 2016
2 parents 4eb8a0b + fc73439 commit ece1a4a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ Pass a special one-time notice to users
python plexEmail.py -n "This is a special notice to all users"
```

Output the current script version

```
python plexEmail.py --version
```

## Config File

The config file is in the scripts folder. Before first run of the script, please update this file with your information.
Expand Down
15 changes: 11 additions & 4 deletions scripts/plexEmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
from email.utils import formataddr
from xml.etree.ElementTree import XML

SCRIPT_VERSION = 'v0.8.2'

def replaceConfigTokens():
## The below code is for backwards compatibility
if ('artist_sort_1' not in config.keys() or config['artist_sort_1'] == ""):
Expand Down Expand Up @@ -64,16 +66,16 @@ def replaceConfigTokens():
config['msg_songs_link'] = 'Songs'

if ('filter_show_artists' not in config):
config['filter_show_artists'] = False
config['filter_show_artists'] = True

if ('filter_show_albums' not in config):
config['filter_show_albums'] = False
config['filter_show_albums'] = True

if ('filter_show_songs' not in config):
config['filter_show_songs'] = False

if ('filter_sections_Music' not in config):
config['filter_sections_Music'] = {'tagline':{'order':1,'show':False,'preText':'<i>','postText':'</i>','include':[],'exclude':[]},'summary':{'order':2,'show':True,'preText':'','postText':'','include':[],'exclude':[]},'tags_genre':{'order':3,'show':True,'preText':'Genre(s): ','postText':'','include':[],'exclude':[]},'tags_director':{'order':4,'show':False,'preText':'Director: ','postText':'','include':[],'exclude':[]},'tags_star':{'order':5,'show':False,'preText':'Star(s): ','postText':'','include':[],'exclude':[]},'content_rating':{'order':6,'show':False,'preText':'ContentRating: ','postText':'','include':[],'exclude':[]},'duration':{'order':7,'show':True,'preText':'Runtime: ','postText':' minutes','include':[],'exclude':[]},'year':{'order':8,'show':False,'preText':'Year: ','postText':'','include':[],'exclude':[]},'studio':{'order':9,'show':True,'preText':'Network: ','postText':'','include':[],'exclude':[]},'rating':{'order':10,'show':False,'preText':'Rating: ','postText':'%','include':[],'exclude':[]}}
config['filter_sections_Music'] = {'tagline':{'order':1,'show':False,'preText':'<i>','postText':'</i>','include':[],'exclude':[]},'summary':{'order':2,'show':True,'preText':'','postText':'','include':[],'exclude':[]},'tags_genre':{'order':3,'show':True,'preText':'Genre(s): ','postText':'','include':[],'exclude':[]},'tags_director':{'order':4,'show':False,'preText':'Director: ','postText':'','include':[],'exclude':[]},'tags_star':{'order':5,'show':False,'preText':'Star(s): ','postText':'','include':[],'exclude':[]},'content_rating':{'order':6,'show':False,'preText':'ContentRating: ','postText':'','include':[],'exclude':[]},'duration':{'order':7,'show':True,'preText':'Runtime: ','postText':' minutes','include':[],'exclude':[]},'year':{'order':8,'show':False,'preText':'Year: ','postText':'','include':[],'exclude':[]},'studio':{'order':9,'show':True,'preText':'Network: ','postText':'','include':[],'exclude':[]},'rating':{'order':10,'show':False,'preText':'Rating: ','postText':'%','include':[],'exclude':[]},'air_date':{'order':11,'show': True,'preText':'Release Date: ','postText':'','include':[],'exclude':[],'format': '%B %d, %Y'},'track_list':{'order':12,'show': True,'headerText':{'trackNumber':'Track#','songName':'Song Name','artistName':'Artist(s)','duration':'Duration'}}}

if ('filter_artists_include' not in config):
config['filter_artists_include'] = []
Expand Down Expand Up @@ -295,7 +297,7 @@ def getSharedUserEmails():
headers = {'Accept': 'application/json', 'X-Plex-Token': token}
response = requests.get(url, headers=headers)

parsed = XML(response.text)
parsed = XML(response.text.encode('ascii', 'ignore'))
for elem in parsed:
for name, value in sorted(elem.attrib.items()):
if (name == 'email'):
Expand Down Expand Up @@ -767,8 +769,13 @@ def createWebHTML():
parser.add_argument('-c','--configfile', help='The path to a config file to be used in the running of this instance of the script.', default=os.path.dirname(os.path.realpath(sys.argv[0])) + os.path.sep + 'config.conf', required=False)
parser.add_argument('-t','--test', help='Run this script in test mode - Sends email only to sender', action='store_true')
parser.add_argument('-n','--notice', help='Add a one-time message to the email/web page')
parser.add_argument('--version', help='Display the version of the script file', action='store_true')
args = vars(parser.parse_args())

if ('version' in args):
print 'Script Version: ' + SCRIPT_VERSION
sys.exit()

testMode = False

if ('configfile' in args):
Expand Down

0 comments on commit ece1a4a

Please sign in to comment.