| 
														
															@@ -1,3 +1,4 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+using System; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 using System.IO; 
														 | 
														
														 | 
														
															 using System.IO; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 using MediaBrowser.Model.Configuration; 
														 | 
														
														 | 
														
															 using MediaBrowser.Model.Configuration; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -17,18 +18,25 @@ namespace MediaBrowser.Common.Configuration 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             => configurationManager.GetConfiguration<EncodingOptions>("encoding"); 
														 | 
														
														 | 
														
															             => configurationManager.GetConfiguration<EncodingOptions>("encoding"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         /// <summary> 
														 | 
														
														 | 
														
															         /// <summary> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        /// Retrieves the transcoding temp path from the encoding configuration. 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        /// Retrieves the transcoding temp path from the encoding configuration, falling back to a default if no path 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        /// is specified in configuration. If the directory does not exist, it will be created. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         /// </summary> 
														 | 
														
														 | 
														
															         /// </summary> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        /// <param name="configurationManager">The Configuration manager.</param> 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        /// <param name="configurationManager">The configuration manager.</param> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         /// <returns>The transcoding temp path.</returns> 
														 | 
														
														 | 
														
															         /// <returns>The transcoding temp path.</returns> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        /// <exception cref="UnauthorizedAccessException">If the directory does not exist, and the caller does not have the required permission to create it.</exception> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        /// <exception cref="NotSupportedException">If there is a custom path transcoding path specified, but it is invalid.</exception> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        /// <exception cref="IOException">If the directory does not exist, and it also could not be created.</exception> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         public static string GetTranscodePath(this IConfigurationManager configurationManager) 
														 | 
														
														 | 
														
															         public static string GetTranscodePath(this IConfigurationManager configurationManager) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         { 
														 | 
														
														 | 
														
															         { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            // Get the configured path and fall back to a default 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             var transcodingTempPath = configurationManager.GetEncodingOptions().TranscodingTempPath; 
														 | 
														
														 | 
														
															             var transcodingTempPath = configurationManager.GetEncodingOptions().TranscodingTempPath; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             if (string.IsNullOrEmpty(transcodingTempPath)) 
														 | 
														
														 | 
														
															             if (string.IsNullOrEmpty(transcodingTempPath)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             { 
														 | 
														
														 | 
														
															             { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                return Path.Combine(configurationManager.CommonApplicationPaths.ProgramDataPath, "transcodes"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                transcodingTempPath = Path.Combine(configurationManager.CommonApplicationPaths.ProgramDataPath, "transcodes"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            // Make sure the directory exists 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            Directory.CreateDirectory(transcodingTempPath); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return transcodingTempPath; 
														 | 
														
														 | 
														
															             return transcodingTempPath; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 |