(self, elem, child, src, srcXML, param)
| 772 | # XML TREE modifier commands |
| 773 | # add new commands to this list! |
| 774 | def TREE_COPY(self, elem, child, src, srcXML, param): |
| 775 | tag, param_enbl = self.getParam(src, param) |
| 776 | |
| 777 | src, srcXML, tag = self.getBase(src, srcXML, tag) |
| 778 | |
| 779 | # walk the src path if neccessary |
| 780 | while '/' in tag and src!=None: |
| 781 | parts = tag.split('/',1) |
| 782 | src = src.find(parts[0]) |
| 783 | tag = parts[1] |
| 784 | |
| 785 | # find index of child in elem - to keep consistent order |
| 786 | for ix, el in enumerate(list(elem)): |
| 787 | if el==child: |
| 788 | break |
| 789 | |
| 790 | # duplicate child and add to tree |
| 791 | cnt = 0 |
| 792 | for elemSRC in src.findall(tag): |
| 793 | key = 'COPY' |
| 794 | if param_enbl!='': |
| 795 | key, leftover, dfltd = self.getKey(elemSRC, srcXML, param_enbl) |
| 796 | conv, leftover = self.getConversion(elemSRC, leftover) |
| 797 | if not dfltd: |
| 798 | key = self.applyConversion(key, conv) |
| 799 | |
| 800 | if key: |
| 801 | self.PMSroot['copy_'+tag] = elemSRC |
| 802 | self.variables['copy_ix'] = str(cnt) |
| 803 | cnt = cnt+1 |
| 804 | el = copy.deepcopy(child) |
| 805 | XML_ExpandTree(self, el, elemSRC, srcXML) |
| 806 | XML_ExpandAllAttrib(self, el, elemSRC, srcXML) |
| 807 | |
| 808 | if el.tag=='__COPY__': |
| 809 | for el_child in list(el): |
| 810 | elem.insert(ix, el_child) |
| 811 | ix += 1 |
| 812 | else: |
| 813 | elem.insert(ix, el) |
| 814 | ix += 1 |
| 815 | |
| 816 | # remove template child |
| 817 | elem.remove(child) |
| 818 | return True # tree modified, nodes updated: restart from 1st elem |
| 819 | |
| 820 | #syntax: Video, playType (Single|Continuous), key to match (^PlexConnectRatingKey), ratingKey |
| 821 | def TREE_COPY_PLAYLIST(self, elem, child, src, srcXML, param): |
nothing calls this directly
no test coverage detected