agrego scripts no versionados
This commit is contained in:
parent
42d268639d
commit
0737a36bdd
61
mounter.py
Normal file
61
mounter.py
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
6
recradio.sh
Normal file
6
recradio.sh
Normal file
@ -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 ;
|
Loading…
x
Reference in New Issue
Block a user