Configurazione di Gnump3d su Linux, Hacking

Categorie: Web Radio
Commenti: Nessun Commento
Pubblicato il: 20 novembre 2007

50 lire del 1938
Cinquantesimo articolo dedicato alle web radio.

Questo è l’ultimo articolo (ed è bello che sia anche il 50°) a parlare di gnump3d.conf. Il file è finito, lo abbiamo discusso in lungo e in largo. Gli articoli dedicati a gnump3d, successivi a questo, si occuperanno di altri file e configurazioni non standard.

##
# HACKING – atypical configuration follows, this will not be of
# interest to casual users.
#
# Dragons lie yonder … ->
#
#####

Noi non siamo utenti casuali. ;)

# When files are served there needs to be an appropriate mime type
# sent along with them, this allows the browser to pass the response
# back to an MP3 player, etc.

Quando sono disponibili dei files, è necessario impostare loro un mime type, (ne abbiamo parlato in precedenza), affinchè si permetta ai browser di trasferire la chiamata a un programma apposito come un player mp3.

# Most Unix systems will have the file ‘/etc/mime.types’ which is
# used by default. If not point this next file to wherever your mime
# types file is located:
#
mime_file = /etc/gnump3d/mime.types
#

Molti sistemi unix hanno un file types all’interno di /etc, noi abbiamo la possibilità di impostare un file che sarà utilizzato da gnump3d.

# This next setting controls where the file types are looked up.
# we support many audio, visual, and playlist files and to do this
# we need to be able to lookup a file to determine what kind of
# file it is.
#
# Here is the lookup file.
file_types = /etc/gnump3d/file.types

Puoi settare in questa riga il path del file che conterrà tutte le estensioni supportate come files da streammare.

# In order to record which songs are currently being played the server
# will create a temporary file containing that path of each file that
# it is serving.
#
# The path under which these files are created in may be set here.
#
now_playing_path = /var/cache/gnump3d/serving

All’interno di questo file troveremo tutte le canzoni che sono trasmesse in un determinato momento. E’ possibile modificare il path a piacimento.

# As a speedup and optimisation song tag is read via a companion script
# which is called ‘gnump3d-index’. This will be run automatically when
# the server starts if possible.
#
# This next setting controls where that script will write its tag database
# to.
#
tag_cache = /var/cache/gnump3d/song.tags

Non ne abbiamo ancora parlato, ma corredato a gnump3d esiste anche uno script chiamato gnump3d-index che si occupa di indicizzare i tag delle canzoni. Tali tag vengono salvati in un file che potete tranquillamente settare.

# This next setting allows you to control the path to the gnump3d-index
# script which is used, as explained above.
#
# Normally you shouldn’t need to touch this.
#
# index_program = /usr/bin/gnump3d-index

Questa riga, se decommentata indica a gnump3d l’indirizzo in cui può trovare lo script gnump3d-index.

# This setting controls whether we should stream song title
# information in shoutcast format.
#
# If your client supports it then you should enable it, otherwise
# not.
#
# (This works correctly on WinAmp, and XMMS.)
#
shoutcast_streaming = 1

Questa opzione permette di streammare i metadati nello stesso modo in cui lo fa shoutcast. Probabilmente Steve è a conoscenza dei metodi di trasmissione dei metadati del protocollo icy, il che fa di lui uno dei miei migliori amici.

# By default the server logfile is appended to when we start.
#
# If you set the following value to ’1′ the logfile will be truncated
# instead.
#
# You might want to truncate the file to save space, but doing this
# renders the server statistics less useful.
#
# truncate_log_file = 0

Il log del server viene incollato alla fine del log precedente. Se per motivi di spazio sul disco, preferisci che esso venga troncato, decommenta l’ultima riga e imposta ad 1.

# By default the server will close a connection it receives if it
# hasn’t received a valid request after 10 seconds.
#
# Here you may change this timeout value.
#
# read_time = 10

Tempo di timeout in secondi.

#
# This next section controls whether we present a HTML interface
# to the server.
#
# In most situations you will want to do this – but some people have
# approached me and suggested that it should be tweakable, so here’s
# the option to disable the browsing of the music
#
# If you set this to ’0′ the best you can probably do is call
# ‘http://server:port/recurse.m3u’ – or similar.
#
# enable_browsing = 1

