(self, src, srcXML, param)
| 1083 | return res |
| 1084 | |
| 1085 | def ATTRIB_MUSICURL(self, src, srcXML, param): |
| 1086 | Track, leftover = self.getElement(src, srcXML, param) |
| 1087 | |
| 1088 | AuthToken = PlexAPI.getPMSProperty(self.ATV_udid, self.PMS_uuid, 'accesstoken') |
| 1089 | |
| 1090 | if not Track: |
| 1091 | # not a complete audio/track structure - take key directly and build direct-play path |
| 1092 | key, leftover, dfltd = self.getKey(src, srcXML, param) |
| 1093 | res = PlexAPI.getDirectAudioPath(key, AuthToken) |
| 1094 | res = PlexAPI.getURL(self.PMS_baseURL, self.path[srcXML], res) |
| 1095 | dprint(__name__, 1, 'MusicURL - direct: {0}', res) |
| 1096 | return res |
| 1097 | |
| 1098 | # complete track structure - request transcoding if needed |
| 1099 | Media = Track.find('Media') |
| 1100 | |
| 1101 | # check "Media" element and get key |
| 1102 | if Media!=None: |
| 1103 | # transcoder action setting? |
| 1104 | # transcoder bitrate setting [kbps] - eg. 128, 256, 384, 512? |
| 1105 | maxAudioBitrateCompressed = '320' |
| 1106 | |
| 1107 | audioATVNative = \ |
| 1108 | Media.get('audioCodec','-') in ("mp3", "aac", "ac3", "drms") and \ |
| 1109 | int(Media.get('bitrate','0')) <= int(maxAudioBitrateCompressed) \ |
| 1110 | or \ |
| 1111 | Media.get('audioCodec','-') in ("alac", "aiff", "wav") |
| 1112 | # check Media.get('container') as well - mp3, m4a, ...? |
| 1113 | |
| 1114 | dprint(__name__, 2, "audio: ATVNative - {0}", audioATVNative) |
| 1115 | |
| 1116 | if audioATVNative: |
| 1117 | # direct play |
| 1118 | res, leftover, dfltd = self.getKey(Media, srcXML, 'Part/key') |
| 1119 | res = PlexAPI.getDirectAudioPath(res, AuthToken) |
| 1120 | else: |
| 1121 | # request transcoding |
| 1122 | res, leftover, dfltd = self.getKey(Track, srcXML, 'key') |
| 1123 | res = PlexAPI.getTranscodeAudioPath(res, AuthToken, self.options, maxAudioBitrateCompressed) |
| 1124 | |
| 1125 | else: |
| 1126 | dprint(__name__, 0, "MEDIAPATH - element not found: {0}", param) |
| 1127 | res = 'FILE_NOT_FOUND' # not found? |
| 1128 | |
| 1129 | res = PlexAPI.getURL(self.PMS_baseURL, self.path[srcXML], res) |
| 1130 | dprint(__name__, 1, 'MusicURL: {0}', res) |
| 1131 | return res |
| 1132 | |
| 1133 | def ATTRIB_URL(self, src, srcXML, param): |
| 1134 | key, leftover, dfltd = self.getKey(src, srcXML, param) |
nothing calls this directly
no test coverage detected