66 lines
No EOL
1.7 KiB
C#
66 lines
No EOL
1.7 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Linq;
|
|
|
|
using JD.Timeline.Model;
|
|
|
|
using TeaBox;
|
|
using TeaBox.ObjectModel;
|
|
using JD.Serialization;
|
|
|
|
namespace JD.Timeline
|
|
{
|
|
public class MashupVideosDocument : MashupDocument
|
|
{
|
|
public MashupVideosDocument(DocumentCreationContext context, Tape tape, bool fromFile = false)
|
|
: base(context, tape, fromFile)
|
|
{ }
|
|
|
|
protected override void LoadImpl(string filename, DocumentLoadingContext context, bool isReloading)
|
|
{
|
|
base.LoadImpl(filename, context, isReloading);
|
|
|
|
GenerateVideoClips();
|
|
foreach (var track in Tape.Tracks)
|
|
{
|
|
track.Height = 96;
|
|
}
|
|
}
|
|
|
|
private void GenerateVideoClips()
|
|
{
|
|
if (!Tape.Clips.Any())
|
|
{
|
|
var signatures = LoadSignatures();
|
|
var track = new TapeTrack();
|
|
Tape.Tracks.Add(track);
|
|
|
|
foreach (var signature in signatures.Clips.OfType<MashupClip>())
|
|
{
|
|
var video = new VideoClip();
|
|
signature.CopyTo(video);
|
|
video.RegenerateId();
|
|
video.Track = track;
|
|
Tape.Clips.Add(video);
|
|
}
|
|
}
|
|
}
|
|
|
|
private Tape LoadSignatures()
|
|
{
|
|
var map = Tape.Map().SignatureTapeFile;
|
|
Tape mashupTape = null;
|
|
if (!File.Exists(map))
|
|
{
|
|
mashupTape = new Tape { Id = map };
|
|
}
|
|
else
|
|
{
|
|
mashupTape = LoadTape(map);
|
|
}
|
|
|
|
mashupTape.GenerateBlocks();
|
|
return mashupTape;
|
|
}
|
|
}
|
|
} |