Merge branch 'upstream/master' into debian/master
Nicolas Boulenguez
4 years ago
0 | #!/usr/bin/make | |
1 | ||
2 | MAIN := music123 | |
3 | ||
4 | GNATMAKE := gnatmake | |
5 | BUILDER_OPTIONS := | |
6 | ||
7 | # Inherit ADAFLAGS, LDFLAGS if set in the environment. | |
8 | ADAFLAGS ?= -g -O2 -gnatf -gnatwa -gnaty -gnatwe | |
9 | LDFLAGS ?= | |
10 | ||
11 | GZIP_FLAGS := --best --name | |
12 | STRIP_OPTION := | |
13 | MSGFMT_FLAGS := | |
14 | ||
15 | DESTDIR := / | |
16 | PREFIX := usr/local | |
17 | INSTALL_BIN := $(DESTDIR)/$(PREFIX)/bin | |
18 | INSTALL_DOC := $(DESTDIR)/$(PREFIX)/share/doc/$(MAIN) | |
19 | INSTALL_ETC := $(DESTDIR)/etc | |
20 | INSTALL_EXAMPLES := $(DESTDIR)/$(PREFIX)/share/doc/$(MAIN)/examples | |
21 | INSTALL_LOCALE := $(DESTDIR)/$(PREFIX)/share/locale | |
22 | INSTALL_MAN := $(DESTDIR)/$(PREFIX)/share/man | |
23 | ||
24 | ||
25 | # Default target. | |
26 | .PHONY: build | |
27 | build: | |
28 | # build prerequisites will be added later | |
29 | ||
30 | .PHONY: install | |
31 | install:: build | |
32 | # install rules will be added later | |
33 | ||
34 | .PHONY: clean | |
35 | clean:: | |
36 | find . -name "*~" -delete | |
37 | # clean rules will be added later | |
38 | ||
39 | ||
40 | ########################################################################### | |
41 | # Documentation, examples and system-wide configuration | |
42 | ||
43 | install:: | |
44 | install -D --mode 644 README $(INSTALL_DOC)/README | |
45 | install -D --mode 644 music123rc.conf $(INSTALL_ETC)/music123rc | |
46 | install -D --mode 644 wavgzplay.sh.1 $(INSTALL_EXAMPLES)/wavgzplay.sh.1 | |
47 | install -D --mode 755 wavgzplay.sh $(INSTALL_EXAMPLES)/wavgzplay.sh | |
48 | ||
49 | ########################################################################### | |
50 | # Main executable | |
51 | ||
52 | build: | |
53 | $(GNATMAKE) $(BUILDER_OPTIONS) $(MAIN) -cargs $(ADAFLAGS) -largs $(LDFLAGS) | |
54 | ||
55 | install:: | |
56 | install $(STRIP_OPTION) -D --mode 755 $(MAIN) $(INSTALL_BIN)/$(MAIN) | |
57 | ||
58 | clean:: | |
59 | rm -f $(MAIN) b~$(MAIN)* *.o *.ali | |
60 | ||
61 | ########################################################################### | |
62 | # Manpage | |
63 | ||
64 | MANPAGE := $(MAIN).1.gz | |
65 | ||
66 | build: $(MAIN).1.gz | |
67 | ||
68 | $(MAIN).1.gz: $(MAIN).1 | |
69 | gzip $(GZIP_FLAGS) $< --stdout > $@ | |
70 | ||
71 | install:: | |
72 | install -D --mode 644 $(MAIN).1.gz $(INSTALL_MAN)/man1/$(MAIN).1.gz | |
73 | ||
74 | clean:: | |
75 | rm -f $(MAIN).1.gz | |
76 | ||
77 | ########################################################################### | |
78 | # Manpages translations | |
79 | ||
80 | MAN_TRANSLATIONS := $(wildcard $(MAIN).*.1) | |
81 | MAN_TRANSLATION_LOCALES := $(patsubst $(MAIN).%.1,%,$(MAN_TRANSLATIONS)) | |
82 | MAN_TRANSLATION_TARGETS := $(addsuffix .man,$(MAN_TRANSLATION_LOCALES)) | |
83 | ||
84 | build: $(MAN_TRANSLATION_TARGETS) | |
85 | ||
86 | $(MAN_TRANSLATION_TARGETS): %.man: $(MAIN).%.1 | |
87 | gzip $(GZIP_FLAGS) $< --stdout > $@ | |
88 | ||
89 | install:: | |
90 | for locale in $(MAN_TRANSLATION_LOCALES); do \ | |
91 | install -D --mode 644 $$locale.man $(INSTALL_MAN)/$$locale/man1/$(MAIN).1.gz; \ | |
92 | done | |
93 | ||
94 | clean:: | |
95 | rm -f $(MAN_TRANSLATION_TARGETS) | |
96 | ||
97 | ########################################################################### | |
98 | # Gettext | |
99 | ||
100 | PO_FILES := $(wildcard po/*.po) | |
101 | MO_LOCALES := $(patsubst po/%.po,%,$(PO_FILES)) | |
102 | MO_TARGETS := $(addsuffix .mo,$(MO_LOCALES)) | |
103 | ||
104 | build: $(MO_TARGETS) | |
105 | ||
106 | $(MO_TARGETS): %.mo: po/%.po | |
107 | msgfmt $(MSGFMT_FLAGS) $< -o $@ | |
108 | ||
109 | install:: | |
110 | for locale in $(MO_LOCALES); do \ | |
111 | install -D --mode 644 $$locale.mo $(INSTALL_LOCALE)/$$locale/LC_MESSAGES/$(MAIN).mo; \ | |
112 | done | |
113 | ||
114 | clean:: | |
115 | rm -f $(MO_TARGETS) |
0 | This is music123 version 16.3 (new versioning policy to include minor | |
1 | changes and bug fixes) | |
2 | ||
3 | music123's goal in life is simple. With just mpg123 or ogg123, there | |
4 | was no way to randomly play a mixed batch of ogg's and mp3's. If | |
5 | you fed the wrong file to the wrong player, it would crash. | |
6 | ||
7 | xmms could randomly play mixed ogg's and mp3's, but I'm frequently | |
8 | not in X. I'm sure there's some ncurses solution out there, but I | |
9 | like the mpg123/ogg123 interface - I just want something that can | |
10 | handle mixed collections of files. So I wrote music123. | |
11 | ||
12 | music123 has a similar interface to mpg123 and ogg123. It'll play | |
13 | any type of file listed in its config file, the first found of | |
14 | ~/.music123rc or /etc/music123rc. The default config file includes | |
15 | lines for mp3, ogg, and wav. With older versions of vorbis-tools, | |
16 | only Ogg Vorbis files would play, but newer ones also handle | |
17 | Ogg Flac and Ogg Speex. | |
18 | ||
19 | ogg123, by default, has the default device set to /dev/null. Since | |
20 | music123 normally uses the default device of ogg123, it won't play | |
21 | ogg files if you haven't changed that option. Fixes include editing | |
22 | /etc/libao.conf to change the default device of ogg123, or change | |
23 | the ogg123 line in /etc/music123rc to include a device option for | |
24 | ogg123 in the quotes. | |
25 | ||
26 | This is a very simple shell; if the music doesn't play under your | |
27 | sound system, check the programs that music123 calls. In specific, | |
28 | both ogg123 and mpg321 use libao, so they can be set to use arts | |
29 | by setting "default_driver=arts" in /etc/libao.conf or ~/.libao, | |
30 | or by changing | |
31 | tool ogg123 ogg,Ogg,OGG "" | |
32 | to | |
33 | tool ogg123 ogg,Ogg,OGG "-d arts" | |
34 | in /etc/music123. (I generally recommend the first approach.) aplay, | |
35 | which plays wave files, is a Linux-only program; I, unfortunately, | |
36 | don't know a more general replacement. | |
37 | ||
38 | The half-second pause between songs is deliberate, so music123 can | |
39 | be killed by Control-C. Note that it can be removed with the -D | |
40 | option, or changed by -d. | |
41 | ||
42 | If anyone has added stuff to /etc/music123rc, I'd like to see it so | |
43 | I can add it into the master file (probably commented out). Note | |
44 | that it expects the exact same case for the extension as listed in | |
45 | that file. | |
46 | ||
47 | -- | |
48 | David Starner - dvdeug@debian.org | |
49 | Last change on December 16, 2756 AUC (2003 AD). | |
50 | -- | |
51 | Xavier Grave <xavier.grave@csnsm.in2p3.fr> | |
52 | Minor modification on March, 2010 |
0 | * TRANSLATION | |
1 | - -i message to translate | |
2 | - -L message to translate | |
3 | - remove english test from music123.pl.1 |
0 | Changes to the source of this package are stored in a version control | |
1 | system, publicly available at | |
2 | http://www.ada-france.org:8081/branch/changes/org.music123 |
0 | with Ada.Text_IO; | |
1 | ||
2 | package body Commands is | |
3 | ||
4 | ------------------ | |
5 | -- Handler_Task -- | |
6 | ------------------ | |
7 | ||
8 | task body Handler_Task is | |
9 | Available : Boolean; | |
10 | C : Character; | |
11 | begin | |
12 | select | |
13 | accept Start; | |
14 | or | |
15 | terminate; | |
16 | end select; | |
17 | loop | |
18 | Ada.Text_IO.Get_Immediate (C, Available); | |
19 | if Available then | |
20 | case C is | |
21 | when 'q' | 'Q' => | |
22 | Repository.Quit; | |
23 | select | |
24 | accept Stop; | |
25 | exit; | |
26 | or | |
27 | terminate; | |
28 | end select; | |
29 | when others => | |
30 | null; | |
31 | end case; | |
32 | end if; | |
33 | select | |
34 | accept Stop; | |
35 | exit; | |
36 | or | |
37 | delay 0.5; | |
38 | end select; | |
39 | end loop; | |
40 | end Handler_Task; | |
41 | ||
42 | protected body Repository is | |
43 | ||
44 | procedure Quit is | |
45 | begin | |
46 | Quit_Pressed := True; | |
47 | Ada.Text_IO.New_Line; | |
48 | Ada.Text_IO.Put_Line ("music213 will end at the end of this song"); | |
49 | end Quit; | |
50 | ||
51 | function Have_To_Quit return Boolean is | |
52 | begin | |
53 | return Quit_Pressed; | |
54 | end Have_To_Quit; | |
55 | ||
56 | end Repository; | |
57 | ||
58 | end Commands; |
0 | package Commands is | |
1 | ||
2 | task type Handler_Task is | |
3 | entry Start; | |
4 | entry Stop; | |
5 | end Handler_Task; | |
6 | ||
7 | protected Repository is | |
8 | procedure Quit; | |
9 | function Have_To_Quit return Boolean; | |
10 | private | |
11 | Quit_Pressed : Boolean := False; | |
12 | end Repository; | |
13 | ||
14 | end Commands; |
0 | ----------------------------------------------------------------------- | |
1 | -- GtkAda - Ada95 binding for the Gimp Toolkit -- | |
2 | -- -- | |
3 | -- Copyright (C) 2000 -- | |
4 | -- Emmanuel Briot, Joel Brobecker and Arnaud Charlet -- | |
5 | -- -- | |
6 | -- This library is free software; you can redistribute it and/or -- | |
7 | -- modify it under the terms of the GNU General Public -- | |
8 | -- License as published by the Free Software Foundation; either -- | |
9 | -- version 2 of the License, or (at your option) any later version. -- | |
10 | -- -- | |
11 | -- This library is distributed in the hope that it will be useful, -- | |
12 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- | |
13 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- | |
14 | -- General Public License for more details. -- | |
15 | -- -- | |
16 | -- You should have received a copy of the GNU General Public -- | |
17 | -- License along with this library; if not, write to the -- | |
18 | -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- | |
19 | -- Boston, MA 02111-1307, USA. -- | |
20 | -- -- | |
21 | -- As a special exception, if other files instantiate generics from -- | |
22 | -- this unit, or you link this unit with other files to produce an -- | |
23 | -- executable, this unit does not by itself cause the resulting -- | |
24 | -- executable to be covered by the GNU General Public License. This -- | |
25 | -- exception does not however invalidate any other reasons why the -- | |
26 | -- executable file might be covered by the GNU Public License. -- | |
27 | ----------------------------------------------------------------------- | |
28 | ||
29 | with Interfaces.C.Strings; | |
30 | ||
31 | package body Intl is | |
32 | ||
33 | use Interfaces.C; | |
34 | use Interfaces.C.Strings; | |
35 | ||
36 | ------------- | |
37 | -- Gettext -- | |
38 | ------------- | |
39 | ||
40 | function Gettext (Msg : String) return String is | |
41 | function Internal (msgid : in char_array) | |
42 | return chars_ptr; | |
43 | pragma Import (C, Internal, "gettext"); | |
44 | R : constant chars_ptr := Internal (To_C (Msg)); | |
45 | begin | |
46 | if R = Null_Ptr then | |
47 | raise Locale_Error; | |
48 | end if; | |
49 | return Value (R); | |
50 | end Gettext; | |
51 | ||
52 | -------------- | |
53 | -- Dgettext -- | |
54 | -------------- | |
55 | ||
56 | function Dgettext (Domain : String; Msg : String) return String is | |
57 | function Internal (domainname : in char_array; | |
58 | msgid : in char_array) | |
59 | return chars_ptr; | |
60 | pragma Import (C, Internal, "dgettext"); | |
61 | R : constant chars_ptr := Internal (To_C (Domain), To_C (Msg)); | |
62 | begin | |
63 | if R = Null_Ptr then | |
64 | raise Locale_Error; | |
65 | end if; | |
66 | return Value (R); | |
67 | end Dgettext; | |
68 | ||
69 | --------------- | |
70 | -- Dcgettext -- | |
71 | --------------- | |
72 | ||
73 | function Dcgettext | |
74 | (Domain : String; Msg : String; Category : Integer) return String | |
75 | is | |
76 | function Internal (domainname : in char_array; | |
77 | msgid : in char_array; | |
78 | category : in int) | |
79 | return chars_ptr; | |
80 | pragma Import (C, Internal, "dcgettext"); | |
81 | R : constant chars_ptr := Internal (To_C (Domain), To_C (Msg), | |
82 | int (Category)); | |
83 | begin | |
84 | if R = Null_Ptr then | |
85 | raise Locale_Error; | |
86 | end if; | |
87 | return Value (R); | |
88 | end Dcgettext; | |
89 | ||
90 | ------------------------- | |
91 | -- Default_Text_Domain -- | |
92 | ------------------------- | |
93 | ||
94 | function Default_Text_Domain return String is | |
95 | function Internal (domainname : in chars_ptr) | |
96 | return chars_ptr; | |
97 | pragma Import (C, Internal, "textdomain"); | |
98 | R : constant chars_ptr := Internal (Null_Ptr); | |
99 | begin | |
100 | if R = Null_Ptr then | |
101 | raise Locale_Error; | |
102 | end if; | |
103 | return Value (R); | |
104 | end Default_Text_Domain; | |
105 | ||
106 | ----------------- | |
107 | -- Text_Domain -- | |
108 | ----------------- | |
109 | ||
110 | procedure Text_Domain (Domain : String := "") is | |
111 | function Internal (domainname : in char_array) | |
112 | return chars_ptr; | |
113 | pragma Import (C, Internal, "textdomain"); | |
114 | begin | |
115 | if Internal (To_C (Domain)) = Null_Ptr then | |
116 | raise Locale_Error; | |
117 | end if; | |
118 | end Text_Domain; | |
119 | ||
120 | ---------------------- | |
121 | -- Bind_Text_Domain -- | |
122 | ---------------------- | |
123 | ||
124 | procedure Bind_Text_Domain (Domain : String; Dirname : String) is | |
125 | function Internal (domainname : in char_array; | |
126 | dirname : in char_array) | |
127 | return chars_ptr; | |
128 | pragma Import (C, Internal, "bindtextdomain"); | |
129 | begin | |
130 | if Internal (To_C (Domain), To_C (Dirname)) = Null_Ptr then | |
131 | raise Locale_Error; | |
132 | end if; | |
133 | end Bind_Text_Domain; | |
134 | ||
135 | procedure Set_Locale is | |
136 | function Internal (category : in int; | |
137 | locale : in char_array) | |
138 | return chars_ptr; | |
139 | pragma Import (C, Internal, "setlocale"); | |
140 | LC_ALL : constant := 6; | |
141 | begin | |
142 | if Internal (LC_ALL, To_C ("")) = Null_Ptr then | |
143 | raise Locale_Error; | |
144 | end if; | |
145 | end Set_Locale; | |
146 | ||
147 | end Intl; |
0 | ----------------------------------------------------------------------- | |
1 | -- GtkAda - Ada95 binding for the Gimp Toolkit -- | |
2 | -- -- | |
3 | -- Copyright (C) 2000 -- | |
4 | -- Emmanuel Briot, Joel Brobecker and Arnaud Charlet -- | |
5 | -- -- | |
6 | -- This library is free software; you can redistribute it and/or -- | |
7 | -- modify it under the terms of the GNU General Public -- | |
8 | -- License as published by the Free Software Foundation; either -- | |
9 | -- version 2 of the License, or (at your option) any later version. -- | |
10 | -- -- | |
11 | -- This library is distributed in the hope that it will be useful, -- | |
12 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- | |
13 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- | |
14 | -- General Public License for more details. -- | |
15 | -- -- | |
16 | -- You should have received a copy of the GNU General Public -- | |
17 | -- License along with this library; if not, write to the -- | |
18 | -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- | |
19 | -- Boston, MA 02111-1307, USA. -- | |
20 | -- -- | |
21 | -- As a special exception, if other files instantiate generics from -- | |
22 | -- this unit, or you link this unit with other files to produce an -- | |
23 | -- executable, this unit does not by itself cause the resulting -- | |
24 | -- executable to be covered by the GNU General Public License. This -- | |
25 | -- exception does not however invalidate any other reasons why the -- | |
26 | -- executable file might be covered by the GNU Public License. -- | |
27 | ----------------------------------------------------------------------- | |
28 | ||
29 | -- <description> | |
30 | -- | |
31 | -- This package provides support for string internationalization using the | |
32 | -- libintl library. | |
33 | -- | |
34 | -- To change the current locale setting, use on the environment variables | |
35 | -- "LANG" or "LC_MESSAGES". For example, to switch to the french locale using | |
36 | -- bash: | |
37 | -- | |
38 | -- $ export LANG=fr | |
39 | -- | |
40 | -- Depending on the specific implementation of gettext, the following | |
41 | -- environment variables may be set to change the default settings of locale | |
42 | -- parameters: | |
43 | -- | |
44 | -- - LANG Specifies locale name. | |
45 | -- | |
46 | -- - LC_MESSAGES | |
47 | -- Specifies messaging locale, and if present overrides | |
48 | -- LANG for messages. | |
49 | -- | |
50 | -- - TEXTDOMAIN | |
51 | -- Specifies the text domain name, which is identical to | |
52 | -- the message object filename without .mo suffix. | |
53 | -- | |
54 | -- - TEXTDOMAINDIR | |
55 | -- Specifies the pathname to the message database, and if | |
56 | -- present replaces the default (e.g /usr/lib/locale on Solaris, | |
57 | -- /usr/share/locale on Linux). | |
58 | -- | |
59 | -- See the gettext documentation of your specific OS for more details. | |
60 | -- | |
61 | -- The recommended way to use the gettext capability in your application is | |
62 | -- to use Dgettext with your own domain, and define the following shortcut: | |
63 | -- | |
64 | -- function "-" (Msg : String) return String; | |
65 | -- -- Convenient shortcut to the Gettext function. | |
66 | -- | |
67 | -- function "-" (Msg : String) return String is | |
68 | -- begin | |
69 | -- return Dgettext ("my_domain", Msg); | |
70 | -- end "-"; | |
71 | -- | |
72 | -- Do not forget to call Bind_Text_Domain ("my_domain", "my locale prefix") | |
73 | -- at the beginning of your program. For example, if the prefix of your | |
74 | -- application is /usr, the standard location of the locale would | |
75 | -- be /usr/share/locale, e.g: | |
76 | -- Bind_Text_Domain ("GtkAda", "/usr/share/locale"); | |
77 | -- | |
78 | -- Under this locale directory, the functions provided by this package | |
79 | -- will look for the directory $LANG/LC_MESSAGES, | |
80 | -- /usr/share/locale/fr/LC_MESSAGES in our example; and in this directory, | |
81 | -- the file <domain>.mo will be used, e.g | |
82 | -- /usr/share/locale/fr/LC_MESSAGES/GtkAda.mo | |
83 | -- | |
84 | -- The .mo files can be generated using the GNU tool msgfmt that takes a | |
85 | -- text file containing for each string the original and the translation. | |
86 | -- See msgfmt documentation for more details. | |
87 | -- Here is a sample translation file that can be used as an input for msgfmt: | |
88 | -- | |
89 | -- # gtkada-fr.po | |
90 | -- msgid "Help" | |
91 | -- msgstr "Aide" | |
92 | -- | |
93 | -- msgid "Yes" | |
94 | -- msgstr "Oui" | |
95 | -- | |
96 | -- $ msgfmt gtkada-fr.po -o gtkada-fr.gmo | |
97 | -- $ cp gtkada-fr.gmo /usr/share/locale/fr/LC_MESSAGES/GtkAda.mo | |
98 | -- | |
99 | -- Then, to enable the string translation in your application, use the "-" | |
100 | -- function defined above, e.g: | |
101 | -- | |
102 | -- Gtk_New (Label, -"Help"); | |
103 | -- Gtk_New (Label, -("Help ?") & ASCII.LF & -("Yes")); | |
104 | -- | |
105 | -- </description> | |
106 | ||
107 | -- Rather than mess around with depending on gtkada, and hoping I'd | |
108 | -- never get in a situtation where I had to link in gtkada and gtk | |
109 | -- and xlibs, I just copied the code here. | |
110 | ||
111 | package Intl is | |
112 | pragma Preelaborate; | |
113 | ||
114 | function Gettext (Msg : String) return String; | |
115 | -- Look up Msg in the current default message catalog. | |
116 | -- Use the current locale as specified by LC_MESSAGES. If not found, return | |
117 | -- Msg itself (the default text). | |
118 | ||
119 | function Dgettext (Domain : String; Msg : String) return String; | |
120 | -- Look up Msg in the Domain message catalog for the current locale. | |
121 | ||
122 | function Dcgettext | |
123 | (Domain : String; Msg : String; Category : Integer) return String; | |
124 | -- Look up Msg in the Domain message catalog for the Category locale. | |
125 | ||
126 | function Default_Text_Domain return String; | |
127 | -- Return the current default message catalog. | |
128 | ||
129 | procedure Text_Domain (Domain : String := ""); | |
130 | -- Set the current default message catalog to Domain. | |
131 | -- If Domain is "", reset to the default of "messages". | |
132 | ||
133 | procedure Bind_Text_Domain (Domain : String; Dirname : String); | |
134 | -- Specify that the Domain message catalog will be found in Dirname. | |
135 | -- This overrides the default system locale data base. | |
136 | ||
137 | procedure Set_Locale; | |
138 | ||
139 | Locale_Error : exception; | |
140 | ||
141 | end Intl; |
0 | Copyright: Copyright (C) 2001-2009 David Starner <dvdeug@debian.org> | |
1 | Copyright (C) 2009-2015 Xavier Grave <xavier.grave@csnsm.in2p3.fr> | |
2 | Copyright (C) 2014-2015 Nicolas Boulenguez <nicolas.boulenguez@free.fr> | |
3 | License: Expat | |
4 | Permission is hereby granted, free of charge, to any person obtaining a | |
5 | copy of this software and associated documentation files (the "Software"), | |
6 | to deal in the Software without restriction, including without limitation | |
7 | the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
8 | and/or sell copies of the Software, and to permit persons to whom the | |
9 | Software is furnished to do so, subject to the following conditions: | |
10 | . | |
11 | The above copyright notice and this permission notice shall be included in | |
12 | all copies or substantial portions of the Software. | |
13 | . | |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
17 | THE AUTHOR OR ANY CONTRIBUTERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
18 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
19 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
20 | DEALINGS IN THE SOFTWARE. | |
21 | ||
22 | Files: intl.adb intl.ads | |
23 | Copyright: Copyright (C) 2000 Emmanuel Briot, Joel Brobecker and Arnaud Charlet | |
24 | Copyright (C) 2015 Nicolas Boulenguez <nicolas.boulenguez@free.fr> | |
25 | License: GPL-2 with GNAT exception | |
26 | intl.adb and intl.ads are from libgtkada. They are licensed under the | |
27 | GPL-2, see /usr/share/common-licenses/GPL-2, with the following | |
28 | exception. | |
29 | . | |
30 | As a special exception, if other files instantiate generics from | |
31 | this unit, or you link this unit with other files to produce an | |
32 | executable, this unit does not by itself cause the resulting | |
33 | executable to be covered by the GNU General Public License. This | |
34 | exception does not however invalidate any other reasons why the | |
35 | executable file might be covered by the GNU General Public License. |
0 | .TH music123 1 "July 24, 2002" | |
1 | ||
2 | .SH NAME | |
3 | music123 \- plays various sound files (usually including MP3, Ogg and Wav). | |
4 | ||
5 | .SH SYNOPSIS | |
6 | .B music123 | |
7 | [ | |
8 | .B \-hqrvz | |
9 | ] | |
10 | .I file | |
11 | .B ... | |
12 | ||
13 | .SH DESCRIPTION | |
14 | .B music123 | |
15 | is a shell around various command line programs to play music files. | |
16 | It will descend directories trees with \-r, and randomize file lists | |
17 | with \-z. The programs used and the options given them are listed | |
18 | in /etc/music123rc or ~/.music123rc. | |
19 | ||
20 | .SH OPTIONS | |
21 | .IP \-h | |
22 | Show command help and exit; | |
23 | .IP \-q | |
24 | Quiet mode. No messages are displayed. | |
25 | .IP \-r | |
26 | Recurse into directories, instead of ignoring them. | |
27 | .IP \-v | |
28 | Display version information and exit. | |
29 | .IP \-z | |
30 | Play files in random order. | |
31 | .IP \-Z | |
32 | Play the files randomly and endlessly. | |
33 | .IP \-l | |
34 | Loop. \-z \-l differs from \-Z in that \-z \-l will randomize, play | |
35 | through the song list (without repetition) in random order once, | |
36 | and repeat the songs in that order over and over; \-Z will randomly | |
37 | play the songs, without any order, and will possibly play a song | |
38 | right after itself. | |
39 | .IP \-i | |
40 | Ignore extension case. | |
41 | .IP \-L | |
42 | List files and exit. | |
43 | .IP \-T | |
44 | Start a task that handle commands, only one command supported : quit, | |
45 | using q or Q will quit the application at the end of the current song. | |
46 | .IP \-D | |
47 | Set music123 not to delay between songs. (May make music123 harder to | |
48 | kill). | |
49 | .IP \-d | |
50 | Customize the time music123 delays between songs. \-d takes one argument, | |
51 | expressed in seconds, which may have a fractional part. | |
52 | .IP \-@ | |
53 | Play the files listed in the mandatory argument of \-@. Other files can be | |
54 | added on the command line, and this option can be given several times. | |
55 | Note that music123 doesn't yet play URLs. | |
56 | .IP \-\- | |
57 | End option list. | |
58 | ||
59 | .SH EXAMPLES | |
60 | ||
61 | Play three songs: | |
62 | .RS | |
63 | .B music123 test1.ogg test2.mp3 test3.wav | |
64 | .RE | |
65 | .PP | |
66 | ||
67 | Play a couple of directories and other songs at random: | |
68 | .RS | |
69 | .B music123 \-z \-r Rock/ test1.ogg Pop/ test4.wav | |
70 | .RE | |
71 | .PP | |
72 | ||
73 | .SH FILES | |
74 | ||
75 | .TP | |
76 | /etc/music123rc | |
77 | Describes which programs | |
78 | .B music123 | |
79 | uses, which files types it supports, | |
80 | and which options it passes those programs. | |
81 | ||
82 | .TP | |
83 | ~/.music123rc | |
84 | Per\-user config file to override the system wide settings. | |
85 | .PP | |
86 | ||
87 | .SH AUTHORS | |
88 | ||
89 | .TP | |
90 | Authors: | |
91 | .br | |
92 | David Starner <dvdeug@debian.org> | |
93 | .br |
0 | -- music123 by David Starner <dvdeug@debian.org> | |
1 | ||
2 | with Ada.Command_Line; use Ada.Command_Line; | |
3 | with Ada.Text_IO; | |
4 | ||
5 | with Support_Routines; use Support_Routines; | |
6 | with Intl; | |
7 | with Commands; | |
8 | ||
9 | procedure Music123 is | |
10 | Seeing_Minus_Options : Boolean := True; | |
11 | Arg_Num : Positive; | |
12 | Option_Task : Boolean := False; | |
13 | Option_Quiet : Boolean := False; | |
14 | Option_Recurse : Boolean := False; | |
15 | Option_Random : Boolean := False; | |
16 | Option_Loop : Boolean := False; | |
17 | Option_Eternal_Random : Boolean := False; | |
18 | Option_Ignore_Extension_Case : Boolean := False; | |
19 | Option_List_Files_Only : Boolean := False; | |
20 | Delay_Length : Duration := 0.5; | |
21 | File_List : UString_List.Vector; | |
22 | Program_List : Tool_List.Vector; | |
23 | Command_Task : Commands.Handler_Task; | |
24 | ||
25 | begin | |
26 | Intl.Set_Locale; | |
27 | Intl.Text_Domain ("music123"); | |
28 | Intl.Bind_Text_Domain ("music123", "/usr/share/locale"); | |
29 | ||
30 | -- Import conffile first | |
31 | Import_Conffile (Program_List); | |
32 | ||
33 | -- Read command-line arguments | |
34 | if Argument_Count = 0 then | |
35 | Error (N ("No arguments found.")); | |
36 | raise Noted_Error; | |
37 | end if; | |
38 | ||
39 | Arg_Num := 1; | |
40 | while Arg_Num <= Argument_Count loop | |
41 | if Seeing_Minus_Options | |
42 | and then Argument (Arg_Num)'Length = 2 | |
43 | and then Argument (Arg_Num) (1) = '-' | |
44 | then | |
45 | case Argument (Arg_Num) (2) is | |
46 | when 'h' => | |
47 | Error (""); | |
48 | Set_Exit_Status (Success); | |
49 | return; | |
50 | when 'q' => Option_Quiet := True; | |
51 | when 'z' => Option_Random := True; | |
52 | when 'Z' => Option_Eternal_Random := True; | |
53 | when 'l' => Option_Loop := True; | |
54 | when 'r' => Option_Recurse := True; | |
55 | when 'i' => Option_Ignore_Extension_Case := True; | |
56 | when 'v' => | |
57 | Ada.Text_IO.Put_Line (Version); | |
58 | Set_Exit_Status (Success); | |
59 | return; | |
60 | when 'D' => | |
61 | Delay_Length := 0.0; | |
62 | when 'd' => | |
63 | if Arg_Num >= Argument_Count then | |
64 | Error (N ("Missing argument for -d.")); | |
65 | raise Noted_Error; | |
66 | end if; | |
67 | Arg_Num := Arg_Num + 1; | |
68 | begin | |
69 | Delay_Length := Duration'Value (Argument (Arg_Num)); | |
70 | exception | |
71 | when Constraint_Error => | |
72 | Error (N ("Bad argument for -d.")); | |
73 | raise Noted_Error; | |
74 | end; | |
75 | when 'L' => Option_List_Files_Only := True; | |
76 | when 'T' => Option_Task := True; | |
77 | when '-' => Seeing_Minus_Options := False; | |
78 | when '@' => | |
79 | if Arg_Num >= Argument_Count then | |
80 | Error (N ("Missing argument for -@.")); | |
81 | raise Noted_Error; | |
82 | end if; | |
83 | Arg_Num := Arg_Num + 1; | |
84 | Read_Playlist (Argument (Arg_Num), File_List); | |
85 | when others => | |
86 | Error (N ("Unknown argument found.")); | |
87 | raise Noted_Error; | |
88 | end case; | |
89 | elsif Check_Filename (Argument (Arg_Num), | |
90 | Program_List, | |
91 | Option_Ignore_Extension_Case) | |
92 | then | |
93 | File_List.Append (Argument (Arg_Num)); | |
94 | else | |
95 | Ada.Text_IO.Put_Line ("Ignoring file """ & Argument (Arg_Num) & """"); | |
96 | end if; | |
97 | Arg_Num := Arg_Num + 1; | |
98 | end loop; | |
99 | ||
100 | Expand_And_Check_Filenames (File_List, | |
101 | Option_Recurse, | |
102 | Program_List, | |
103 | Option_Ignore_Extension_Case); | |
104 | ||
105 | if Option_List_Files_Only then | |
106 | Display_Songs (File_List); | |
107 | Set_Exit_Status (Success); | |
108 | return; | |
109 | end if; | |
110 | ||
111 | if Option_Task then | |
112 | Command_Task.Start; | |
113 | end if; | |
114 | ||
115 | Play_Songs | |
116 | (File_List, | |
117 | Program_List, | |
118 | Delay_Length => Delay_Length, | |
119 | Option_Quiet => Option_Quiet, | |
120 | Option_Loop => Option_Loop, | |
121 | Option_Random => Option_Random, | |
122 | Option_Eternal_Random => Option_Eternal_Random, | |
123 | Option_Ignore_Extension_Case => Option_Ignore_Extension_Case); | |
124 | ||
125 | if Option_Task then | |
126 | Command_Task.Stop; | |
127 | end if; | |
128 | ||
129 | Set_Exit_Status (Success); | |
130 | exception | |
131 | when Noted_Error => | |
132 | Set_Exit_Status (Failure); | |
133 | end Music123; |
0 | .TH music123 1 "25 lipiec 2002" | |
1 | ||
2 | .SH NAZWA | |
3 | music123 \- odtwarza ró¿ne pliki d¼wiêkowe (w tym MP3, Ogg i Wav). | |
4 | ||
5 | .SH SK£ADNIA | |
6 | .B music123 | |
7 | [ | |
8 | .B \-hqrvz | |
9 | ] | |
10 | .I plik | |
11 | .B ... | |
12 | ||
13 | .SH OPIS | |
14 | .B music123 | |
15 | jest pow³ok± wokó³ ró¿nych programów s³u¿±cych do odtwarzania plików | |
16 | muzycznych. Mo¿e zag³êbiaæ siê w strukturê katalogów przy pomocy \-r | |
17 | oraz losowo odtwarzaæ utwory przy pomozy \-z. U¿ywane programy i opcje | |
18 | im przekazywane s± zawarte w plikach /etc/music123rc lub ~/.music123rc. | |
19 | ||
20 | .SH OPCJE | |
21 | .IP \-h | |
22 | Poka¿ pomoc do polecenia i zakoñcz dzia³anie. | |
23 | .IP \-q | |
24 | Tryb cichy. ¯adne komunikaty nie s± wy¶wietlane. | |
25 | .IP \-r | |
26 | Rekurencyjnie zag³êbiaj siê w katalogi, zamiast je ignorowaæ. | |
27 | .IP \-v | |
28 | Poka¿ informacjê o wersji programu i zakoñcz dzia³anie. | |
29 | .IP \-z | |
30 | Odtwarzaj pliki w losowej kolejno¶ci. | |
31 | .IP \-Z | |
32 | Odtwarzaj pliki w losowej kolejno¶ci i bez koñca. | |
33 | .IP \-l | |
34 | Pêtla. \-z \-l ró¿ni siê od \-Z tym, ¿e \-z \-l najpierw wylosuje | |
35 | kolejno¶æ, a nastêpnie bêdzie odtwarza³ pliki w tej¿e kolejno¶ci | |
36 | raz po raz; \-Z za¶ odtwarza piosenki w losowej kolejno¶ci | |
37 | pozbawionej jakiegokolwiek porz±dku, w zwiazku z czym istnieje | |
38 | mo¿liwo¶æ odtworzenia tego samego pliku dwa (lub wiêcej) razy | |
39 | pod rz±d. | |
40 | .IP \-i | |
41 | Ignore extension case. | |
42 | .IP \-L | |
43 | List files and exit. | |
44 | .IP \-T | |
45 | Start a task that handle commands, only one command supported : quit, | |
46 | using q or Q will quit the application at the end of the current song. | |
47 | .IP \-D | |
48 | Nie rób przerw miêdzy piosenkami (mo¿e uczyniæ music123 trudniejszym | |
49 | do zabicia) | |
50 | .IP \-d | |
51 | Ustawia d³ugo¶æ przerw miêdzy piosenkami. \-d przyjmuje jeden argument, | |
52 | wyra¿ony w sekundach. Czas mo¿e zawieraæ czê¶æ u³amkow±. | |
53 | .IP \-@ | |
54 | Odtwarzaj pliki wymienione w obowi±zkowym argumencie do \-@. Inne pliki mog± | |
55 | byæ dodane z linii poleceñ. Ta opcja mo¿e byæ podana kilkakrotnie. Zauwa¿, | |
56 | ¿e music123 jeszcze nie odtwarza URLi. | |
57 | .IP \-\- | |
58 | Koniec listy opcji. | |
59 | ||
60 | .SH PRZYK£ADY | |
61 | ||
62 | Odtwórz trzy piosenki: | |
63 | .RS | |
64 | .B music123 test1.ogg test2.mp3 test3.wav | |
65 | .RE | |
66 | .PP | |
67 | ||
68 | Odtwórz losowo parê katalogów i piosenek: | |
69 | .RS | |
70 | .B music123 \-z \-r Rock/ test1.ogg Pop/ test4.wav | |
71 | .RE | |
72 | .PP | |
73 | ||
74 | .SH PLIKI | |
75 | ||
76 | .TP | |
77 | /etc/music123rc | |
78 | Opisuje których programów | |
79 | .B music123 | |
80 | ma u¿yæ, jakie typy plików obs³uguje | |
81 | i jakie opcje przekazuje tym¿e programom. | |
82 | ||
83 | .TP | |
84 | ~/.music123rc | |
85 | Indywidualne ustawienia danego u¿ytkownika. | |
86 | .PP | |
87 | ||
88 | .SH AUTORZY | |
89 | ||
90 | .TP | |
91 | Autorzy: | |
92 | .br | |
93 | David Starner <dvdeug@debian.org> | |
94 | .br | |
95 | ||
96 | .SH T£UMACZENIE | |
97 | ||
98 | .TP | |
99 | T³umacze: | |
100 | .br | |
101 | Grzegorz Ku¶nierz <konik@v\-lo.krakow.pl> | |
102 | .br |
0 | # This is the configuration file for music123 | |
1 | # A list of music playing programs follow for music123 to use | |
2 | # Format is | |
3 | # tool name_of_program extension1,extension2,... "options to be given before the file name" | |
4 | ||
5 | tool ogg123 ogg,Ogg,OGG "" | |
6 | tool ogg123 oga,Oga,OGA "" | |
7 | tool ogg123 spx,Spx,SPX "" | |
8 | tool mpg123 mp3,MP3,Mp3 "" | |
9 | #tool esdplay wav,Wav,WAV "" | |
10 | tool aplay wav,Wav,WAV "" | |
11 | # wavgzplay.sh depends on music123 being able to play wav files. | |
12 | # it's in examples because of known problems | |
13 | #tool wavgzplay.sh wav.gz "" | |
14 | ||
15 | # mplayer is a little heavy-weight; you might want to add -q to the options | |
16 | #tool mplayer ra,wmv "" |
0 | # SOME DESCRIPTIVE TITLE. | |
1 | # Copyright (C) YEAR Free Software Foundation, Inc. | |
2 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
3 | # | |
4 | msgid "" | |
5 | msgstr "" | |
6 | "Project-Id-Version: music123 8\n" | |
7 | "POT-Creation-Date: 2002-05-20 00:14-0500\n" | |
8 | "PO-Revision-Date: 2754-12-11 19:24+0500\n" | |
9 | "Last-Translator: Michael Bramer <grisu@debian.org>\n" | |
10 | "Language-Team: Deutsch <de@li.org>\n" | |
11 | "MIME-Version: 1.0\n" | |
12 | "Content-Type: text/plain; charset=iso-8859-1\n" | |
13 | "Content-Transfer-Encoding: 8bit\n" | |
14 | ||
15 | # music123.adb | |
16 | msgid "music123 version %d by David Starner" | |
17 | msgstr "music123 Version %d von David Starner" | |
18 | ||
19 | # music123.adb | |
20 | msgid "No arguments found." | |
21 | msgstr "Keine Argumente gefunden" | |
22 | ||
23 | # music123.adb | |
24 | # changed by dvdeug | |
25 | msgid "Bad argument for -d." | |
26 | msgstr "Falsches Argument für -d." | |
27 | ||
28 | # music123.adb | |
29 | # changed by dvdeug | |
30 | msgid "Missing argument for -d." | |
31 | msgstr "Fehlendes Argument für -d." | |
32 | ||
33 | # music123.adb | |
34 | msgid "Missing argument for -@." | |
35 | msgstr "Fehlendes Argument für -@." | |
36 | ||
37 | # music123.adb | |
38 | msgid "Unknown argument found." | |
39 | msgstr "Unbekanntes Argument gefunden" | |
40 | ||
41 | # support_routines.adb | |
42 | msgid "music123: " | |
43 | msgstr "music123: " | |
44 | ||
45 | # support_routines.adb | |
46 | msgid "usage: music123 [-hqrvz] files ..." | |
47 | msgstr "usage: music123 [-hqrvz] files ..." | |
48 | ||
49 | # support_routines.adb | |
50 | msgid "-h This help" | |
51 | msgstr "-h Diese Hilfe" | |
52 | ||
53 | # support_routines.adb | |
54 | msgid "-q Run quiet" | |
55 | msgstr "-q Programmablauf ohne Ausgabe" | |
56 | ||
57 | # support_routines.adb | |
58 | msgid "-r Recurse over directories" | |
59 | msgstr "-r rekursiv durch die Verzeichnisse" | |
60 | ||
61 | # support_routines.adb | |
62 | msgid "-v Print the version and exit" | |
63 | msgstr "-v gibt die Version aus" | |
64 | ||
65 | # support_routines.adb | |
66 | msgid "-z Randomize the filelist" | |
67 | msgstr "-z mischt die Dateiliste" | |
68 | ||
69 | # support_routines.adb | |
70 | msgid "See the manpage for more options." | |
71 | msgstr "Für weitere Optionen siehe Man-Page" | |
72 | ||
73 | # support_routines.adb | |
74 | msgid "Neither /etc/music123rc or ~/.music123rc found. Exiting." | |
75 | msgstr "Weder /etc/music123rc noch ~/.music123rc wurden gefunden. Abbruch" | |
76 | ||
77 | # support_routines.adb | |
78 | msgid "The config file (~/.music123rc or /etc/music123rc) is corrupt." | |
79 | msgstr "Die Konfigdatei (~/.music123rc oder /etc/music123rc) sind beschädigt" | |
80 | ||
81 | # support_routines.adb | |
82 | msgid "No valid filenames found." | |
83 | msgstr "Kein gültiger Dateiname gefunden" | |
84 | ||
85 | # support_routines.adb | |
86 | msgid "Playlist file not found." | |
87 | msgstr "Playlist Datei nicht gefunden" |
0 | # Mesaøoj por music123 de David Starner. | |
1 | # Edmund GRIMLEY EVANS <edmundo@rano.org>, 2001. | |
2 | # | |
3 | msgid "" | |
4 | msgstr "" | |
5 | "Project-Id-Version: music123 5\n" | |
6 | "POT-Creation-Date: 2002-05-20 00:14-0500\n" | |
7 | "PO-Revision-Date: 2001-12-12 09:00+0000\n" | |
8 | "Last-Translator: Edmund GRIMLEY EVANS <edmundo@rano.org>\n" | |
9 | "Language-Team: eo <eo@li.org>\n" | |
10 | "MIME-Version: 1.0\n" | |
11 | "Content-Type: text/plain; charset=iso-8859-3\n" | |
12 | "Content-Transfer-Encoding: 8bit\n" | |
13 | ||
14 | # music123.adb | |
15 | msgid "music123 version %d by David Starner" | |
16 | msgstr "music123 versio %d de David Starner" | |
17 | ||
18 | # music123.adb | |
19 | msgid "No arguments found." | |
20 | msgstr "Mankas argumentoj." | |
21 | ||
22 | # music123.adb | |
23 | # changed by dvdeug | |
24 | msgid "Bad argument for -d." | |
25 | msgstr "Malbona argumento por -d." | |
26 | ||
27 | # music123.adb | |
28 | # changed by dvdeug | |
29 | msgid "Missing argument for -d." | |
30 | msgstr "Mankas argumento por -d." | |
31 | ||
32 | # music123.adb | |
33 | msgid "Missing argument for -@." | |
34 | msgstr "Mankas argumento por -@." | |
35 | ||
36 | # music123.adb | |
37 | msgid "Unknown argument found." | |
38 | msgstr "Nekonata argumento." | |
39 | ||
40 | # support_routines.adb | |
41 | msgid "music123: " | |
42 | msgstr "music123: " | |
43 | ||
44 | # support_routines.adb | |
45 | msgid "usage: music123 [-hqrvz] files ..." | |
46 | msgstr "uzado: music123 [-hqrvz] dosieroj ..." | |
47 | ||
48 | # support_routines.adb | |
49 | msgid "-h This help" | |
50 | msgstr "-h Æi tiu helpo" | |
51 | ||
52 | # support_routines.adb | |
53 | msgid "-q Run quiet" | |
54 | msgstr "-q Ruli silente" | |
55 | ||
56 | # support_routines.adb | |
57 | msgid "-r Recurse over directories" | |
58 | msgstr "-r Trakti dosierujojn rekurse" | |
59 | ||
60 | # support_routines.adb | |
61 | msgid "-v Print the version and exit" | |
62 | msgstr "-v Montri la version kaj eliri" | |
63 | ||
64 | # support_routines.adb | |
65 | msgid "-z Randomize the filelist" | |
66 | msgstr "-z Hazarde reordigi la dosierliston" | |
67 | ||
68 | # support_routines.adb | |
69 | msgid "See the manpage for more options." | |
70 | msgstr "Vidu la manpaøon por pli da opcioj." | |
71 | ||
72 | # support_routines.adb | |
73 | msgid "Neither /etc/music123rc or ~/.music123rc found. Exiting." | |
74 | msgstr "Nek /etc/music123rc nek ~/.music123rc estas trovita. Eliras." | |
75 | ||
76 | # support_routines.adb | |
77 | msgid "The config file (~/.music123rc or /etc/music123rc) is corrupt." | |
78 | msgstr "La agordodosiero (~/.music123rc aý /etc/music123rc) estas fuþita." | |
79 | ||
80 | # support_routines.adb | |
81 | msgid "No valid filenames found." | |
82 | msgstr "Mankas validaj dosiernomoj." | |
83 | ||
84 | # support_routines.adb | |
85 | msgid "Playlist file not found." | |
86 | msgstr "Dosiero kun ludolisto ne trovita." |
0 | # french po file for music123 | |
1 | # Copyright (C) 2001 Free Software Foundation, Inc. | |
2 | # Martin Quinson <Martin.Quinson@ens-lyon.fr>, 2001, 2002. | |
3 | # | |
4 | msgid "" | |
5 | msgstr "" | |
6 | "Project-Id-Version: music123\n" | |
7 | "POT-Creation-Date: 2002-05-20 00:14-0500\n" | |
8 | "PO-Revision-Date: 2001-12-12 10:55+0100\n" | |
9 | "Last-Translator: Martin Quinson <Martin.Quinson@ens-lyon.fr>\n" | |
10 | "Language-Team: dlf <debian-l10n-french@lists.debian.org>\n" | |
11 | "MIME-Version: 1.0\n" | |
12 | "Content-Type: text/plain; charset=ISO-8859-1\n" | |
13 | "Content-Transfer-Encoding: 8bit\n" | |
14 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" | |
15 | ||
16 | # music123.adb | |
17 | msgid "music123 version %d by David Starner" | |
18 | msgstr "music123 version %d par David Starner" | |
19 | ||
20 | # music123.adb | |
21 | msgid "No arguments found." | |
22 | msgstr "Arguments introuvables." | |
23 | ||
24 | # music123.adb | |
25 | msgid "Bad argument for -d." | |
26 | msgstr "Paramètre pour -d invalide." | |
27 | ||
28 | # music123.adb | |
29 | msgid "Missing argument for -d." | |
30 | msgstr "Paramètre pour -d manquant." | |
31 | ||
32 | # music123.adb | |
33 | msgid "Missing argument for -@." | |
34 | msgstr "Paramètre pour -@ manquant." | |
35 | ||
36 | # music123.adb | |
37 | msgid "Unknown argument found." | |
38 | msgstr "Argument inconnu trouvé." | |
39 | ||
40 | # support_routines.adb | |
41 | msgid "music123: " | |
42 | msgstr "music123 : " | |
43 | ||
44 | # support_routines.adb | |
45 | msgid "usage: music123 [-hqrvz] files ..." | |
46 | msgstr "usage : music123 [-hqrvz] fichiers ..." | |
47 | ||
48 | # support_routines.adb | |
49 | msgid "-h This help" | |
50 | msgstr "-h Afficher cette aide" | |
51 | ||
52 | # support_routines.adb | |
53 | msgid "-q Run quiet" | |
54 | msgstr "-q Exécuter silencieusement" | |
55 | ||
56 | # support_routines.adb | |
57 | msgid "-i Ignore extension case" | |
58 | msgstr "-i Ignorer la casse des extensions de fichier" | |
59 | ||
60 | # support_routines.adb | |
61 | msgid "-L List files and exit" | |
62 | msgstr "-L Donner la liste des fichier et sortir" | |
63 | ||
64 | # support_routines.adb | |
65 | msgid "-r Recurse over directories" | |
66 | msgstr "-r Parcourir les sous-répertoires récursivement" | |
67 | ||
68 | # support_routines.adb | |
69 | msgid "-v Print the version and exit" | |
70 | msgstr "-v Afficher la version et terminer" | |
71 | ||
72 | # support_routines.adb | |
73 | msgid "-z Randomize the filelist" | |
74 | msgstr "-z Utiliser la liste de fichiers dans un ordre aléatoire" | |
75 | ||
76 | # support_routines.adb | |
77 | msgid "See the manpage for more options." | |
78 | msgstr "Voir la page de manuel pour découvrir d'autres d'options." | |
79 | ||
80 | # support_routines.adb | |
81 | msgid "Neither /etc/music123rc or ~/.music123rc found. Exiting." | |
82 | msgstr "/etc/music123rc et ~/.music123rc sont tous les deux introuvables. Arrêt." | |
83 | ||
84 | # support_routines.adb | |
85 | msgid "The config file (~/.music123rc or /etc/music123rc) is corrupt." | |
86 | msgstr "" | |
87 | "Le fichier de configuration (~/.music123rc ou /etc/music123rc) est corrompu." | |
88 | ||
89 | # support_routines.adb | |
90 | msgid "No valid filenames found." | |
91 | msgstr "Aucun nom de fichier valide n'a été trouvé." | |
92 | ||
93 | # support_routines.adb | |
94 | msgid "Playlist file not found." | |
95 | msgstr "Le fichier contenant la liste à jouer est introuvable." |
0 | # SOME DESCRIPTIVE TITLE. | |
1 | # Copyright (C) YEAR Free Software Foundation, Inc. | |
2 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
3 | # | |
4 | #, fuzzy | |
5 | msgid "" | |
6 | msgstr "" | |
7 | "Project-Id-Version: music123 version 8\n" | |
8 | "POT-Creation-Date: 2002-05-20 00:14-0500\n" | |
9 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |
10 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
11 | "Language-Team: LANGUAGE <LL@li.org>\n" | |
12 | "MIME-Version: 1.0\n" | |
13 | "Content-Type: text/plain; charset=CHARSET\n" | |
14 | "Content-Transfer-Encoding: 8bit\n" | |
15 | ||
16 | #: music123.adb | |
17 | msgid "music123 version %d by David Starner" | |
18 | msgstr "" | |
19 | ||
20 | #: music123.adb | |
21 | msgid "No arguments found." | |
22 | msgstr "" | |
23 | ||
24 | #: music123.adb | |
25 | msgid "Bad argument for -d." | |
26 | msgstr "" | |
27 | ||
28 | #: music123.adb | |
29 | msgid "Missing argument for -d." | |
30 | msgstr "" | |
31 | ||
32 | #: music123.adb | |
33 | msgid "Missing argument for -@." | |
34 | msgstr "" | |
35 | ||
36 | #: music123.adb | |
37 | msgid "Unknown argument found." | |
38 | msgstr "" | |
39 | ||
40 | #: support_routines.adb | |
41 | msgid "music123: " | |
42 | msgstr "" | |
43 | ||
44 | #: support_routines.adb | |
45 | msgid "usage: music123 [-hqrvz] files ..." | |
46 | msgstr "" | |
47 | ||
48 | #: support_routines.adb | |
49 | msgid "-h This help" | |
50 | msgstr "" | |
51 | ||
52 | #: support_routines.adb | |
53 | msgid "-q Run quiet" | |
54 | msgstr "" | |
55 | ||
56 | #: support_routines.adb | |
57 | msgid "-i Ignore extension case" | |
58 | msgstr "" | |
59 | ||
60 | #: support_routines.adb | |
61 | msgid "-L List files and exit" | |
62 | msgstr "" | |
63 | ||
64 | #: support_routines.adb | |
65 | msgid "-r Recurse over directories" | |
66 | msgstr "" | |
67 | ||
68 | #: support_routines.adb | |
69 | msgid "-v Print the version and exit" | |
70 | msgstr "" | |
71 | ||
72 | #: support_routines.adb | |
73 | msgid "-z Randomize the filelist" | |
74 | msgstr "" | |
75 | ||
76 | #: support_routines.adb | |
77 | msgid "See the manpage for more options." | |
78 | msgstr "" | |
79 | ||
80 | #: support_routines.adb | |
81 | msgid "Neither /etc/music123rc or ~/.music123 found. Exiting." | |
82 | msgstr "" | |
83 | ||
84 | #: support_routines.adb | |
85 | msgid "The config file (~/.music123 or /etc/music123rc) is corrupt." | |
86 | msgstr "" | |
87 | ||
88 | #: support_routines.adb | |
89 | msgid "No valid filenames found." | |
90 | msgstr "" | |
91 | ||
92 | #: support_routines.adb | |
93 | msgid "Playlist file not found." | |
94 | msgstr "" | |
95 |
0 | # Dutch messages for music123 | |
1 | # Copyright (C) 2001, 2002 Free Software Foundation, Inc. | |
2 | # Joost van Baal <joostvb-music123-po-82@mdcc.cx>, 2001, 2002 | |
3 | # | |
4 | msgid "" | |
5 | msgstr "" | |
6 | "Project-Id-Version: music123 VERSION\n" | |
7 | "POT-Creation-Date: 2002-05-20 00:14-0500\n" | |
8 | "PO-Revision-Date: 2002-05-21 10:42 +0100\n" | |
9 | "Last-Translator: Joost van Baal <joostvb-music123-po-82@mdcc.cx>\n" | |
10 | "Language-Team: Dutch <nl@li.org>\n" | |
11 | "MIME-Version: 1.0\n" | |
12 | "Content-Type: text/plain; charset=iso-8859-1\n" | |
13 | "Content-Transfer-Encoding: 8bit\n" | |
14 | ||
15 | # music123.adb | |
16 | msgid "music123 version %d by David Starner" | |
17 | msgstr "music123 versie %d door David Starner" | |
18 | ||
19 | # music123.adb | |
20 | msgid "No arguments found." | |
21 | msgstr "Geen argumenten gevonden." | |
22 | ||
23 | # music123.adb | |
24 | #, fuzzy | |
25 | msgid "Bad argument for -d." | |
26 | msgstr "Ontbrekend argument bij -d." | |
27 | ||
28 | # music123.adb | |
29 | #, fuzzy | |
30 | msgid "Missing argument for -d." | |
31 | msgstr "Ontbrekend argument bij -d." | |
32 | ||
33 | # music123.adb | |
34 | msgid "Missing argument for -@." | |
35 | msgstr "Ontbrekend argument bij -@." | |
36 | ||
37 | # music123.adb | |
38 | msgid "Unknown argument found." | |
39 | msgstr "Ongeldig argument gevonden." | |
40 | ||
41 | # support_routines.adb | |
42 | msgid "music123: " | |
43 | msgstr "music123: " | |
44 | ||
45 | # support_routines.adb | |
46 | msgid "usage: music123 [-hqrvz] files ..." | |
47 | msgstr "gebruik: music123 [-hqrvz] bestanden ..." | |
48 | ||
49 | # support_routines.adb | |
50 | msgid "-h This help" | |
51 | msgstr "-h Deze hulp" | |
52 | ||
53 | # support_routines.adb | |
54 | msgid "-q Run quiet" | |
55 | msgstr "-q Draai stil" | |
56 | ||
57 | # support_routines.adb | |
58 | msgid "-r Recurse over directories" | |
59 | msgstr "-r Loop recursief door directories" | |
60 | ||
61 | # support_routines.adb | |
62 | msgid "-v Print the version and exit" | |
63 | msgstr "-v Toon het versienummer en beëindig programma" | |
64 | ||
65 | # support_routines.adb | |
66 | msgid "-z Randomize the filelist" | |
67 | msgstr "-z Maak de volgorde van de bestandslijst willekeurig" | |
68 | ||
69 | # support_routines.adb | |
70 | msgid "See the manpage for more options." | |
71 | msgstr "Zie de manpage voor meer opties." | |
72 | ||
73 | # support_routines.adb | |
74 | msgid "Neither /etc/music123rc or ~/.music123rc found. Exiting." | |
75 | msgstr "/etc/music123rc noch ~/.music123rc gevonden. Programma beëindigd." | |
76 | ||
77 | # support_routines.adb | |
78 | msgid "The config file (~/.music123rc or /etc/music123rc) is corrupt." | |
79 | msgstr "Het configuratiebestand (~/.music123rc of /etc/music123rc) bevat fouten." | |
80 | ||
81 | # support_routines.adb | |
82 | msgid "No valid filenames found." | |
83 | msgstr "Geen valide bestandsnamen gevonden." | |
84 | ||
85 | # support_routines.adb | |
86 | msgid "Playlist file not found." | |
87 | msgstr "De playlist is niet gevonden." |
0 | # SOME DESCRIPTIVE TITLE. | |
1 | # Copyright (C) YEAR Free Software Foundation, Inc. | |
2 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
3 | # | |
4 | msgid "" | |
5 | msgstr "" | |
6 | "Project-Id-Version: music123 8\n" | |
7 | "POT-Creation-Date: 2002-07-26 04:36+0200\n" | |
8 | "Last-Translator: Grzegorz Ku¶nierz <konik@v-lo.krakow.pl>\n" | |
9 | "MIME-Version: 1.0\n" | |
10 | "Content-Type: text/plain; charset=iso-8859-2\n" | |
11 | "Content-Transfer-Encoding: 8bit\n" | |
12 | ||
13 | # music123.adb | |
14 | msgid "music123 version %d by David Starner" | |
15 | msgstr "music123 wersja %d autorstwa David'a Starner'a" | |
16 | ||
17 | # music123.adb | |
18 | msgid "No arguments found." | |
19 | msgstr "Nie znaleziono argumentów." | |
20 | ||
21 | # music123.adb | |
22 | # changed by dvdeug | |
23 | msgid "Bad argument for -d." | |
24 | msgstr "Z³y argument dla -d." | |
25 | ||
26 | # music123.adb | |
27 | # changed by dvdeug | |
28 | msgid "Missing argument for -d." | |
29 | msgstr "Brakuj±cy argument dla -d." | |
30 | ||
31 | # music123.adb | |
32 | msgid "Missing argument for -@." | |
33 | msgstr "Brakuj±cy argument dla -@." | |
34 | ||
35 | # music123.adb | |
36 | msgid "Unknown argument found." | |
37 | msgstr "Nieznany argument." | |
38 | ||
39 | # support_routines.adb | |
40 | msgid "music123: " | |
41 | msgstr "music123: " | |
42 | ||
43 | # support_routines.adb | |
44 | msgid "usage: music123 [-hqrvz] files ..." | |
45 | msgstr "sk³adnia: music123 [-hqrvz] files ..." | |
46 | ||
47 | # support_routines.adb | |
48 | msgid "-h This help" | |
49 | msgstr "-h Ta pomoc" | |
50 | ||
51 | # support_routines.adb | |
52 | msgid "-q Run quiet" | |
53 | msgstr "-q Uruchom w trybie cichym" | |
54 | ||
55 | # support_routines.adb | |
56 | msgid "-r Recurse over directories" | |
57 | msgstr "-r Zag³êbiaj siê w katalogi" | |
58 | ||
59 | # support_routines.adb | |
60 | msgid "-v Print the version and exit" | |
61 | msgstr "-v Wy¶wietl informacjê o wersji i wyjd¼" | |
62 | ||
63 | # support_routines.adb | |
64 | msgid "-z Randomize the filelist" | |
65 | msgstr "-z Odtwarzaj listê losowo" | |
66 | ||
67 | # support_routines.adb | |
68 | msgid "See the manpage for more options." | |
69 | msgstr "Zobacz stronê man aby zapoznaæ siê z pozosta³ymi opcjami." | |
70 | ||
71 | # support_routines.adb | |
72 | msgid "Neither /etc/music123rc or ~/.music123rc found. Exiting." | |
73 | msgstr "Nie znaleziono /etc/music123rc ani ~/.music123rc. Wychodzê." | |
74 | ||
75 | # support_routines.adb | |
76 | msgid "The config file (~/.music123rc or /etc/music123rc) is corrupt." | |
77 | msgstr "Plik konfigurcji (~/.music123rc lub /etc/music123rc) jest nieprawid³owy." | |
78 | ||
79 | # support_routines.adb | |
80 | msgid "No valid filenames found." | |
81 | msgstr "Nie odnaleziono ¿adnych prawid³owych nazw plików." | |
82 | ||
83 | # support_routines.adb | |
84 | msgid "Playlist file not found." | |
85 | msgstr "Nie odnaleziono pliku playlisty." |
0 | # SOME DESCRIPTIVE TITLE. | |
1 | # Copyright (C) YEAR Free Software Foundation, Inc. | |
2 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
3 | # | |
4 | msgid "" | |
5 | msgstr "" | |
6 | "Project-Id-Version: music123\n" | |
7 | "POT-Creation-Date: 2002-05-20 00:14-0500\n" | |
8 | "PO-Revision-Date: \n" | |
9 | "Last-Translator: Gustavo Noronha Silva <kov@debian.org>\n" | |
10 | "Language-Team: Debian-BR <debian-l10n-portuguese@lists.debian.org>\n" | |
11 | "MIME-Version: 1.0\n" | |
12 | "Content-Type: text/plain; charset=iso-8859-1\n" | |
13 | "Content-Transfer-Encoding: 8bit\n" | |
14 | ||
15 | # music123.adb | |
16 | msgid "music123 version %d by David Starner" | |
17 | msgstr "music123 versão %d, por David Starner" | |
18 | ||
19 | # music123.adb | |
20 | msgid "No arguments found." | |
21 | msgstr "Argumentos não encontrados." | |
22 | ||
23 | # music123.adb | |
24 | msgid "Bad argument for -d." | |
25 | msgstr "Argumento incorreto para -@." | |
26 | ||
27 | # music123.adb | |
28 | msgid "Missing argument for -d." | |
29 | msgstr "Argumento faltando para -d." | |
30 | ||
31 | # music123.adb | |
32 | msgid "Missing argument for -@." | |
33 | msgstr "Argumento faltando para -@." | |
34 | ||
35 | # music123.adb | |
36 | msgid "Unknown argument found." | |
37 | msgstr "Argumento desconhecido encontrado." | |
38 | ||
39 | # support_routines.adb | |
40 | msgid "music123: " | |
41 | msgstr "music123: " | |
42 | ||
43 | # support_routines.adb | |
44 | msgid "usage: music123 [-hqrvz] files ..." | |
45 | msgstr "uso: music123 [-hqrvz] arquivos ..." | |
46 | ||
47 | # support_routines.adb | |
48 | msgid "-h This help" | |
49 | msgstr "-h Esta ajuda" | |
50 | ||
51 | # support_routines.adb | |
52 | msgid "-q Run quiet" | |
53 | msgstr "-q Rodar quieto" | |
54 | ||
55 | # support_routines.adb | |
56 | msgid "-r Recurse over directories" | |
57 | msgstr "-r Entrar nos subdiretórios" | |
58 | ||
59 | # support_routines.adb | |
60 | msgid "-v Print the version and exit" | |
61 | msgstr "-v Imprime a versão e sai" | |
62 | ||
63 | # support_routines.adb | |
64 | msgid "-z Randomize the filelist" | |
65 | msgstr "-z Torna a lista de arquivos aleatória." | |
66 | ||
67 | # support_routines.adb | |
68 | msgid "See the manpage for more options." | |
69 | msgstr "Veja a página de manual para mais opções." | |
70 | ||
71 | # support_routines.adb | |
72 | msgid "Neither /etc/music123rc or ~/.music123rc found. Exiting." | |
73 | msgstr "Nem o /etc/music123rc nem o ~/.music123rc foram encontrados. Saindo." | |
74 | ||
75 | # support_routines.adb | |
76 | msgid "The config file (~/.music123rc or /etc/music123rc) is corrupt." | |
77 | msgstr "" | |
78 | "O arquivo de configuração (~/.music123rc ou /etc/music123rc) está corrompido." | |
79 | ||
80 | # support_routines.adb | |
81 | msgid "No valid filenames found." | |
82 | msgstr "Não foram encontrados nomes de arquivos válidos." | |
83 | ||
84 | # support_routines.adb | |
85 | msgid "Playlist file not found." | |
86 | msgstr "Arquivo de playlist não encontrado." |
0 | with Ada.Text_IO; | |
1 | with Ada.Characters.Latin_1; | |
2 | with Ada.Environment_Variables; | |
3 | with Ada.Numerics.Discrete_Random; | |
4 | with Ada.Numerics.Float_Random; | |
5 | with Ada.Calendar; | |
6 | with Ada.Strings.Maps; | |
7 | with Ada.Strings.Maps.Constants; | |
8 | with Ada.Directories; | |
9 | with Interfaces.C; | |
10 | ||
11 | with Commands; | |
12 | ||
13 | package body Support_Routines is | |
14 | ||
15 | -- local function and procedures declarations | |
16 | function Matched_Extension (Extension_List : in Tool_List.Vector; | |
17 | Filename : String; | |
18 | Option_Ignore_Extension_Case : Boolean) | |
19 | return Tool; | |
20 | ||
21 | Whitespace : constant Ada.Strings.Maps.Character_Set | |
22 | := Ada.Strings.Maps.To_Set (Sequence => (' ', Ada.Characters.Latin_1.HT)); | |
23 | ||
24 | function Split_Comma (Source : in String) | |
25 | return UString_List.Vector; | |
26 | function Home_Directory return String; | |
27 | function Shell_Fix (File : String) return String; | |
28 | -- end of declarations | |
29 | ||
30 | procedure Error (Error_String : String) is | |
31 | use Ada.Text_IO; | |
32 | begin | |
33 | Put_Line (Standard_Error, N ("music123: ") & Error_String); | |
34 | Put_Line (Standard_Error, Version); | |
35 | Put_Line (Standard_Error, N ("usage: music123 [-hqrvz] files ...")); | |
36 | Put_Line (Standard_Error, N ("-h This help")); | |
37 | Put_Line (Standard_Error, N ("-q Run quiet")); | |
38 | Put_Line (Standard_Error, N ("-i Ignore extension case")); | |
39 | Put_Line (Standard_Error, N ("-L List files and exit")); | |
40 | Put_Line (Standard_Error, N ("-r Recurse over directories")); | |
41 | Put_Line (Standard_Error, N ("-v Print the version and exit")); | |
42 | Put_Line (Standard_Error, N ("-z Randomize the filelist")); | |
43 | New_Line (Standard_Error); | |
44 | Put_Line (Standard_Error, N ("See the manpage for more options.")); | |
45 | end Error; | |
46 | ||
47 | No_Home_Directory : exception; | |
48 | ||
49 | function Home_Directory return String is | |
50 | use Ada.Environment_Variables; | |
51 | begin | |
52 | if Exists ("HOME") then | |
53 | return Value ("HOME"); | |
54 | else | |
55 | raise No_Home_Directory; | |
56 | end if; | |
57 | end Home_Directory; | |
58 | ||
59 | procedure Import_Conffile (Program_List : in out Tool_List.Vector) | |
60 | is | |
61 | use Ada.Text_IO; | |
62 | Error_String : constant String | |
63 | := N ("Neither /etc/music123rc or ~/.music123rc found. Exiting."); | |
64 | Conf_File : File_Type; | |
65 | begin | |
66 | Program_List.Clear; | |
67 | begin | |
68 | Open (Conf_File, In_File, Home_Directory & "/.music123rc"); | |
69 | exception | |
70 | when others => | |
71 | begin | |
72 | Open (Conf_File, In_File, "/etc/music123rc"); | |
73 | exception | |
74 | when others => | |
75 | Error (Error_String); | |
76 | raise Noted_Error; | |
77 | end; | |
78 | end; | |
79 | while not End_Of_File (Conf_File) loop | |
80 | declare | |
81 | Line : constant String := Get_Line (Conf_File); | |
82 | use Ada.Strings.Fixed; | |
83 | P_F, E_F, O_F : Positive; | |
84 | P_L, E_L, O_L : Natural; | |
85 | begin | |
86 | if Head (Line, 4) = "tool" then | |
87 | Find_Token (Source => Line, From => Line'First + 4, | |
88 | Test => Ada.Strings.Outside, Set => Whitespace, | |
89 | First => P_F, Last => P_L); | |
90 | Find_Token (Source => Line, From => P_L + 1, | |
91 | Test => Ada.Strings.Outside, Set => Whitespace, | |
92 | First => E_F, Last => E_L); | |
93 | O_F := Index (Source => Line, From => E_L + 1, | |
94 | Pattern => """") + 1; | |
95 | O_L := Index (Source => Line, From => O_F, Pattern => """") - 1; | |
96 | Program_List.Append | |
97 | ((Program_Length => P_L - P_F + O_L - O_F + 3, | |
98 | Program => Line (P_F .. P_L) & " " | |
99 | & Line (O_F .. O_L), | |
100 | Extension_List => Split_Comma (Line (E_F .. E_L)))); | |
101 | end if; | |
102 | end; | |
103 | end loop; | |
104 | Close (Conf_File); | |
105 | exception | |
106 | when others => | |
107 | if Is_Open (Conf_File) then | |
108 | Close (Conf_File); | |
109 | end if; | |
110 | Put_Line ("Warning: unable to parse configuration file."); | |
111 | raise; | |
112 | end Import_Conffile; | |
113 | ||
114 | Null_Tool : constant Tool := (Program_Length => 9, Program => "/dev/null", | |
115 | Extension_List => UString_List.Empty_Vector); | |
116 | ||
117 | function Matched_Extension (Extension_List : in Tool_List.Vector; | |
118 | Filename : String; | |
119 | Option_Ignore_Extension_Case : Boolean) | |
120 | return Tool is | |
121 | use Ada.Strings.Fixed; | |
122 | use Ada.Strings.Maps; | |
123 | use Ada.Strings.Maps.Constants; | |
124 | Mapping : constant Character_Mapping | |
125 | := (if Option_Ignore_Extension_Case then Lower_Case_Map else Identity); | |
126 | begin | |
127 | for This_Tool of Extension_List loop | |
128 | for Extension of This_Tool.Extension_List loop | |
129 | if Translate (Tail (Filename, Extension'Length), Mapping) | |
130 | = Translate (Extension, Mapping) | |
131 | then | |
132 | return This_Tool; | |
133 | end if; | |
134 | end loop; | |
135 | end loop; | |
136 | return Null_Tool; | |
137 | ||
138 | end Matched_Extension; | |
139 | ||
140 | function Check_Filename (Full_Name : String; | |
141 | Extension_List : Tool_List.Vector; | |
142 | Option_Ignore_Extension_Case : Boolean) | |
143 | return Boolean is | |
144 | use Ada.Directories; | |
145 | begin | |
146 | return Exists (Full_Name) and then | |
147 | (Kind (Full_Name) = Directory or else | |
148 | Matched_Extension (Extension_List, | |
149 | Full_Name, | |
150 | Option_Ignore_Extension_Case) /= Null_Tool); | |
151 | end Check_Filename; | |
152 | ||
153 | procedure Expand_And_Check_Filenames | |
154 | (File_List : in out UString_List.Vector; | |
155 | Option_Recurse : in Boolean; | |
156 | Extension_List : in Tool_List.Vector; | |
157 | Option_Ignore_Extension_Case : in Boolean | |
158 | ) | |
159 | is | |
160 | use Ada.Directories; | |
161 | Temporary_File_List : UString_List.Vector; | |
162 | procedure Check_And_Append (Directory_Entry : in Directory_Entry_Type); | |
163 | procedure Check_And_Append (Directory_Entry : in Directory_Entry_Type) | |
164 | is | |
165 | -- Adding, then removing the file was | |
166 | -- creating a O(N^2) result. Check it first. | |
167 | Simple : constant String := Simple_Name (Directory_Entry); | |
168 | Full_Path : constant String := Full_Name (Directory_Entry); | |
169 | begin | |
170 | if Simple /= "." | |
171 | and then Simple /= ".." | |
172 | and then Check_Filename (Full_Path, | |
173 | Extension_List, | |
174 | Option_Ignore_Extension_Case) | |
175 | then | |
176 | Temporary_File_List.Append (Full_Path); | |
177 | end if; | |
178 | end Check_And_Append; | |
179 | I : Integer; | |
180 | Error_String : constant String := | |
181 | N ("The config file (~/.music123rc or /etc/music123rc) is corrupt."); | |
182 | begin | |
183 | if Extension_List.Is_Empty then | |
184 | Error (Error_String); | |
185 | raise Noted_Error; | |
186 | end if; | |
187 | I := File_List.First_Index; | |
188 | while I <= File_List.Last_Index loop | |
189 | declare | |
190 | Current_File : constant String := File_List.Element (I); | |
191 | begin | |
192 | if not Exists (Current_File) then | |
193 | File_List.Delete (I); | |
194 | elsif Kind (Current_File) = Directory then | |
195 | File_List.Delete (I); | |
196 | if Option_Recurse then | |
197 | begin | |
198 | Temporary_File_List.Clear; | |
199 | Search (Directory => Current_File, | |
200 | Pattern => "", | |
201 | Process => Check_And_Append'Access); | |
202 | File_Sorting.Sort (Temporary_File_List); | |
203 | File_List.Append (Temporary_File_List); | |
204 | Temporary_File_List.Clear; | |
205 | exception | |
206 | -- Name_Error should not happen here | |
207 | when Use_Error => null; -- no recurse after all | |
208 | end; | |
209 | end if; | |
210 | else | |
211 | I := I + 1; | |
212 | end if; | |
213 | end; | |
214 | end loop; | |
215 | if File_List.Is_Empty then | |
216 | Error (N ("No valid filenames found.")); | |
217 | raise Noted_Error; | |
218 | end if; | |
219 | ||
220 | end Expand_And_Check_Filenames; | |
221 | ||
222 | procedure Randomize_Names (File_List : in out UString_List.Vector) is | |
223 | use Ada.Calendar; | |
224 | use Ada.Numerics.Float_Random; | |
225 | J : Positive; | |
226 | Gen : Generator; | |
227 | begin | |
228 | Reset (Gen, Integer (Seconds (Clock) * 10.0)); | |
229 | -- From Knuth, TAOCP vol. 2, edition 3, page 146, 3.4.2, algorithm P | |
230 | for I in reverse File_List.First_Index + 1 .. File_List.Last_Index loop | |
231 | J := Integer | |
232 | (Float'Floor (Random (Gen) | |
233 | * Float (I + File_List.First_Index - 1))) | |
234 | + File_List.First_Index; | |
235 | File_List.Swap (I, J); | |
236 | end loop; | |
237 | end Randomize_Names; | |
238 | ||
239 | function Shell_Fix (File : String) return String is | |
240 | begin | |
241 | if File'Length = 1 then | |
242 | if File = "'" then | |
243 | return "'""'""'"; | |
244 | else | |
245 | return File; | |
246 | end if; | |
247 | elsif File (File'First) = ''' then | |
248 | return "'""'""'" & Shell_Fix (File (File'First + 1 .. File'Last)); | |
249 | else | |
250 | return File (File'First) & | |
251 | Shell_Fix (File (File'First + 1 .. File'Last)); | |
252 | end if; | |
253 | end Shell_Fix; | |
254 | ||
255 | procedure Display_Songs (File_List : in UString_List.Vector) is | |
256 | begin | |
257 | for Song of File_List loop | |
258 | Ada.Text_IO.Put_Line (Song); | |
259 | end loop; | |
260 | end Display_Songs; | |
261 | ||
262 | procedure Play_Songs | |
263 | (File_List : in out UString_List.Vector; | |
264 | Program_List : in Tool_List.Vector; | |
265 | Delay_Length : in Duration; | |
266 | Option_Quiet : in Boolean; | |
267 | Option_Loop : in Boolean; | |
268 | Option_Random : in Boolean; | |
269 | Option_Eternal_Random : in Boolean; | |
270 | Option_Ignore_Extension_Case : in Boolean | |
271 | ) is | |
272 | ||
273 | procedure Play_A_Song (File_Name : in String); | |
274 | procedure Play_A_Song (File_Name : in String) is | |
275 | use Interfaces.C; | |
276 | function System (command : char_array) return int; | |
277 | pragma Import (C, System, "system"); | |
278 | This_Program : constant Tool := Matched_Extension | |
279 | (Program_List, | |
280 | File_Name, | |
281 | Option_Ignore_Extension_Case); | |
282 | System_String : constant String := | |
283 | This_Program.Program & " '" & Shell_Fix (File_Name) & "'" | |
284 | & (if Option_Quiet then " > /dev/null 2> /dev/null" else ""); | |
285 | System_Result : constant int := System (To_C (System_String)); | |
286 | begin | |
287 | if System_Result /= 0 then | |
288 | Ada.Text_IO.Put_Line ("Command """ & System_String | |
289 | & """ exited with non zero status (" | |
290 | & int'Image (System_Result) & ")."); | |
291 | end if; | |
292 | end Play_A_Song; | |
293 | ||
294 | begin | |
295 | if Option_Eternal_Random then | |
296 | declare | |
297 | subtype S is Integer | |
298 | range File_List.First_Index .. File_List.Last_Index; | |
299 | package S_Random is new Ada.Numerics.Discrete_Random (S); | |
300 | use S_Random; | |
301 | use Ada.Calendar; | |
302 | Gen : Generator; | |
303 | begin | |
304 | Reset (Gen, Integer (Seconds (Clock) * 10.0)); | |
305 | while not Commands.Repository.Have_To_Quit loop | |
306 | Play_A_Song (File_List.Element (Random (Gen))); | |
307 | end loop; | |
308 | end; | |
309 | end if; | |
310 | ||
311 | if Option_Random then | |
312 | Randomize_Names (File_List); | |
313 | end if; | |
314 | ||
315 | loop | |
316 | for Song of File_List loop | |
317 | exit when Commands.Repository.Have_To_Quit; | |
318 | Play_A_Song (Song); | |
319 | delay Delay_Length; | |
320 | end loop; | |
321 | exit when Commands.Repository.Have_To_Quit; | |
322 | exit when not Option_Loop; | |
323 | end loop; | |
324 | end Play_Songs; | |
325 | ||
326 | procedure Read_Playlist (Full_Name : String; | |
327 | File_List : in out UString_List.Vector) is | |
328 | use Ada.Text_IO; | |
329 | Playlist : File_Type; | |
330 | begin | |
331 | begin | |
332 | Open (Playlist, In_File, Full_Name); | |
333 | exception | |
334 | when others => | |
335 | Error (N ("Playlist file not found.")); | |
336 | raise Noted_Error; | |
337 | end; | |
338 | while not End_Of_File (Playlist) loop | |
339 | declare | |
340 | Line : constant String := | |
341 | Ada.Strings.Fixed.Trim (Get_Line (Playlist), Ada.Strings.Both); | |
342 | begin | |
343 | if Line /= "" and then Line (1) /= '#' then | |
344 | File_List.Append (Line); | |
345 | end if; | |
346 | end; | |
347 | end loop; | |
348 | Close (Playlist); | |
349 | exception | |
350 | when others => | |
351 | if Is_Open (Playlist) then | |
352 | Close (Playlist); | |
353 | end if; | |
354 | Put_Line ("Warning: unable to parse playlist."); | |
355 | raise; | |
356 | end Read_Playlist; | |
357 | ||
358 | function Split_Comma (Source : in String) | |
359 | return UString_List.Vector is | |
360 | First : Positive := Source'First; | |
361 | Comma_Index : Natural; | |
362 | begin | |
363 | return Result : UString_List.Vector do | |
364 | loop | |
365 | Comma_Index := Ada.Strings.Fixed.Index (Source => Source, | |
366 | Pattern => ",", | |
367 | From => First); | |
368 | exit when Comma_Index = 0; | |
369 | Result.Append ("." & Source (First .. Comma_Index - 1)); | |
370 | First := Comma_Index + 1; | |
371 | end loop; | |
372 | Result.Append ("." & Source (First .. Source'Last)); | |
373 | end return; | |
374 | end Split_Comma; | |
375 | ||
376 | end Support_Routines; |
0 | with Ada.Containers.Indefinite_Vectors; | |
1 | with Ada.Strings.Fixed; | |
2 | ||
3 | with Intl; | |
4 | ||
5 | package Support_Routines is | |
6 | ||
7 | package UString_List is new Ada.Containers.Indefinite_Vectors | |
8 | (Positive, String); | |
9 | package File_Sorting is new UString_List.Generic_Sorting ("<"); | |
10 | ||
11 | function N (Msg : String) return String renames Intl.Gettext; | |
12 | ||
13 | -- Set the major version here. | |
14 | Version_Number : constant String := "16"; | |
15 | ||
16 | -- Translate the format, then replace the major version. | |
17 | Version_Format : constant String | |
18 | := N ("music123 version %d by David Starner"); | |
19 | Version_Index : constant Positive := Ada.Strings.Fixed.Index | |
20 | (Source => Version_Format, | |
21 | Pattern => "%d"); | |
22 | Version : constant String := Ada.Strings.Fixed.Replace_Slice | |
23 | (Source => Version_Format, | |
24 | Low => Version_Index, | |
25 | High => Version_Index + 1, | |
26 | By => Version_Number); | |
27 | ||
28 | Noted_Error : exception; | |
29 | ||
30 | -- The Program field contains the command and its options. | |
31 | type Tool | |
32 | (Program_Length : Natural) is record | |
33 | Program : String (1 .. Program_Length); | |
34 | Extension_List : UString_List.Vector; | |
35 | end record; | |
36 | ||
37 | package Tool_List is new Ada.Containers.Indefinite_Vectors (Positive, Tool); | |
38 | ||
39 | procedure Error (Error_String : String); | |
40 | procedure Import_Conffile (Program_List : in out Tool_List.Vector); | |
41 | procedure Expand_And_Check_Filenames | |
42 | (File_List : in out UString_List.Vector; | |
43 | Option_Recurse : in Boolean; | |
44 | Extension_List : in Tool_List.Vector; | |
45 | Option_Ignore_Extension_Case : in Boolean); | |
46 | procedure Display_Songs (File_List : in UString_List.Vector); | |
47 | procedure Play_Songs | |
48 | (File_List : in out UString_List.Vector; | |
49 | Program_List : in Tool_List.Vector; | |
50 | Delay_Length : in Duration; | |
51 | Option_Quiet : in Boolean; | |
52 | Option_Loop : in Boolean; | |
53 | Option_Random : in Boolean; | |
54 | Option_Eternal_Random : in Boolean; | |
55 | Option_Ignore_Extension_Case : in Boolean); | |
56 | procedure Randomize_Names (File_List : in out UString_List.Vector); | |
57 | procedure Read_Playlist (Full_Name : String; | |
58 | File_List : in out UString_List.Vector); | |
59 | function Check_Filename (Full_Name : String; | |
60 | Extension_List : Tool_List.Vector; | |
61 | Option_Ignore_Extension_Case : Boolean) | |
62 | return Boolean; | |
63 | ||
64 | end Support_Routines; |
0 | #!/bin/sh | |
1 | FILENAME=`tempfile -s .wav` | |
2 | zcat "$1" > $FILENAME | |
3 | music123 $FILENAME | |
4 | rm $FILENAME |
0 | .\" Hey, EMACS: -*- nroff -*- | |
1 | .TH wavgzplay.sh 1 "August 3, 2001" | |
2 | .SH NAME | |
3 | wavgzplay.sh \- a wav.gz player using music123 | |
4 | .SH SYNOPSIS | |
5 | .B wavgzplay.sh file.wav.gz | |
6 | .SH DESCRIPTION | |
7 | This manual page documents briefly the | |
8 | .B wavgzplay.sh | |
9 | command. | |
10 | .PP | |
11 | \fBwavgzplay.sh\fP is a gzipped wave file player. It unzips a wav.gz file | |
12 | and feeds the wav file to music123. A terribly simple script. | |
13 | .SH OPTIONS | |
14 | There are no options. | |
15 | .SH BUGS | |
16 | Certain file names with ' " ` and probably other characters in them won't work, and you can probably run | |
17 | arbitrary code with the right filenames. That's why this is in examples rather than /usr/bin. | |
18 | .SH AUTHOR | |
19 | This manual page was written by David Starner <dvdeug@debian.org>. |