We have moved to a new Sailfish OS Forum. Please start new discussions there.
2

Random ringtone everytime

asked 2018-07-29 15:43:45 +0300

Malakay gravatar image

updated 2018-08-22 10:36:00 +0300

jiit gravatar image

Hi everyone, I have a question - is there any app that randomly changes ringtones? The point is if I set one ringtone, after a while it starts boring me. So my idea is that you make some folder, copy ringtones in mp3 for example, go to ringtone settings and select app as ringtone. when someone calls, the app will randomly choose ringtone and starts ringing.next tme app will randomly choose another ringtone. does it exist? or is someone able to do it?

edit retag flag offensive close delete

Comments

This might do something similar; https://openrepos.net/content/schturman/auto-ambience-changer as each ambience has a different ringtone.

Spam Hunter ( 2018-07-29 16:47:36 +0300 )edit

yeah, i have tried this already, but i had to spent much time with setting up for example 8 ambiences (same ambiances, but another ringtone), my solution could be better.you can simply put desired files in one folder and tell the app where folder is.This app will be listed between ringtones as Custom Ringtone - you will set it as ringtone in current ambience and whenever someone calls, app will choose custom ringtone and start ringing. I think this is much more easy to set up than make x ambiances only because another ringtone.

Malakay ( 2018-07-29 18:29:01 +0300 )edit

noone knows about any solution? :(

Malakay ( 2018-08-09 20:47:00 +0300 )edit
2

The script should be pretty simple. Problem here is triggering the script after hunging up every call, which is beyond my knowledge; or just running the script every X minutes/hours. If you choose the later, there are several options: systemd scheduler doesn't work when the phone is sleeping and I've found 'timedclient-qt5" rather unstable. So the only remaining choice is CRON; better 'Sailcron' for you, since it's got a graphical interface (available through Openrepos), which needs 'Vixiecron' (also at Openrepos, same repository).

If you want to try, as for the script, I've just run this one on my Sailfish X and it works flawlessly:

#!/bin/bash

# This script changes custom ringtone at given intervals,
# configurable by CRON options. Tones must be MP3 files.

# This is the folder you are putting your MP3 ringtones in.
# Subfolders are also scanned.
FOLDER='/home/nemo/Music/ringtones'

# This is the bogus MP3 file (actually, it's just a soft link)
# you need to point at in Settings>Sounds>Ringtone.
BOGUSMP3='/home/nemo/Music/randomringtone.mp3'

COLLECTION=$(find $FOLDER -type f -name "*.mp3")
TOTALMP3=$(echo "$COLLECTION" | wc -l)

while :; do
        RANDOMNUMBER=$(( RANDOM % TOTALMP3 ))
        RANDOMMP3=$(awk 'NR=='${RANDOMNUMBER}<<<"$COLLECTION")

        [[ -f "$RANDOMMP3" ]] && break
done

ln -f -s "$RANDOMMP3" "$BOGUSMP3"

You must save it somewhere (my scripts are at /home/nemo/bin) and give it execute permission. If you don't have developer mode enabled, try File Browser app. Next should be download and install Sailcron and Vixiecron. Tell me if you're interested.

Mced ( 2018-08-16 18:46:44 +0300 )edit

yeas, i am interested :) but i have a little knowledge about linux

Malakay ( 2018-08-21 23:19:52 +0300 )edit

4 Answers

Sort by » oldest newest most voted
2

answered 2018-08-22 15:55:34 +0300

Levone1 gravatar image

updated 2018-08-22 17:52:26 +0300

Got it working, using Evil Doer, and script above, by Mced.

  1. Install and set up Evil Doer. Instructions are in notes on Openrepos page, butI had to modify the instructions a little - to install pexpect, 'pip3 install dbus pexpect' didn't work for me, but simply 'pip install pexpect' did. Also, I didn't run --interactiveschedule until everything else was set up and ready. --interactiveschedule seemed the best way to get the script running, once everything was in place. Do the other steps shown there first. Also, after everything was installed, I got error when opening Evil Doer about missing requirements. Need to run 'pip install requests' in terminal, (popup notification).
  2. Copy Mced's script to /home/nemo/, (or wherever), and name it 'tones.sh', (or whatever)
  3. Make a directory in /home/nemo/ where you will have all of your ringtone files. If you want the default Jolla ones, copy them there.
  4. Put an mp3 file in /home/nemo/Music, and name it 'randomringtone.mp3'. I had to create /Music, (it wasn't there already).
  5. Adjust the 'FOLDER' line in your script according to your setup.
  6. Now run --interactiveschedule, and enter info, to get it running. I set change times to every 30 seconds to test, and sure enough, the tone changes every 30 seconds.

A few things:

  • I don't know if ogg files will work along with mp3, or if you can just change extension, or if some more complex coding is necessary... @Mced - would it work to just add 'ogg' in the script, in the same spots where it says 'mp3'?
  • Not sure how it affects battery.
  • It's not actually an answer to what the original poster is asking, since he wanted to know how to pick a random tone for each separate incoming call, not necessarily for a set period of time, but it practically could work out to be the same thing, depending on the number of files to choose from, and the length of time set.

image description

edit flag offensive delete publish link more
2

answered 2020-06-21 21:04:17 +0300

Malakay gravatar image

I just wanted to say that this is now possible with an app "Personal Ringtones", which could be found on OpenRepos :)

edit flag offensive delete publish link more

Comments

1

Great find! :D https://openrepos.net/content/coderus/personal-ringtones

coderus ( 2020-06-21 22:54:24 +0300 )edit

Yeah :) and I really thank you coderus for it, its great :)

Malakay ( 2020-06-22 00:04:40 +0300 )edit

Coderus, I have almost finished Czech translation on transifex - I only dont understand one thing - in personal ringtones, in setting is a thing "Match numbers by right digits" what this feature precisely do? I need to know for proper translation, can you tell me?

Malakay ( 2020-06-23 00:03:47 +0300 )edit
0

answered 2018-07-29 18:33:46 +0300

Filip K. gravatar image

Maybe you can use Situations to start a script which would rename random ringtone file to the used one.

edit flag offensive delete publish link more
0

answered 2018-08-21 23:18:36 +0300

Malakay gravatar image

yes, i am interested :) but i have minimal knowledge of linux

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
5 followers

Stats

Asked: 2018-07-29 15:43:45 +0300

Seen: 900 times

Last updated: Jun 21 '20