Is there a possibility to play files randomly?

Hi,
Is there a possibility to play files randomly?
For example, I have all “Three ???” episodes and I want to play one randomly.

Hi, as far as i know not directly, but… in HowTo: Toniebox as Jukebox [mpd] [teddyCloud] is described how to setup a media server which streams content to the box. maybe that can do that.

Yes, mpd can play randomly as well as never ending stream.

Thanks.
Mpd is only streaming?
Can I stream a random episode with a teddy? Or is it like a radio channel?

Well, mpd provides a (web)stream of your own radio chanel. You can configure your mpd to randomly play titles and/or let it loop for ever and so on…

The tonie on the box triggers teddycloud to play that (web)stream, just like it would be a “live tonie”. So what ever the mpd stream would provide, it will be played on toniebox.

In regards to the question: yes, mpd is only a stream, like a radio channel. And yes although it is only a stream, it can play random episodes. And no, it is not teddy doing that, but mpd. Teddy will only link your stream(playback) with a tonie/custom tag.

I had a similar idea. I wrote a shell script which gets all my “Die drei ???” audiobooks from the Teddycloud library, chooses a random episode and assigns it to a Tonie.

#!/bin/bash
TEDDYCLOUD_IP=192.168.178.11

# check amount of episodes
count=$(curl -s "http://$TEDDYCLOUD_IP/api/fileIndexV2?path=/DDF&special=library" | jq '.files' | jq length)

# roll the dice
r=$(( $RANDOM % $count )); 

# get random episode name
episodeName=$(curl -s "http://$TEDDYCLOUD_IP/api/fileIndexV2?path=/DDF&special=library" | jq -r ".files[$r].name")

# assign episode to tonie (uid)
curl "http://$TEDDYCLOUD_IP/content/json/set/55********0304e0?overlay=582B0A599452" \
  --data-raw "source=lib://DDF/$episodeName"

Now you could run this manually or automatically or maybe once a day. You could also convert it into an iOS shortcut and run it via voice (Siri) or as an automation or even nfc triggered.

2 Likes