list with repeats spaced apart
Eric Chatonet
eric.chatonet at sosmartsoftware.com
Thu Jul 14 05:48:35 EDT 2005
Hi Sims,
Quick and dirty but fast and working as expected ;-)
function ExpandedList pList
local
tTotal,tLine,tSubTotal,tCurLineNo,tBestGap,tRawExpandedList,tExpandedLis
t
-----
set the itemDel to tab
sort pList numeric descending by item 2 of each
put 0 into tTotal
-----
repeat for each line tLine in pList
add item -1 of tLine to tTotal
end repeat
-----
repeat for each line tLine in pList
put lineOffset(tLine,pList) into tCurLineNo
put item -1 of tLine into tSubTotal
put tTotal div tSubTotal into tBestGap
-----
repeat with i = 1 to tSubTotal
if line tCurLineNo of tRawExpandedList = cr then
put item 1 of tLine into line tCurLineNo of tRawExpandedList
else put cr & item 1 of tLine after line tCurLineNo of
tRawExpandedList
add tBestGap to tCurLineNo
end repeat
end repeat
-----
repeat for each line tLine in tRawExpandedList
if ".mov" is in tLine then put tLine & cr after tExpandedList
end repeat
delete char -1 of tExpandedList
-----
return tExpandedList
end ExpandedList
Le 14 juil. 05 à 11:00, sims a écrit :
> I have a list of short movie files, the movies are to be played in
> rotation.
>
> Each movie followed by a tab and then a number. The number is the
> number of
> times it is to be placed (repeated) in the list (shown in a rotation).
>
> 0099ts2729bs.mov 5
> 0085ts1316bs.mov 1
> 0091ts0918bs.mov 2
> 0077ts0913bs.mov 1
> 0032ts2930bs.mov 3
> 0089ts2126bs.mov 1
> 0075ts0919bl.mov 1
> 0076ts0919br.mov 4
> 0001ts0313bs.mov 1
>
>
> The real list will probably be close to 100 different movies, I am
> using
> the list shown above as an example. Each movie will be played
> somewhere
> between 1 to 5 times in the rotation.
>
> Ideally I would like to have all repeated movies separated as much
> as possible
> so they do not play (repeat) too closely in the rotation. In other
> words it would
> be nice if repeated movies are spaced as far apart as possible.
>
> I need a script which will take such a list as shown above and then
> provide me with a rotation list as described.
Best Regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
So Smart Software
For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch
Free plugins and tutorials on my website
----------------------------------------------------------------
Web site http://www.sosmartsoftware.com/
Email eric.chatonet at sosmartsoftware.com/
Phone 33 (0)1 43 31 77 62
Mobile 33 (0)6 20 74 50 86
----------------------------------------------------------------
More information about the use-livecode
mailing list