>From 35c3b2f10898f0458f86ff508016543991faf8ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Janne=20Kujanp=C3=A4=C3=A4?= <jikuja@iki.fi>
Date: Sat, 24 Sep 2011 23:45:13 +0300
Subject: [PATCH 1/2] vdr access: minor fixes

fixed: module will now work if directory name ends with /
added: error messages
beautify: lowercased all debug and error messages
---
 modules/access/vdr.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/modules/access/vdr.c b/modules/access/vdr.c
index 873d93f..f42f4bd 100644
--- a/modules/access/vdr.c
+++ b/modules/access/vdr.c
@@ -182,16 +182,24 @@ static int Open( vlc_object_t *p_this )
      * sure if ScanDirectory() actually finds files. */
     if( b_strict )
     {
+        msg_Dbg ( p_access, "module not forced: doing all checks");
         const char *psz_ext = strrchr( p_access->psz_filepath, '.' );
-        if( !psz_ext || strcasecmp( psz_ext, ".rec" ) )
+        if( !psz_ext || strncasecmp( psz_ext, ".rec", 4 ) )
+        {
+            msg_Warn( p_access, "directory name not VDR format: %s",
+                p_access->psz_filepath );
             return VLC_EGENERIC;
+        }
     }
 
     /* Only directories can be recordings */
     struct stat st;
     if( vlc_stat( p_access->psz_filepath, &st ) ||
         !S_ISDIR( st.st_mode ) )
-        return VLC_EGENERIC;
+        {
+            msg_Err( p_access, "not a directory: %s", p_access->psz_filepath );
+            return VLC_EGENERIC;
+        }
 
     access_sys_t *p_sys;
     STANDARD_READ_ACCESS_INIT;
@@ -242,7 +250,10 @@ static bool ScanDirectory( access_t *p_access, bool b_strict )
     {
         p_sys->b_ts_format = !p_sys->b_ts_format;
         if( !ImportNextFile( p_access ) )
+        {
+            msg_Err( p_access, "unable to detect VDR recording format" );
             return false;
+        }
     }
 
     /* meta data and index should exist */
@@ -334,7 +345,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
             return VLC_EGENERIC;
 
         default:
-            msg_Warn( p_access, "unimplemented query in control" );
+            msg_Warn( p_access, "unimplemented query %d in control", i_query );
             return VLC_EGENERIC;
     }
     return VLC_SUCCESS;
@@ -533,7 +544,7 @@ static bool SwitchFile( access_t *p_access, unsigned i_file )
 
     if( p_sys->fd == -1 )
     {
-        msg_Err( p_access, "Failed to open %s: %m", psz_path );
+        msg_Err( p_access, "failed to open %s: %m", psz_path );
         goto error;
     }
 
@@ -642,7 +653,7 @@ static FILE *OpenRelativeFile( access_t *p_access, const char *psz_file )
 
     FILE *file = vlc_fopen( psz_path, "rb" );
     if( !file )
-        msg_Warn( p_access, "Failed to open %s: %m", psz_path );
+        msg_Warn( p_access, "failed to open %s: %m", psz_path );
     free( psz_path );
 
     return file;
-- 
1.7.6.3

