コード例 #1
0
    def selected_items(self):
        """
        List of all selected items.

        :type: list of Item

        See also
        --------
        Project.get_selected_item
            Return a specific selected item.
        """
        return [
            reapy.Item(RPR.GetSelectedMediaItem(self.id, i))
            for i in range(self.n_selected_items)
        ]
コード例 #2
0
ファイル: project.py プロジェクト: mercuree/reapy
    def get_selected_item(self, index):
        """
        Return index-th selected item.

        Parameters
        ----------
        index : int
            Item index.

        Returns
        -------
        item : Item
            index-th selected item.
        """
        item_id = RPR.GetSelectedMediaItem(self.id, index)
        item = reapy.Item(item_id)
        return item
コード例 #3
0
class Item():
    def __init__(self, item):
        self.item = item
        self.itemLength = reaper.GetMediaItemInfo_Value(item, 'D_LENGTH')
        self.activeTake = reaper.GetActiveTake(item)
        self.source = reaper.GetMediaItemTake_Source(self.activeTake)
        self.offset = reaper.GetMediaItemTakeInfo_Value(self.activeTake, 'D_STARTOFFS')
        self.sourcePath = reaper.GetMediaSourceFileName(self.source, '',512)[1]
        self.sourceLength = reaper.GetMediaSourceLength(self.source, False)[0]
        self.sourceSR = reaper.GetMediaSourceSampleRate(self.source)
        self.itemTrack = reaper.GetMediaItem_Track(item)
        self.trackName = reaper.GetTrackName(self.itemTrack,'',512)[2]
        self.trackColor = reaper.GetTrackColor(self.itemTrack)

if smi > 1:
    items = [Item(reaper.GetSelectedMediaItem(0,i)) for i in range(smi)]
    lengths = [i.itemLength for i in items]
    maxLengthIndex = lengths.index(max(lengths))
    gt = items[maxLengthIndex]
    items.pop(maxLengthIndex)

    gtData = [gt.trackName, gt.sourcePath, gt.offset, gt.offset+gt.itemLength, gt.sourceSR]
    dxData = [[i.trackName, i.sourcePath, i.offset, i.offset + i.itemLength, i.sourceSR, i.trackColor] for i in items]
    
    config = configparser.ConfigParser()
    
    config.read(str(rscPath / 'DxTracker.ini'))
    
    config['PROJECT'] = {'name':projectName,'path':projPath}
    
    config['GT'] = {'name':gt.trackName,'path':gt.sourcePath, 'sourceName':Path(gt.sourcePath).name,