Archivio mensile 31 January 2021

Escursione Ostiense e Testaccio

Musei chiusi, cinema chiusi, teatri chiusi, locali chiusi, pub chiusi, discoteche chiuse, ristoranti chiusi.. e via dicendo. E allora che si fà? Io questo fine settimana ho cercato di scoprire pezzi della città, di Roma. Grazie all’associazione Ottavo Colle ho scoperta la storia del Rione Testaccio e del quartiere Ostiense (e la differenza di categoria non è casuale) Se volete anche voi scoprire cose, curiosità, posti, io vi consiglio di dare uno sguardo agli appuntamenti dell’associazione Ottavo Colle sul loro sito. Qui vi metto qualche foto

EZSTREAM for streaming

ezstream is a command line source client software that can stream audio with/without reconding to an icecast or shoutcast server.

In its basic mode of operation, it streams media files or data from standard input without reencoding and thus requires only very little CPU resources. It can also use various external decoders and encoders to reencode from one format to another, and then stream the result to an Icecast server. I’m using it to stream a list of mp3 files to a webradio server. My use case is:

I want to stream the podcasts that I host in a folder, with some auto-update mechanism, so that If a new podcast is added, then it’s played (sooner or later).

ezstream can be used for streaming with a configuration file and it can be launched with:

ezstream -c mystream.xml

where mystream.xml is the configuration file

EZSTREAM configuration

ezstream use an xml file for configuration. Mine is very simple and I’ve used a modified version of the example that ezstream itself provides. Here’s the configuration I’m using:

<format>MP3</format>
<filename>/myfolder/playlist.txt</filename>
<stream_once>0</stream_once>

format: is the file format

filename: it’s the name and the path of a text file that contains a path of every single podcast, one per line

stream_once: zero (0) stream and then restart the list, one (1) stream the list once.

In the file there are other configurations: <url>, <sourcepassword>, <svrinfobitrate> but I think these are trivial.

The playlist

ezstream provide a very usefull feature to shuffle a list of file, it’s documented so you can check it with -h flag, and you can run it with:

ezstream -s playlist.txt

this command gets the playlist.txt input file, shuffles it, and sends it to the stdoutput, so it writes the shuffled list to the console. You can redirect the stdoutput to a file so that the list is shuffled. But, to be honest, I need something similar… but different. I want a shuffled version of the list but every X podcast, I want to insert two sounds, two musical cuts. So I’ve used a scripting language to generate the playlist. Unfortunately for you, I’ve used php, but let’s just analyze the logic:

<?php
$baseFolder = "/music/";
$cutArray = array("jingle.mp3","spot.mp3");
$playlistFile = "/myfolder/playlist.txt";
$everySong =3;

if (file_exists($playlistFile)){
    unlink($playlistFile);
}

foreach (glob($baseFolder . '*.mp3', GLOB_NOSORT) as $file) {
     $tmp = basename($file);
     if (strpos($tmp, 'news-automatiche') === false) {
         $allfile[] = $baseFolder . basename($tmp);
     }
}
shuffle($allfile);

$f = fopen($playlistFile, "w+");
foreach ($allfile as $index => $file) {
    if ($index % $everySong == 0) {
        foreach ($cutArray as $sng) {
            fwrite($f, $sng . PHP_EOL);
        }
     }
     fwrite($f, $file . PHP_EOL);
}
fclose($f);

I check if the file exists and, if yes, I delete it. Then I scan the folder $baseFolder for mp3 files and store them in an Array (with full path).

The array is shuffled with shuffle($allfile)

Then I write the playlist file line by line, and with % (mod mathematic operation), every 3 podcast files (defined with the variable $everySong), I write the two musical cut sounds.

Shuffle and update playlist

How can I reload the playlist with the new added podcasts? I’ve written a bash script that I run with cron:

Every 12 hours the cronjob runs the php script to write a new playlist file. This generated playlist file includes all the podcasts, including the added ones. Then, with the usage of sig -HUP signal mechanism of ezstream, I can reload this new playlist.

#!/bin/bash

SERVICE="ezstream"
COMMAND="pidof $SERVICE"
EZSTREAMPID=$(eval $COMMAND)

# Randomize playlist and insert sounds
php createPlaylist.php

 # Rereads the playlist file
kill -HUP $EZSTREAMPID

The main point here is kill -HUP $EZSTREAMPID: this command sends signal -HUP to the running ezstream. This signal:

  1. Rereads the playlist file
  2. Checks, in the new playlist file, where is the current playing podcast file
  3. If the current playing podcast file exists, the next song will be the one below it. Otherwise the next song will be the first of the playlist file

Conclusion

The need for an icecast client player that can stream podcast files with an update functionality is solved with ezstream and some lines of code, easy to read and to configure for your needs.

L’ottimismo VS il realismo

La pagina allegata fornisce dati sui tempi di somministrazione del vaccino anti Covid-19. Il vaccino sembra essere l’unico modo per uscire dalla pandemia, e la vaccinazione di massa indica quando saremo sufficientemente vaccinati per tornare alla “vita di prima“.

La domanda è: Si ma quando? Quanto ci mettiamo a vaccinarci tutti, o almeno il fatidico 70% dell’immunità di gregge?

La risposta è fornita dalla pagina allegata, che potete trovare anche qui che utilizza gli Open Data, ovvero fonti pubbliche di dati, e le elabora per fornirle in maniera leggibile agli utenti. A noi. La pagina si aggiorna in automatico via via che nuovi dati sono a disposizione.

La pagina è obiettiva. Non giudica, non accusa, non fornisce sensazionalismi o titoli acchiappaclick. La pagina si basa sui dati e su proiezioni e modelli matematici verosimili. Estrarre informazione dai dati è il compito e il lavoro del cervello umano.

Katzenjammer del 25 Gennaio 2020

Really Love (feat. Craig David & Digital Farm Animals) – KSI
Wrong – Depeche Mode
Ring My Bell – Anita Ward
Nothin’ but U – SLWJM
Emancipation Of The Mind – Bad Religion
Chase the Sun – Planet Funk
The Bandit – Kings of Leon
Saremo Giovani (feat. Selton) – Bianco
Drops of Jupiter – Train
Felicità (feat. Fulminacci) – Samuel
Dig, Lazarus, Dig!!! – Nick Cave & The Bad Seeds
I Cerchi Degli Alberi – Subsonica
Time is Running Out – Muse
Vivo – Andrea Laszlo De Simone

Katzenjammer 18 gennaio 2020

Coexist – Sonia Stein
Jump – Van Halen
Online Songs – blink-182
Waiting On A War – Foo Fighters
Too Much Information – Duran Duran
Chemtrails Over The Country Club – Lana Del Rey
La Faccia Di Briatore – Ministri
Demoni – Fast Animals and Slow Kids
Frogs – Alice In Chains
All Star – Smash Mouth
Mother – David Bowie
Vedrai, vedrai – Iosonouncane

Katzenjammer 11 Gennaio 2021

Whatsapp ha nuove regole sulla privacy e di privacy abbiamo parlato a Katzenjammer, insieme ad altri argomenti.

Ghost – Emma Holzer
Cocoricò – Samuel Colapesce
Believer – Black Honey
Tell Me What I Said – Kip Macklejar
It Ain’t Easy – Delta Spirit
Tryin’ To Get To Heaven – David Bowie
De Parade – Eefje de Visser
If I Ever Feel Better – Phoenix
By This River – Brian Eno
Mountain Song – Jane’s Addiction
Reason to Believe – Vagabon, Courtney Barnett
Extreme Ways – Moby
Hoppípolla – Sigur Rós