internal FileCopier[] ExportFilesTo(string contentLoc, string[] _languages) { string newWorkArea = contentLoc + "\\" + title; List <FileCopier> allFilesToCopy = new List <FileCopier>(); // create root folder DiskIO.CreateDirectory(newWorkArea); DiskIO.DeleteAllFiles(newWorkArea); foreach (MovieFile p in this.library) { // create each movie folder string movieNewLocation = newWorkArea + "\\" + p.id; DiskIO.CreateDirectory(movieNewLocation); // add video files to copy allFilesToCopy.Add(new FileCopier(p.video.path, movieNewLocation + "\\" + DiskIO.GetFileName(p.video.path))); // change the file path to the new path for further library json saving p.video.path = DiskIO.GetFileName(p.video.path); // add trailer if exist if (!string.IsNullOrEmpty(p.trailer.path)) { allFilesToCopy.Add(new FileCopier(p.trailer.path, movieNewLocation + "\\" + DiskIO.GetFileName(p.trailer.path))); p.trailer.path = DiskIO.GetFileName(p.trailer.path); } if (!string.IsNullOrEmpty(p.cover)) { // add video cover to copy allFilesToCopy.Add(new FileCopier(p.cover, movieNewLocation + "\\cover.jpg")); // change the cover path to the new path for further library json saving p.cover = "\\cover.jpg"; } } // save changed paths and music files into exported location this.SaveMovieLibraryAtLocation(newWorkArea, "index.en.json"); // copy all requested non-English langs foreach (string lang in _languages) { string abbriv = "index." + lang.Substring(0, 2).ToLower() + ".json"; if (DiskIO.IsFileExist(ContentLocation, abbriv)) { VideoFolder temp = DiskIO.DeserializeVideoFolderFromFile(ContentLocation, abbriv); foreach (MovieFile p in temp.library) { p.video.path = "\\" + DiskIO.GetFileName(p.video.path); if (!string.IsNullOrEmpty(p.trailer.path)) { p.trailer.path = "\\" + DiskIO.GetFileName(p.trailer.path); } if (!string.IsNullOrEmpty(p.cover)) { p.cover = "\\cover.jpg"; } } DiskIO.SaveAsJSONFile(temp, newWorkArea, abbriv); } } return(allFilesToCopy.ToArray()); }
internal FileCopier[] ExportFilesTo(string _contentLoc, string[] _languages) { string newWorkArea = _contentLoc + "\\" + title; List <FileCopier> allFilesToCopy = new List <FileCopier>(); // create root folder DiskIO.CreateDirectory(newWorkArea); DiskIO.DeleteAllFiles(newWorkArea); // create each playlist folder foreach (MusicPlaylist p in this.library) { string playlistNewLocation = newWorkArea + "\\" + p.id; DiskIO.CreateDirectory(playlistNewLocation); // determine music files to copy foreach (MusicFile file in p.GetMusicFilesInfo()) { // add music file allFilesToCopy.Add(new FileCopier(file.file, playlistNewLocation + "\\" + DiskIO.GetFileName(file.file))); // change the file path to the new path for further library json saving file.file = DiskIO.GetFileName(file.file); } // add playlist cover to copy if (p.cover != "") { allFilesToCopy.Add(new FileCopier(p.cover, playlistNewLocation + "\\cover.jpg")); // change the cover path to the new path for further library json saving p.cover = "\\cover.jpg"; } p.playlist = "\\index.m3u"; } // save changed paths and music files into exported location this.SavePlaylistLibraryAtLocation(newWorkArea, "index.en.json"); // copy all requested non-English langs foreach (string lang in _languages) { string abbriv = "index." + lang.Substring(0, 2).ToLower() + ".json"; if (DiskIO.IsFileExist(ContentLocation, abbriv)) { AudioFolder temp = DiskIO.DeserializeAudioFolderFromFile(ContentLocation, abbriv); foreach (MusicPlaylist x in temp.library) { x.playlist = "\\index.m3u"; if (x.cover != "") { x.cover = "\\cover.jpg"; } } DiskIO.SaveAsJSONFile(temp, newWorkArea, abbriv); } } return(allFilesToCopy.ToArray()); }