mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2026-01-11 15:16:07 +01:00
Initial import of CVS-v2_8_branch
This commit is contained in:
55
helpers/Makefile.am
Normal file
55
helpers/Makefile.am
Normal file
@@ -0,0 +1,55 @@
|
||||
## automake.am
|
||||
##
|
||||
## helper/ Automake.am for Rivendell
|
||||
##
|
||||
## (C) Copyright 2003-2005 Fred Gleason <fredg@paravelsystems.com>
|
||||
##
|
||||
## $Id: Makefile.am,v 1.9.6.1 2012/11/29 01:37:35 cvs Exp $
|
||||
## $Date: 2012/11/29 01:37:35 $
|
||||
##
|
||||
## Use automake to process this into a Makefile.in
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License version 2 as
|
||||
## published by the Free Software Foundation.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public
|
||||
## License along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
##
|
||||
|
||||
|
||||
AM_CFLAGS = -Wall
|
||||
|
||||
noinst_PROGRAMS = cwrap\
|
||||
jsmin
|
||||
|
||||
noinst_SCRIPTS = rdpack.sh\
|
||||
rdtrans.sh
|
||||
|
||||
dist_cwrap_SOURCES = cwrap.cpp cwrap.h
|
||||
|
||||
dist_jsmin_SOURCES = jsmin.c
|
||||
|
||||
EXTRA_DIST = rdpack.sh\
|
||||
rdtrans.sh\
|
||||
rdtransgui.sh\
|
||||
setenvvar.sh\
|
||||
win32_frag1.txt\
|
||||
win32_frag2.txt
|
||||
|
||||
CLEANFILES = *~\
|
||||
*.tar.gz\
|
||||
moc_*
|
||||
|
||||
MAINTAINERCLEANFILES = *~\
|
||||
*.tar.gz\
|
||||
aclocal.m4\
|
||||
configure\
|
||||
Makefile.in\
|
||||
moc_*
|
||||
136
helpers/cwrap.cpp
Normal file
136
helpers/cwrap.cpp
Normal file
@@ -0,0 +1,136 @@
|
||||
// cwrap.cpp
|
||||
//
|
||||
// A utility for wrapping arbitrary file data in C-compaibile source
|
||||
// statements.
|
||||
//
|
||||
// (C) Copyright 2003 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: cwrap.cpp,v 1.3 2007/02/14 21:48:41 fredg Exp $
|
||||
// $Date: 2007/02/14 21:48:41 $
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <cwrap.h>
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
int input_fd;
|
||||
FILE *output_desc;
|
||||
char *input_name;
|
||||
char output_name[256];
|
||||
char var_name[256];
|
||||
bool found;
|
||||
struct stat stat;
|
||||
char line[LINE_LENGTH];
|
||||
int n;
|
||||
int count=0;
|
||||
|
||||
//
|
||||
// Build Defaults
|
||||
//
|
||||
sprintf(output_name,"%s.c",argv[argc-1]);
|
||||
|
||||
//
|
||||
// Process Arguments
|
||||
//
|
||||
for(int i=1;i<argc;i++) {
|
||||
found=false;
|
||||
if((!strcmp(argv[i],"-o"))||(!strcmp(argv[i],"--output-file"))) {
|
||||
found=true;
|
||||
if(i<(argc-2)) {
|
||||
strcpy(output_name,argv[++i]);
|
||||
}
|
||||
else {
|
||||
printf(USAGE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if(i==(argc-1)) {
|
||||
input_name=argv[i];
|
||||
found=true;
|
||||
}
|
||||
if(!found) {
|
||||
printf(USAGE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Set Variable Name
|
||||
//
|
||||
for(int j=0;j<strlen(output_name);j++) {
|
||||
if(output_name[j]!='.') {
|
||||
var_name[j]=output_name[j];
|
||||
}
|
||||
else {
|
||||
var_name[j]=0;
|
||||
j=strlen(output_name);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Open Files
|
||||
//
|
||||
if((input_fd=open(input_name,O_RDONLY))<0) {
|
||||
perror("wrapdat");
|
||||
exit(1);
|
||||
}
|
||||
if((output_desc=fopen(output_name,"w"))==NULL) {
|
||||
perror("wrapdat");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Get Size of Source File and Write Header
|
||||
//
|
||||
memset(&stat,0,sizeof(struct stat));
|
||||
if(fstat(input_fd,&stat)) {
|
||||
perror("wrapdat");
|
||||
exit(1);
|
||||
}
|
||||
fprintf(output_desc,"const unsigned char %s[%d] = {\n",
|
||||
var_name,stat.st_size+1);
|
||||
|
||||
//
|
||||
// Write Body
|
||||
//
|
||||
for(int i=0;i<(stat.st_size/LINE_LENGTH+1);i++) {
|
||||
n=read(input_fd,line,LINE_LENGTH);
|
||||
for(int j=0;j<n;j++) {
|
||||
fprintf(output_desc,"%d,",line[j]);
|
||||
count++;
|
||||
}
|
||||
if(n>0) {
|
||||
fprintf(output_desc,"\n");
|
||||
}
|
||||
}
|
||||
fprintf(output_desc,"0};\n");
|
||||
|
||||
//
|
||||
// Finish Up
|
||||
//
|
||||
close(input_fd);
|
||||
fclose(output_desc);
|
||||
exit(0);
|
||||
}
|
||||
37
helpers/cwrap.h
Normal file
37
helpers/cwrap.h
Normal file
@@ -0,0 +1,37 @@
|
||||
// cwrap.h
|
||||
//
|
||||
// A utility for wrapping arbitrary file data in C-compaibile source
|
||||
// statements.
|
||||
//
|
||||
// (C) Copyright 2003 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: cwrap.h,v 1.3 2007/02/14 21:48:41 fredg Exp $
|
||||
// $Date: 2007/02/14 21:48:41 $
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef WRAPDAT_H
|
||||
#define WRAPDAT_H
|
||||
|
||||
#define USAGE "wrapdat [-o|--output-file <file>] <file>\n"
|
||||
|
||||
//
|
||||
// Data Values per Line
|
||||
//
|
||||
#define LINE_LENGTH 16
|
||||
|
||||
|
||||
#endif // WRAPDAT_H
|
||||
275
helpers/jsmin.c
Normal file
275
helpers/jsmin.c
Normal file
@@ -0,0 +1,275 @@
|
||||
/* jsmin.c
|
||||
2008-08-03
|
||||
|
||||
Copyright (c) 2002 Douglas Crockford (www.crockford.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
The Software shall be used for Good, not Evil.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static int theA;
|
||||
static int theB;
|
||||
static int theLookahead = EOF;
|
||||
|
||||
|
||||
/* isAlphanum -- return true if the character is a letter, digit, underscore,
|
||||
dollar sign, or non-ASCII character.
|
||||
*/
|
||||
|
||||
static int
|
||||
isAlphanum(int c)
|
||||
{
|
||||
return ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') ||
|
||||
(c >= 'A' && c <= 'Z') || c == '_' || c == '$' || c == '\\' ||
|
||||
c > 126);
|
||||
}
|
||||
|
||||
|
||||
/* get -- return the next character from stdin. Watch out for lookahead. If
|
||||
the character is a control character, translate it to a space or
|
||||
linefeed.
|
||||
*/
|
||||
|
||||
static int
|
||||
get()
|
||||
{
|
||||
int c = theLookahead;
|
||||
theLookahead = EOF;
|
||||
if (c == EOF) {
|
||||
c = getc(stdin);
|
||||
}
|
||||
if (c >= ' ' || c == '\n' || c == EOF) {
|
||||
return c;
|
||||
}
|
||||
if (c == '\r') {
|
||||
return '\n';
|
||||
}
|
||||
return ' ';
|
||||
}
|
||||
|
||||
|
||||
/* peek -- get the next character without getting it.
|
||||
*/
|
||||
|
||||
static int
|
||||
peek()
|
||||
{
|
||||
theLookahead = get();
|
||||
return theLookahead;
|
||||
}
|
||||
|
||||
|
||||
/* next -- get the next character, excluding comments. peek() is used to see
|
||||
if a '/' is followed by a '/' or '*'.
|
||||
*/
|
||||
|
||||
static int
|
||||
next()
|
||||
{
|
||||
int c = get();
|
||||
if (c == '/') {
|
||||
switch (peek()) {
|
||||
case '/':
|
||||
for (;;) {
|
||||
c = get();
|
||||
if (c <= '\n') {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
case '*':
|
||||
get();
|
||||
for (;;) {
|
||||
switch (get()) {
|
||||
case '*':
|
||||
if (peek() == '/') {
|
||||
get();
|
||||
return ' ';
|
||||
}
|
||||
break;
|
||||
case EOF:
|
||||
fprintf(stderr, "Error: JSMIN Unterminated comment.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
default:
|
||||
return c;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/* action -- do something! What you do is determined by the argument:
|
||||
1 Output A. Copy B to A. Get the next B.
|
||||
2 Copy B to A. Get the next B. (Delete A).
|
||||
3 Get the next B. (Delete B).
|
||||
action treats a string as a single character. Wow!
|
||||
action recognizes a regular expression if it is preceded by ( or , or =.
|
||||
*/
|
||||
|
||||
static void
|
||||
action(int d)
|
||||
{
|
||||
switch (d) {
|
||||
case 1:
|
||||
putc(theA, stdout);
|
||||
case 2:
|
||||
theA = theB;
|
||||
if (theA == '\'' || theA == '"') {
|
||||
for (;;) {
|
||||
putc(theA, stdout);
|
||||
theA = get();
|
||||
if (theA == theB) {
|
||||
break;
|
||||
}
|
||||
if (theA == '\\') {
|
||||
putc(theA, stdout);
|
||||
theA = get();
|
||||
}
|
||||
if (theA == EOF) {
|
||||
fprintf(stderr, "Error: JSMIN unterminated string literal.");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
theB = next();
|
||||
if (theB == '/' && (theA == '(' || theA == ',' || theA == '=' ||
|
||||
theA == ':' || theA == '[' || theA == '!' ||
|
||||
theA == '&' || theA == '|' || theA == '?' ||
|
||||
theA == '{' || theA == '}' || theA == ';' ||
|
||||
theA == '\n')) {
|
||||
putc(theA, stdout);
|
||||
putc(theB, stdout);
|
||||
for (;;) {
|
||||
theA = get();
|
||||
if (theA == '/') {
|
||||
break;
|
||||
}
|
||||
if (theA =='\\') {
|
||||
putc(theA, stdout);
|
||||
theA = get();
|
||||
}
|
||||
if (theA == EOF) {
|
||||
fprintf(stderr,
|
||||
"Error: JSMIN unterminated Regular Expression literal.\n");
|
||||
exit(1);
|
||||
}
|
||||
putc(theA, stdout);
|
||||
}
|
||||
theB = next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* jsmin -- Copy the input to the output, deleting the characters which are
|
||||
insignificant to JavaScript. Comments will be removed. Tabs will be
|
||||
replaced with spaces. Carriage returns will be replaced with linefeeds.
|
||||
Most spaces and linefeeds will be removed.
|
||||
*/
|
||||
|
||||
static void
|
||||
jsmin()
|
||||
{
|
||||
theA = '\n';
|
||||
action(3);
|
||||
while (theA != EOF) {
|
||||
switch (theA) {
|
||||
case ' ':
|
||||
if (isAlphanum(theB)) {
|
||||
action(1);
|
||||
} else {
|
||||
action(2);
|
||||
}
|
||||
break;
|
||||
case '\n':
|
||||
switch (theB) {
|
||||
case '{':
|
||||
case '[':
|
||||
case '(':
|
||||
case '+':
|
||||
case '-':
|
||||
action(1);
|
||||
break;
|
||||
case ' ':
|
||||
action(3);
|
||||
break;
|
||||
default:
|
||||
if (isAlphanum(theB)) {
|
||||
action(1);
|
||||
} else {
|
||||
action(2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
switch (theB) {
|
||||
case ' ':
|
||||
if (isAlphanum(theA)) {
|
||||
action(1);
|
||||
break;
|
||||
}
|
||||
action(3);
|
||||
break;
|
||||
case '\n':
|
||||
switch (theA) {
|
||||
case '}':
|
||||
case ']':
|
||||
case ')':
|
||||
case '+':
|
||||
case '-':
|
||||
case '"':
|
||||
case '\'':
|
||||
action(1);
|
||||
break;
|
||||
default:
|
||||
if (isAlphanum(theA)) {
|
||||
action(1);
|
||||
} else {
|
||||
action(3);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
action(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* main -- Output any command line arguments as comments
|
||||
and then minify the input.
|
||||
*/
|
||||
extern int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i < argc; i += 1) {
|
||||
fprintf(stdout, "// %s\n", argv[i]);
|
||||
}
|
||||
jsmin();
|
||||
return 0;
|
||||
}
|
||||
50
helpers/rdpack.sh
Executable file
50
helpers/rdpack.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
|
||||
# rdpack.sh
|
||||
#
|
||||
# A shell utility for packaging Rivendell translation files.
|
||||
#
|
||||
# (C) Copyright 2005,2008 Fred Gleason <fredg@paravelsystems.com>
|
||||
#
|
||||
# $Id: rdpack.sh,v 1.6 2010/07/29 19:32:32 cvs Exp $
|
||||
# $Date: 2010/07/29 19:32:32 $
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
|
||||
MAIL_ADDR=translations@paravelsystems.com
|
||||
|
||||
|
||||
echo -n "Packaging translation files..."
|
||||
|
||||
#
|
||||
# Get Language
|
||||
#
|
||||
LANG=`cat language`
|
||||
|
||||
#
|
||||
# Package it
|
||||
#
|
||||
tar zvcf rivendell_$LANG-done.tar.gz * > /dev/null
|
||||
|
||||
echo "done."
|
||||
echo
|
||||
echo "Please e-mail the file 'rivendell_$LANG-done.tar.gz' to"
|
||||
echo "'$MAIL_ADDR.'"
|
||||
echo
|
||||
echo "Thank you for supporting the Rivendell project!"
|
||||
echo
|
||||
|
||||
|
||||
# End of rdpack.sh
|
||||
153
helpers/rdtrans.sh
Executable file
153
helpers/rdtrans.sh
Executable file
@@ -0,0 +1,153 @@
|
||||
#!/bin/bash
|
||||
|
||||
# rdtrans.sh
|
||||
#
|
||||
# A shell utility for managing Rivendell translation files.
|
||||
#
|
||||
# (C) Copyright 2005,2008 Fred Gleason <fredg@paravelsystems.com>
|
||||
#
|
||||
# $Id: rdtrans.sh,v 1.7 2010/07/29 19:32:32 cvs Exp $
|
||||
# $Date: 2010/07/29 19:32:32 $
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# The following environmental variables are used by this utility:
|
||||
#
|
||||
# RD_SOURCE - The path to the top of the Rivendell source tree.
|
||||
# RD_LANGUAGES - The path to the top of the langauges tree.
|
||||
|
||||
#
|
||||
# Some readable variable names
|
||||
#
|
||||
CMD=$1
|
||||
LANG=$2
|
||||
|
||||
#
|
||||
# Usage
|
||||
#
|
||||
USAGE="USAGE: rdtrans.sh <cmd> <lang>"
|
||||
|
||||
|
||||
function ReadLanguage
|
||||
{
|
||||
echo -n "Reading language '$LANG' ... "
|
||||
mkdir -p $RD_LANGUAGES/$LANG
|
||||
cp $RD_SOURCE/lib/librd_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
cp $RD_SOURCE/rdhpi/rdhpi_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
cp $RD_SOURCE/rdadmin/rdadmin_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
cp $RD_SOURCE/rdairplay/rdairplay_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
cp $RD_SOURCE/rdpanel/rdpanel_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
cp $RD_SOURCE/rdcastmanager/rdcastmanager_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
cp $RD_SOURCE/rdcatch/rdcatch_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
cp $RD_SOURCE/rdlibrary/rdlibrary_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
cp $RD_SOURCE/rdlogedit/rdlogedit_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
cp $RD_SOURCE/rdlogin/rdlogin_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
cp $RD_SOURCE/rdlogmanager/rdlogmanager_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
cp $RD_SOURCE/utils/rdgpimon/rdgpimon_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
cp $RD_SOURCE/utils/rmlsend/rmlsend_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
cp $RD_SOURCE/utils/rdchunk/rdchunk_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
cp $RD_SOURCE/utils/rdgpimon/rdgpimon_$LANG.ts $RD_LANGUAGES/$LANG/
|
||||
echo "done."
|
||||
}
|
||||
|
||||
|
||||
function WriteLanguage
|
||||
{
|
||||
echo -n "Writing language '$LANG' ... "
|
||||
cp $RD_LANGUAGES/$LANG/librd_$LANG.ts $RD_SOURCE/lib/
|
||||
cp $RD_LANGUAGES/$LANG/rdhpi_$LANG.ts $RD_SOURCE/rdhpi/
|
||||
cp $RD_LANGUAGES/$LANG/rdadmin_$LANG.ts $RD_SOURCE/rdadmin/
|
||||
cp $RD_LANGUAGES/$LANG/rdairplay_$LANG.ts $RD_SOURCE/rdairplay/
|
||||
cp $RD_LANGUAGES/$LANG/rdpanel_$LANG.ts $RD_SOURCE/rdpanel/
|
||||
cp $RD_LANGUAGES/$LANG/rdcastmanager_$LANG.ts $RD_SOURCE/rdcastmanager/
|
||||
cp $RD_LANGUAGES/$LANG/rdcatch_$LANG.ts $RD_SOURCE/rdcatch/
|
||||
cp $RD_LANGUAGES/$LANG/rdlibrary_$LANG.ts $RD_SOURCE/rdlibrary/
|
||||
cp $RD_LANGUAGES/$LANG/rdlogedit_$LANG.ts $RD_SOURCE/rdlogedit/
|
||||
cp $RD_LANGUAGES/$LANG/rdlogin_$LANG.ts $RD_SOURCE/rdlogin/
|
||||
cp $RD_LANGUAGES/$LANG/rdlogmanager_$LANG.ts $RD_SOURCE/rdlogmanager/
|
||||
cp $RD_LANGUAGES/$LANG/rdgpimon_$LANG.ts $RD_SOURCE/utils/rdgpimon/
|
||||
cp $RD_LANGUAGES/$LANG/rmlsend_$LANG.ts $RD_SOURCE/utils/rmlsend/
|
||||
cp $RD_LANGUAGES/$LANG/rdchunk_$LANG.ts $RD_SOURCE/utils/rdchunk/
|
||||
cp $RD_LANGUAGES/$LANG/rdgpimon_$LANG.ts $RD_SOURCE/utils/rdgpimon/
|
||||
echo "done."
|
||||
}
|
||||
|
||||
function PackLanguage
|
||||
{
|
||||
echo $LANG > $RD_LANGUAGES/$LANG/language
|
||||
cp $RD_SOURCE/helpers/rdpack.sh $RD_LANGUAGES/$LANG
|
||||
CURRENT_DIR=`pwd`
|
||||
cd $RD_LANGUAGES/
|
||||
tar -zvcf $RD_LANGUAGES/rivendell_$LANG.tar.gz $LANG/*
|
||||
cd $CURRENT_DIR
|
||||
}
|
||||
|
||||
function EnvironmentError
|
||||
{
|
||||
echo
|
||||
echo "You need to set up the following environmental variables before"
|
||||
echo "before you can use this utility:"
|
||||
echo " \$RD_LANGUAGES"
|
||||
echo " \$RD_SOURCE"
|
||||
echo
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Check for a valid environment
|
||||
#
|
||||
if [ -z $RD_LANGUAGES ] ; then
|
||||
echo $RD_LANGUAGES
|
||||
EnvironmentError
|
||||
exit 1
|
||||
fi
|
||||
if [ -z $RD_SOURCE ] ; then
|
||||
echo RD_SOURCE
|
||||
EnvironmentError
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Check for argument sanity
|
||||
#
|
||||
if [ -z $CMD ] ; then
|
||||
echo $USAGE
|
||||
exit 1
|
||||
fi
|
||||
if [ -z $LANG ] ; then
|
||||
echo $USAGE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# dispatch the command
|
||||
#
|
||||
case $CMD in
|
||||
"read")
|
||||
ReadLanguage
|
||||
;;
|
||||
|
||||
"write")
|
||||
WriteLanguage
|
||||
;;
|
||||
|
||||
"pack")
|
||||
PackLanguage
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown command. Try 'write', 'read' or 'pack'."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
187
helpers/rdtransgui.sh
Normal file
187
helpers/rdtransgui.sh
Normal file
@@ -0,0 +1,187 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# rdtransgui.sh
|
||||
#
|
||||
# A GUi interface for rdtrans.sh script that is used to manage Rivendell
|
||||
# translation files.
|
||||
#
|
||||
# (C) Copyright 2010 Frederick Henderson <frederickjh@henderson-meier.org>
|
||||
#
|
||||
# $Id: rdtransgui.sh,v 1.1 2011/03/01 21:00:07 cvs Exp $
|
||||
# $Date: 2011/03/01 21:00:07 $
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
### Functions ###
|
||||
function whichdialog()
|
||||
{
|
||||
zenitypresent="$(type "zenity" 2> /dev/null )"
|
||||
# Line below commented out. Used for testing kdialog
|
||||
#zenitypresent=
|
||||
kdialogpresent="$(type "kdialog" 2> /dev/null )"
|
||||
if [ ${#zenitypresent} -gt 0 ] ; then
|
||||
dialog=zenity
|
||||
else
|
||||
if [ ${#kdialogpresent} -gt 0 ] ; then
|
||||
dialog=kdialog
|
||||
else
|
||||
echo "Sorry this script needs a script GUI to run correctly."
|
||||
echo "Try installing 'zenity' or 'kdialog' from the 'kdebase-bin'\
|
||||
package."
|
||||
exit
|
||||
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Check for a valid environment
|
||||
#
|
||||
function checkenviroment()
|
||||
{
|
||||
if [[ -z "$RD_LANGUAGES" || -z "$RD_SOURCE" || -z "$RD_SHAREDDIR" ]] ; then
|
||||
text="First you need to set the Enviromental Variables for this script to\
|
||||
work. I will bring up the setenvvar.sh script so you can do so before\
|
||||
continuing to the menu."
|
||||
title="Need to set Enviromental Variables first."
|
||||
if [ "${dialog}" = "kdialog" ] ; then
|
||||
${dialog} --title "$title" --passivepopup "$text" 15
|
||||
elif [ "${dialog}" = "zenity" ] ; then
|
||||
${dialog} --info --title="$title" --text="$text"\
|
||||
--timeout=15
|
||||
fi
|
||||
. ./setenvvar.sh
|
||||
fi
|
||||
}
|
||||
|
||||
function setlanguagecode()
|
||||
{
|
||||
title="Enter a Valid Language Code"
|
||||
text="Enter a Valid i18n language code. These are two letter codes for\
|
||||
language.
|
||||
ie. German=de
|
||||
|
||||
These maybe followed by an underscore and a capitalize two letter country code.
|
||||
ie. de__CH for German and Switzerland to create a country specific language\
|
||||
code.
|
||||
|
||||
You can find a list in '''/usr/share/i18n/SUPPORTED''' on Ubuntu systems.
|
||||
|
||||
Run 'man locale' and check near the bottom of the man page for the location on\
|
||||
your system
|
||||
of the SUPPORTED locale codes file. Only the portion before .UTF-8 is needed.
|
||||
|
||||
The locale code that your computer is set to now is filled in below for you."
|
||||
computerlocale=$(echo $LANG | sed 's/.utf8$//')
|
||||
if [ "${dialog}" = "kdialog" ] ; then
|
||||
langcode=$(${dialog} --title "$title" --inputbox "$text"\
|
||||
"$computerlocale")
|
||||
elif [ "${dialog}" = "zenity" ] ; then
|
||||
langcode=$(${dialog} --entry --title="$title" --text="$text"\
|
||||
--entry-text="$computerlocale")
|
||||
fi
|
||||
checkforcode
|
||||
}
|
||||
|
||||
function checkforcode()
|
||||
{
|
||||
until [ -n "$langcode" ] ; do
|
||||
setlanguagecode
|
||||
done
|
||||
}
|
||||
|
||||
function menu()
|
||||
{
|
||||
while true; do
|
||||
title="RD Translation Utility - $langcode"
|
||||
text="Please choose from the menu."
|
||||
if [ "${dialog}" = "kdialog" ] ; then
|
||||
choice=$(${dialog} --title "$title" --menu "$text" "Add Language"\
|
||||
"Add Language" "Remove Language" "Remove Language" "Update Language"\
|
||||
"Update Language" "Read Language" "Read Language" "Write Language"\
|
||||
"Write Language" "Test Language" "Test Language" "Pack Language"\
|
||||
"Pack Language" "Set Environmental Variables" "Set Environmental Variables"\
|
||||
"Set Language Code" "Set Language Code" "Exit" "Exit" )
|
||||
elif [ "${dialog}" = "zenity" ] ; then
|
||||
choice=$(zenity --width=350 --height=350 --list --column "" --title="$title"\
|
||||
--text="$text" "Add Language" "Remove Language" "Update Language"\
|
||||
"Read Language" "Write Language" "Test Language" "Pack Language"\
|
||||
"Set Environmental Variables" "Set Language Code" "Exit")
|
||||
fi
|
||||
|
||||
|
||||
case "${choice}" in
|
||||
|
||||
"Add Language")
|
||||
./rdtrans.sh add $langcode
|
||||
;;
|
||||
"Remove Language")
|
||||
./rdtrans.sh remove $langcode
|
||||
;;
|
||||
"Update Language")
|
||||
./rdtrans.sh update $langcode
|
||||
;;
|
||||
"Read Language")
|
||||
./rdtrans.sh read $langcode
|
||||
;;
|
||||
"Write Language")
|
||||
./rdtrans.sh write $langcode
|
||||
;;
|
||||
"Test Language")
|
||||
title="Password needed!"
|
||||
text="Please enter your sudo password
|
||||
as the test command needs super user
|
||||
privileges."
|
||||
if [ "${dialog}" = "kdialog" ] ; then
|
||||
password=$(${dialog} --title "$title" --password "$text")
|
||||
echo $password | sudo -ES ./rdtrans.sh test $langcode
|
||||
password=
|
||||
elif [ "${dialog}" = "zenity" ] ; then
|
||||
password=$(${dialog} --title="$title" --text="$text" --entry --hide-text)
|
||||
echo $password | sudo -ES ./rdtrans.sh test $langcode
|
||||
password=
|
||||
sudo -k
|
||||
fi
|
||||
|
||||
;;
|
||||
"Pack Language")
|
||||
. ./rdtrans.sh pack $langcode
|
||||
title="Archive is ready to email!"
|
||||
text="All done. Archive for language $LANG can be found here:
|
||||
$RD_LANGUAGES/rivendell_$LANG.tar.gz
|
||||
Please email it to the developer - $MAIL_ADDR
|
||||
and thanks for translating Rivendell!"
|
||||
if [ "${dialog}" = "kdialog" ] ; then
|
||||
${dialog} --title "$title" --msgbox "$text"
|
||||
elif [ "${dialog}" = "zenity" ] ; then
|
||||
${dialog} --info --title="$title" --text="$text"
|
||||
fi
|
||||
;;
|
||||
"Set Environmental Variables")
|
||||
. ./setenvvar.sh
|
||||
;;
|
||||
"Set Language Code")
|
||||
setlanguagecode
|
||||
;;
|
||||
Exit|*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
### Main Program ###
|
||||
whichdialog
|
||||
checkenviroment
|
||||
setlanguagecode
|
||||
menu
|
||||
197
helpers/setenvvar.sh
Normal file
197
helpers/setenvvar.sh
Normal file
@@ -0,0 +1,197 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# setenvvar.sh
|
||||
#
|
||||
# A utility for setting environmental variables to be used by the
|
||||
# rdtrans.sh script that is used to manage Rivendell translation files.
|
||||
#
|
||||
# (C) Copyright 2010 Frederick Henderson <frederickjh@henderson-meier.org>
|
||||
#
|
||||
# $Id: setenvvar.sh,v 1.1 2011/03/01 21:00:07 cvs Exp $
|
||||
# $Date: 2011/03/01 21:00:07 $
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# The following environmental variables are set by this utility:
|
||||
#
|
||||
# RD_SOURCE - The path to the top of the Rivendell source tree.
|
||||
# RD_LANGUAGES - The path to the top of the languages tree.
|
||||
# This a working folder for your translation files.
|
||||
# RD_SHAREDDIR - The path to Rivendell's shared data directory
|
||||
# /usr/local/share/rivendell by default
|
||||
# /usr/share/rivendell on Ubuntu
|
||||
#
|
||||
## IMPORTANT NOTE: This script must be run in a special way. The best
|
||||
## is if you run it from the /helpers folder with the following command:
|
||||
## . ./setenvvar.sh
|
||||
## If the first .(period) and space are omitted the script will run but
|
||||
## environmental variables will not be set.
|
||||
#
|
||||
#
|
||||
## Functions
|
||||
|
||||
function whichdialog()
|
||||
{
|
||||
zenitypresent="$(type "zenity" 2> /dev/null )"
|
||||
# Line below commented out. Used for testing kdialog
|
||||
#zenitypresent=
|
||||
kdialogpresent="$(type "kdialog" 2> /dev/null )"
|
||||
# Line below commented out. Used for testing bash 4
|
||||
#kdialogpresent=
|
||||
if [ ${#zenitypresent} -gt 0 ] ; then
|
||||
dialog=zenity
|
||||
else
|
||||
if [ ${#kdialogpresent} -gt 0 ] ; then
|
||||
dialog=kdialog
|
||||
else
|
||||
if [ $BASH_VERSINFO -lt 4 ] ; then
|
||||
echo "Sorry this script need at least Bash version 4 to run correctly."
|
||||
echo "Try installing 'zenity' or 'kdialog' from the 'kdebase-bin'\
|
||||
package."
|
||||
exit
|
||||
fi
|
||||
dialog=read
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function getdir()
|
||||
{
|
||||
if [ "${dialog}" = "kdialog" ] ; then
|
||||
${dialog} --title "$shorttitle" --passivepopup "$title" 15
|
||||
height=600 ; width=1050
|
||||
selecteddir=$(${dialog} --title "$title" --getexistingdirectory\
|
||||
"${dir}" --geometry ${width}x${height}+0-0 2> /dev/null )
|
||||
if [ $? -ne 0 ] ; then
|
||||
kill -SIGINT $$
|
||||
fi
|
||||
elif [ "${dialog}" = "zenity" ] ; then
|
||||
${dialog} --info --title "$shorttitle" --text "$title"\
|
||||
--timeout=15
|
||||
selecteddir=$(${dialog} --title "$title" --file-selection\
|
||||
--directory --filename="$dir/" 2> /dev/null )
|
||||
if [ $? -ne 0 ] ; then
|
||||
kill -SIGINT $$
|
||||
fi
|
||||
elif [ "${dialog}" = "read" ]; then
|
||||
echo ======================================================\
|
||||
=====================================
|
||||
echo
|
||||
read -e -p "$title " -i "$dir" selecteddir
|
||||
echo
|
||||
echo =======================================================\
|
||||
===================================
|
||||
fi
|
||||
}
|
||||
|
||||
function setrdsource()
|
||||
{
|
||||
dir=${PWD%\/*}
|
||||
title="Enter the directory for the RD_SOURCE variable. If you ran this in the\
|
||||
/helpers directory then you can most likely just use the default of $dir ."
|
||||
shorttitle="Enter the directory for the RD_SOURCE variable."
|
||||
if [ -n "$RD_SOURCE" ] ; then
|
||||
dir="$RD_SOURCE"
|
||||
fi
|
||||
getdir
|
||||
export RD_SOURCE="$selecteddir"
|
||||
}
|
||||
|
||||
function setrdlanguages()
|
||||
{
|
||||
dir="$HOME/rdlanguages"
|
||||
title="Enter the directory for the RD_LANGUAGES variable. This will be your\
|
||||
working folder for your translation files. The default is $dir in your home\
|
||||
folder."
|
||||
shorttitle="Enter the directory for the RD_LANGUAGES variable."
|
||||
if [ -n "$RD_LANGUAGES" ] ; then
|
||||
dir="$RD_LANGUAGES"
|
||||
fi
|
||||
getdir
|
||||
export RD_LANGUAGES="$selecteddir"
|
||||
}
|
||||
|
||||
function setrdshareddir()
|
||||
{
|
||||
title="Enter the directory for the RD_SHAREDDIR variable. For Ubuntu use\
|
||||
/usr/share/rivendell The default is /usr/local/share/rivendell"
|
||||
shorttitle="Enter the directory for the RD_SHAREDDIR variable."
|
||||
if [ -n "$RD_SHAREDDIR" ] ; then
|
||||
dir="$RD_SHAREDDIR"
|
||||
else
|
||||
distro=$(cat /etc/*_ver* /etc/*-rel* | sed '/^DISTRIB_ID=*/!d; s///; q')
|
||||
if [ $distro = "Ubuntu" ] ; then
|
||||
dir="/usr/share/rivendell"
|
||||
else
|
||||
dir="/usr/local/share/rivendell"
|
||||
fi
|
||||
fi
|
||||
getdir
|
||||
export RD_SHAREDDIR="$selecteddir"
|
||||
}
|
||||
|
||||
function addtodotprofile()
|
||||
{
|
||||
title="Would you like me to add these variables to your $HOME/.profile file,\
|
||||
so that they are loaded each time you login?"
|
||||
shorttitle="Would you like me to add . . ."
|
||||
if [ "${dialog}" = "kdialog" ] ; then
|
||||
${dialog} --title "$shorttitle" --yesno "$title"
|
||||
if [ $? -ne 0 ] ; then
|
||||
kill -SIGINT $$
|
||||
else
|
||||
envtoprofile
|
||||
fi
|
||||
elif [ "${dialog}" = "zenity" ]
|
||||
then
|
||||
${dialog} --question --title "$shorttitle" --text "$title"
|
||||
if [ $? -eq 0 ] ; then
|
||||
envtoprofile
|
||||
fi
|
||||
elif [ "${dialog}" = "read" ]; then
|
||||
echo =====================================================\
|
||||
=====================================
|
||||
echo
|
||||
answer=
|
||||
until [[ "$answer" = "Yes" || "$answer" = "yes" ||\
|
||||
"$answer" = "No" || "$answer" = "no" ]] ; do
|
||||
read -e -p "$title " -i "Yes" answer
|
||||
if [[ "$answer" = "Yes" || "$answer" = "yes" ]] ; then
|
||||
envtoprofile
|
||||
fi
|
||||
done
|
||||
echo
|
||||
echo =====================================================\
|
||||
=====================================
|
||||
fi
|
||||
}
|
||||
|
||||
function envtoprofile()
|
||||
{
|
||||
echo >> $HOME/.profile
|
||||
echo "### The lines below were added to set Environmental Variables for\
|
||||
Rivendell translation script rdtrans.sh" >> $HOME/.profile
|
||||
echo 'export RD_SOURCE='"$RD_SOURCE" >> $HOME/.profile
|
||||
echo 'export RD_LANGUAGES='"$RD_LANGUAGES" >> $HOME/.profile
|
||||
echo 'export RD_SHAREDDIR='"$RD_SHAREDDIR" >> $HOME/.profile
|
||||
echo "### End of environmental variables for rdtrans.sh" >> $HOME/.profile
|
||||
echo >> $HOME/.profile
|
||||
}
|
||||
|
||||
## MAIN PROGRAM ###
|
||||
whichdialog
|
||||
setrdsource
|
||||
setrdlanguages
|
||||
setrdshareddir
|
||||
addtodotprofile
|
||||
1
helpers/win32_frag1.txt
Normal file
1
helpers/win32_frag1.txt
Normal file
@@ -0,0 +1 @@
|
||||
qmake -set VERSION "
|
||||
1
helpers/win32_frag2.txt
Normal file
1
helpers/win32_frag2.txt
Normal file
@@ -0,0 +1 @@
|
||||
"
|
||||
Reference in New Issue
Block a user