| 1   2   | Next
maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Time based Music Stopper for N900? (https://talk.maemo.org/showthread.php?t=40764)

Pejman 2010-01-15 19:29

Time based Music Stopper for N900?
 
Is there any application for N900 to stop the default music player automatically after the time you want? (e.g. when you use your phone as a “radio” before you’ll get to sleep etc.)

I found one for N97, but wasn't able to find one for N900

http://www.n97i.com/nokia-n97-applic...nokia-n97-1307

joedumper 2010-01-15 21:06

Re: Time based Music Stopper for N900?
 
I'd be rather interested in this aswell.

I guess one could write a script that slept for an amount of time input by the user, then finds the media player process and kills it.

Not the most user friendly thing though.

twaelti 2010-01-15 21:51

Re: Time based Music Stopper for N900?
 
I will try to do a widget over the weekend. Need that for my kids anyway :-)

joedumper 2010-01-15 22:03

Re: Time based Music Stopper for N900?
 
Sounds cool ^^


i almost have my little script ( all 5 lines of it :D ),

just need to find where the pid of the media player is kept

born2wonder 2010-01-15 22:08

Re: Time based Music Stopper for N900?
 
Quote:

Originally Posted by joedumper (Post 475084)
Sounds cool ^^


i almost have my little script ( all 5 lines of it :D ),

just need to find where the pid of the media player is kept

I think the Process ID number changes according to when the program is launched. You should use the process name instead and issue a killall command.

Shaq

joedumper 2010-01-15 22:37

Re: Time based Music Stopper for N900?
 
Ok ... here's my first pass :

Quote:

echo "Time to shutdown in mins : "
read shutdowntime

sleep $((shutdowntime * 60));

kill $(pidof mediaplayer)

echo "Goodnight";
It works from the command line, just input the time you want the Mediaplayer to run for in minutes.

It's probably overly simplistic ... but it's just nice to play with these things.

Now... wheres my widget hammer :D

Pejman 2010-01-15 22:38

Re: Time based Music Stopper for N900?
 
That is why I love this forum ...
People are all eager to help.
Thanks ..

joedumper 2010-01-15 22:57

Re: Time based Music Stopper for N900?
 
So.... errrm....

Anyone know how to create a shortcut on the desktop to execute my shell script ( MusicSleep.sh ) ?

AlexDT 2010-01-15 22:57

Re: Time based Music Stopper for N900?
 
Id love to have this feature in the mediaplayer.

twaelti 2010-01-15 23:06

Re: Time based Music Stopper for N900?
 
What are your typical "sleep timer" durations?
15-30-45-60 minutes?

joedumper 2010-01-15 23:16

Re: Time based Music Stopper for N900?
 
I'd probably like another shorter time interval aswell... say 5 - 10 mins, aswell as the ones you've mentioned.

In my wee script i was aiming for just a numeric entry by the user as to whatever amount of minutes they'd like.

You dont think thats the right approach ?

Cernunnos 2010-01-15 23:23

Re: Time based Music Stopper for N900?
 
Yeh, just click on the widget/shortcut, and enter amount of mins? I'd download this app instantly!

AlexDT 2010-01-15 23:25

Re: Time based Music Stopper for N900?
 
With music on I'll fall asleep within 30 min haha. I'd rather use a slider instead of having to type in the time.

Pejman 2010-01-15 23:31

Re: Time based Music Stopper for N900?
 
Will this work, if I use KMplayer instead of Media Player?

Cernunnos 2010-01-15 23:41

Re: Time based Music Stopper for N900?
 
Quote:

Originally Posted by Pejman (Post 475273)
Will this work, if I use KMplayer instead of Media Player?

It would only take a tiny modification, but I guess it's fairly simple to make something that would work with both.

twaelti 2010-01-16 00:27

Re: Time based Music Stopper for N900?
 
OK, I did it :-) Falling asleep on my chair, 1.30 AM here...
During the next few hours, a package called "sleeper" will show up in extras-devel. It's a very simple widget with two buttons, one "15" and the other "30". Have fun :-)
(If the widget doesn't shop up after you added it to the desktop, please reboot - this only happens if haven't yet installed any pyton-widget before)

joedumper 2010-01-16 00:46

Re: Time based Music Stopper for N900?
 
Thanks man :D

this has to be some of the quickest concept to useable thing ever !!


i'lll grab your widget as soon as its up.



