Thursday, June 18, 2020

Some helpful stuff to make a party online:

https://github.com/theasp/docker-novnc

https://stackoverflow.com/questions/43312975/record-sound-on-ubuntu-docker-image

apt-get update
apt-get install pulseaudio socat
apt-get install alsa-utils

# Start the pulseaudio server
pulseaudio -D --exit-idle-time=-1

# Load the virtual sink and set it as default
pacmd load-module module-virtual-sink sink_name=v1
pacmd set-default-sink v1

# set the monitor of v1 sink to be the default source
pacmd set-default-source v1.monitor
 
 
 
Then use darkice and darksnow to send to icecast2. 

Wednesday, May 6, 2020

CentOS8 and vpnc

VPNC packages are missing from CentOS8 and EPEL 8. Furthermore, recent RPMs from Fedora will not install on CentOS8 because rpm is apparently missing zlib compression support. For this reason, if you want to connect to vpnc I suggest you rebuild the SRPMs. I used:

  NetworkManager-vpnc-1.2.6-4.fc32.src.rpm
and
  vpnc-0.5.3-37.svn550.fc32.src.rpm

And those packages got everything working for me from the command line on CentOS8.

Thursday, April 2, 2020

wiimms tools compile on AArch64 with Fedora 33...

I've downloaded a recent version of Wiimms tools to manipulate WBFS and wii images. https://wit.wiimm.de/

make all failes unless I added this to the LDFLAGS in the Makefile:


-Wl,--allow-multiple-definition
 
 
Thanks to this post: https://github.com/onsi/ginkgo/issues/435

Wednesday, August 21, 2019

Rename export from JB7, Brennan

I found myself having to migrate a MP3 collection off a Brennan JB7. This was good new as the JB7 wasn't fit for purpose in this case. I exported the MP3s, and the catalogue to a text file. I was surprised to discover the JB7 does not apparently use MP3 ID3 tags.

The script below corrects this by applying the catalogue data from the text file to the MP3 metadata. Use at your own risk!

import re
import eyed3
from pathlib import Path

if __name__ == "__main__":

    file = open('jb7_catalogue.txt', 'r')
    big_list = file.read().split('\n')
    cd_dict = {}
    lineno = 1    for line in big_list:
        m = re.match('^(\d)+$', line)
        if m:
            title = big_list[lineno - 2]
            if re.match('^(\d|[A-Z])+$', title):
                title = big_list[lineno - 3]
            artist = title
            if '/' in title:
                artist = title.split(' / ')[0]
                title = title.split(' / ')[1]
            if artist not in cd_dict:
                cd_dict[artist] = {}
            cd_dict[artist][title] = big_list[lineno:lineno+int(line)]
        lineno += 1
    processed = 0    for artist, album in cd_dict.items():
        print("processing {} of {}: {} .".format(processed, len(cd_dict.keys()), artist))
        for title, tracks in album.items():
            print("processing album {}".format(title))
            trackcounter = 0            for track in tracks:
                for f in list(Path("/path/to/brennan/exported/mp3/directory/").rglob("{}.mp3".format(track))):
                    if artist in str(f) and title in str(f):
                        trackcounter += 1                        mp3file = eyed3.load(f)
                        mp3file.initTag()
                        mp3file.tag.artist = artist
                        mp3file.tag.album = title
                        mp3file.tag.title = track
                        mp3file.tag.track_num = trackcounter
                        mp3file.tag.save()
        processed += 1    print("Done" )

Tuesday, October 23, 2018

pycharm debug detecting

I use pycharm. I have a program that works through tasks in parallel. When I'm debugging, however, I want to work though tasks in series. So I have this check to know if I'm running in debug:

    IS_DEBUG = True if __loader__.path.endswith('pydev/pydevd.py') else False

or, you can just use:

 __debug__


Wednesday, July 25, 2018

parse clj

if you've got a lob of Clojure data in a clj file, this gubbins will allow you to ingest it into python using the pyparsing library

            lkey = Suppress(Literal(":")) + Word(printables)
            lvalue = Forward()
            lvalue << (QuotedString(quoteChar='"', escChar='\\')
                       ^ Suppress('[') + Group(OneOrMore(QuotedString('"', escChar='\\'))) + Suppress(']')
                       ^ Suppress('{') + Dict(delimitedList(Group(lkey + lvalue), delim=',')) + Suppress('}'))
            row = Suppress("{") + Dict(delimitedList(Group(lkey + lvalue), delim=',')) + Suppress("}")

you call it with: cljdict = row.parseString(row_of_clj data)

Thursday, March 8, 2018

dockerfile for get_iplayer on Alpine linux

as subject:

FROM alpine:latest

RUN apk update
RUN apk add perl curl git perl-utils perl-dev musl-dev make gcc wget perl-net-ssleay libxml2-dev
RUN curl -L http://cpanmin.us | perl - App::cpanminus
RUN cpanm HTML::Entities JSON::PP LWP LWP::Protocol::https Mojolicious XML::LibXML CGI
RUN git clone https://github.com/get-iplayer/get_iplayer.git
CMD ["/get_iplayer/get_iplayer.cgi", "--getiplayer=/get_iplayer/get_iplayer", "--listen=0.0.0.0", "--port=8080"]