Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #48469 > unrolled thread
| Started by | "C. N. Desrosiers" <cndesrosiers@gmail.com> |
|---|---|
| First post | 2013-06-16 12:06 -0700 |
| Last post | 2013-06-17 17:52 +0000 |
| Articles | 13 — 11 participants |
Back to article view | Back to comp.lang.python
Using Python to automatically boot my computer at a specific time and play a podcast "C. N. Desrosiers" <cndesrosiers@gmail.com> - 2013-06-16 12:06 -0700
Re: Using Python to automatically boot my computer at a specific time and play a podcast Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-16 19:22 +0000
Re: Using Python to automatically boot my computer at a specific time and play a podcast Joel Goldstick <joel.goldstick@gmail.com> - 2013-06-16 15:34 -0400
Re: Using Python to automatically boot my computer at a specific time and play a podcast Joel Goldstick <joel.goldstick@gmail.com> - 2013-06-16 15:25 -0400
Re: Using Python to automatically boot my computer at a specific time and play a podcast Petite Abeille <petite.abeille@gmail.com> - 2013-06-16 21:44 +0200
Re: Using Python to automatically boot my computer at a specific time and play a podcast Jason Swails <jason.swails@gmail.com> - 2013-06-16 15:49 -0400
Re: Using Python to automatically boot my computer at a specific time and play a podcast Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-06-16 16:18 -0400
Re: Using Python to automatically boot my computer at a specific time and play a podcast "C. N. Desrosiers" <cndesrosiers@gmail.com> - 2013-06-16 16:56 -0400
Re: Using Python to automatically boot my computer at a specific time and play a podcast Chris Angelico <rosuav@gmail.com> - 2013-06-17 07:55 +1000
Re: Using Python to automatically boot my computer at a specific time and play a podcast inq1ltd <inq1ltd@inqvista.com> - 2013-06-17 09:24 -0400
Re: Using Python to automatically boot my computer at a specific time and play a podcast Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2013-06-17 19:03 +0200
Re: Using Python to automatically boot my computer at a specific time and play a podcast "Lefavor, Matthew (GSFC-582.0)[MICROTEL LLC]" <matthew.lefavor@nasa.gov> - 2013-06-17 10:02 -0500
Re: Using Python to automatically boot my computer at a specific time and play a podcast Giorgos Tzampanakis <giorgos.tzampanakis@gmail.com> - 2013-06-17 17:52 +0000
| From | "C. N. Desrosiers" <cndesrosiers@gmail.com> |
|---|---|
| Date | 2013-06-16 12:06 -0700 |
| Subject | Using Python to automatically boot my computer at a specific time and play a podcast |
| Message-ID | <6f5ad203-f692-414f-a895-2c474082e9bb@googlegroups.com> |
Hi, I'm planning to buy a Macbook Air and I want to use it as a sort of alarm. I'd like to write a program that boots my computer at a specific time, loads iTunes, and starts playing a podcast. Is this sort of thing possible in Python? Thanks in advance. CND
[toc] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2013-06-16 19:22 +0000 |
| Message-ID | <51be108c$0$29966$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #48469 |
On Sun, 16 Jun 2013 12:06:08 -0700, C. N. Desrosiers wrote: > Hi, > > I'm planning to buy a Macbook Air and I want to use it as a sort of > alarm. I'd like to write a program that boots my computer at a specific > time, If your computer is turned off, how is the program supposed to run? -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Joel Goldstick <joel.goldstick@gmail.com> |
|---|---|
| Date | 2013-06-16 15:34 -0400 |
| Message-ID | <mailman.3454.1371411300.3114.python-list@python.org> |
| In reply to | #48470 |
[Multipart message — attachments visible in raw view] — view raw
On Sun, Jun 16, 2013 at 3:22 PM, Steven D'Aprano < steve+comp.lang.python@pearwood.info> wrote: > On Sun, 16 Jun 2013 12:06:08 -0700, C. N. Desrosiers wrote: > > > Hi, > > > > I'm planning to buy a Macbook Air and I want to use it as a sort of > > alarm. I'd like to write a program that boots my computer at a specific > > time, > > If your computer is turned off, how is the program supposed to run? > I was thinking maybe it could in some sleep mode that still ran cron jobs. but I am totally guessing that. If its OFF off then you might need another computer attached to a robot arm that could push the on button first! > > > > -- > Steven > -- > http://mail.python.org/mailman/listinfo/python-list > -- Joel Goldstick http://joelgoldstick.com
[toc] | [prev] | [next] | [standalone]
| From | Joel Goldstick <joel.goldstick@gmail.com> |
|---|---|
| Date | 2013-06-16 15:25 -0400 |
| Message-ID | <mailman.3452.1371410718.3114.python-list@python.org> |
| In reply to | #48469 |
[Multipart message — attachments visible in raw view] — view raw
On Sun, Jun 16, 2013 at 3:06 PM, C. N. Desrosiers <cndesrosiers@gmail.com>wrote: > Hi, > > I'm planning to buy a Macbook Air and I want to use it as a sort of alarm. > I'd like to write a program that boots my computer at a specific time, > loads iTunes, and starts playing a podcast. Is this sort of thing possible > in Python? > > Thanks in advance. > Since Macs run a version of Unix underneath you can write a cron job to get things started at a specific time. I'm not sure about the iTunes interface. Have you researched to see if it has and API? If it does, likely python could handle that. > > CND > -- > http://mail.python.org/mailman/listinfo/python-list > -- Joel Goldstick http://joelgoldstick.com
[toc] | [prev] | [next] | [standalone]
| From | Petite Abeille <petite.abeille@gmail.com> |
|---|---|
| Date | 2013-06-16 21:44 +0200 |
| Message-ID | <mailman.3455.1371411931.3114.python-list@python.org> |
| In reply to | #48469 |
On Jun 16, 2013, at 9:06 PM, C. N. Desrosiers <cndesrosiers@gmail.com> wrote: > I'm planning to buy a Macbook Air and I want to use it as a sort of alarm. I'd like to write a program that boots my computer at a specific time, loads iTunes, and starts playing a podcast. Under preferences, take a look at Energy Saver -> Power Adapter -> Schedule -> Start up or wake. Alternatively, the command line utility pmset allows one to access the same functionalities. > Is this sort of thing possible in Python? Sure. But why bother? All at one's finger tip already...
[toc] | [prev] | [next] | [standalone]
| From | Jason Swails <jason.swails@gmail.com> |
|---|---|
| Date | 2013-06-16 15:49 -0400 |
| Message-ID | <mailman.3456.1371412200.3114.python-list@python.org> |
| In reply to | #48469 |
[Multipart message — attachments visible in raw view] — view raw
On Sun, Jun 16, 2013 at 3:06 PM, C. N. Desrosiers <cndesrosiers@gmail.com>wrote: > Hi, > > I'm planning to buy a Macbook Air and I want to use it as a sort of alarm. > I'd like to write a program that boots my computer at a specific time, > loads iTunes, and starts playing a podcast. Is this sort of thing possible > in Python? > Python cannot do this by itself, as has already been mentioned. If you're using a Mac, you can schedule your computer to turn on (and/or off) using System Preferences->Energy Saver->Schedule... Then run a Python script in a cron job. In fact, you could do this in bash ;) HTH, Jason
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2013-06-16 16:18 -0400 |
| Message-ID | <mailman.3458.1371414010.3114.python-list@python.org> |
| In reply to | #48469 |
On Sun, 16 Jun 2013 12:06:08 -0700 (PDT), "C. N. Desrosiers"
<cndesrosiers@gmail.com> declaimed the following:
>Hi,
>
>I'm planning to buy a Macbook Air and I want to use it as a sort of alarm. I'd like to write a program that boots my computer at a specific time, loads iTunes, and starts playing a podcast. Is this sort of thing possible in Python?
>
Uhm... It can't run a program until after it has been booted.
And if you leave the system up and running, I'm sure the OS has some
sort of scheduled task system (probably a version of cron) in which you can
define what should happen when...
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
| From | "C. N. Desrosiers" <cndesrosiers@gmail.com> |
|---|---|
| Date | 2013-06-16 16:56 -0400 |
| Message-ID | <mailman.3460.1371416186.3114.python-list@python.org> |
| In reply to | #48469 |
[Multipart message — attachments visible in raw view] — view raw
Thank you! On Sun, Jun 16, 2013 at 3:49 PM, Jason Swails <jason.swails@gmail.com>wrote: > > > > On Sun, Jun 16, 2013 at 3:06 PM, C. N. Desrosiers <cndesrosiers@gmail.com>wrote: > >> Hi, >> >> I'm planning to buy a Macbook Air and I want to use it as a sort of >> alarm. I'd like to write a program that boots my computer at a specific >> time, loads iTunes, and starts playing a podcast. Is this sort of thing >> possible in Python? >> > > Python cannot do this by itself, as has already been mentioned. > > If you're using a Mac, you can schedule your computer to turn on (and/or > off) using System Preferences->Energy Saver->Schedule... > > Then run a Python script in a cron job. > > In fact, you could do this in bash ;) > > HTH, > Jason > -- Christian Nicolás Desrosiers Master of City Planning candidate School of Architecture + Planning Massachusetts Institute of Technology t. 717 860 6252 e. cnd@mit.edu www.twitter.com/cndesrosiers
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-06-17 07:55 +1000 |
| Message-ID | <mailman.3462.1371419733.3114.python-list@python.org> |
| In reply to | #48469 |
On Mon, Jun 17, 2013 at 5:06 AM, C. N. Desrosiers <cndesrosiers@gmail.com> wrote: > Hi, > > I'm planning to buy a Macbook Air and I want to use it as a sort of alarm. I'd like to write a program that boots my computer at a specific time, loads iTunes, and starts playing a podcast. Is this sort of thing possible in Python? Python *on the system itself* cannot do this. However, if the BIOS features aren't enough (eg if you want more flexibility), there's one option to explore. See if your Macbook has Wake-On-LAN support; with that, you could have a Python script *on a different machine* send a magic packet that wakes your target. However, this isn't a Python question, it's a systems administration one. (The very specific question "How can I trigger wake-on-LAN from a Python program" would be a Python question (obviously!), but that's only a tiny part of your problem.) ChrisA
[toc] | [prev] | [next] | [standalone]
| From | inq1ltd <inq1ltd@inqvista.com> |
|---|---|
| Date | 2013-06-17 09:24 -0400 |
| Message-ID | <mailman.3480.1371477619.3114.python-list@python.org> |
| In reply to | #48469 |
[Multipart message — attachments visible in raw view] — view raw
On Sunday, June 16, 2013 12:06:08 PM C. N. Desrosiers wrote: > Hi, > > I'm planning to buy a Macbook Air and I want to use it as a sort of alarm. > I'd like to write a program that boots my computer at a specific time, > loads iTunes, and starts playing a podcast. Is this sort of thing possible > in Python? > > Thanks in advance. > > CND Up to Jan 1, 2012 we had 6 computers that were connected to timers. The timers were set to come on at various times during the day. When the timer came on, the computer, on boot up, ran a .BAT file that called our screen saver which in turn launched another program. I don't know about Mac but this was all written on DOS machines. With a little research and I'm sure it could be done through the bios on a Mac. The screen saver gave us time to opt out of the call to another program. So, simply turning on a machine could launch an OS file that will call your python module. Another approach is building a python screen saver that reboots your computer at a specific time. On reboot, your OS calls a python screen saver with options, as mentioned. jd inqvista.com
[toc] | [prev] | [next] | [standalone]
| From | Irmen de Jong <irmen.NOSPAM@xs4all.nl> |
|---|---|
| Date | 2013-06-17 19:03 +0200 |
| Message-ID | <51bf417a$0$15987$e4fe514c@news.xs4all.nl> |
| In reply to | #48517 |
On 17-6-2013 15:24, inq1ltd wrote:
> On Sunday, June 16, 2013 12:06:08 PM C. N. Desrosiers wrote:
>
>> Hi,
>
>>
>
>> I'm planning to buy a Macbook Air and I want to use it as a sort of alarm.
>> I'd like to write a program that boots my computer at a specific time,
>> loads iTunes, and starts playing a podcast. Is this sort of thing possible
>> in Python?
You can use the osascript utility to send commands to itunes, and invoke it from Python
like this:
import subprocess
listname = "My Playlist"
subprocess.call(["osascript", "-e", "tell application \"iTunes\" to play playlist
\"{0}\"".format(listname)])
But that seems overkill (using Python to use Applescript to control iTunes)...
Irmen
[toc] | [prev] | [next] | [standalone]
| From | "Lefavor, Matthew (GSFC-582.0)[MICROTEL LLC]" <matthew.lefavor@nasa.gov> |
|---|---|
| Date | 2013-06-17 10:02 -0500 |
| Message-ID | <mailman.3485.1371482451.3114.python-list@python.org> |
| In reply to | #48469 |
[Multipart message — attachments visible in raw view] — view raw
And as for launching iTunes and playing a Podcast, you should take a look at AppleScript. AppleScript is designed specifically for running and controlling Mac OS X applications—iTunes among them. (I once wrote a script to sync my iTunes play counts from last.fm, for example.) You might also look at the Automator program (I guess it's still included on most Macs). It does mostly the same thing as Applescript (automate Mac processes) but it's graphical and doesn't do quite as much. -MCL On Jun 16, 2013, at 3:44 PM, Petite Abeille wrote: On Jun 16, 2013, at 9:06 PM, C. N. Desrosiers <cndesrosiers@gmail.com<mailto:cndesrosiers@gmail.com>> wrote: I'm planning to buy a Macbook Air and I want to use it as a sort of alarm. I'd like to write a program that boots my computer at a specific time, loads iTunes, and starts playing a podcast. Under preferences, take a look at Energy Saver -> Power Adapter -> Schedule -> Start up or wake. Alternatively, the command line utility pmset allows one to access the same functionalities. Is this sort of thing possible in Python? Sure. But why bother? All at one's finger tip already... -- http://mail.python.org/mailman/listinfo/python-list
[toc] | [prev] | [next] | [standalone]
| From | Giorgos Tzampanakis <giorgos.tzampanakis@gmail.com> |
|---|---|
| Date | 2013-06-17 17:52 +0000 |
| Message-ID | <slrnkrujgk.5p0.giorgos.tzampanakis@brilliance.eternal-september.org> |
| In reply to | #48469 |
On 2013-06-16, C. N. Desrosiers wrote: > I'm planning to buy a Macbook Air and I want to use it as a sort of > alarm. I'd like to write a program that boots my computer at a specific > time, loads iTunes, and starts playing a podcast. Is this sort of thing > possible in Python? I would suggest leaving your computer on and using the sched and subprocess modules of the standard library. -- Real (i.e. statistical) tennis and snooker player rankings and ratings: http://www.statsfair.com/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web