]> git.sesse.net Git - vlc/blob - modules/access/fs.c
Add option to use version sort when adding a dir
[vlc] / modules / access / fs.c
1 /*****************************************************************************
2  * fs.c: file system access plugin
3  *****************************************************************************
4  * Copyright (C) 2001-2006 the VideoLAN team
5  * Copyright © 2006-2007 Rémi Denis-Courmont
6  *
7  * Authors: Christophe Massiot <massiot@via.ecp.fr>
8  *          Rémi Denis-Courmont <rem # videolan # org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifdef HAVE_CONFIG_H
26 # include "config.h"
27 #endif
28
29 #include <vlc_common.h>
30 #include "fs.h"
31 #include <vlc_plugin.h>
32
33 #define RECURSIVE_TEXT N_("Subdirectory behavior")
34 #define RECURSIVE_LONGTEXT N_( \
35         "Select whether subdirectories must be expanded.\n" \
36         "none: subdirectories do not appear in the playlist.\n" \
37         "collapse: subdirectories appear but are expanded on first play.\n" \
38         "expand: all subdirectories are expanded.\n" )
39
40 static const char *const psz_recursive_list[] = { "none", "collapse", "expand" };
41 static const char *const psz_recursive_list_text[] = {
42     N_("none"), N_("collapse"), N_("expand") };
43
44 #define IGNORE_TEXT N_("Ignored extensions")
45 #define IGNORE_LONGTEXT N_( \
46         "Files with these extensions will not be added to playlist when " \
47         "opening a directory.\n" \
48         "This is useful if you add directories that contain playlist files " \
49         "for instance. Use a comma-separated list of extensions." )
50
51 #define VERSION_SORT_TEXT N_("Use version sort")
52 #define VERSION_SORT_LONGTEXT N_( \
53         "When opening a directory, add items in a natural order. " \
54         "For example, track-1.ogg track-2.ogg track-10.ogg will be sorted " \
55         "as expected while the default method would sort them as " \
56         "track-1.ogg track-10.ogg track-2.ogg." )
57
58 vlc_module_begin ()
59     set_description( N_("File input") )
60     set_shortname( N_("File") )
61     set_category( CAT_INPUT )
62     set_subcategory( SUBCAT_INPUT_ACCESS )
63     add_obsolete_string( "file-cat" )
64     set_capability( "access", 50 )
65     add_shortcut( "file", "fd", "stream" )
66     set_callbacks( FileOpen, FileClose )
67
68     add_submodule()
69     set_section( N_("Directory" ), NULL )
70     set_capability( "access", 55 )
71     add_string( "recursive", "expand" , RECURSIVE_TEXT,
72                 RECURSIVE_LONGTEXT, false )
73       change_string_list( psz_recursive_list, psz_recursive_list_text, 0 )
74     add_string( "ignore-filetypes", "m3u,db,nfo,ini,jpg,jpeg,ljpg,gif,png,pgm,pgmyuv,pbm,pam,tga,bmp,pnm,xpm,xcf,pcx,tif,tiff,lbm,sfv,txt,sub,idx,srt,cue,ssa",
75                 IGNORE_TEXT, IGNORE_LONGTEXT, false )
76     add_bool( "directory-version-sort", false,
77               VERSION_SORT_TEXT, VERSION_SORT_LONGTEXT, false );
78 #ifndef HAVE_FDOPENDIR
79     add_shortcut( "file", "directory", "dir" )
80 #else
81     add_shortcut( "directory", "dir" )
82 #endif
83     set_callbacks( DirOpen, DirClose )
84 vlc_module_end ()