Skip to content

Commit

Permalink
Merge pull request #162 from ukdtom/tommy-work
Browse files Browse the repository at this point in the history
Fix #159
  • Loading branch information
ukdtom authored Jan 27, 2021
2 parents 6621f74 + fe58ebd commit 1ef7045
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Contents/Code/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
########################################################################

# APP specific stuff
VERSION = ' V2.0.0.15'
VERSION = ' V2.0.0.16'
APPNAME = 'ExportTools'
NAME = APPNAME + VERSION
DESCRIPTION = 'Export Plex libraries to csv-files or xlsx-files'
Expand Down
26 changes: 25 additions & 1 deletion Contents/Code/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def getItemInfo(et, myRow, fieldList, mediaType='movie'):


def getMediaPath(myMedia, myRow):
''' return the media path info for movies '''
''' return the media path info '''
# Get tree info for media
try:
myMediaTreeInfoURL = GetLoopBack() + '/library/metadata/' + \
Expand All @@ -426,6 +426,30 @@ def getMediaPath(myMedia, myRow):
return myRow


def getMetadataPath(myMedia, myRow):
''' return the Metadata path info '''
# Get tree info for media
try:
MediaHash = Hash.SHA1(GetRegInfo(myMedia, 'guid'))
mediaType = GetRegInfo(myMedia, 'type')
if mediaType == 'movie':
mediaType = 'Movies'
elif mediaType == 'show':
mediaType = 'TV Shows'
MetadataPath = os.path.join(
Core.app_support_path,
'Metadata',
mediaType,
MediaHash[0], MediaHash[1:] + '.bundle'
)
myRow['PMS Metadata Path'] = MetadataPath.encode('utf8')
return myRow
except Exception, e:
Log.Exception('Bad Metadata Path with error: %s' % (str(e)))
myRow['PMS Metadata Path'] = 'Error'
return myRow


def getPlayCountLevel(myMedia, fieldlist):
''' return the playcount info for media '''
# Playcount level selected
Expand Down
1 change: 1 addition & 0 deletions Contents/Code/moviefields.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@
# Define rows and element name for level 666 (Two calls pr. movie)
Level_666 = [
# ('PMS Media Path' , 'hash') # Field auto added
# ('PMS Metadata Path' , 'SHA1') # Field auto added
]

# Define rows and element name for Special level 1 (one call pr. movie)
Expand Down
6 changes: 6 additions & 0 deletions Contents/Code/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def getMovieHeader(PrefsLevel):
# Do we need the PMS path?
if '666' in PrefsLevel:
fieldnames.append('PMS Media Path')
fieldnames.append('PMS Metadata Path')
return fieldnames
elif PrefsLevel == 'PlayCount 1':
fieldnames = misc.getLevelFields(
Expand Down Expand Up @@ -91,6 +92,7 @@ def getMovieHeader(PrefsLevel):
# PMS Path also needs to be exported
if '666' in PrefsLevel:
fieldnames.append('PMS Media Path')
fieldnames.append('PMS Metadata Path')
return fieldnames


Expand All @@ -111,6 +113,7 @@ def getMovieInfo(myMedia, myRow, prefsLevel):
myRow = misc.getItemInfo(myMedia, myRow, moviefields.SLevel_666)
if '666' in prefsLevel:
myRow = misc.getMediaPath(myMedia, myRow)
myRow = misc.getMetadataPath(myMedia, myRow)
return myRow
else:
# Get Simple Info
Expand Down Expand Up @@ -183,4 +186,7 @@ def getMovieInfo(myMedia, myRow, prefsLevel):
myRow = misc.getMediaPath(
myMedia,
myRow)
myRow = misc.getMetadataPath(
myMedia,
myRow)
return myRow
2 changes: 1 addition & 1 deletion Contents/Code/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def createHeader(outFile, sectionType, playListType='', level=None):
global wrap
wrap = targetfile.add_format()
wrap.set_text_wrap()
Log.Debug('CSVGED****** Header written okay')
Log.Debug('Header written okay')
return


Expand Down
4 changes: 3 additions & 1 deletion Contents/Code/tvfields.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@
'//Guid[starts-with(@id, "tvdb")]/@id'),
('Labels', '//Label/@tag'),
('Collection', ''),
('Delete Item Watched after days', '@autoDeletionItemPolicyWatchedLibrary')
('Delete Item Watched after days',
'@autoDeletionItemPolicyWatchedLibrary'),
('PMS Metadata Path', 'SHA1') # Field auto added
]

# Define rows and element name for PlayCount 1 (one calls pr. episode)
Expand Down
4 changes: 4 additions & 0 deletions Contents/Code/tvseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ def getShowOnly(myMedia, myRow, level):
except Exception, e:
myRow[key] = consts.DEFAULT
pass
elif key == 'PMS Metadata Path':
myRow = misc.getMetadataPath(
myMedia,
myRow)
elif key == 'Delete Item Watched after days':
try:
deleteDays = directMedia.xpath(
Expand Down
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
V2.0.0.16:
- New:
#159 Export PMS path to the Metadata bundle path
* Added to shows at level 3
* Added to movies at level 666

V2.0.0.15:
- Fix:
- #153 Blocker: CSV Export broken
Expand Down

0 comments on commit 1ef7045

Please sign in to comment.