Yes, it was my first try, i even replace request.dynamic by playlist.safe...
Here is my php script (i just add the annotate yesterday...)
<?php
$link = mysql_connect('localhost', 'user', 'pass') or die('Impossible de se
connecter : ' . mysql_error());
mysql_select_db('lgt') or die('Impossible de sélectionner la base de données');
//Logique de sélection de base sur random...
$query = 'SELECT ID, songtype, duration, artist, title, filename FROM songs
WHERE songtype=\'S\' and weight > 10 and RAND() > 0.9 ORDER BY RAND() LIMIT 1';
$result = mysql_query($query) or die('Échec de la requête : ' . mysql_error());
if (!$result) { die('Impossible d\'exécuter la requête :' . mysql_error());}
$ID = utf8_encode(mysql_result($result, 0, 'ID'));
$songtype = utf8_encode(mysql_result($result, 0, 'songtype'));
$duration = utf8_encode(mysql_result($result, 0, 'duration'));
$artist = utf8_encode(mysql_result($result, 0, 'artist'));
$title = utf8_encode(mysql_result($result, 0, 'title'));
$filename = utf8_encode(mysql_result($result, 0, 'filename'));
echo
utf8_encode("annotate:ID=\"$ID\",songtype=\"$songtype\",duration=\"$duration\",artist=\"$artist\",title=\"$title\":$filename");
mysql_free_result($result);
mysql_close($link);
?>
In summary
this snippet works well (with playlist.safe but not with playlist only):
flux =
rotate(weights=[1,1],[playlist.safe("/pathtofile/"),playlist.safe("/pathtofile/")])
flux = crossfade(flux)
But this one stream blank (or whatever you put in the fallback) :
flux =
rotate(weights=[1,1],[request.dynamic(myrequest),request.dynamic(myrequest)])
flux = crossfade(flux)
I think the problem come from clock affectation (just a supposition, i'm quite
new on liquidsoap, i'm still in a kind of discovery stage with this soft...)
Because i read somewhere in the documentation that the cross operator is only
possible between track of the same source, or between source sharing the same
clock.
At least it's what i understand, perhaps i make confusion... Nevertheless i'm
still searching...
Thanks
MrChrisCool
www.lagrossetambouille.com
----- Mail original -----
De: "Romain Beauxis" <[email protected]>
À: [email protected]
Cc: [email protected]
Envoyé: Lundi 10 Décembre 2012 16:27:10
Objet: Re: [Savonet-users] Crossfading
Hi,
2012/12/9 <[email protected]>
>
> Finally, after several headache, i decided to play whith
> the queue only, because i noticed that liquidsoap process well
> the crossfade between track of the same queue...
> (just my opinion, i just can't stand what liquidsoap do internally)
>
> So i transform the script to push a new track to the queue
> each time a track is played. And i use a server variable
> to do the rotation.
>
> Full script :
>
>
> set("log.file",true)
> set("log.level",3)
> set("log.file.path","/home/radio/log/test.log")
> set("server.telnet",true)
>
> nbtrack = interactive.float("nbtrack",0.)
>
> def Titre() =
> result = get_process_output("php /var/www/titre.php")
> request.create(result)
> end
>
> def Jingle() =
> result = get_process_output("php /var/www/jingle.php")
> request.create(result)
> end
>
> def crossfade(~conservative=true,s)
> s = fade.in(duration=5.,s)
> s = fade.out(duration=5.,s)
> fader = fun (a,b) -> add(normalize=false,[b,a])
> cross(conservative=conservative,duration=3.,fader,s)
> end
>
> flux = request.queue(id="titrequeue",interactive=true,queue=[Titre()])
>
> def AddTitre(m)
> cnt = nbtrack() + 1.
> if cnt > 5. then
> ignore(server.execute("var.set nbtrack = 0."))
> result = get_process_output("php /var/www/jingle.php")
> ignore(server.execute("#{source.id(flux)}.push #{result}"))
> else
> ignore(server.execute("var.set nbtrack = #{cnt}"))
> result = get_process_output("php /var/www/titre.php")
> ignore(server.execute("#{source.id(flux)}.push #{result}"))
> end
> log(label="ON TRACK",level=3,"Track count #{cnt}")
> end
>
> flux = on_track(AddTitre(), flux)
>
> flux = crossfade(flux)
>
> flux = fallback(track_sensitive=false,[flux,blank()])
>
> output.icecast(%mp3, host="127.0.0.1", port=8000, mount="/",
> protocol="icy", encoding="ISO-8859-1", user="source", password="test", flux)
>
>
> But i still don't understant why the following snippet don't do the trick
> :
>
> flux =
> rotate(weights=[1,1],[request.dynamic(request1),request.dynamic(request2)])
> flux = crossfade(flux)
>
>
> Hope this help
Well.. :-)
I am quite suspicious of the php script being used. Have you tried
with request.dynamic sources but using a dummy script like "echo
/path/to/file.mp3" ?
Romain
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users