diff --git a/apis/PyPAD/examples/pypad_icecast2.py b/apis/PyPAD/examples/pypad_icecast2.py deleted file mode 100755 index 34baaaa8..00000000 --- a/apis/PyPAD/examples/pypad_icecast2.py +++ /dev/null @@ -1,100 +0,0 @@ -#!%PYTHON_BANGPATH% - -# pypad_icecast2.py -# -# Send PAD updates to Icecast2 mountpoint -# -# (C) Copyright 2018 Fred Gleason -# -# 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. -# - -from __future__ import print_function - -import os -import sys -import socket -import requests -from requests.auth import HTTPBasicAuth -import xml.etree.ElementTree as ET -import syslog -import PyPAD -import configparser - -def eprint(*args,**kwargs): - print(pypad_name+': ',file=sys.stderr,end='') - print(*args,file=sys.stderr) - syslog.syslog(syslog.LOG_ERR,*args) - -def iprint(*args,**kwargs): - print(pypad_name+': ',file=sys.stdout,end='') - print(*args,file=sys.stdout) - syslog.syslog(syslog.LOG_INFO,*args) - -def isTrue(string): - l=['Yes','On','True','1'] - return string.lower() in map(str.lower,l) - -def ProcessPad(update): - if update.hasPadType(PyPAD.TYPE_NOW): - n=1 - while(True): - section='Icecast'+str(n) - try: - values={} - values['mount']=update.config().get(section,'Mountpoint') - values['song']=update.resolvePadFields(update.config().get(section,'FormatString'),PyPAD.ESCAPE_URL) - values['mode']='updinfo' - iprint('Updating '+update.config().get(section,'Hostname')+': song='+values['song']) - url="http://%s:%s/admin/metadata" % (update.config().get(section,'Hostname'),update.config().get(section,'Tcpport')) - try: - response=requests.get(url,auth=HTTPBasicAuth(update.config().get(section,'Username'),update.config().get(section,'Password')),params=values) - response.raise_for_status() - except requests.exceptions.RequestException as e: - eprint(str(e)) - n=n+1 - except configparser.NoSectionError: - if(n==1): - eprint('No icecast config found') - return - -# -# Program Name -# -pypad_name=os.path.basename(__file__) - -# -# Open Syslog -# -syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_DAEMON) - - -# -# Create Send Socket -# -send_sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) - -# -# Start Receiver -# -rcvr=PyPAD.Receiver() -try: - rcvr.setConfigFile(sys.argv[1]) -except IndexError: - eprint('You must specify a configuration file') - sys.exit(1) -rcvr.setCallback(ProcessPad) -iprint('Started') -rcvr.start("localhost",PyPAD.PAD_TCP_PORT) -iprint('Stopped') diff --git a/apis/PyPAD/examples/pypad_tunein.py b/apis/PyPAD/examples/pypad_tunein.py deleted file mode 100755 index 75039032..00000000 --- a/apis/PyPAD/examples/pypad_tunein.py +++ /dev/null @@ -1,106 +0,0 @@ -#!%PYTHON_BANGPATH% - -# pypad_tunein.py -# -# Send PAD updates to TuneIn -# -# (C) Copyright 2018 Fred Gleason -# -# 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. -# - -from __future__ import print_function - -import os -import sys -import socket -import requests -import xml.etree.ElementTree as ET -import syslog -import PyPAD -import configparser - -def eprint(*args,**kwargs): - print(pypad_name+': ',file=sys.stderr,end='') - print(*args,file=sys.stderr) - syslog.syslog(syslog.LOG_ERR,*args) - -def iprint(*args,**kwargs): - print(pypad_name+': ',file=sys.stdout,end='') - print(*args,file=sys.stdout) - syslog.syslog(syslog.LOG_INFO,*args) - -def isTrue(string): - l=['Yes','On','True','1'] - return string.lower() in map(str.lower,l) - -def ProcessPad(update): - if update.hasPadType(PyPAD.TYPE_NOW): - n=1 - while(True): - section='Station'+str(n) - try: - values={} - values['id']=update.config().get(section,'StationID') - values['partnerId']=update.config().get(section,'PartnerID') - values['partnerKey']=update.config().get(section,'PartnerKey') - values['title']=update.resolvePadFields(update.config().get(section,'TitleString'),PyPAD.ESCAPE_URL) - values['artist']=update.resolvePadFields(update.config().get(section,'ArtistString'),PyPAD.ESCAPE_URL) - values['album']=update.resolvePadFields(update.config().get(section,'AlbumString'),PyPAD.ESCAPE_URL) - iprint('Updating TuneIn: artist='+values['artist']+' title='+values['title']+' album='+values['album']) - try: - response=requests.get('http://air.radiotime.com/Playing.ashx',params=values) - response.raise_for_status() - except requests.exceptions.RequestException as e: - eprint(str(e)) - else: - xml=ET.fromstring(response.text) - status=xml.find('./head/status') - if(status.text!='200'): - eprint('Update Failed: '+xml.find('./head/fault').text) - n=n+1 - except configparser.NoSectionError: - if(n==1): - eprint('No station config found') - return - -# -# Program Name -# -pypad_name=os.path.basename(__file__) - -# -# Open Syslog -# -syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_DAEMON) - - -# -# Create Send Socket -# -send_sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) - -# -# Start Receiver -# -rcvr=PyPAD.Receiver() -try: - rcvr.setConfigFile(sys.argv[1]) -except IndexError: - eprint('You must specify a configuration file') - sys.exit(1) -rcvr.setCallback(ProcessPad) -iprint('Started') -rcvr.start("localhost",PyPAD.PAD_TCP_PORT) -iprint('Stopped') diff --git a/conf/pypad_icecast2.conf b/conf/pypad_icecast2.conf deleted file mode 100644 index 55dcddf5..00000000 --- a/conf/pypad_icecast2.conf +++ /dev/null @@ -1,108 +0,0 @@ -; pypad_icecast2.conf -; -; This is the sample configuration file for the 'pypad_icecast2.py' module for -; Rivendell, which can be used to update the metadata on an Icecast2 -; mountpoint using Now & Next data. - - -; Section Header -; -; One section per Icecast2 mountpoint is configured, starting with -; 'Icecast1' and working up consecutively -[Icecast1] - -; User Name -; -; The username of the Icecast2 account to which to send updates. -Username=source - -; Password -; -; The password of the Icecast2 account to which to send updates. -Password=hackme - -; Host Name -; -; The fully-qualified domain name or IP address of the Icecast2 server -Hostname=icecast.example.com - -; Host Port -; -; The TCP port number of the Icecast2 server -Tcpport=8000 - -; Mountpoint -; -; The Icecast2 mountpoint -Mountpoint=/audio.mp3 - -; Format String. The metadata to be sent each time RDAirPlay changes -; play state, including any wildcards as placeholders for metadata values. -; -; The list of available wildcards can be found in the 'metadata_wildcards.txt' -; file in the Rivendell documentation directory. -; -FormatString=%t - -; Log Selection -; -; Set the status for each log to 'Yes', 'No' or 'Onair' to indicate whether -; state changes on that log should be output to this account. If set -; to 'Onair', then output will be generated only if RDAirPlays OnAir flag -; is active. -MasterLog=Yes -Aux1Log=Yes -Aux2Log=Yes -VLog101=No -VLog102=No -VLog103=No -VLog104=No -VLog105=No -VLog106=No -VLog107=No -VLog108=No -VLog109=No -VLog110=No -VLog111=No -VLog112=No -VLog113=No -VLog114=No -VLog115=No -VLog116=No -VLog117=No -VLog118=No -VLog119=No -VLog120=No - - -; Additional Icecast2 mountpoints can be configured by adding new sections... -;[Icecast2] -;Username=source -;Password=letmein -;Hostname=anotherone.example.com -;Tcpport=80 -;Mountpoint=moreaudio.mp3 -;FormatString=%t by %a -;MasterLog=Yes -;Aux1Log=No -;Aux2Log=Onair -;VLog101=No -;VLog102=No -;VLog103=No -;VLog104=No -;VLog105=No -;VLog106=No -;VLog107=No -;VLog108=No -;VLog109=No -;VLog110=No -;VLog111=No -;VLog112=No -;VLog113=No -;VLog114=No -;VLog115=No -;VLog116=No -;VLog117=No -;VLog118=No -;VLog119=No -;VLog120=No diff --git a/conf/pypad_tunein.conf b/conf/pypad_tunein.conf deleted file mode 100644 index f607c033..00000000 --- a/conf/pypad_tunein.conf +++ /dev/null @@ -1,108 +0,0 @@ -; pypad_tunein.conf -; -; This is the sample configuration file for the 'pypad_tunein' module for -; Rivendell, which can be used to update the metadata at TuneIn -; server using Now & Next data. -; - - -; Section Header -; -; One section per TuneIn station is configured, starting with -; 'Station1' and working up consecutively -[Station1] - - -; StationID -; -; The Station ID of the TuneIn station to which to send updates. -StationID=s123456 - - -; PartnerID -; -; The Partner ID of the TuneIn station to which to send updates. -PartnerID=changeme - - -; PartnerKey -; -; The Partner Key of the TuneIn station to which to send updates. -PartnerKey=changeme - - -; Metadata String. The metadata fields to be sent each time RDAirPlay changes -; play state, including any wildcards as placeholders for metadata values. -; -; The list of available wildcards can be found in the 'metadata_wildcards.txt' -; file in the Rivendell documentation directory. -; -TitleString=%t -ArtistString=%a -AlbumString=%l - - -; Log Selection -; -; Set the status for each log to 'Yes', 'No' or 'Onair' to indicate whether -; state changes on that log should be output to this station. If set -; to 'Onair', then output will be generated only if RDAirPlays OnAir flag -; is active. -MasterLog=Yes -Aux1Log=Yes -Aux2Log=Yes -VLog101=No -VLog102=No -VLog103=No -VLog104=No -VLog105=No -VLog106=No -VLog107=No -VLog108=No -VLog109=No -VLog110=No -VLog111=No -VLog112=No -VLog113=No -VLog114=No -VLog115=No -VLog116=No -VLog117=No -VLog118=No -VLog119=No -VLog120=No - - -; Additional TuneIn stations can be configured by adding new -; sections... -; -;[Station2] -;StationID=s654321 -;PartnerID=changeme -;PartnerKey=changeme -;TitleString=%t -;ArtistString=%a -;AlbumString=%l -;MasterLog=No -;Aux1Log=Yes -;Aux2Log=No -;VLog101=No -;VLog102=No -;VLog103=No -;VLog104=No -;VLog105=No -;VLog106=No -;VLog107=No -;VLog108=No -;VLog109=No -;VLog110=No -;VLog111=No -;VLog112=No -;VLog113=No -;VLog114=No -;VLog115=No -;VLog116=No -;VLog117=No -;VLog118=No -;VLog119=No -;VLog120=No