Sorry Mike
i found some small problem. I had no shoutcast so i was not sure about the
modification. Now i was able to test and i made some more modifications.

Attached u will find new script working withalso in the log the answer for
each section.
Example:
pypad_shoutcast1.py[27071]: [PyPAD][Shoutcast1] Update exit code: 200
pypad_shoutcast1.py[27077]: [PyPAD][Shoutcast2] Update exit code: 200

Let me know if is working also for you

Regards
Gabriele Fergola


Il giorno sab 18 gen 2020 alle ore 14:38 Mike Cox <mike@rosetta.group> ha
scritto:

> Thanks Gabriele
> I'll give it a try
>
> Mike
>
> Mike Cox
> Managing Director
> The Rosetta Group Ltd
>
> Email: mike@rosetta.group
> Website: www.rosetta.group
> Phone: 01983 229 229
>
> 
>
> Have a look at our new cloud phone system at www.rosettatelecom.com
> See our payment options and pay online by clicking here Pay online
>
> ------------------------------
> *From:* Gabriele Fergola <work...@gmail.com>
> *Sent:* Saturday, January 18, 2020 11:33:52 AM
> *To:* Mike Cox <mike@rosetta.group>
> *Cc:* rivendell-dev@lists.rivendellaudio.org <
> rivendell-dev@lists.rivendellaudio.org>
> *Subject:* Re: [RDD] pypad shows red
>
> Hello Mike,
> please try this version and let me know.
> I had for Icecast and not for Shoutcast so i just modified it for
> shoutcast also.
>
> Regards
> Gariele
>
>
> Il giorno sab 18 gen 2020 alle ore 11:26 Mike Cox <mike@rosetta.group> ha
> scritto:
>
> I found the cart with the problem. It has a back tick instead of an
> apostrophe which the script obviously doesn't like.
>
> I think I'll need to write a MySQL script that checks for characters that
> the Pypad script doesn't like and change them.
>
> I'm not sure how to get my Pypad running again though. Looks like a reboot
> is needed as a systemctl restart rivendell didn't work this time.
>
>
> Mike
> On 18/01/2020 10:10, Mike Cox wrote:
>
> Strangely my Pypad dropped out again and is now showing red.
>
> It last updated at 04:55:59 today which is about 15 hours or so since it
> was last working. There's nothing unusual in our server messages log
> however, this time there is a message in the pypad error log.
>
> Traceback (most recent call last):
>   File "/usr/lib64/rivendell/pypad/pypad_shoutcast1.py", line 81, in
> <module>
>     rcvr.start(sys.argv[1],int(sys.argv[2]))
>   File "/usr/lib64/python3.6/site-packages/pypad.py", line 914, in start
>
> self.__pypad_Process(Update(json.loads(msg),self.__config_parser,rd_config))
>   File "/usr/lib64/python3.6/site-packages/pypad.py", line 787, in
> __pypad_Process
>     self.__pad_callback(pad)
>   File "/usr/lib64/rivendell/pypad/pypad_shoutcast1.py", line 45, in
> ProcessPad
>     curl.setopt(curl.URL,url)
> UnicodeEncodeError: 'ascii' codec can't encode character '\xb4' in
> position 149: ordinal not in range(128)
>
> That suggests that it can't cope with a character in one of the songs. If
> that's the case can we add some sort of string filter to the script to get
> rid of dodgy characters? I'm not a Python king so I'm not sure how to start
> with that one.
>
> Mike
>
>
> On 17/01/2020 14:12, Mike Cox wrote:
>
> Hi Drew
>
> It seems like a great way of setting up Now and Next notifications and was
> easy to set up so that's good news!
>
> 1. Are they updating the same server?
> Yes
> 2. Are they updating different mount points?
> No. Both the same mount point but I've only got one of the servers
> broadcasting so only one should be sending updates.
>
> 3. Is there a limit in the number of sources for the server that is being
> exceeded?
> Don't think so as it works fine now I've restarted Rivendell
>
> 4. " has switched to red" Were both working at one point and one stopped
> for not discernible reason or did one work from the start and one fail from
> the start?
> Yes. They have both been working fine since last night when I built them
> so that's about 16 hours or so.
>
> 5. Which one is working and which one is not? (in relation to which went
> through the "name change")
> Not sure on this one as I can't remember which server I created and which
> on I cloned. It's an agee thing :)
>
> 6.    If you copy the swap the config details between them (let each try
> and update the other's "server") does the problem swap "boxes"?
> As they are both updating the same endpoint on the same server I don't
> think this is relevant although I did try copying the working config to the
> dead server and simply changing the username.
>
> For info, both RD servers are on Proxmox VM instances (CENTOS7). The
> streaming server is Azuracast on a digital ocean droplet.
> Mike
>
> ------------------------------
>
> Mike Cox
> Managing Director
> The Rosetta Group Ltd
>
> Email: mike@rosetta.group
> Website: www.rosetta.group
> Phone: 01983 229 229
>
> <http://www.rosetta.group>
>
> Have a look at our new cloud phone system at www.rosettatelecom.com
>
> See our payment options and pay online by clicking here Pay online
> <http://www.rosetta.group/payment>
>
> On 17/01/2020 14:05, drew Roberts wrote:
>
> Mike,
>
> On Fri, Jan 17, 2020 at 7:38 AM Mike Cox <mike@rosetta.group>
> <mike@rosetta.group> wrote:
>
> Hi all
>
> I have two identical RD 3.02 servers running with the same setups (they
> were cloned off each other and new hostname added).
>
> Everything was working fine but one of the pypad commands
> (pypad_shoutcast1.py) has switched to red and is not updating our
> server. If I click on the Error log button, nothing is showing.
>
> Is there somewhere else I should look for error messages and is there
> some way I can run the script manually to view any errors?
>
> I saw Peter's message about a similar issue but I'm not sure what else
> to do. The other server works fine so I'm not sure why this one is
> playing up.
>
>
> I am not sure about any specifics wet pypad as I have never used it yet
> but may do so as early as today.
>
> Questions:
>
> Are they updating the same server?
> Are they updating different mount points?
> Is there a limit in the number of sources for the server that is being
> exceeded?
> " has switched to red" Were both working at one point and one stopped for
> not discernible reason or did one work from the start and one fail from the
> start?
> Which one is working and which one is not? (in relation to which went
> through the "name change")
> If you copy the swap the config details between them (let each try and
> update the other's "server") does the problem swap "boxes"?
>
> drew
>
>
> Many thanks
>
> Mike
>
> --
> _______________________________________________
> Rivendell-dev mailing list
> Rivendell-dev@lists.rivendellaudio.org
> http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
>
>
>
> --
> Enjoy the *Paradise Island Cam* playing
> *Bahamian Or Nuttin* - https://www.paradiseislandcam.com/
>
>
> _______________________________________________
> Rivendell-dev mailing 
> listRivendell-dev@lists.rivendellaudio.orghttp://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
>
>
> _______________________________________________
> Rivendell-dev mailing 
> listRivendell-dev@lists.rivendellaudio.orghttp://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
>
> _______________________________________________
> Rivendell-dev mailing list
> Rivendell-dev@lists.rivendellaudio.org
> http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
>
>
#!%PYTHON_BANGPATH%

# pypad_shoutcast1.py
#
# Write PAD updates to a Shoutcast 1 instance
#
#   (C) Copyright 2018-2019 Fred Gleason <fr...@paravelsystems.com>
#
#   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.
#

import sys
import syslog
import configparser
import requests
import pypad
from io import BytesIO

def eprint(*args,**kwargs):
    print(*args,file=sys.stderr,**kwargs)

def ProcessPad(update):
    if update.hasPadType(pypad.TYPE_NOW):
        for section in update.config().sections():
            try:
                song=update.resolvePadFields(update.config().get(section,'FormatString'),pypad.ESCAPE_URL)
                url="http://%s:%s/admin.cgi"; % (update.config().get(section,'Hostname'),str(update.config().get(section,'Tcpport')))
                headers = {'user-agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2'}
                payload={'pass': update.escape(update.config().get(section,'Password'),pypad.ESCAPE_URL),
                         'mode': 'updinfo',
                         'song': song,
                         'sid': update.escape(update.config().get(section,'Sid'),pypad.ESCAPE_URL)}
            except configparser.NoSectionError:
                return
            if update.shouldBeProcessed(section):
                try:
                    r = requests.get(url, params=payload, headers=headers)
                    update.syslog(syslog.LOG_INFO,'[PyPAD][%s] Update exit code: %s' % (section,str(r.status_code)))
                except requests.exceptions.RequestException as e:
                    update.syslog(syslog.LOG_WARNING,'[PyPAD][Shoutcast1] Update failed: ' + str(e))

#
# 'Main' function
#
rcvr=pypad.Receiver()
try:
    rcvr.setConfigFile(sys.argv[3])
except IndexError:
    eprint('pypad_shoutcast1.py: USAGE: cmd <hostname> <port> <config>')
    sys.exit(1)
rcvr.setPadCallback(ProcessPad)
rcvr.start(sys.argv[1],int(sys.argv[2]))
_______________________________________________
Rivendell-dev mailing list
Rivendell-dev@lists.rivendellaudio.org
http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev

Reply via email to