//path - file name
        public ActionResult Crop(string path, int from, int to)
        {
            //ppath - directory
            string ppath = "C:\\Users\\Administratorius\\Documents\\GitHub\\MusicEditor\\PawellsMusicEditor\\PawellsMusicEditor\\Content\\Songs\\";
            string editedFile = "croped " + path;
            for (int i = 0; i < 100; i++)
            {
                if (!System.IO.File.Exists(ppath + (i + 1) + editedFile))
                {
                    editedFile = (i + 1) + editedFile;
                    WavFileUtils.TrimWavFile(ppath + path, ppath + editedFile, TimeSpan.FromSeconds(from), TimeSpan.FromSeconds(to));
                    break;
                }
            }

            IRepository repository = new Repository(SessionFactoryProvider);

            var soundTracks = new SoundTracks
            {
                SoundTrackName = editedFile
            };
            if (editedFile.Length < 200)
            {
                repository.Save(soundTracks);
            }
            else
            {
            }
            return RedirectToAction("Index");
        }
Example #2
0
 public void RemoveTrack(JSoundTrack soundTrack)
 {
     SoundTracks.Remove(soundTrack);
 }
Example #3
0
 public void AddTrack(JSoundTrack soundTrack)
 {
     soundTrack.TimeLine = this;
     SoundTracks.Add(soundTrack);
 }
        public ActionResult Index(SoundTrack soundTrack)
        {
            if (soundTrack.Failas.ContentLength > 0)
            {
                var fileName = Path.GetFileName(soundTrack.Failas.FileName);
                var path = Path.Combine(Server.MapPath("~/Content/Songs/"), fileName);
                soundTrack.Failas.SaveAs(path);

                IRepository repository = new Repository(SessionFactoryProvider);

                var soundTracks = new SoundTracks
                {
                    SoundTrackName = fileName
                };
                repository.Save(soundTracks);
            }
            return RedirectToAction("Index");
        }