automatic playlist startup

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
j0ly Offline
Junior Member
Posts: 5
Joined: Jan 2004
Reputation: 0
Post: #16
awesome, this works great for the needs i have in my nightclub, but now i want to do something a little differnt, basically heres what im looking for:

i have a network within the club, with a server in my office that serves 1 xbox videos for display on the tv, now my dj's dont show up to begin playing music till around 9:30pm at night, and the club opens at 7.

i have a ton of mp3s that we did from taking all of our music and encoding (our club has actually been checked numerous times for legal music (not burned), so to be legit we encoded all our music) what i want to do is simplify everything, so im going to put another xbox in the dj both and run the audio ports into my mixer, basically i want it this xbox to do is check the system date, and play a playlist according to that.

so lemme give you an example:

its wednessday night, our hiphop urban night, i come in, turn everything on, turn on the xbox and the system boots in to mediacenter, runs a autoexec script, that run another script that checks the system time, if day = wednessday it loads wednessday.plu, randomizes it, begins playing it and switches to visuals.

thursday, friday and saturday would be the same, but obviously the script would reconize a different day of the week and switch to load a different script (thursday: rock, friday: country and top40, saturday: everything)

possible?
find quote
Alexpoet Offline
Skilled Python Coder
Posts: 172
Joined: Jun 2004
Reputation: 0
Location: Oklahoma City, OK
Post: #17
j0ly, i'm pretty sure this will do basically what you need. it could take some degree of modification, but it should get the first three letters of the day of the week from the xbox, and then play a playlist by the name of those three letters (like "wed.m3u" on wednesday).

Quote:import time, xbmc

day = time.ctime()[:3] # all values are the first three letters of the day: sun, mon, tue, wed, thu, fri, sat
pls = xbmc.playlist(0) ## 0 should be music playlist and 2 should be video playlist... not tested      

pls.load(day + ".m3u") ## load non xbmc playlist into xbmc's playlist  m3u and pls work
# remember to add a path as necessary; it can be local: pls.load("q:/music/" + day + ".m3u"),
# or smb network share: pls.load("smb://user:password@/" + day + ".m3u")

pls.shuffle() ## delete this line if you don't want random songs to be played from your given playlist
xbmc.player().play(pls) ## play the playlist

obviously, it's a modification of the same sort of playlist code earlier in this post. you would use the exact same autoexec script.

i don't have access to an xbox right now, so i can't guarantee time.ctime() will return the same information reliably on the xbox, but it should. i'll double-check that as soon as i get home.

For scripts, script development tools, and documentation, visit my website:
http://www.maskedfox.com/xbmc/
find quote
pluto Offline
Junior Member
Posts: 2
Joined: Jul 2004
Reputation: 0
Post: #18
someone knows after run the script how switches to visuals, or hide the information bar from home
find quote
mich24 Offline
Junior Member
Posts: 7
Joined: Jul 2004
Reputation: 0
Post: #19
hi!

does someone know how to randomly pick one of the playlists, without writing all of them
(i have a few hundreds, one for each album, so using the dic={1:"playlist1.m3u",2:"playlist2.pls",3:"playlist3.m3u"} is not possible)

thanks for any idea!

(actually the best (for me) would be to automaticly open a folder randomly choosen and read all the mp3 inside)
find quote
jcee Offline
Member
Posts: 61
Joined: Oct 2003
Reputation: 0
Post: #20
hi everybody.

want to share my experience and i do have a question in the end ;-)

auto-powerup:

i placed my xbox in the trunk of my car, replaced one controller port with a usb port and the installed the controller port in the dashboard. there i plugged-in the dvd-remote-ir-thing. the connection from trunk to dashboard is donw via a common usb extension cable :-)

i utilized a 150w 12/230 inverter which normally has got a switch to swich on/offf. i replaced this switch with a relay which is driven by the "remote signal" of the headunit. means when the headunit is switched on, the inverter starts working.

then the following mechanical arc / spring on the front power button of the xbox and sticked it with some glue.

-----------bbbbb -------------
xxx zzz xxx
x zzz x
xxxxxxxxxx
this spring (z) pushes the power button (b) all the time. actually this means when the inverters powers on the xbox starts working. if decide to power-off and repower the xbox i can just pull against the spring for a moment, so the power button is released.


works perfectly for about 7 month. :-)

