Hi,

This function timetitle is called everytime there is new metadata on
the stream (typically on each new track) to change the metadata. So, I
guess that Xavier's solution is quite close to what you are looking
for because on each track it will rewrite the title according to the
hour. If you want to check when the function is called, you can change
it to:

def timetitle (m)
  print("updating metadata!")
  [("title",
    if 12h-14h then "Lunchtime"
    elsif 6h30-9h then "Breakfast"
    elsif 14h-18h then "Afternoon"
    else "Anytime"
    end
  )]
end

source = map_metadata(timetitle, source)

Cheers,

Sam.

On Sun, Feb 24, 2013 at 10:51 PM, Rob Canning <[email protected]> wrote:
> On 02/24/2013 08:31 PM, Xavier Cazin wrote:
>
> Hi,
>
> map_metadata is probably more suitable. Something along the lines of
>
> def timetitle (m)
>   [("title",
>     if 12h-14h then "Lunchtime"
>     elsif 6h30-9h then "Breakfast"
>     elsif 14h-18h then "Afternoon"
>     else "Anytime"
>     end
>   )]
> end
>
> x = map_metadata(timetitle,x)
>
>
> thats perfect! thank you Xavier.
> i guess that will only evaluate once when the script starts though?
> i need it to check the time every hour for example... am playing with switch
> (maybe completely wrong) i cant seem to get the right syntax
>
> def dometadata ()
> x = map_metadata(timetitle,x)
> print("updating metadata...................")
> end
>
> switch([({0m0s},dometadata)])
> ?
>
> thanks
>
> rob
>
>
>
> Cheers,
> Xavier.
>
> On Sun, Feb 24, 2013 at 2:59 PM, Rob Canning <[email protected]> wrote:
>>
>> hi!
>>
>> how do i rewrite metadata according to time of day?
>>
>>   x = rewrite_metadata([("artist", "The Bot"), ("title","Breakfast")],x)
>>   x = rewrite_metadata([("artist", "The Bot"), ("title","Lunchtime")],x)
>>   x = rewrite_metadata([("artist", "The Bot"), ("title","Afternoon")],x)
>>
>> can this be done internally with the switch style scheduler?
>> {14h-15h} etc
>>
>> rob
>>
>
> -- Xavier Cazin
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> Savonet-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/savonet-users
>

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to