# How to pull sequencer data from the top left corner and to the right lower corner

Using batFINGERs example from here I get the data from the lower right corner to the top left corner. Is there a way to read the data in the opposite direction?

EDIT: I just realized that the order of the list is the order clips are added to the timeline and not the order the clips are located in the timelines. So reversing the loop is not the solution.

• These lists should be sortable and therefore reversable. – Samoth Mar 25 '17 at 2:25
• How do I do that in batFINGERS example? – tintwotin Mar 25 '17 at 4:46
• maybe somehow related or of help... blender.stackexchange.com/a/57235/2843 – Samoth Mar 25 '17 at 10:59
• Rather than changing and adding to your question again and again you should ask new precise questions and maybe link to the previous one. This site is not like a forum. It's hard to keep up with changing requirements... ;-) – Samoth Mar 26 '17 at 7:14
• I'm sorry. I'm a Stack Exchange and Python noob. But I'm really, really greatful for all of your execelent help. I would have been stuck with the EDL export script without you. Part of my problem is that what I think I need solved chances as I learn from you guys. So the question changes, but my ultimate goal remains the same, so I should proberly be more clear in the way I ask the questions. Thanks again! – tintwotin Mar 26 '17 at 7:49

Python's sorted() can use a custom function that defines the key to use when sorting a list and it also has a reverse option.

def start(strip):
return strip.frame_start

def end(strip):
return strip.frame_start + strip.frame_final_duration


Then you can sort by start or end frame with

seq_strips = bpy.context.scene.sequence_editor.sequences

strips_by_start = sorted(seq_strips, key=start)

strips_reversed = sorted(seq_strips, key=end, reverse=True)

• Thank you. I didn't know about the sorted function. It is very helpful. I managed to get the list sorted after clip start points in sequence and after channels(reversed), but I also need to get all video related clips first(including effectstrips like Cross, Wipe etc.) and then all sound related clips. Is there some way to do this? – tintwotin Mar 26 '17 at 6:20
• Expand the key function used - build the sorting index by using frame_start+channel+type maybe multiply frame by 100,000 and channel by 10,000 – sambler Mar 26 '17 at 6:30
• Can't you just call sorted multiple times with different keys to achieve that? – Samoth Mar 26 '17 at 7:10
• I have first sorted all clips after their start frames and then sorted in channels. And since the sorting is stable the previous sorting is still respected. So that question is solved. However in most nles all video is located in the top tracks and all audio is located in the bottom tracks. So crossfades and wipes should not be separated from video clips. Actually I only need to separate the audio clips. I might just do one loop for video and one for audio. – tintwotin Mar 26 '17 at 7:38

Just use reversed(...) on that collection like reversed(vse.sequences_all) in the case of this script and you're done...

• Thank you for this function I didn't know about it. However I just realized that the order of the list is the order clips are added to the timeline and not the order the clips are located in the timelines. So the question still stands: How to pull sequencer data from the top left corner and to the right lower corner? – tintwotin Mar 25 '17 at 15:51