Da quello che si evince nel commento di Steve, qualcuno gli ha consigliato di impostare un flag di visibilità alla pagina web del server. Inutile dire che questa è stata una mano santa!

Nel caso in cui non siamo interessati ad un server di streaming on demand, ma unicamente ad una web radio, possiamo dare solo l’indirizzo http://server:porta/recurse,m3u o similari e fare radio!

In più, ma io sono solo un po’ malizioso, questo è un metodo MOLTO semplice per evitare problemi di visualizzazione da parte di qualche agente siae senza niente da fare.

# This next value controls whether we should believe, and use, the
# client supplied ‘Host:’ header.
#
# This header is sent by HTTP/1.1 clients only, and could be spoofed.
# You’ll only NEED to use it if tunnelling over SSH or performing similar
# magic.
#
# It’s enabled here because I don’t believe it should cause any real harm
# YMMV.
#
use_client_host = 1

Vuoi che le richieste inviino l’header HOST, che è una peculiarità di HTTP/1.1 ?
Non è un’opzione di profondo interesse se non si realizzano tunnel ssh o altre hackerate. Se lo fate, fatemi sapere, io purtroppo non ho molto tempo (e credo nemmeno le capacità tecniche)

# Set this option to rewrite the hostname:port combination in the URLs in
# your playlist. Most people won’t need this unless they are proxying
# their connection or running multiple streaming servers through a load
# balancer or DNS rotor.
#
# Note: If you set this you will almost certainly need to set
# “use_client_host=0″
##
# host_rewrite = “”

Vuoi che la tua playlist abbia un indirizzo per ciascun file diverso da server:porta, magari perchè usi un server proxy? lo puoi fare decommentando la riga host_rewrite. In più può esserti utile settare a 0 l’opzione precedente, ovvero use_client_host.

# This is an experimental feature – ignore it.
#
# It does not work.
#
# Ignore it: You are not expected to understand this (I’ve always wanted
# to leave that as a comment somewhere ;)
#
##
#
# jukebox_mode = 1
# jukebox_player = /usr/bin/mpg123 $FILENAME
#
##

Steve è un burlone incredibile, oltre che un bravo ragazzo davvero. Ha lasciato un opzione sperimentale che non serve a nulla, si chiama modalità jukebox, ed effettivamente, non fa niente se decommentata, ci fa anche notare che non siamo in grado di capirla ;)

UPDATE: prendiamo maggiore spunto (avevo questo nodo al fazzoletto) dalle man pages. Effettivamente, come mi facevano notare dalla regia, non è vero che questa opzione non fa niente, ma Steve ne parla così nella man page del file conf:

This is an experimental mode whereby all the songs that users select
are played back upon your GNUMP3d server – and not streamed at all.
It’s not been tested very much and is included purely to demonstrate
that such a thing is possible. It may disappear with no notice unless
there is sufficient interest in it.
Set this to ’1’ to enable it, but be sure to set ’jukebox_player’ to
point to an appropriate playback binary.

Sostanzialmente, il settaggio di questa opzione, permette di sfruttare un programma situato all’interno del server, in modo che funzioni esattamente come un jukebox. Il path del file binario che verrà sfruttato per riprodurre il file è nella seconda riga, ovvero jukebox_player.

# Make it possible to hide song tags, and just display filenames.
#
##
# hide_song_tags = 0

Non te ne frega niente di fare mostrare i tag delle canzoni? Decommenta l’ultima riga.

# Make it possible to disable the tag cache altogether, to save memory.
#
##
# disable_tag_cache = 0

Vuoi anche disabilitare la tag cache? Magari per salvare spazio? Decommenta l’ultima riga.

# This option allows you to insert a custom META-tag inside the header of
# each page which is output.
#
# You can add whatever you like here, perhaps the most useful thing to
# add is an encoding type.
#
# add_meta_tag =
# add_meta_tag =
##

Queste opzioni ti permettono di aggiungere dei tag meta, all’interno della sezione head di ciascuna pagina web visualizzata tramite gnump3d. Chi ci dice che non possiamo inserire anche tag diversi dai meta? ;) Proverò, appena avrò un attimo di tempo.


Condividilo
Nessun Commento - Lascia un commento

Lascia un commento

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *

*

È possibile utilizzare questi tag ed attributi XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">


Benvenuto , oggi è sabato, 11 febbraio 2012