delete obsolete scripts
This commit is contained in:
parent
514a770608
commit
b7243360ca
41
add_mg.sh
41
add_mg.sh
@ -1,41 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
MG_ROOT="/usr/local/www/photos.meutel.net/mediagoblin"
|
||||
ALBUMS_ROOT="/home/mediagoblin/albums"
|
||||
MG_USER=meutel
|
||||
|
||||
add_all()
|
||||
{
|
||||
echo "=== TAGS $2 $3 ==="
|
||||
ADD_PATH=$1
|
||||
echo "== path: $ADD_PATH"
|
||||
FILES=$(find $ADD_PATH -type f -maxdepth 1 -iname "*.png" -o -iname "*.mp4" -o -iname "*.jpg")
|
||||
for file in $FILES
|
||||
do
|
||||
echo "Ajout: $file"
|
||||
TITLE=$(basename $file)
|
||||
$MG_ROOT/bin/gmg addmedia $MG_USER "$file" --title "$TITLE" --tags "$2,$3"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
ifs=$IFS
|
||||
IFS='\
|
||||
'
|
||||
ALBUMS=$(ls $ALBUMS_ROOT)
|
||||
echo "albums: $ALBUMS"
|
||||
for album in $ALBUMS
|
||||
do
|
||||
ALBUM_NAME=$(basename $album)
|
||||
TAGALBUM=$(echo $ALBUM_NAME | sed 's/ /_/g')
|
||||
echo "Album: $ALBUM_NAME"
|
||||
ALBUM_PATH="${ALBUMS_ROOT}/$ALBUM_NAME"
|
||||
for subalbum in $(find $ALBUM_PATH -type d)
|
||||
do
|
||||
echo "Sous-album: $subalbum"
|
||||
SUBALBUM_NAME=$(basename $subalbum)
|
||||
TAGSUBALBUM=$(echo $SUBALBUM_NAME | sed 's/ /_/g')
|
||||
add_all "$subalbum" "$TAGALBUM" "$TAGSUBALBUM"
|
||||
done
|
||||
done
|
||||
IFS=$ifs
|
246
arte7-dl.sh
246
arte7-dl.sh
@ -1,246 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# arte7-dl.sh - Download Arte+7 videos
|
||||
# Version: 0.3.2
|
||||
# Creation date: Sun, 26 Apr 2009 00:27:18 +0200
|
||||
# Last update: Sun, 22 Nov 2009 21:35:34 +0100
|
||||
# Author: CSM 'illovae' Seldon <druuna@dud-t.org>
|
||||
# Copyleft 2009
|
||||
|
||||
# Helpers/Debuggers/Contributors:
|
||||
|
||||
# This script is a fork of an original idea by beubeud : Arte+7 Recorder
|
||||
# http://codingteam.net/project/arte7recorder
|
||||
|
||||
# FREE ADVERTISE: http://u-classroom.net FTW!!
|
||||
|
||||
# arte7-dl.sh --help for help
|
||||
# Dependancies: bash, mimms, wget, coreutils (echo, awk, grep, etc)
|
||||
|
||||
# arte7-dl.sh is distributed by license: Dual Beer-Ware/WTFPLv2
|
||||
|
||||
# THE BEER-WARE LICENSE:
|
||||
# As long as you retain this notice you can do whatever you want with this
|
||||
# stuff. If we meet some day, and you think this stuff is worth it, you can
|
||||
# buy me a beer in return.
|
||||
|
||||
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
# Version 2, December 2004
|
||||
# Copies of this license document, and changing it is allowed as long
|
||||
# as the name is changed.
|
||||
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
||||
# NOTE for the video quality --
|
||||
# With Arte7 you can download Medium Quality videos or High Quality videos.
|
||||
# For the moment, this script haven't option to let you choose what video
|
||||
# quality you want. The video quality is defined in this script in the $VQ
|
||||
# variable below and use by default Medium Quality (MQ). Feel free to
|
||||
# edit this variable at your convenience.
|
||||
|
||||
# BUG with mimms 3.2 --
|
||||
# The original mimms 3.2 which can be downloaded from the project website
|
||||
# http://savannah.nongnu.org/projects/mimms/ have a know bug : you cannot
|
||||
# use the filename you want while downloading the stream. This is a function
|
||||
# used by this script, so we invite you to use an other mimms version, or you
|
||||
# can use a patched version. For example in debian, mimms have been patched to
|
||||
# mimms 3.2.1, by debian devels, which is working properly.
|
||||
|
||||
# AND KNOW WE CAN BEGIN!
|
||||
|
||||
# Variables
|
||||
|
||||
# Name by which this script was invoked.
|
||||
PROGNAME=$(basename $0)
|
||||
VERSION="0.3.2"
|
||||
|
||||
# Video Quality
|
||||
VQ=MQ # HQ == High Quality ; MQ = Medium Quality
|
||||
|
||||
# Others variables
|
||||
USAGE="Usage: $PROGNAME {option}
|
||||
|
||||
NB: The [VALUES] are required.
|
||||
|
||||
Options are:
|
||||
-h, --help You're looking at it
|
||||
-l, --list List all availables shows
|
||||
-i, --infos [VIDEO_ID] Get informations for a show using VIDEO_ID
|
||||
-d, --download [VIDEO_ID] Download a file using VIDEO_ID
|
||||
-v, --version Version and license
|
||||
"
|
||||
CASE=help
|
||||
|
||||
# To prevent hairy quoting and escaping later.
|
||||
bq='`'
|
||||
eq="'"
|
||||
|
||||
# The functions
|
||||
|
||||
# We want to get the list of available shows
|
||||
function getlist
|
||||
{
|
||||
XMLLINK="http://plus7.arte.tv$(wget -q -O - http://plus7.arte.tv/ | \
|
||||
grep xmlURL | awk -F'"' '{print $4}')"
|
||||
|
||||
wget -q -O - $XMLLINK | grep -F "<index>
|
||||
<bigTitle>
|
||||
<startDate>
|
||||
<offlineDate>
|
||||
<targetURL>" | sed -e 's/<index>/-- VIDEO #/g' \
|
||||
-e 's/<bigTitle>/Title: /g' \
|
||||
-e 's/<startDate>/Since: /g' \
|
||||
-e 's/<offlineDate>/To: /g' \
|
||||
-e 's/<targetURL>/Video ID: /g' \
|
||||
-e 's/http[^>]*,CmC=//g' \
|
||||
-e 's/,schedu[^>]*html/\n/g' | \
|
||||
sed -e 's/^\s*//' | sed 's/<[^>]*>//g'
|
||||
}
|
||||
|
||||
# We want informations from a show
|
||||
function getinfos
|
||||
{
|
||||
# We get the stuffs
|
||||
XMLLINK="http://plus7.arte.tv$(wget -q -O - http://plus7.arte.tv/ | \
|
||||
grep xmlURL | awk -F'"' '{print $4}')"
|
||||
GETXML=$(wget -q -O - "$XMLLINK" | grep -B 6 "$VIDEO_ID")
|
||||
VIDEOURL=$(echo "$GETXML" | grep "<targetURL>" | sed -e "s/^\s*//" | \
|
||||
sed "s/<[^>]*>//g")
|
||||
|
||||
if [ ! -z "$VIDEOURL" ]; then
|
||||
|
||||
# We want the name and date of the video and the HTML content
|
||||
VIDEOTITLE=$(echo "$GETXML" | grep "<bigTitle>" | sed -e "s/^\s*//" | \
|
||||
sed "s/<[^>]*>//g")
|
||||
VIDEODATE=$(echo "$GETXML" | grep "<startDate>" | sed -e "s/^\s*//" | \
|
||||
sed "s/<[^>]*>//g" | cut -d"T" -f1)
|
||||
VIDEOHTML=$(wget -q -O - "$VIDEOURL")
|
||||
|
||||
# First we get the information
|
||||
HEADLINE=$(echo "$VIDEOHTML" | grep -A 2 '<p class="headline">' | \
|
||||
sed 's/<[^>]*>//g' | sed -e 's/^\s*//')
|
||||
SYNOPSIS=$(echo "$VIDEOHTML" | grep -A 2 '<p class="text">' | \
|
||||
sed 's/<[^>]*>//g' | sed -e 's/^\s*//')
|
||||
INFOS=$(echo "$VIDEOHTML" | grep -A 2 '<p class="info">' | \
|
||||
sed 's/<[^>]*>//g' | sed -e 's/^\s*//' | \
|
||||
sed 's/(//' | sed 's/)/./')
|
||||
|
||||
# And finally we can display them
|
||||
echo -e "Informations for "$bq$VIDEOTITLE$eq" ("$VIDEODATE"):\n"
|
||||
echo -e "Headline --"$HEADLINE"\n"
|
||||
echo -e "Synopsis --"$SYNOPSIS"\n"
|
||||
echo -e "Others --"$INFOS
|
||||
|
||||
else
|
||||
echo "$PROGNAME: there's no show whith the ID $bq$VIDEO_ID$eq"
|
||||
echo "$PROGNAME: please check the show list to get a right ID"
|
||||
echo "$PROGNAME: if your're sure of your ID, then this script might be deprecated"
|
||||
echo "$PROGNAME: or the site may be broken..."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Finally we want to download the wmv file
|
||||
function getfile
|
||||
{
|
||||
# We get the stuffs + we define CONV for a good file renaming
|
||||
XMLLINK="http://plus7.arte.tv$(wget -q -O - http://plus7.arte.tv/ | \
|
||||
grep xmlURL | awk -F'"' '{print $4}')"
|
||||
GETXML=$(wget -q -O - "$XMLLINK" | grep -B 6 "$VIDEO_ID")
|
||||
CONV="y/abcdefghijklmnopqrstuvwxyzéèêçàù/ABCDEFGHIJKLMNOPQRSTUVWXYZEEECAU/"
|
||||
|
||||
if [ ! -z "$GETXML" ]; then
|
||||
|
||||
# We want the name and date of the video ; putting them together
|
||||
VIDEOTITLE=$(echo "$GETXML" | grep "<bigTitle>" | sed -e "s/^\s*//" | \
|
||||
sed "s/<[^>]*>//g" | sed -e $CONV | \
|
||||
tr "[:blank:]" "_")
|
||||
VIDEODATE=$(echo "$GETXML" | grep "<startDate>" | sed -e "s/^\s*//" | \
|
||||
sed "s/<[^>]*>//g" | cut -d"T" -f1)
|
||||
FILERENAME=$VIDEOTITLE"_"$VIDEODATE
|
||||
|
||||
# Now we want the mms link and the original filename
|
||||
VIDEOURL=$(echo "$GETXML" | grep "<targetURL>" | sed -e "s/^\s*//" | \
|
||||
sed "s/<[^>]*>//g")
|
||||
VIDEOLINK=$(wget -q -O - "$VIDEOURL" | grep wmv | grep $VQ | cut -d"\"" -f4)
|
||||
FILEORINAME=$(echo "$VIDEOLINK" | cut -d"/" -f8 | cut -d"." -f1)
|
||||
MMSLINK=$(wget -q -O - "$VIDEOLINK" | grep mms | cut -d"\"" -f2)
|
||||
|
||||
# All stuff ok, we can proceed
|
||||
mimms -r $MMSLINK $FILERENAME"_"$FILEORINAME".wmv"
|
||||
|
||||
else
|
||||
echo "$PROGNAME: there's no show whith the ID $bq$VIDEO_ID$eq"
|
||||
echo "$PROGNAME: please check the show list to get a right ID"
|
||||
echo "$PROGNAME: if your're sure of your ID, then this script might be deprecated"
|
||||
echo "$PROGNAME: or the site may be broken..."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# OK here we go now!
|
||||
|
||||
# Parse command line arguments.
|
||||
while test $# != 0; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
CASE=help
|
||||
shift
|
||||
;;
|
||||
-l|--list)
|
||||
CASE=list
|
||||
shift
|
||||
;;
|
||||
-i|--infos)
|
||||
CASE=infos
|
||||
shift
|
||||
;;
|
||||
-d|--download)
|
||||
CASE=download
|
||||
shift
|
||||
;;
|
||||
-v|--version)
|
||||
echo "$PROGNAME ($VERSION) distributed under Dual Beer-Ware/WTFPLv2"
|
||||
exit 0
|
||||
;;
|
||||
-- ) # Stop option processing
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-? | --* )
|
||||
case "$1" in
|
||||
--*=* ) arg=`echo "$1" | sed -e 's/=.*//'` ;;
|
||||
*) arg="$1" ;;
|
||||
esac
|
||||
exec 1>&2
|
||||
echo "$PROGNAME: unknown or ambiguous option $bq$arg$eq"
|
||||
echo "$PROGNAME: Use $bq--help$eq for a list of options."
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# for every case, do something!
|
||||
case "$CASE" in
|
||||
help)
|
||||
echo "$USAGE" 1>&2
|
||||
exit 0
|
||||
;;
|
||||
list)
|
||||
getlist
|
||||
;;
|
||||
infos)
|
||||
VIDEO_ID=$1
|
||||
getinfos
|
||||
;;
|
||||
download)
|
||||
VIDEO_ID=$1
|
||||
getfile
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
54
arte7dump
54
arte7dump
@ -1,54 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Arte+7 video downloader (french HD version)
|
||||
# Author: Gerome Fournier
|
||||
# Version: 0.3
|
||||
# Date: 2013-09-15
|
||||
# http://foutaise.org/code/
|
||||
|
||||
usage()
|
||||
{
|
||||
local progname=${0##*/}
|
||||
|
||||
cat <<EOF
|
||||
Dump French HD version of a arte+7 video
|
||||
Usage:
|
||||
|
||||
$progname <arte+7 url>
|
||||
|
||||
Example:
|
||||
|
||||
$progname "http://www.arte.tv/guide/fr/047158-000/evasion-fiscale?autoplay=1" > evasion-fiscale.flv
|
||||
EOF
|
||||
}
|
||||
|
||||
if [ "$1" == "-h" ]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Wrong number of arguments" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# walk through several URLs to find the stream
|
||||
link1=$(curl -s "$1" \
|
||||
| grep ALL.json \
|
||||
| head -n1 \
|
||||
| sed -e 's/^.*arte_vp_url="//' -e 's/".*$//')
|
||||
if [ -n "$link1" ]; then
|
||||
json_hd_french=$(curl -s "$link1" \
|
||||
| tr '{' '\n' \
|
||||
| grep '"quality":"HD - 720p".*"versionCode":"\(VF\|VF-STF\|VOF-STF\)"' \
|
||||
| tr ',' '\n')
|
||||
streamer=$(grep '^"streamer"' <<< "$json_hd_french" | cut -d: -f2- | tr -d '"')
|
||||
url=$(grep '^"url"' <<< "$json_hd_french" | cut -d: -f2- | tr -d '"')
|
||||
if [ "${streamer:0:7}" == "rtmp://" ]; then
|
||||
rtmpdump -r "$streamer" -y "mp4:$url"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Unable to find source stream" >&2
|
||||
exit 1
|
@ -1,76 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2010 Mary Gardiner
|
||||
#
|
||||
# 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 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.
|
||||
|
||||
## INFO
|
||||
# This is a very simple script designed to be used when using the email client
|
||||
# mutt remotely. It copies attachments to a web accessible folder and tells you
|
||||
# where to view them.
|
||||
#
|
||||
# More details are available at http://puzzling.org/logs/thoughts/2010/May/6/mutt-attachments
|
||||
|
||||
# if you want to override OUTPUTDIR and VIEWINGDIR edit them here or create a
|
||||
# ~/.copy-to-dir # file that looks like:
|
||||
# OUTPUTDIR=someotherdir
|
||||
# VIEWINGDIR=someother URI
|
||||
|
||||
# You can also optionally specify a location to rsync attachments to,
|
||||
# RSYNCOUTPUTDIR=host:dir
|
||||
# You'll probably want a passphraseless key for this and NO DELETION of rsynced
|
||||
# attachments will take place.
|
||||
|
||||
### Extension
|
||||
# use short generated file name
|
||||
|
||||
OUTPUTDIR=$HOME/public_html/attachments
|
||||
VIEWINGDIR=https://ssl.meutel.net/~meutel/attachments
|
||||
|
||||
CONFIGFILE=$HOME/.copy-to-dir
|
||||
if [ -e "$CONFIGFILE" ]
|
||||
then
|
||||
. "$CONFIGFILE"
|
||||
fi
|
||||
|
||||
if [ -n "$1" ]
|
||||
then
|
||||
if [ -n "$RSYNCOUTPUTDIR" ]
|
||||
then
|
||||
SHORTNAME=`basename "$1"`
|
||||
echo "Uploading attachment $SHORTNAME for viewing"
|
||||
rsync --chmod=ugo+r --progress -ptve "ssh -C" "$1" "$RSYNCOUTPUTDIR"
|
||||
echo
|
||||
echo "View attachment $SHORTNAME at $VIEWINGDIR/$SHORTNAME"
|
||||
elif [ ! -d "$OUTPUTDIR" ]
|
||||
then
|
||||
echo "ERROR: '$OUTPUTDIR' doesn't exist, or is not a directory"
|
||||
else
|
||||
SHORTNAME=`md5sum "$1" | cut -c -4`
|
||||
MIME_TYPE=`file -Lb --mime-type "$1"`
|
||||
# utilisation de l'extension correspondant au type mime
|
||||
FILE_EXT=$(grep $MIME_TYPE /etc/mime.types | awk '{ print $2}')
|
||||
DELETE="$OUTPUTDIR/$SHORTNAME.$FILE_EXT"
|
||||
cp "$1" "$DELETE"
|
||||
# ajoute le type mime dans les attributs etendus
|
||||
attr -s Content-Type -V "$MIME_TYPE" $DELETE > /dev/null
|
||||
chmod 644 "$DELETE"
|
||||
echo "View attachment $SHORTNAME at $VIEWINGDIR/$SHORTNAME.$FILE_EXT"
|
||||
fi
|
||||
fi
|
@ -1,45 +0,0 @@
|
||||
#!/bin/bash
|
||||
# TODO
|
||||
# home (hors données distribuées)
|
||||
# repos git
|
||||
# crypter les données secu
|
||||
# copier vers ftp
|
||||
|
||||
# repertoire contenant les backups
|
||||
BACKUP_DIR=/home/backup
|
||||
BACKUP_CUR=$BACKUP_DIR/current
|
||||
mkdir -p $BACKUP_CUR
|
||||
|
||||
function do_backup {
|
||||
BACKUP_PATH=$1
|
||||
BACKUP_NAME=$2
|
||||
|
||||
BACKUP_FILE=$BACKUP_DIR/$BACKUP_NAME.$(date +%Y%m%d).tar.gz
|
||||
BACKUP_LST=$BACKUP_DIR/$BACKUP_NAME.lst
|
||||
ARCHIVE_DIR=$BACKUP_DIR/$(date +%Y%m%d)
|
||||
# si le lst existe, incremental
|
||||
test -f $BACKUP_LST
|
||||
INCR_BACKUP=$?
|
||||
|
||||
tar cpzf $BACKUP_FILE -C / --listed-incremental=$BACKUP_LST $BACKUP_PATH
|
||||
# TODO crypt
|
||||
|
||||
# si non incremental (cad complet) copie vers repertoire archive
|
||||
if [ $INCR_BACKUP -ne 0 ]
|
||||
then
|
||||
mkdir -p $ARCHIVE_DIR
|
||||
mv $BACKUP_FILE $ARCHIVE_DIR
|
||||
# effacer les backups incrementaux précédents
|
||||
rm -rf $BACKUP_CUR
|
||||
else
|
||||
mv $BACKUP_FILE $BACKUP_CUR
|
||||
fi
|
||||
}
|
||||
|
||||
# /etc
|
||||
do_backup "/etc/" "$(hostname).etc"
|
||||
|
||||
# webapps
|
||||
# TODO pas besoin d'etre root
|
||||
do_backup "/home/www" "$(hostname).www"
|
||||
|
106
batt_status.pl
106
batt_status.pl
@ -1,106 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
##############################
|
||||
# Calcul l'etat de la batterie
|
||||
##############################
|
||||
|
||||
use strict;
|
||||
|
||||
use vars qw(@Batt_Data %Useful);
|
||||
|
||||
# renvoit une liste de hash des valeurs lues (un element par batterie)
|
||||
sub read_proc {
|
||||
my @batts = find_batts();
|
||||
my @Batt_Data;
|
||||
for (@batts) {
|
||||
my $batt_dir = $_;
|
||||
my %h1 = read_Batt_Data($batt_dir.'state');
|
||||
my %h2 = read_Batt_Data($batt_dir.'info');
|
||||
# TODO mieux?
|
||||
my %h = %h1;
|
||||
for my $key ( keys %h2 ) {
|
||||
$h{$key} = $h2{$key};
|
||||
}
|
||||
# le tableau contient une reference au hash
|
||||
push @Batt_Data, {%h};
|
||||
}
|
||||
return @Batt_Data;
|
||||
}
|
||||
|
||||
# lit un fichier de donnees de la batterie dans proc
|
||||
sub read_Batt_Data {
|
||||
my ($file) = @_;
|
||||
|
||||
my %data;
|
||||
#print '>>',$file,"\n";
|
||||
open(DATA, "< $file") or next;
|
||||
while (<DATA>) {
|
||||
if (/^([^:]+):\s+(.+)/){
|
||||
#print "$1 -> $2\n";
|
||||
$data{$1} = $2;
|
||||
}
|
||||
}
|
||||
return %data;
|
||||
}
|
||||
|
||||
# trouve les repertoires d'etat des batteries
|
||||
sub find_batts {
|
||||
my @batts;
|
||||
my $proc_path = '/proc/acpi/battery/';
|
||||
|
||||
# TODO verifier que c'est un repertoire
|
||||
opendir(BATTS, $proc_path) or die "can't open $proc_path: $!";
|
||||
while (defined(my $bat_dir = readdir(BATTS))) {
|
||||
# TODO verifier que c'est un repertoire
|
||||
if ($bat_dir =~ /BAT([0-9])/) {
|
||||
#print $1,$bat_dir,"\n";
|
||||
$batts[$1] = $proc_path.$bat_dir.'/';
|
||||
}
|
||||
}
|
||||
return @batts;
|
||||
}
|
||||
|
||||
# synthetise les donnees utiles
|
||||
sub summarize {
|
||||
# capacite totale des batteries
|
||||
#print $Batt_Data[0]{'present'},"\n";
|
||||
my $total_full_cap = 0;
|
||||
my $total_rem = 0;
|
||||
my $total_rate = 0;
|
||||
for my $href ( @Batt_Data ) {
|
||||
my $cap = $href->{'last full capacity'} || 0;
|
||||
# toujours en mAh ?
|
||||
$total_full_cap += $_ for ( $cap =~ /(\d+) mAh/ );
|
||||
|
||||
#for ( keys %$href ) {
|
||||
#print $_,"\n";
|
||||
#}
|
||||
my $remaining = $href->{'remaining capacity'} || 0;
|
||||
#print $remaining,"\n";
|
||||
$total_rem += $_ for ( $remaining =~ /(\d+) mAh/ );
|
||||
|
||||
my $rate = $href->{'present rate'} || 0;
|
||||
$total_rate += $_ for ( $rate =~ /(\d+) mA/ );
|
||||
}
|
||||
$Useful{'capacity'} = $total_full_cap;
|
||||
$Useful{'remaining'} = $total_rem;
|
||||
$Useful{'rate'} = $total_rate;
|
||||
# temps restant en heures (end of operation)
|
||||
$Useful{'eooTime'} = $total_rem / $total_rate;
|
||||
$Useful{'remainingPerc'} = 100*$total_rem/$total_full_cap;
|
||||
return %Useful;
|
||||
}
|
||||
|
||||
# TODO adapter selon l'OS
|
||||
@Batt_Data = read_proc();
|
||||
summarize();
|
||||
print <<EOL;
|
||||
total full cap $Useful{'capacity'}
|
||||
total remaining cap $Useful{'remaining'}
|
||||
total rate $Useful{'rate'}
|
||||
EOL
|
||||
printf("remaining: %.3f%%\n", $Useful{'remainingPerc'});
|
||||
# TODO formattage delai
|
||||
printf("remaining time: %d min\n", 60 * $Useful{'eooTime'});
|
||||
# TODO heure de fin de fonctionnement
|
||||
# TODO operation en cours (charge, decharge)
|
57
dl_pluzz
57
dl_pluzz
@ -1,57 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Script pour utiliser pluzz.fr
|
||||
# v0.2 (11 juillet 2010)
|
||||
|
||||
if [ $# != 2 ]
|
||||
then
|
||||
printf "Syntaxe: $0 [url|play|record] http://www.pluzz.fr/...\n" >&2
|
||||
exit 1
|
||||
fi
|
||||
command="$1"
|
||||
url="$2"
|
||||
|
||||
if [ "$command" != 'url' -a "$command" != 'play' -a "$command" != 'record' ]
|
||||
then
|
||||
printf "Command must be 'url', 'play' or 'record', not '$command'\n" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
video_page_url=$(wget -qO- "$url" | grep -o 'http://info.francetelevisions.fr/?id-video=[^"]\+')
|
||||
stream_url_part2=$(wget -qO- "$video_page_url" | grep urls-url-video | sed 's/.*content="\(.*\)".*/\1/')
|
||||
ext=${stream_url_part2##*.}
|
||||
|
||||
if [ "$ext" = 'wmv' ]
|
||||
then
|
||||
stream_url_part1='mms://a988.v101995.c10199.e.vm.akamaistream.net/7/988/10199/3f97c7e6/ftvigrp.download.akamai.com/10199/cappuccino/production/publication'
|
||||
elif [ "$ext" = 'mp4' ]
|
||||
then
|
||||
stream_url_part1='rtmp://videozones-rtmp.francetv.fr/ondemand/mp4:cappuccino/publication'
|
||||
else
|
||||
printf "Extension not managed : '$ext'\n" >&2
|
||||
exit 3
|
||||
fi
|
||||
|
||||
stream_url="$stream_url_part1/$stream_url_part2"
|
||||
|
||||
if [ "$command" = "url" ]
|
||||
then
|
||||
printf "$stream_url\n"
|
||||
elif [ "$command" = "play" ]
|
||||
then
|
||||
if [ "$ext" = 'wmv' ]
|
||||
then
|
||||
vlc "$stream_url"
|
||||
else
|
||||
flvstreamer -r "$stream_url" | vlc -
|
||||
fi
|
||||
elif [ "$command" = "record" ]
|
||||
then
|
||||
output_file=${stream_url##*/}
|
||||
printf "Recording to $output_file...\n"
|
||||
if [ "$ext" = 'wmv' ]
|
||||
then
|
||||
vlc "$stream_url" ":sout=#std{access=file,mux=asf,dst=$output_file}"
|
||||
else
|
||||
flvstreamer -r "$stream_url" -o "$output_file"
|
||||
fi
|
||||
fi
|
@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
EARFILE=$1
|
||||
EXTR_DIR=$2
|
||||
|
||||
# tester fichier et repertoire
|
||||
|
||||
# extraire le fichier donné dans le repertoire
|
||||
unzip $EARFILE -d $EXTR_DIR
|
||||
|
||||
# extraire chaque fichier jar, war, sar dans le repertoire temporaire
|
||||
for ar_file in `ls $EXTR_DIR/*.?ar`
|
||||
do
|
||||
TMP_DIR=$EXTR_DIR/.tmp
|
||||
mkdir -p $TMP_DIR
|
||||
|
||||
# suppromer le jar/war/sar du repertoire d'extraction, le remplacer par le repertoire des fichiers extraits
|
||||
unzip $ar_file -d $TMP_DIR
|
||||
rm -f $ar_file
|
||||
mv $TMP_DIR $ar_file
|
||||
done
|
13
fix_wicd.sh
13
fix_wicd.sh
@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# corrige un bug de wicd, un ligne contenant [] apparait dans le fichier de
|
||||
# conf et fait planter le demon
|
||||
# à executer avec les droits root
|
||||
|
||||
# Fichier à corriger
|
||||
CONF_FILE=/etc/wicd/wired-settings.conf
|
||||
# Backup
|
||||
cp $CONF_FILE $CONF_FILE.bak
|
||||
# supprimer les lignes contenant []
|
||||
sed '/\[\]/d' $CONF_FILE.bak > $CONF_FILE
|
||||
/etc/init.d/wicd restart
|
45
mgceleryd
45
mgceleryd
@ -1,45 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# PROVIDE: mgceleryd
|
||||
# REQUIRE: LOGIN cleanvar
|
||||
# KEYWORD: shutdown
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="mgceleryd"
|
||||
rcvar="mgceleryd_enable"
|
||||
|
||||
load_rc_config $name
|
||||
: ${mgceleryd_enable:="NO"}
|
||||
: ${mgceleryd_path:="/usr/local/www/photos.meutel.net/mediagoblin"}
|
||||
: ${mgceleryd_user:="www"}
|
||||
: ${mgceleryd_mgconfig:="$mgceleryd_path/mediagoblin_local.ini"}
|
||||
: ${mgceleryd_config_module:="mediagoblin.init.celery.from_celery"}
|
||||
: ${mgceleryd_logdir:="/var/log/mediagoblin"}
|
||||
: ${mgceleryd_eggcache:="/usr/local/www/.python-eggs"}
|
||||
|
||||
pidfile="/var/run/${name}.pid"
|
||||
required_files="$mgceleryd_mgconfig"
|
||||
required_dirs="$mgceleryd_path $mgceleryd_path/bin $mgceleryd_logdir"
|
||||
|
||||
start_precmd="${name}_prestart"
|
||||
mgceleryd_chdir=$mgceleryd_path
|
||||
command="$mgceleryd_path/bin/celery"
|
||||
command_args=" > $mgceleryd_logdir/${name}_start.log 2>&1 &"
|
||||
command_interpreter="$mgceleryd_path/bin/python"
|
||||
|
||||
mgceleryd_flags=" worker --pidfile $pidfile -f ${mgceleryd_logdir}/${name}.log $mgceleryd_flags"
|
||||
|
||||
mgceleryd_prestart()
|
||||
{
|
||||
touch $pidfile
|
||||
chown $mgceleryd_user $pidfile
|
||||
MEDIAGOBLIN_CONFIG=$mgceleryd_mgconfig
|
||||
export MEDIAGOBLIN_CONFIG
|
||||
CELERY_CONFIG_MODULE=$mgceleryd_config_module
|
||||
export CELERY_CONFIG_MODULE
|
||||
PYTHON_EGG_CACHE="$mgceleryd_eggcache"
|
||||
export PYTHON_EGG_CACHE
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
47
mgpaster
47
mgpaster
@ -1,47 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# PROVIDE: mgpaster
|
||||
# REQUIRE: LOGIN cleanvar
|
||||
# KEYWORD: shutdown
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="mgpaster"
|
||||
rcvar="mgpaster_enable"
|
||||
|
||||
load_rc_config $name
|
||||
: ${mgpaster_enable:="NO"}
|
||||
: ${mgpaster_path:="/usr/local/www/photos.meutel.net/mediagoblin"}
|
||||
: ${mgpaster_user:="www"}
|
||||
: ${mgpaster_pasteini:="paste_local.ini"}
|
||||
: ${mgpaster_logdir:="/var/log/mediagoblin"}
|
||||
: ${mgpaster_eggcache:="/usr/local/www/.python-eggs"}
|
||||
: ${mgpaster_host:="10.42.0.90"}
|
||||
: ${mgpaster_port:="26543"}
|
||||
: ${mgpaster_celery_eager:="false"}
|
||||
|
||||
pidfile="/var/run/${name}.pid"
|
||||
required_files="$mgpaster_path/$mgpaster_pasteini"
|
||||
required_dirs="$mgpaster_path $mgpaster_path/bin $mgpaster_logdir"
|
||||
|
||||
start_precmd="${name}_prestart"
|
||||
mgpaster_chdir=$mgpaster_path
|
||||
command="$mgpaster_path/bin/paster"
|
||||
command_interpreter="$mgpaster_path/bin/python"
|
||||
command_args=" > $mgpaster_logdir/${name}_start.log 2>&1"
|
||||
|
||||
mgpaster_flags=" serve $mgpaster_path/$mgpaster_pasteini --server-name=fcgi \
|
||||
fcgi_host=$mgpaster_host fcgi_port=$mgpaster_port \
|
||||
--pid-file $pidfile --log-file ${mgpaster_logdir}/${name}.log --daemon $mgpaster_flags"
|
||||
|
||||
mgpaster_prestart()
|
||||
{
|
||||
touch $pidfile
|
||||
chown $mgpaster_user $pidfile
|
||||
CELERY_ALWAYS_EAGER=$mgpaster_celery_eager
|
||||
export CELERY_ALWAYS_EAGER
|
||||
PYTHON_EGG_CACHE="$mgpaster_eggcache"
|
||||
export PYTHON_EGG_CACHE
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
# backup mysql base gallery3
|
||||
mysqldump -Q --add-drop-table gallery3 > ~/mysql/mysql_gallery3_$(date +%Y%m%d).sql
|
58
pluzz
58
pluzz
@ -1,58 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Script pour utiliser pluzz.fr
|
||||
# v0.2 (11 juillet 2010)
|
||||
|
||||
if [ $# != 2 ]
|
||||
then
|
||||
printf "Syntaxe: $0 [url|play|record] http://www.pluzz.fr/...\n" >&2
|
||||
exit 1
|
||||
fi
|
||||
command="$1"
|
||||
url="$2"
|
||||
|
||||
if [ "$command" != 'url' -a "$command" != 'play' -a "$command" != 'record' ]
|
||||
then
|
||||
printf "Command must be 'url', 'play' or 'record', not '$command'\n" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
video_page_url=$(wget -qO- "$url" | grep -o 'http://info.francetelevisions.fr/?id-video=[^"]\+')
|
||||
stream_url_part2=$(wget -qO- "$video_page_url" | grep urls-url-video | sed 's/.*content="\(.*\)".*/\1/')
|
||||
ext=${stream_url_part2##*.}
|
||||
|
||||
if [ "$ext" = 'wmv' ]
|
||||
then
|
||||
stream_url_part1='mms://a988.v101995.c10199.e.vm.akamaistream.net/7/988/10199/3f97c7e6/ftvigrp.download.akamai.com/10199/cappuccino/production/publication'
|
||||
elif [ "$ext" = 'mp4' ]
|
||||
then
|
||||
stream_url_part1='rtmp://videozones-rtmp.francetv.fr/ondemand/mp4:cappuccino/publication'
|
||||
else
|
||||
printf "Extension not managed : '$ext'\n" >&2
|
||||
exit 3
|
||||
fi
|
||||
|
||||
stream_url="$stream_url_part1/$stream_url_part2"
|
||||
|
||||
if [ "$command" = "url" ]
|
||||
then
|
||||
printf "$stream_url\n"
|
||||
elif [ "$command" = "play" ]
|
||||
then
|
||||
if [ "$ext" = 'wmv' ]
|
||||
then
|
||||
vlc "$stream_url"
|
||||
else
|
||||
flvstreamer -r "$stream_url" | vlc -
|
||||
fi
|
||||
elif [ "$command" = "record" ]
|
||||
then
|
||||
output_file=${stream_url##*/}
|
||||
printf "Recording to $output_file...\n"
|
||||
if [ "$ext" = 'wmv' ]
|
||||
then
|
||||
#vlc "$stream_url" ":sout=#std{access=file,mux=asf,dst=$output_file}"
|
||||
mplayer $stream_url -dumpstream -dumpfile $output_file
|
||||
else
|
||||
flvstreamer -r "$stream_url" -o "$output_file"
|
||||
fi
|
||||
fi
|
Loading…
Reference in New Issue
Block a user