[rygel/wip/dvd: 54/56] media-export: Find lsdvd in path



commit 980a4fa93e68e67271c2b1663bb543c98c7e7dbd
Author: Jens Georg <mail jensge org>
Date:   Fri Jan 1 12:52:34 2016 +0100

    media-export: Find lsdvd in path
    
    Signed-off-by: Jens Georg <mail jensge org>

 .../rygel-media-export-dvd-parser.vala             |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-dvd-parser.vala 
b/src/plugins/media-export/rygel-media-export-dvd-parser.vala
index 087ef4a..8aa03ac 100644
--- a/src/plugins/media-export/rygel-media-export-dvd-parser.vala
+++ b/src/plugins/media-export/rygel-media-export-dvd-parser.vala
@@ -29,11 +29,22 @@ internal class Rygel.DVDParser : GLib.Object {
     public File file { public get; construct; }
 
     private File cache_file;
+    private static string? lsdvd_binary_path;
 
     public DVDParser (File file) {
         Object (file : file);
     }
 
+    static construct {
+        string? path = Environment.find_program_in_path ("lsdvd");
+        if (path == null) {
+            var msg = _("Failed to find lsdvd binary in path. DVD extraction will not be available");
+            warning (msg);
+        }
+
+        DVDParser.lsdvd_binary_path = path;
+    }
+
     public static string get_cache_path (string image_path) {
         unowned string user_cache = Environment.get_user_cache_dir ();
         var id = Checksum.compute_for_string (ChecksumType.MD5, image_path);
@@ -50,6 +61,10 @@ internal class Rygel.DVDParser : GLib.Object {
     }
 
     public async void run () throws Error {
+        if (DVDParser.lsdvd_binary_path == null) {
+            throw new DVDParserError.GENERAL ("No DVD extractor found");
+        }
+
         yield this.get_information ();
     }
 
@@ -58,7 +73,7 @@ internal class Rygel.DVDParser : GLib.Object {
             var launcher = new SubprocessLauncher (SubprocessFlags.STDERR_SILENCE);
             launcher.set_stdout_file_path (this.cache_file.get_path ());
             string[] args = {
-                "/usr/bin/lsdvd",
+                DVDParser.lsdvd_binary_path,
                 "-Ox",
                 "-x",
                 "-q",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]