still gona try making a desktop icon to execute my script.... just for the satisfaction factor : D

koos 2010-01-16 01:03

Re: Time based Music Stopper for N900?
 
Quote:

Originally Posted by Pejman (Post 475273)
Will this work, if I use KMplayer instead of Media Player?

Currently you can only achieve this by wrapping the music file in a smil file, like

<smil>
<body>
<audio dur="900" src="your-music.mp3"/>
</body>
</smil>

and open this file.
(actually 15m should work, but somehow it doesn't ..)

koos 2010-01-16 01:42

Re: Time based Music Stopper for N900?
 
Quote:

Originally Posted by koos (Post 475470)
Currently you can only achieve this by wrapping the music file in a smil file

Just tried and unfortunately this isn't detected as audio only, the screen isn't dimmed.

But there is another playlist format where a duration can be set, namely asx. So

<ASX>
<entry>
<duration value="15:00"/>
<ref href="your-music.mp3"/>
</entry>
</ASX>

plays for 15 minutes and does dim the screen.

donsaibot 2010-01-16 12:41

Re: Time based Music Stopper for N900?
 
Does it only work with headphones?
I tried it out because i really could use such an app but it does not work.

koos 2010-01-16 20:19

Re: Time based Music Stopper for N900?
 
1 Attachment(s)
Quote:

Originally Posted by koos (Post 475517)
But there is another playlist format where a duration can be set, namely asx

To turn is a user friendly interface for KMPlayer, download sleep.zip and copy the two files in this archive to your device. Next open the terminal application.
Create the directory /home/user/.kmplayer/generators:

$ mkdir .kmplayer/generators

Copy the sleep.xml to this directory

$ cp sleep.xml .kmplayer/generators

Copy the shell script to /home/user/.kmplayer

$ cp sleep.sh .kmplayer

Finally (re)start kmplayer and from the menu choose 'Sleep Timer'. You are prompted for a file selection and for how many minutes to play.

koos 2010-01-16 20:32

Re: Time based Music Stopper for N900?
 
Quote:

Originally Posted by donsaibot (Post 476063)
Does it only work with headphones?
I tried it out because i really could use such an app but it does not work.

Could it be your device is in silent mode? I found this http://talk.maemo.org/showthread.php...410#post448410 and if you're using the default player, then the exe would be kgstplayer.

koos 2010-01-16 20:37

Re: Time based Music Stopper for N900?
 
Quote:

Originally Posted by koos (Post 476759)
To turn is a user friendly interface

and from the menu choose 'Sleep Timer'.

Uhm, the above should read

To turn this in a user friendly

and from the menu choose 'Generate Playlist' and then 'Sleep Timer'

(Promised myself to re-read my writing :) )

debernardis 2010-01-17 05:13

Re: Time based Music Stopper for N900?
 
@Joedumper: here's a desktop file to call it from the menu:
Code:

[Desktop Entry]
Version=1.0
Name=Timusic
Type=Application
Comment=Shuts music off after N minutes
Terminal=true
Exec=osso-xterm -e /opt/mybin/timusic.sh
Icon=mediaplayer_nowplaying_indicator_pause
Categories=ConsoleOnly;System;
GenericName=Music timer

I saved your script in /opt/mybin/timusic.sh and gave it one of the default icons (really, an ugly one - you could choose another or prepare a brand new one).
The desktop file is /usr/share/applications/hildon/timusic.desktop

This could be packaged also... it's not so bad :)

F2thaK 2010-01-17 05:36

Re: Time based Music Stopper for N900?
 
thanks 4 this

joedumper 2010-01-17 19:26

Re: Time based Music Stopper for N900?
 
1 Attachment(s)
Cheers debernardis,

I was just putting together something similar,
seems to work ... nice little "app" now... doing exactly what i originally hoped.

I grabbed an image for the icon too... first draft attached

twaelti 2010-01-17 20:27

Re: Time based Music Stopper for N900?
 
Quote:

Originally Posted by donsaibot (Post 476063)
I tried it out because i really could use such an app but it does not work.

That's why it is in extras-devel :D There was a bug and it couldn't work... now I fixed it and added state-switching plus sleeptimer-stop functionality.
Once the maemo servers are up again, I'll upload version 0.2.0

donsaibot 2010-01-18 21:12

Re: Time based Music Stopper for N900?
 
Quote:

Originally Posted by twaelti (Post 478569)
That's why it is in extras-devel :D There was a bug and it couldn't work... now I fixed it and added state-switching plus sleeptimer-stop functionality.
Once the maemo servers are up again, I'll upload version 0.2.0

Ah okay ^^

I'll gonna check it out again then.

Dosenblech 2010-01-18 21:21

Re: Time based Music Stopper for N900?
 
@twaelti
great!!! thank you very much.... :-)
I've been waiting for such a app since weeks....

Dosenblech 2010-01-18 21:57

Re: Time based Music Stopper for N900?
 
okay...at the moment it doesn't work... - i will wait for version 0.2.0 :-)

twaelti 2010-01-18 21:59

Re: Time based Music Stopper for N900?
 
I've uploaded version 0.2.0 tonight, if the infrastruture is up again it should become available in extras-devel during the next few hours.

donsaibot 2010-01-19 12:45

Re: Time based Music Stopper for N900?
 
Okay works perfect!

But i gotta confess i misunderstood something^^

The App just stops playing music. I thought it would be like in LCG Jukebox for S605th where it closes the Musicplayer completely. So its not remaining in stand-by for the hole night for example.
When you're somewhere where you can't charge your phone i think it will drain battery. Even if its not much the power you lost might be the power you need to get through the day.

Just what i think.

greetz

Donsaibot

twaelti 2010-01-19 12:52

Re: Time based Music Stopper for N900?
 
Quote:

Originally Posted by donsaibot (Post 481815)
Okay works perfect!
But i gotta confess i misunderstood something^^
The App just stops playing music. I thought it would be like in LCG Jukebox for S605th where it closes the Musicplayer completely. So its not remaining in stand-by for the hole night for example.
When you're somewhere where you can't charge your phone i think it will drain battery. Even if its not much the power you lost might be the power you need to get through the day.

No need to worry, in my estimation there won't be any measurable difference. IMHO, the media player was highly optimized for power consumption by Nokia themselves.

twaelti 2010-01-19 16:47

Re: Time based Music Stopper for N900?
 
Sleeper has now been promoted to extras-testing:

http://static.maemo.org/static/1/161...4_sleeper_icon
A simple sleep widget to pause the music player after 15 or 30 minutes.
Good for falling asleep while listening to music on the N900.

debernardis 2010-01-19 19:09

Re: Time based Music Stopper for N900?
 
@twaelti: so far I haven't installed Sleeper yet but... are there any config files one can edit to change the 15 or 30 min times? Or maybe is it possible to tweak the source (it's python isn't it?). Wife needs 1h30m to get asleep :)

wurnz 2010-01-19 20:13

Re: Time based Music Stopper for N900?
 
great app so far :)

is there a way to implement this option directly into the media player as a menu option?

rldstover48 2010-01-20 04:04

Re: Time based Music Stopper for N900?
 
on the g1 there was a program musicsleep it had a minuet field to put in as many minuets as needed ex. 30, 60, 120 also when it shut things off it turned off media player n disconnected internet if streaming

Alan_Peery 2010-01-20 13:44

Re: Time based Music Stopper for N900?
 
This may be working, but I don't think it's the right way to do it. Check for a DBUS command that will send a PAUSE to the running player. I suspect that the developer of headphoned can help, or his source code can.

Edit: This thread http://talk.maemo.org/showthread.php?t=40134 probably of use...
Edit 2: Even better http://talk.maemo.org/showthread.php?t=33215

thp 2010-03-02 13:33

Re: Time based Music Stopper for N900?
 
I've added Panucci support to "sleeper" and also added more buttons (5, 10, 15, 30 and 45 minutes) to the widget. You can get the modified source here (with dget):

http://khan.thpinfo.com/~thp/deb-out...0.2.0-3thp.dsc

You can also download a ready-to-install binary .deb of it here:

http://khan.thpinfo.com/~thp/deb-out...0-3thp_all.deb

I've sent these changes to twaelti for integration in a future release :)

Obligatory screenshot:

http://farm5.static.flickr.com/4068/...dbcb2896_o.jpg

EDIT: Of course the code is also easily modifyable to either add new "actions" (in on_sleeptimer_fired) and new minute values (simply edit/add to TIMER_PRESETS).

Dosenblech 2010-03-02 14:54

Re: Time based Music Stopper for N900?
 
It would be very useful.
thanks to thp!!!


| 1   2   | Next
All times are GMT. The time now is 19:29.

vBulletin® Version 3.8.8