private void LoadFolder(string folderPath) { var dirInfo = new DirectoryInfo(folderPath); string AllowedVideoTypes = "*.mkv"; var files = dirInfo.GetFiles(AllowedVideoTypes, SearchOption.TopDirectoryOnly); int season = (int)nudSeason.Value; int startEp = (int)nudEpisodes.Value; foreach (var info in files) { var player = new WindowsMediaPlayer(); var clip = player.newMedia(info.FullName); var file = new ShowFile() { OriginalFileName = info.Name, OriginalFilePath = info.FullName, DirectoryName = info.DirectoryName, FileSize = info.Length, FileSizeString = BytesToString(info.Length), Duration = TimeSpan.FromSeconds(clip.duration).ToString(), Season = season, Episode = startEp, Extension = info.Extension, CreatedAt = info.CreationTime, Skip = false, }; this._showFiles.Add(file); if (CbIncEp.Checked) { startEp++; } } RefreshView(); }
private int GetListViewIndexFromTag(ShowFile file) { foreach (ListViewItem item in lvFiles.Items) { if (item.Tag == file) { return(item.Index); } } return(-1); }
internal string GetFormattedName(string format, ShowFile file, string showName = "Unidentified", int curSeason = 1, int curEpisode = 1) { Console.Write(curSeason + " " + curEpisode); string tarName = string.Empty; tarName = format.Replace("%sn", showName); tarName = tarName.Replace("%s", "Season" + CheckOrAppendPrefix(curSeason)); tarName = tarName.Replace("%ss", "Season" + curSeason); tarName = tarName.Replace("%e", "Episode" + CheckOrAppendPrefix(curEpisode)); tarName = tarName.Replace("%ee", "Episode" + curEpisode); tarName = tarName.Replace("%S", "S" + CheckOrAppendPrefix(curSeason)); tarName = tarName.Replace("%SS", "S" + curSeason); tarName = tarName.Replace("%E", "E" + CheckOrAppendPrefix(curEpisode)); tarName = tarName.Replace("%EE", "E" + curEpisode); tarName = tarName.Replace("%xt", file.Extension); return(tarName); }