private int GetTimeStopped(string fileName) { IMDBMovie movieDetails = new IMDBMovie(); VideoDatabase.GetMovieInfo(fileName, ref movieDetails); int idFile = VideoDatabase.GetFileId(fileName); int idMovie = VideoDatabase.GetMovieId(fileName); byte[] resumeData = null; if ((idMovie >= 0) && (idFile >= 0)) { return(VideoDatabase.GetMovieStopTimeAndResumeData(idFile, out resumeData)); } return(0); }
public static LatestMediaHandler.MQTTItem CheckDB(string SearchFile) { LatestMediaHandler.MQTTItem item = new LatestMediaHandler.MQTTItem(); if (MQTTPlugin.DebugMode) { Logger.Debug("Check to see if video is in MyVideos database."); } if (MQTTPlugin.DebugMode) { Logger.Debug("MyVideo found, searching Database for: " + SearchFile); } try { IMDBMovie movie = new IMDBMovie(); int movieID = VideoDatabase.GetMovieId(SearchFile); VideoDatabase.GetMovieInfoById(movieID, ref movie); if (movie.ID > 0) { if (MQTTPlugin.DebugMode) { Logger.Debug("Video is in MyVideos database."); } item.Id = movie.IMDBNumber; item.Title = movie.Title + " (" + movie.Year + ")"; item.Filename = SearchFile; item.Genres = movie.Genre; item.GetArtwork("movie"); } } catch (Exception e) { Logger.Error("Error getting info from MyVideo Database: " + e.Message); } return(item); }
private void SetIMDBThumbs(ArrayList items) { GUIListItem listItem; ArrayList movies = new ArrayList(); for (int x = 0; x < items.Count; ++x) { listItem = (GUIListItem)items[x]; if (listItem.IsFolder) { if (File.Exists(listItem.Path + @"\VIDEO_TS\VIDEO_TS.IFO")) { movies.Clear(); string pathName = listItem.Path + @"\VIDEO_TS"; VideoDatabase.GetMoviesByPath(pathName, ref movies); for (int i = 0; i < movies.Count; ++i) { IMDBMovie movieDetails = (IMDBMovie)movies[i]; string fileName = "VIDEO_TS.IFO"; if (movieDetails.File[0] == '\\' || movieDetails.File[0] == '/') { movieDetails.File = movieDetails.File.Substring(1); } if (fileName.Length > 0) { if (movieDetails.File == fileName /*|| pItem->GetLabel() == info.Title*/) { if (Util.Utils.IsDVD(listItem.Path)) { listItem.Label = String.Format("({0}:) {1}", listItem.Path.Substring(0, 1), movieDetails.Title); } string coverArtImage = Util.Utils.GetCoverArt(Thumbs.MovieTitle, movieDetails.Title + "{" + movieDetails.ID + "}"); if (Util.Utils.FileExistsInCache(coverArtImage)) { listItem.ThumbnailImage = coverArtImage; listItem.IconImageBig = coverArtImage; listItem.IconImage = coverArtImage; } // look for better thumbs coverArtImage = Util.Utils.ConvertToLargeCoverArt(coverArtImage); if (Util.Utils.FileExistsInCache(coverArtImage)) { listItem.ThumbnailImage = coverArtImage; } break; } } } } } else { // Try to fetch covers for playlist items added from database views int movieId = VideoDatabase.GetMovieId(listItem.Path); if (movieId > 0) { IMDBMovie movie = new IMDBMovie(); VideoDatabase.GetMovieInfoById(movieId, ref movie); listItem.AlbumInfoTag = movie; string cover = Util.Utils.GetCoverArt(Thumbs.MovieTitle, movie.Title + "{" + movieId + "}"); if (Util.Utils.FileExistsInCache(cover)) { listItem.ThumbnailImage = cover; listItem.IconImageBig = cover; listItem.IconImage = cover; } // look for better thumbs cover = Util.Utils.ConvertToLargeCoverArt(cover); if (Util.Utils.FileExistsInCache(cover)) { listItem.ThumbnailImage = cover; } } } } movies.Clear(); VideoDatabase.GetMoviesByPath(currentFolder, ref movies); for (int x = 0; x < items.Count; ++x) { listItem = (GUIListItem)items[x]; if (!listItem.IsFolder) { IMDBMovie movieDetails = new IMDBMovie(); int idMovie = VideoDatabase.GetMovieInfo(listItem.Path, ref movieDetails); if (idMovie >= 0) { string coverArtImage = Util.Utils.GetCoverArt(Thumbs.MovieTitle, movieDetails.Title); if (Util.Utils.FileExistsInCache(coverArtImage)) { listItem.ThumbnailImage = coverArtImage; listItem.IconImageBig = coverArtImage; listItem.IconImage = coverArtImage; } // look for better thumbs coverArtImage = Util.Utils.ConvertToLargeCoverArt(coverArtImage); if (Util.Utils.FileExistsInCache(coverArtImage)) { listItem.ThumbnailImage = coverArtImage; } } else { Util.Utils.SetThumbnails(ref listItem); } } } }
protected virtual void SetLabels() { bool isShareView = false; if (GUIWindowManager.ActiveWindow == (int)Window.WINDOW_VIDEOS) { isShareView = true; } bool _stackedFolder = true; if (isShareView) { _currentFolder = GUIVideoFiles.GetCurrentFolder; object o; MediaPortal.Database.FolderSettings.GetFolderSetting(_currentFolder, "VideoFiles", typeof(GUIVideoFiles.MapSettings), out o); if (o != null) { GUIVideoFiles.MapSettings mapSettings = o as GUIVideoFiles.MapSettings; _stackedFolder = mapSettings.Stack; } } else { _currentFolder = GUIVideoTitle.GetCurrentView; object o; // MediaPortal.Database.FolderSettings.GetFolderSetting(_currentFolder, "VideoViews", typeof(GUIVideoTitle.MapSettings), out o); MediaPortal.Database.FolderSettings.GetViewSetting(_currentFolder, "VideoViews", typeof(GUIVideoTitle.MapSettings), out o); if (o != null) { GUIVideoTitle.MapSettings mapSettings = o as GUIVideoTitle.MapSettings; if (mapSettings != null) { CurrentSortMethod = (VideoSort.SortMethod)mapSettings.SortBy; CurrentSortAsc = mapSettings.SortAscending; } } } for (int i = 0; i < facadeLayout.Count; ++i) { GUIListItem item = facadeLayout[i]; IMDBMovie movie = item.AlbumInfoTag as IMDBMovie; if (movie != null && movie.ID > 0 && !isShareView && (!item.IsFolder || CurrentSortMethod == VideoSort.SortMethod.NameAll)) { if (CurrentSortMethod == VideoSort.SortMethod.Name || CurrentSortMethod == VideoSort.SortMethod.NameAll || CurrentSortMethod == VideoSort.SortMethod.Name_With_Duration) { if (item.IsFolder) { item.Label2 = string.Empty; } else { // Show real movie duration (from video file) int mDuration = VideoDatabase.GetMovieDuration(movie.ID); if (mDuration <= 0) { ArrayList mFiles = new ArrayList(); VideoDatabase.GetFilesForMovie(movie.ID, ref mFiles); mDuration = GUIVideoFiles.MovieDuration(mFiles, true); if (mDuration <= 0) { item.Label2 = Util.Utils.SecondsToHMString(movie.RunTime * 60); } else { item.Label2 = Util.Utils.SecondsToHMString(mDuration); } } else { item.Label2 = Util.Utils.SecondsToHMString(mDuration); } } } else if (CurrentSortMethod == VideoSort.SortMethod.Year) { item.Label2 = movie.Year.ToString(); } else if (CurrentSortMethod == VideoSort.SortMethod.Rating) { item.Label2 = movie.Rating.ToString(); } else if (CurrentSortMethod == VideoSort.SortMethod.Label) { item.Label2 = movie.DVDLabel.ToString(); } else if (CurrentSortMethod == VideoSort.SortMethod.Size) { if (item.FileInfo != null) { item.Label2 = Util.Utils.GetSize(item.FileInfo.Length); } else { item.Label2 = Util.Utils.SecondsToHMString(movie.RunTime * 60); } } else if (!isShareView && CurrentSortMethod == VideoSort.SortMethod.Date) { string strDate = string.Empty; if (!item.IsFolder && movie != null) { if (movie.DateAdded != "0001-01-01 00:00:00") { strDate = movie.DateAdded; } else { strDate = movie.LastUpdate; } } item.Label2 = strDate; } } else { string strSize1 = string.Empty, strDate = string.Empty; if (item.FileInfo != null && !item.IsFolder) { strSize1 = Util.Utils.GetSize(item.FileInfo.Length); } if (item.FileInfo != null && !item.IsFolder) { if (CurrentSortMethod == VideoSort.SortMethod.Modified) { strDate = item.FileInfo.ModificationTime.ToShortDateString() + " " + item.FileInfo.ModificationTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat); } else { strDate = item.FileInfo.CreationTime.ToShortDateString() + " " + item.FileInfo.CreationTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat); } } if (CurrentSortMethod == VideoSort.SortMethod.Name || CurrentSortMethod == VideoSort.SortMethod.NameAll) { if (item.IsFolder) { item.Label2 = string.Empty; } else { item.Label2 = strSize1; } } if (CurrentSortMethod == VideoSort.SortMethod.Name_With_Duration && !item.IsFolder && item.Label != "..") { if (_stackedFolder) { int newMovieId = VideoDatabase.GetMovieId(item.Path); item.Duration = VideoDatabase.GetMovieDuration(newMovieId); } else { int fileID = VideoDatabase.GetFileId(item.Path); item.Duration = VideoDatabase.GetVideoDuration(fileID); } if (item.Duration > 0) { item.Label2 = Util.Utils.SecondsToShortHMSString(item.Duration); } else { item.Label2 = string.Empty; } } else if (CurrentSortMethod == VideoSort.SortMethod.Created || CurrentSortMethod == VideoSort.SortMethod.Date || CurrentSortMethod == VideoSort.SortMethod.Modified) { if (!isShareView && CurrentSortMethod == VideoSort.SortMethod.Date && string.IsNullOrWhiteSpace(strDate)) { if (!item.IsFolder && movie != null) { if (movie.DateAdded != "0001-01-01 00:00:00") { strDate = movie.DateAdded; } else { strDate = movie.LastUpdate; } } } item.Label2 = strDate; } else { if (item.IsFolder) { item.Label2 = string.Empty; } else { item.Label2 = strSize1; } } } } }
public bool OnPlayDVD(String drive, int parentId) { Log.Info("SelectDVDHandler: OnPlayDVD() playing DVD {0}", drive); if (g_Player.Playing && g_Player.IsDVD) { if (g_Player.CurrentFile.Equals(drive + @"\VIDEO_TS\VIDEO_TS.IFO")) { return(true); } } if (Util.Utils.getDriveType(drive) == 5) //cd or dvd drive { string driverLetter = drive.Substring(0, 1); string fileName = String.Format(@"{0}:\VIDEO_TS\VIDEO_TS.IFO", driverLetter); if (!VirtualDirectories.Instance.Movies.RequestPin(fileName)) { return(false); } if (File.Exists(fileName)) { IMDBMovie movieDetails = new IMDBMovie(); VideoDatabase.GetMovieInfo(fileName, ref movieDetails); int idFile = VideoDatabase.GetFileId(fileName); int idMovie = VideoDatabase.GetMovieId(fileName); int timeMovieStopped = 0; byte[] resumeData = null; if ((idMovie >= 0) && (idFile >= 0)) { timeMovieStopped = VideoDatabase.GetMovieStopTimeAndResumeData(idFile, out resumeData); //Log.Info("GUIVideoFiles: OnPlayBackStopped for DVD - idFile={0} timeMovieStopped={1} resumeData={2}", idFile, timeMovieStopped, resumeData); if (timeMovieStopped > 0) { string title = Path.GetFileName(fileName); VideoDatabase.GetMovieInfoById(idMovie, ref movieDetails); if (movieDetails.Title != string.Empty) { title = movieDetails.Title; } GUIResumeDialog.Result result = GUIResumeDialog.ShowResumeDialog(title, timeMovieStopped, GUIResumeDialog.MediaType.DVD); if (result == GUIResumeDialog.Result.Abort) { return(false); } if (result == GUIResumeDialog.Result.PlayFromBeginning) { timeMovieStopped = 0; } } } if (g_Player.Playing) { g_Player.Stop(); } g_Player.PlayDVD(drive + @"\VIDEO_TS\VIDEO_TS.IFO"); g_Player.ShowFullScreenWindow(); if (g_Player.Playing && timeMovieStopped > 0) { if (g_Player.IsDVD) { g_Player.Player.SetResumeState(resumeData); } else { Log.Debug("SelectDVDHandler.OnPlayDVD - skipping"); g_Player.SeekAbsolute(timeMovieStopped); } } return(true); } } //no disc in drive... GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); dlgOk.SetHeading(3); //my videos Log.Error("SelectDVDHandler: OnPlayDVD() Plz Insert Disk (ShowSelectDriveDialog)"); dlgOk.SetLine(1, 219); //no disc dlgOk.DoModal(parentId); return(false); }
// Image play method public bool OnPlayBD(String drive, int parentId) { Log.Info("SelectBDHandler: OnPlayBD() playing BD {0}", drive); string currentFile = g_Player.CurrentFile; if (g_Player.Playing && Util.Utils.IsISOImage(currentFile) && IsBDPlayList(ref currentFile)) //if (g_Player.Playing && IsBDPlayList(ref currentFile)) { return(true); } if (Util.Utils.getDriveType(drive) == 5) //cd or dvd drive { string driverLetter = drive.Substring(0, 1); string fileName = String.Format(@"{0}:\BDMV\index.bdmv", driverLetter); if (File.Exists(fileName)) { IMDBMovie movieDetails = new IMDBMovie(); //string name = DaemonTools._MountedIsoFile; int idFileImg = VideoDatabase.GetFileId(fileName); int idMovieImg = VideoDatabase.GetMovieId(fileName); ///* int timeMovieStopped = 0; byte[] resumeData = null; if ((idMovieImg >= 0) && (idFileImg >= 0)) { timeMovieStopped = VideoDatabase.GetMovieStopTimeAndResumeData(idFileImg, out resumeData, g_Player.SetResumeBDTitleState); if (timeMovieStopped > 0) { string title = Path.GetFileName(fileName); VideoDatabase.GetMovieInfoById(idMovieImg, ref movieDetails); if (movieDetails.Title != string.Empty) { title = movieDetails.Title; } GUIResumeDialog.Result result = GUIResumeDialog.ShowResumeDialog(title, timeMovieStopped, GUIResumeDialog.MediaType.DVD); if (result == GUIResumeDialog.Result.Abort) { return(false); } if (result == GUIResumeDialog.Result.PlayFromBeginning) { timeMovieStopped = 0; } } } //*/ if (g_Player.Playing) { g_Player.Stop(); } g_Player.PlayBD(drive + @"\BDMV\index.bdmv"); g_Player.ShowFullScreenWindow(); ///* if (g_Player.Playing && timeMovieStopped > 0) { g_Player.SeekAbsolute(timeMovieStopped); } //*/ return(true); } } //no disc in drive... GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); dlgOk.SetHeading(3); //my videos Log.Error("SelectBDHandler: OnPlayBD() Plz Insert Disk"); dlgOk.SetLine(1, 219); //no disc dlgOk.DoModal(parentId); return(true); }
public void SyncProgress() { if (!TraktSettings.SyncPlayback || SyncPlaybackInProgress) { return; } SyncPlaybackInProgress = true; TraktLogger.Info("My Videos Starting Playback Sync"); // get playback data from trakt string lastPausedAtMovie; var playbackData = TraktCache.GetPausedMovies(out lastPausedAtMovie); if (playbackData == null) { TraktLogger.Warning("Failed to get resume data from trakt.tv"); SyncPlaybackInProgress = false; return; } DateTime lastPausedItemProcessed; DateTime.TryParse(lastPausedAtMovie, out lastPausedItemProcessed); TraktLogger.Info("Found {0} movies on trakt.tv with resume data, processing paused movies after {1}", playbackData.Where(p => p.Type == "movie").Count(), lastPausedAtMovie); foreach (var item in playbackData.Where(p => p.Type == "movie")) { DateTime itemPausedAt; if (DateTime.TryParse(item.PausedAt, out itemPausedAt)) { // check if we need to process if (itemPausedAt <= lastPausedItemProcessed) { continue; } } // get movie from local database if it exists var movie = GetMovies().FirstOrDefault(m => ((m.IMDBNumber == item.Movie.Ids.Imdb) && !string.IsNullOrEmpty(item.Movie.Ids.Imdb) || m.Title.ToLowerInvariant() == item.Movie.Title.ToLowerInvariant() && m.Year == item.Movie.Year)); if (movie == null) { continue; } // if the local playtime is not known then skip if (movie.Duration <= 0) { TraktLogger.Warning("Skipping item with invalid runtime in database, Title = '{0}', Year = '{1}', IMDb ID = '{2}'", item.Movie.Title, item.Movie.Year, item.Movie.Ids.Imdb); continue; } // update the stop time based on percentage watched // the video database stores duration in seconds (runtime in minutes if duration not available) and stopTime in secs var resumeData = Convert.ToInt32(movie.Duration * (item.Progress / 100.0)) - TraktSettings.SyncResumeDelta; if (resumeData < 0) { resumeData = 0; } if (string.IsNullOrEmpty(movie.VideoFileName)) { TraktLogger.Warning("Skipping item with invalid filename in database, Title = '{0}', Year = '{1}', IMDb ID = '{2}'", item.Movie.Title, item.Movie.Year, item.Movie.Ids.Imdb); continue; } // if we are syncing on plugin entry we could possibly still be sending paused data to trakt // after stopping video (stopping video == re-entry to plugin), prevent possibly reverting stale resumed data // we already have updated resume data when stopping video in real-time if (TraktSettings.SyncPlaybackOnEnterPlugin && LastMovie != null && LastMovie.VideoFileName == movie.VideoFileName) { continue; } // check if movie is restricted if (TraktSettings.BlockedFilenames.Any(f => f == movie.VideoFileName) || TraktSettings.BlockedFolders.Any(f => f == Path.GetDirectoryName(movie.VideoFileName))) { TraktLogger.Info("Ignoring resume data sync for movie, filename/folder is ignored by user. Title = '{0}', Year = '{1}', IMDb ID = '{2}', Filename = '{3}'", item.Movie.Title, item.Movie.Year, item.Movie.Ids.Imdb, movie.VideoFileName); continue; } // Get FileId from filename int fileId = VideoDatabase.GetMovieId(movie.VideoFileName); // get current stop time for movie int currentResumeData = VideoDatabase.GetMovieStopTime(fileId); if (currentResumeData != resumeData) { // Note: will need to be a bit smarter for multi-part files (who the heck still does that!) TraktLogger.Info("Setting resume time '{0}' for movie, Title = '{1}', Year = '{2}', IMDb ID = '{3}'", new TimeSpan(0, 0, 0, resumeData), item.Movie.Title, item.Movie.Year, item.Movie.Ids.Imdb); VideoDatabase.SetMovieStopTime(fileId, resumeData); } } TraktLogger.Info("My Videos Playback Sync Completed"); SyncPlaybackInProgress = false; return; }
// Changed - cover for movies with the same name public void SetIMDBThumbs(IList items, bool markWatchedFiles, bool eachMovieHasDedicatedFolder) { GUIListItem pItem; IMDBMovie movieDetails = new IMDBMovie(); for (int x = 0; x < items.Count; x++) { string strThumb = string.Empty; pItem = (GUIListItem)items[x]; string file = string.Empty; bool isFolderPinProtected = (pItem.IsFolder && IsFolderPinProtected(pItem.Path)); // Skip DVD backup folder if (pItem.IsFolder && !IsDvdDirectory(pItem.Path)) { if (pItem.Label == "..") { continue; } if (isFolderPinProtected) { // hide maybe rated content Util.Utils.SetDefaultIcons(pItem); continue; } // If this is enabled you'll see the thumb of the first movie in that dir - but if you put serveral movies into that dir you'll be irritated... else { if (eachMovieHasDedicatedFolder) { file = GetFolderVideoFile(pItem.Path); } } } // If folder is DVD backup folder then take it for watched status else if (pItem.IsFolder && IsDvdDirectory(pItem.Path)) { file = GetFolderVideoFile(pItem.Path); } else if (!pItem.IsFolder || (pItem.IsFolder && VirtualDirectory.IsImageFile(Path.GetExtension(pItem.Path).ToLower()))) { file = pItem.Path; } else { continue; } if (!string.IsNullOrEmpty(file)) { int fileId = VideoDatabase.GetFileId(file); int id = VideoDatabase.GetMovieInfo(file, ref movieDetails); bool foundWatched = false; // Set thumb for movies if (id >= 0) { if (Util.Utils.IsDVD(pItem.Path)) { pItem.Label = String.Format("({0}:) {1}", pItem.Path.Substring(0, 1), movieDetails.Title); } string titleExt = movieDetails.Title + "{" + movieDetails.ID + "}"; strThumb = Util.Utils.GetCoverArt(Thumbs.MovieTitle, titleExt); } // Find watched status for videos if (fileId >= 0 && markWatchedFiles) { if (VideoDatabase.GetmovieWatchedStatus(VideoDatabase.GetMovieId(file))) { foundWatched = true; } } // Set watched status for list item if (!pItem.IsFolder || (IsDvdDirectory(pItem.Path) && foundWatched)) { pItem.IsPlayed = foundWatched; } if (!Util.Utils.FileExistsInCache(strThumb) || string.IsNullOrEmpty(strThumb)) { strThumb = string.Format(@"{0}\{1}", Thumbs.MovieTitle, Util.Utils.MakeFileName(Util.Utils.SplitFilename(Path.ChangeExtension(file, ".jpg")))); if (!Util.Utils.FileExistsInCache(strThumb)) { continue; } } pItem.ThumbnailImage = strThumb; pItem.IconImageBig = strThumb; pItem.IconImage = strThumb; strThumb = Util.Utils.ConvertToLargeCoverArt(strThumb); if (Util.Utils.FileExistsInCache(strThumb)) { pItem.ThumbnailImage = strThumb; } } // <-- file == empty } // of for (int x = 0; x < items.Count; ++x) }
protected virtual void SetLabels() { bool isShareView = false; if (GUIWindowManager.ActiveWindow == (int)Window.WINDOW_VIDEOS) { isShareView = true; } for (int i = 0; i < facadeLayout.Count; ++i) { GUIListItem item = facadeLayout[i]; IMDBMovie movie = item.AlbumInfoTag as IMDBMovie; if (movie != null && movie.ID > 0 && !isShareView && (!item.IsFolder || CurrentSortMethod == VideoSort.SortMethod.NameAll)) { if (CurrentSortMethod == VideoSort.SortMethod.Name || CurrentSortMethod == VideoSort.SortMethod.NameAll || CurrentSortMethod == VideoSort.SortMethod.Name_With_Duration) { if (item.IsFolder) { item.Label2 = string.Empty; } else { // Show real movie duration (from video file) int mDuration = VideoDatabase.GetMovieDuration(movie.ID); if (mDuration <= 0) { ArrayList mFiles = new ArrayList(); VideoDatabase.GetFilesForMovie(movie.ID, ref mFiles); mDuration = GUIVideoFiles.MovieDuration(mFiles, true); if (mDuration <= 0) { item.Label2 = Util.Utils.SecondsToHMString(movie.RunTime * 60); } else { item.Label2 = Util.Utils.SecondsToHMString(mDuration); } } else { item.Label2 = Util.Utils.SecondsToHMString(mDuration); } } } else if (CurrentSortMethod == VideoSort.SortMethod.Year) { item.Label2 = movie.Year.ToString(); } else if (CurrentSortMethod == VideoSort.SortMethod.Rating) { item.Label2 = movie.Rating.ToString(); } else if (CurrentSortMethod == VideoSort.SortMethod.Label) { item.Label2 = movie.DVDLabel.ToString(); } else if (CurrentSortMethod == VideoSort.SortMethod.Size) { if (item.FileInfo != null) { item.Label2 = Util.Utils.GetSize(item.FileInfo.Length); } else { item.Label2 = Util.Utils.SecondsToHMString(movie.RunTime * 60); } } } else { string strSize1 = string.Empty, strDate = string.Empty; if (item.FileInfo != null && !item.IsFolder) { strSize1 = Util.Utils.GetSize(item.FileInfo.Length); } if (item.FileInfo != null && !item.IsFolder) { if (CurrentSortMethod == VideoSort.SortMethod.Modified) { strDate = item.FileInfo.ModificationTime.ToShortDateString() + " " + item.FileInfo.ModificationTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat); } else { strDate = item.FileInfo.CreationTime.ToShortDateString() + " " + item.FileInfo.CreationTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat); } } if (CurrentSortMethod == VideoSort.SortMethod.Name || CurrentSortMethod == VideoSort.SortMethod.NameAll) { if (item.IsFolder) { item.Label2 = string.Empty; } else { item.Label2 = strSize1; } } if (CurrentSortMethod == VideoSort.SortMethod.Name_With_Duration && !item.IsFolder && item.Label != "..") { int newMovieId = VideoDatabase.GetMovieId(item.Path); item.Duration = VideoDatabase.GetMovieDuration(newMovieId); if (item.Duration > 0) { item.Label2 = Util.Utils.SecondsToShortHMSString(item.Duration); } else { item.Label2 = string.Empty; } } else if (CurrentSortMethod == VideoSort.SortMethod.Created || CurrentSortMethod == VideoSort.SortMethod.Date || CurrentSortMethod == VideoSort.SortMethod.Modified) { item.Label2 = strDate; } else { if (item.IsFolder) { item.Label2 = string.Empty; } else { item.Label2 = strSize1; } } } } }