![]() |
using N800 as a mp3 player with autoshutdown
hello, i would like to automate some tasks on my n800 (OS2008) : play a mp3 file during a preset time (e.g. 60') and then shutdown the tablet. The aim is of course to simulate a clock radio's 'sleep' function. Alternatively, rather than a preset time, the shutdown could occur when the mp3 file has been completely played. Any suggestions ?
|
Re: using N800 as a mp3 player with autoshutdown
Code:
mpg321 file.mp3; run-standalone.sh dbus-send --system --type=method_call --dest="com.nokia.mce" --print-reply "/com/nokia/mce/request" com.nokia.mce.request.req_shutdown |
Re: using N800 as a mp3 player with autoshutdown
would it be possible to write a script (python ?) that
1) start mplayer (or another player) with the adequate options to play a mp3 file and then exit 2) init shutdown of the tablet (or at least enter in sleep mode) |
Re: using N800 as a mp3 player with autoshutdown
thanks benson, (ignore my 2nd post, i was writing it before i got your answer);
however, i'm a complete newbie in linux; i guess that i have to enter those instructions in a command line ? And how to record these instructions in a batch (script) ? |
Re: using N800 as a mp3 player with autoshutdown
OK, no need for python, and same as above except use mplayer instead of mpg321.
That's a line of text you can enter in the shell; to save it in a file as a shell script, prepend a shebang line like this: Code:
#!/bin/sh Code:
chmod +x scriptfile Code:
./scriptfile (And as for sleep mode, the tablet doesn't really have a sleep mode; when the processor has nothing to do, it stops, and once the screen backlight times out, it draws almost no power. An N800 in this state (fully powered on, and left to sit) will last about a month, and will wake up instantly on touching the the screen. This is the recommended state to leave the tablet in, as booting actually consumes significant power, several days' worth at idle.) |
Re: using N800 as a mp3 player with autoshutdown
Ah, just saw your third post, but I hope I've adequately answered it...
|
Re: using N800 as a mp3 player with autoshutdown
sorry, i don't get it, you seems to presume i'm much more knowledgeable than i am (moreover english is not my 1st langage);
This is what i understand : i have to create a script, that's the role of the #!/bin/sh line ? The 2nd line (mplayer ...) is the content of the script; but how do i save it as a script ? I tried to enter #!/bin/sh in xterm, i don't see any 'reply' from the os; in fact it's the 1st time i really use xterm (i downloaded it just for sake of curiosity). So perhaps the best thing i can do is start reading a tutorial about linux command line ... Anyway, as you told me that the tablet automatically enters in a very 'frugal' mode when it has nothing to do, then shutting down the tablet is not really necessary, as i will use it as a 'clock radio' every night. So the problem is much simpler : i just have to start mplayer with the name of a mp3 file, at the end of the file, mplayer ends, and after a minute or 2, the tablet enters in quasi 'sleep mode'. I will try that. |
Re: using N800 as a mp3 player with autoshutdown
Okay, a little detail on shells, scripts, and shebangs. Some of this you don't need right now, and don't worry if it doesn't completely make sense, but having heard it once should help you not get confused in some particularly annoying ways that many newbs do.
The UNIX way is, among other things, to have the command interpeter (a shell) separated from the core OS (the kernel); in fact, the shell is just another process, on the same level as the database, document typesetter, or other apps. Another aspect of the UNIX way is that all* resources are abstracted as files; files that are abstractions rather than actual data on a disk are called special files, and mainly live in /dev/, though they can be created anywhere. One example of a resource that's a file is a system console (maybe /dev/tty0); writing data to it displays on the console's screen, and reading data from it gets data from the console's keyboard.** These two characteristics mean that a shell operates by reading commands from a file and writing output to a file. (These can be the same file, but don't have to be.) Normally, using a machine from the console, the shell would be reading from /dev/tty0, and writing to /dev/tty0, so you type commands and see the output.As for what you need to do:
|
Re: using N800 as a mp3 player with autoshutdown
Many thanks for such 'dedication' for helping beginners.
The instructions you gave at the end of your previous post are much clearer, in fact i just have to create a text file, as i would do for creating a batch for windows. Concerning xterm, i have the memory of having downloaded it, but it was surely when i was using os2007 some months ago; now i'm using os2008, so surely as you said xterm came with it. I realise that there is great potential in being able to control the tablet from a command line; but I won't abuse from your time, if i want to investigate more deeply the subject, i will have to spend some time in learning unix basics. And for my initial question (just play a mp3 then 'sleep'), problem is solved, as you said the tablet will automatically enter in quasi sleep mode when it has nothing to do. So no need to shut down. I feel a bit shameful to discover that only now, as i own my tablet since several months. |
All times are GMT. The time now is 20:08. |
vBulletin® Version 3.8.8