[mythtv-users] Need some help to convert cutlist to ogg format chapter file

Christopher Meredith chmeredith at gmail.com
Wed Jul 8 18:31:02 UTC 2009


On Wed, Jul 8, 2009 at 12:52 PM, John Finlay <finlay at moeraki.com> wrote:

> belcampo wrote:
>
>> Hi all,
>>
>> I would like to transform a cutlist like:
>>
>> 0-13,16549-28321,61825-72061,105517-115885,154405-166573,206713-20982
>>
>> to an ogg chapterfile like:
>> CHAPTER01=00:00:00.000
>> CHAPTER01NAME=Chapter 1
>> CHAPTER02=00:11:01.920
>> CHAPTER02NAME=Chapter 2
>> CHAPTER03=00:18:52.800
>> CHAPTER03NAME=Chapter 3
>> CHAPTER04=00:41:12.960
>> CHAPTER04NAME=Chapter 4
>> CHAPTER05=00:48:02.400
>> CHAPTER05NAME=Chapter 5
>> CHAPTER06=01:10:20.640
>> CHAPTER06NAME=Chapter 6
>> CHAPTER07=01:17:15.360
>> CHAPTER07NAME=Chapter 7
>> CHAPTER08=01:42:56.160
>> CHAPTER08NAME=Chapter 8
>> CHAPTER09=01:51:02.880
>> CHAPTER09NAME=Chapter 9
>> CHAPTER10=02:17:48.480
>>
>> I managed to transform above cutlist to a Projectx-cutlist like:
>>
>> 13
>> 16549
>> 28321
>> 61825
>> 72061
>> 105517
>> 115885
>> 154405
>> 166573
>> 206713
>>
>> with
>>
>> mythcommflag --getcutlist -f 3005_20090508203000.mpg | grep Cutlist | cut
>> -d ":" -f 2 | cut -d " " -f 2 | sed 's/,/-/g' | sed 's/^0-//g' | sed
>> 's/-/\n/g' | sed 'x' > cutlist
>>
>> I know that by doing:
>>
>> cat cutlist | sed 's/$/\*.04/g' | bc
>>
>> I get the time in seconds, but I'm stuck at getting the seconds to the
>> above mentioned ogg chapterfile format. Any bright chap that knows how to do
>> this and willing to share ?
>>
> Here's a python one-liner to do this:
>
> mythcommflag --getcutlist -f mythfile.mpg | python -c "import sys,re;
> cutlist=[re.split('\D+',l)[2:-1] for l in sys.stdin.readlines() if
> l.startswith('Cutlist:')][0]; cl=[(i+1,.04*int(l)) for i,l in
> enumerate(cutlist)];
> cl=['CHAPTER%02d=%02d:%02d:%06.3f\nCHAPTER%02dNAME=Chapter
> %d'%(ii,int(i/3600),int((i%3600)/60),i%60,ii,ii) for ii,i in cl]; print
> '\n'.join(cl)"
>

Goodness, but is that ever a mouthful.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20090708/afd07ec9/attachment.htm>


More information about the mythtv-users mailing list