From 0737a36bddf7479f0c2b1caaa512c71891ca8d1e Mon Sep 17 00:00:00 2001 From: Mauro Torrez Date: Fri, 15 Nov 2019 15:37:12 -0300 Subject: [PATCH] agrego scripts no versionados --- mounter.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ recradio.sh | 6 ++++++ 2 files changed, 67 insertions(+) create mode 100644 mounter.py create mode 100644 recradio.sh diff --git a/mounter.py b/mounter.py new file mode 100644 index 0000000..d88ed37 --- /dev/null +++ b/mounter.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2010 Mauro Torrez. All rights reserved. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# 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, see . + +import json +import pexpect +import subprocess +import errno +import os + +class App: + conffile = os.path.expanduser('~/.config/mounter/settings.json') + configs = None + + def read_config( self ): + try: + with open(self.conffile, 'r') as conf: + self.configs = json.JSONDecoder.decode(conf) + except IOError as e: + if e.errno == errno.ENOENT: + # no existe el archivo. debo crear el archivo de configuración antes + print "No existe el archivo de configuración." + return 1 + elif e.errno == errno.EACCES: + # el archivo existe pero no se puede leer. cagamos.. + print "No se tiene permisos para leer la configuración! Ouch!" + return -1 + + def write_config( self ): + try: + with open(self.conffile, 'w') as conf: + conf.write( json.JSONEncoder.encode(configs) ) + except IOError as e: + if e.errno == errno.EACCES: + # el archivo existe pero no se puede leer. cagamos.. + print "No se tiene permisos para escribir la configuración! Ouch!" + return -1 + + def __init__ (self): + # read config file to set path and disp accordingly, then redraw + out = self.read_config() + if out == 1: + self.first_run() + + + + diff --git a/recradio.sh b/recradio.sh new file mode 100644 index 0000000..ace7441 --- /dev/null +++ b/recradio.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +URL=$1 +RUN=$2 +PRE=$3 +NOW=$(date +%F) +cvlc --run-time=$RUN $URL --sout "#duplicate{dst=std{access=file,mux=raw,dst=$PRE-$NOW.mp3}" vlc://quit ; \ No newline at end of file