]> git.sesse.net Git - vlc/blob - modules/access/fs.c
175c549a204b6caec3784c501a4c9ce1a7974653
[vlc] / modules / access / fs.c
1 /*****************************************************************************
2  * fs.c: file system access plugin
3  *****************************************************************************
4  * Copyright (C) 2001-2006 VLC authors and VideoLAN
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 it
11  * under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program; if not, write to the Free Software Foundation,
22  * 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 static const char *const psz_sort_list[] = { "collate", "version", "none" };
52 static const char *const psz_sort_list_text[] = {
53     N_("Sort alphabetically according to the current language's collation rules."),
54     N_("Sort items in a natural order (for example: 1.ogg 2.ogg 10.ogg). This method does not take the current language's collation rules into account."),
55     N_("Do not sort the items.") };
56
57 #define SORT_TEXT N_("Directory sort order")
58 #define SORT_LONGTEXT N_( \
59     "Define the sort algorithm used when adding items from a directory." )
60
61 vlc_module_begin ()
62     set_description( N_("File input") )
63     set_shortname( N_("File") )
64     set_category( CAT_INPUT )
65     set_subcategory( SUBCAT_INPUT_ACCESS )
66     add_obsolete_string( "file-cat" )
67     set_capability( "access", 50 )
68     add_shortcut( "file", "fd", "stream" )
69     set_callbacks( FileOpen, FileClose )
70
71     add_submodule()
72     set_section( N_("Directory" ), NULL )
73     set_capability( "access", 55 )
74     add_string( "recursive", "expand" , RECURSIVE_TEXT,
75                 RECURSIVE_LONGTEXT, false )
76       change_string_list( psz_recursive_list, psz_recursive_list_text )
77     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",
78                 IGNORE_TEXT, IGNORE_LONGTEXT, false )
79     add_string( "directory-sort", "collate", SORT_TEXT, SORT_LONGTEXT, false )
80       change_string_list( psz_sort_list, psz_sort_list_text )
81 #ifndef HAVE_FDOPENDIR
82     add_shortcut( "file", "directory", "dir" )
83 #else
84     add_shortcut( "directory", "dir" )
85 #endif
86     set_callbacks( DirOpen, DirClose )
87 vlc_module_end ()