Jason R. Coombs avatar Jason R. Coombs committed 92359c2

Improved compatibility with Linux

Comments (0)

Files changed (2)


 from os.path import join
 from copy import deepcopy
 import logging
+import platform
+import path
 	import win32api
 		names = names[:-1]
 	return ' '.join(names)
+def get_source():
+	default_device = path.path('D:\\')
+	if platform.system() != 'Windows':
+		media = path.path('/media')
+		default_device = media.dirs()[0]
+	return os.environ.get('DVD', default_device)
 def infer_name(device=None):
-	device = device or os.environ.get('DVD', 'D:\\')
+	device = device or get_source()
 		label = win32api.GetVolumeInformation(device)[0]
 	except Exception:


 import re
 import datetime
 import threading
+import importlib
 from jaraco.util import ui
 from path import path
 from jaraco.util.string import local_format as lf
-from jaraco.windows import filesystem
 from . import dvd
 from . import config
-def get_source():
-	return os.environ.get('DVD', 'D:\\')
 def source_is_high_def():
-	blueray_dir = os.path.join(get_source(), 'BDMV')
+	blueray_dir = os.path.join(dvd.get_source(), 'BDMV')
 	return os.path.isdir(blueray_dir)
 def get_handbrake_cmd():
 	quality = 22 if source_is_high_def() else 20
 	return [
-		'HandbrakeCLI', '-i', get_source(), '--subtitle', 'scan',
+		'HandBrakeCLI', '-i', dvd.get_source(), '--subtitle', 'scan',
 		'--subtitle-forced', '--native-language', 'eng',
 		'--encoder', 'x264',
 		'--quality', str(quality),
 	return filepath.startswith('.') or has_hidden_attribute(filepath)
 def has_hidden_attribute(filepath):
+	try:
+		filesystem = importlib.import_module('jaraco.windows.filesystem')
+	except ImportError:
+		return False
 	return filesystem.GetFileAttributes(filepath).hidden
 path.is_hidden = is_hidden
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.