Skip to content

Commit ece1a4a

Browse files
committed
Merge pull request #26 from jakewaldron/dev
Bug Fix
2 parents 4eb8a0b + fc73439 commit ece1a4a

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ Pass a special one-time notice to users
7777
python plexEmail.py -n "This is a special notice to all users"
7878
```
7979

80+
Output the current script version
81+
82+
```
83+
python plexEmail.py --version
84+
```
85+
8086
## Config File
8187

8288
The config file is in the scripts folder. Before first run of the script, please update this file with your information.

scripts/plexEmail.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
from email.utils import formataddr
2424
from xml.etree.ElementTree import XML
2525

26+
SCRIPT_VERSION = 'v0.8.2'
27+
2628
def replaceConfigTokens():
2729
## The below code is for backwards compatibility
2830
if ('artist_sort_1' not in config.keys() or config['artist_sort_1'] == ""):
@@ -64,16 +66,16 @@ def replaceConfigTokens():
6466
config['msg_songs_link'] = 'Songs'
6567

6668
if ('filter_show_artists' not in config):
67-
config['filter_show_artists'] = False
69+
config['filter_show_artists'] = True
6870

6971
if ('filter_show_albums' not in config):
70-
config['filter_show_albums'] = False
72+
config['filter_show_albums'] = True
7173

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

7577
if ('filter_sections_Music' not in config):
76-
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':[]}}
78+
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'}}}
7779

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

298-
parsed = XML(response.text)
300+
parsed = XML(response.text.encode('ascii', 'ignore'))
299301
for elem in parsed:
300302
for name, value in sorted(elem.attrib.items()):
301303
if (name == 'email'):
@@ -767,8 +769,13 @@ def createWebHTML():
767769
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)
768770
parser.add_argument('-t','--test', help='Run this script in test mode - Sends email only to sender', action='store_true')
769771
parser.add_argument('-n','--notice', help='Add a one-time message to the email/web page')
772+
parser.add_argument('--version', help='Display the version of the script file', action='store_true')
770773
args = vars(parser.parse_args())
771774

775+
if ('version' in args):
776+
print 'Script Version: ' + SCRIPT_VERSION
777+
sys.exit()
778+
772779
testMode = False
773780

774781
if ('configfile' in args):

0 commit comments

Comments
 (0)