after reading all this about the auto startup script i wonder if it possible to have resume and restart option.
i have not looked at the forum for a while. something new on this?
i do not have playlists.. :-(
find quote
MrT Offline
Junior Member
Posts: 45
Joined: Jan 2004
Reputation: 0
Location: Norway
Post: #21
does this work with the 1006 build?
i can't get it to work whatsooever.

iv copied the script from this tread (and modified it a bit). i put it in /f:/apps/xbmc/scripts/
and then run it manually.

the script looks like: (iv x'ed out the user/pw bit):

import xbmc
pls = xbmc.playlist(0)
pls.load("smb://xxx:xxx@10.0.0.2/mp3/test.m3u")
pls.shuffle()
xbmc.player().play(pls)

this does not work. noting happens when i start the script.

iv also tried :
pls.load("f://apps/xbmc/albums/playlists/test.m3u")
and
pls.load("q:\\albums\\playlists\\test.m3u")

(yes, i copied the .m3u file to those locations).
still nothing. is there a logfile i can check to see what goes wrong? or does anyone see the error?

I donated $40 to the XBMC project, and so should you.
find quote
MrT Offline
Junior Member
Posts: 45
Joined: Jan 2004
Reputation: 0
Location: Norway
Post: #22
forget the question above. i fucked around with the scripts and fixed it Smile

I donated $40 to the XBMC project, and so should you.
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,228
Joined: Oct 2003
Reputation: 177
Post: #23
looks like whatever editor you're using is screwing the file up.

it just needs to be a plain text file. use notepad.

then rename it to .py and ftp across to your xbox.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
scarecrow420 Offline
Moderator
Posts: 890
Joined: Oct 2004
Reputation: 21
Post: #24
hey guys ive written a script for car setups that starts playing as soon as the xbox comes on, and it has resume support, ie it remembers what song you last played and will load it up again next time you turn on the xbox.

it also creates a playlist of all the other files in the same directory as the resumed song

and failing being able to do that it will load a specified default playlist.


what i need to do to finish it off is to automatically switch to visuals when the playing starts... but i just cant see a way to do it! is there a way even to send keystrokes/button press messages to xbmc so i can send a display button command to it?

it's working very well in the car already, and this will just top it off if i can automate going to visuals too.

anyone have any ideas?
find quote
Threepwood Offline
Junior Member
Posts: 1
Joined: Oct 2004
Reputation: 0
Post: #25
i can't really help you with figuring out how to get it to startup visualizations, but would love a copy of your script. been preping to do a car install and have been looking for a script to start up where it last left off.
find quote
darkie Offline
Team-XBMC Developer
Posts: 529
Joined: Sep 2003
Reputation: 0
Post: #26
Quote:what i need to do to finish it off is to automatically switch to visuals when the playing starts... but i just cant see a way to do it!  is there a way even to send keystrokes/button press messages to xbmc so i can send a display button command to it?
search for the file key.h in xbmc cvs. in there you will find a window id for the visualization screen (for example 10345)
now in your script you have to create a new window that uses the visualization screen

Quote:viswindow = xbmcgui.window(10345)
now you have access to that specific window and you will be able to show / close it with
Quote:viswindow.show()

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
Dogo Offline
Junior Member
Posts: 33
Joined: Jun 2004
Reputation: 0
Post: #27
yes can you please post your script, even if not 100% complete and tested.
find quote
joe2000 Offline
Junior Member
Posts: 5
Joined: Dec 2003
Reputation: 0
Post: #28
thats exactly what i need for my car ! can yo post your script ? that would be great !
find quote
metalcoat Offline
Junior Member
Posts: 10
Joined: Nov 2004
Reputation: 0
Post: #29
i tried learning python but i think it may be a bit too complicated since all i want is to know if its possible to make a script play a random mp3 file instead of a playlist from a network share or the hd
find quote
XbcSharpShooter Offline
Junior Member
Posts: 19
Joined: Nov 2004
Reputation: 0
Post: #30
(xsintill @ mar. 21 2004,10:02 Wrote:or you can create the files yourself.. they are normal textfiles but with a .py extension. they should be put in the scripts directory in xbmc's 'home' directory.

one file should be named autoexec.py
and have the following code in it:
Quote:import xbmc

xbmc.executescript('q:\\scripts\\autoplay.py')

and the other one should be named autoplay.py
and have the following code in it:
Quote:
import xbmc

pls = xbmc.playlist(0)                                       ##0 should be music playlist and 2 should be video playlist... not tested      
pls.load("smb://user:password@/idm/test.m3u")   ## load non xbmc playlist into xbmc's playlist  m3u and pls work
pls.shuffle()                                                   ## delete this line if you don't want random songs to be played from your given playlist
xbmc.player().play(pls)                                    ## play the playlist
i did that exact thing, with the 11-16 build, and nothing happens. i looked in log and nothing. i go to scripts folder, and click on it in xbmc, and it flashes running for a second, nothing happens.
find quote