As tu bien installé Xcode (il fait partie des developper tools, non installés par défaut avec macosX mais disponibles sur le cd d'installation de macos X) ?
"port install darkice" ne fonctionnera pas : il y a confusion avec "port install icecast"
Icecast peut être installé par macports :
Code:
port install icecast
En revanche, Darkice ne peut être installé automatiquement par macports car ce dernier ne le distribue plus. Il faut donc l'installer "manuellement" :
Citation
- Je pensais pourvoir installer darkice de la même manière mais darkice n'apparait plus être distribué par macports. Tant pis on va tout faire à la main. - Avant de pouvoir installer Darkice, il faut installer des dépendances (les petits machins qui vont faire l'encodage)
Code:
port install faac port install faad2 port install flac port install id3lib port install lame port install libid3tag port install libvorbis
- On peut installer darkice. On télécharge la source ici, on décompresse le dossier puis avec le terminal, on se positionne dans le dossier
Voici le script que j'ai élaboré (voir plus haut), à enregistrer comme une application en cochant l'option "Rester en arrière plan" (important).
Code:
(* on lance Jack *) do shell script "/usr/local/bin/jackd -R -d coreaudio -r 44100 -p 1024 -o 2 -i 2 &> /dev/null & echo $!" (*on lance Icecast *) do shell script "/opt/local/bin/icecast -c /opt/local/etc/icecast.xml &> /dev/null & echo $!" delay 1 (* on lance darkice *) do shell script "/opt/local/bin/darkice -c /opt/local/etc/darkice.cfg &> /dev/null & echo $!" set numero to result (* on modifie la sortie audio *) tell application "System Preferences" activate set current pane to pane "com.apple.preference.sound" reveal (first anchor of current pane whose name is "output") end tell
tell application "System Events" launch tell process "System Preferences" set theRows to every row of table 1 of scroll area 1 of tab group 1 of window 1 repeat with aRow in theRows if (value of text field 1 of aRow) is equal to "JackRouter" then set selected of aRow to true exit repeat end if end repeat end tell end tell
quit application "System Preferences" (* on fait relier iTunes à Darkice par Jack *) do shell script "/Applications/Jack/Extras/Developer/example-clients/jack_connect iTunes:out1 darkice-" & numero & ":left" do shell script "/Applications/Jack/Extras/Developer/example-clients/jack_connect iTunes:out2 darkice-" & numero & ":right"
(* ceci permet de mettre à jour les metatag à chaque nouveau morceau joué par iTunes*) global newTrack global oldTrack global dLogs
set oldTrack to anything
on idle
tell application "iTunes" if player state is playing then set newTrack to current track if newTrack is not oldTrack then tell application "iTunes" to set currentTrack to name of current track tell application "iTunes" to set currentArtist to artist of current track
set theTextEnc to "" repeat with eachChar in characters of currentArtist set useChar to eachChar set eachCharNum to ASCII number of eachChar if eachCharNum = 32 then set useChar to "+" else if (eachCharNum ≠ 42) and (eachCharNum ≠ 95) and (eachCharNum < 45 or eachCharNum > 46) and (eachCharNum < 48 or eachCharNum > 57) and (eachCharNum < 65 or eachCharNum > 90) and (eachCharNum < 97 or eachCharNum > 122) then set firstDig to round (eachCharNum / 16) rounding down set secondDig to eachCharNum mod 16 if firstDig > 9 then set aNum to firstDig + 55 set firstDig to ASCII character aNum end if if secondDig > 9 then set aNum to secondDig + 55 set secondDig to ASCII character aNum end if set numHex to ("%" & (firstDig as string) & (secondDig as string)) as string set useChar to numHex end if set theTextEnc to theTextEnc & useChar as string end repeat
set theTextEnc2 to "" repeat with eachChar in characters of currentTrack set useChar to eachChar set eachCharNum to ASCII number of eachChar if eachCharNum = 32 then set useChar to "+" else if (eachCharNum ≠ 42) and (eachCharNum ≠ 95) and (eachCharNum < 45 or eachCharNum > 46) and (eachCharNum < 48 or eachCharNum > 57) and (eachCharNum < 65 or eachCharNum > 90) and (eachCharNum < 97 or eachCharNum > 122) then set firstDig to round (eachCharNum / 16) rounding down set secondDig to eachCharNum mod 16 if firstDig > 9 then set aNum to firstDig + 55 set firstDig to ASCII character aNum end if if secondDig > 9 then set aNum to secondDig + 55 set secondDig to ASCII character aNum end if set numHex to ("%" & (firstDig as string) & (secondDig as string)) as string set useChar to numHex end if set theTextEnc2 to theTextEnc2 & useChar as string end repeat
set theURL to "http://admin:hackme@adresseIPduserveurIcecast:8000/admin/metadata.xsl?song=" & theTextEnc & "+-+" & theTextEnc2 & "&mount=%2Fsample96&mode=updinfo&charset=UTF-8" do shell script "curl '" & theURL & "'" end if end if end tell
return 3 end idle
(* si on quitte l'application, on ferme tous les processus en cours et on réaffecte la sortie audio aux préférences habituelles*)
on quit do shell script "killall icecast"
tell application "System Preferences" activate set current pane to pane "com.apple.preference.sound" reveal (first anchor of current pane whose name is "output") end tell
tell application "System Events" launch tell process "System Preferences" set theRows to every row of table 1 of scroll area 1 of tab group 1 of window 1 repeat with aRow in theRows if (value of text field 1 of aRow) is equal to "Haut-parleurs internes" then set selected of aRow to true exit repeat end if end repeat end tell end tell
quit application "System Preferences" do shell script "killall jackd" continue quit end quit
Il semble que depuis quelques jours (semaines ?) le site "allociné" aie modifié ses pages d'information relatives aux films.
J'ai bidouillé un peu ce week end avec "easybox" qui fait également appel à allociné pour acquérir les informations relatives aux films et ai du faire un certain nombre de modifications au script php qui réalise cette tâche (easybox étant en php).
Techniquement, les balises ne sont plus du type <h4>Date :.... mais <h3 class="... de même, la balise "titre" est à présent toujours "titre du fil - allociné".
Je pense donc qu'il faut mettre à jour le script qui récupère les infos d'allociné compte tenu des modifications qu'ils ont apportés à leur page.
Si cela peut aider (mais j'en doute, Homeplayer n'étant pas en php et mon niveau en code doit être risible) je pourrai mettre ici les modifications précises que j'ai apportées au script php d'easybox qui interroge allociné et qui fonctionne.
La solution que j'ai proposée précédemment fonctionne mais présente un désavantage : elle nécessite l'utilisation du logiciel Nicecast qui est payant.
Il existe un moyen de mettre en place une solution similaire mais totalement gratuite. En revanche, il va falloir mettre les mains dans le cambouis.
Donc, pré-requis : avoir installé les Apple Developer tools et si le terminal effraie, ne pas faire ceci.
Principe :
- Nicecast utilise icecast : nous allons donc l'installer. Icecast est un serveur de flux audio ; - Il nous faudra un streamer (c'est à dire un "truc" qui encode le son pour le mettre dans un format lisible par le serveur icecast) : darkice fait ça. Darkice peut être alimenté par un contenu sonore de différentes natures mais pas par iTunes directement (c'eût été trop simple !!). Il faut encore un petit quelque chose qui s'appelle Jack qui va faire le lien entre iTunes et DarkIce.
Résumé :
iTunes joue de la musique récupérée par Jack, qui l'envoie à Darkice. Darkice stream cette musique vers notre serveur Icecast. Dès lors, on pourra accèder depuis sa télévision, une fois Homeplayer lancé, à une radio qui correspond à ce flux.
Installation :
- Jack : pour OSX, disponible ici - icecast : ça se corse. Le plus simple : utiliser macports. - Une fois Macports installé, lancer le terminal. - Pour installer le serveur icecast, entrer la ligne de commande suivante :
Code:
port install icecast
- Vous remarquerez que Macports installe tout dans le répertoire /opt - Je pensais pourvoir installer darkice de la même manière mais darkice n'apparait plus être distribué par macports. Tant pis on va tout faire à la main. - Avant de pouvoir installer Darkice, il faut installer des dépendances (les petits machins qui vont faire l'encodage)
Code:
port install faac port install faad2 port install flac port install id3lib port install lame port install libid3tag port install libvorbis
- On peut installer darkice. On télécharge la source ici, on décompresse le dossier puis avec le terminal, on se positionne dans le dossier
où l'on spécifie un identifiant et un mot de passe qui permettra d'administrer le serveur icecast.
Darkice : son fichier de configuration est darkice.cfg (à coté de icecast.xml). c'est ici qu'on précise à darkice qu'il va recevoir du contenu en provenance de Jack et qu'il doit le streamer vers notre serveur icecast. Voici une porposition de configuration :
Code:
# sample DarkIce configuration file, edit for your needs before using # see the darkice.cfg man page for details
# this section describes general aspects of the live streaming session [general] duration = 0 # duration of encoding, in seconds. 0 means forever bufferSecs = 2 # size of internal slip buffer, in seconds reconnect = yes # reconnect to the server(s) if disconnected
# this section describes the audio input that will be streamed [input] device = jack_auto # OSS DSP soundcard device for the audio input # the string �jack�, to have an unconnected Jack port, # or �jack_auto� to automatically make Jack connect to the first source. sampleRate = 44100 # sample rate in Hz. try 11025, 22050 or 44100 bitsPerSample = 16 # bits per sample. try 16 channel = 2 # channels. 1 = mono, 2 = stereo
# this section describes a streaming connection to an IceCast server # there may be up to 8 of these sections, named [icecast-0] ... [icecast-7] # these can be mixed with [icecast2-x] and [shoutcast-x] sections # [icecast-0] # bitrateMode = cbr # constant bit rate # bitrate = 96 # bitrate of the mp3 stream sent to the server # quality = 0.8 # encoding quality # server = yp.yourserver.com # # host name of the server # port = 8000 # port of the IceCast server, usually 8000 # password = hackme # source password to the IceCast server # mountPoint = sample96 # mount point of this stream on the IceCast server # name = DarkIce trial # # name of the stream # description = This is only a trial # # description of the stream # url = http://www.yourserver.com # # URL related to the stream # genre = my own # genre of the stream # public = yes # advertise this stream?
# this section describes a streaming connection to an IceCast2 server # there may be up to 8 of these sections, named [icecast2-0] ... [icecast2-7] # these can be mixed with [icecast-x] and [shoutcast-x] sections [icecast2-0] bitrateMode = abr # average bit rate format = mp3 # vorbis # format of the stream: ogg vorbis bitrate = 96 # bitrate of the stream sent to the server server = 127.0.0.1 # host name of the server port = 8000 # port of the IceCast2 server, usually 8000 password = hackme # source password to the IceCast2 server mountPoint = iTunesRadio # mount point of this stream on the IceCast2 server name = iTunesRadio # name of the stream description = ITunes depuis mon Mac vers ma télé # description of the stream url = http://192.168.0.14/iTunesRadio # URL related to the stream genre = my own # genre of the stream public = no # advertise this stream?
# this section describes a streaming connection to a ShoutCast server # there may be up to 8 of these sections, named [shoutcast-0] ... [shoutcast-7] # these can be mixed with [icecast-x] and [icecast2-x] sections # [shoutcast-0] # bitrateMode = vbr # variable bit rate mode # quality = 0.5 # encoding quality # server = 127.0.0.1 # # host name of the server # port = 8001 # source port of the ShoutCast server, usually 8001 # password = hackme # source password to the ShoutCast server # name = DarkIce trial # # name of the stream # url = http://www.yourserver.com # # URL related to the stream # genre = my own # genre of the stream # public = yes # advertise this stream? # irc = irc.yourserver.com # # IRC info related to the stream # aim = aim here # AIM info related to the stream # icq = I see you too # # ICQ info related to the stream #
Utilisation - Lancer Jackpilot et lancer le serveur Jack ; - Lancer Icecast via le terminal :
où 192.192.192.192 est à remplacer par l'adresse du mac serveur.
- Depuis la télévision, via Homeplayer, accédez à cette radio.
A venir
Je fournirai ici un script qui permet : - le lancement des services de manière automatique sans avoir à retourner voir cet odieux Terminal ; - la mise à jour des tags (Artistes / Titre) de la musique diffusée par Icecast
10 février 2009 : modifications apportées (soundflower n'est pas nécessaire, mise à jour du lien pour JackosX et quelques points mineurs)
Je suis en train de mettre en place une interface web, qui ressemble beaucoup à celle de l'application d'Apple "Remote" (c'est à dire qui permet de se ballader dans sa bibliothèque iTunes, choisir les morceaux, les playlistes) mais, qui plutôt que de lancer la lecture par iTunes, lancera la lecture par VLC pour rediriger vers la freebox. Cela évitera de passer par la case "streaming".
Dès que j'aurai quelque chose qui tient la route (je suis pas un as hein), je mettrai ici ce que j'obtiens.
Je tiens d'abord à vous féliciter pour Homeplayer. C'est un travail remarquable.
Parmi les usages que j'en fais, il y a l'écoute de ma musique (morceaux mp3) dans mon salon. Bien que vous ayez fait un exploit formidable, se ballafer dans sa collection musicale, choisir un morceau, une playlist etc, semble demeurer assez fastidieux depuis sa télévision pour un bon moment : le html de bas niveau géré par la freebox et sa télécommande spoutnik n'aident pas.
Pour ma part, voici ce que je fais :
- Je lance iTunes - Je lance "Nicecast" qui permet de streamer la musique jouée par iTunes - J'ai ajouté une radio dans homeplayer : http://monadresseip:8000/listen.m3u - J'ai placé cette radio en favori - Depuis ma télévision j'écoute cette "radio" via homeplayer - Je commande iTunes via mon iPhone (mais il y a d'autres télécommandes possibles)
Pour aller un peu plus loin et simuler une airportexpress, j'ai fait un tout petit script accessible une fois iTunes lancé :
Code:
tell application "Nicecast" start broadcast end tell
Donc typiquement, je suis dans iTunes. Je veux passer au salon : je clique sur ce script et hop, la radio est lancée. Il n'y a plus qu'à l'écouter depuis la télévision et homeplayer.
L'écran d etélévision n'est d'ailleurs pas nécessaire mais il permet d'afficher l'artiste, le titre et des images (souvent la pochette).
Voilà, si jamais cela peut servir ou donner des idées.