Aller au contenu


Submitter

File Information

  • Submitted: juil. 13 2009 13:32
  • Last Updated: juil. 13 2009 13:32
  • File Size: 651,88 Ko
  • Views: 13
  • Downloads: 1

Download Xandu Media Player v1.2

- - - - -



white = Color.new(255,255,255)
black = Color.new(125,125,125)
blue = Color.new(0,0,255)
blank = Color.new(0,0,0)
skyish = Color.new(238,243,250)
BG = Image.load("files/temp.png")

Pause = Image.load("files/pause.png")
Play = Image.load("files/play.png")



imgtemp = nil





lib = Image.load("files/lib.png")
np = Image.load("files/np.png")

screenchange = 0

menuaccess = false
cursor = 4
cdir = System.listDirectory("ms0:/PSP/MUSIC/")
cdirn = table.getn(cdir)



bigBG = Image.createEmpty(480,272)
bigBG:clear(blank)


CHZ2 = Image.createEmpty(480,13)
CHZ2:clear(Color.new(59,147,255))

CHZ = Image.load("files/chz.png")


playing = false
showit = false

screen1b = 1 + screenchange
screen1e = 16

lyric = 0

y = 0
x = 0



function graphicsPrint(text)
  for i = 1, string.len(text) do
  char = string.sub(text, i, i)
  if char == "\n" then
  y = y + 8
  x = 0
  elseif char ~= "\r" then
  screen:print(x, y, char, white)
  x = x + 8
  end
  end
  

end

function graphicsPrintln(text)
  graphicsPrint(text .. "\n")
end

playcheck = false

mode = "none"

function mp3play()


if menuaccess == true then


if pad:up() and not oldpad:up() and cursor > 1+3 then cursor = cursor - 1 end

if cdirn > 13 then


if pad:down() and not oldpad:down() and cursor < 16 then cursor = cursor + 1 end

end

if cdirn < 13 then

if pad:down() and not oldpad:down() and cursor < cdirn+3 then cursor = cursor + 1 end
end



if cursor >= screen1e then
screenchange = screenchange + 1

if screenchange > cdirn-15 then screenchange = cdirn-14 end
end



if cursor <= 4 then
screenchange = screenchange - 1
if screenchange > cdirn-15 then screenchange = cdirn-14 end
end


if screenchange < 0 then screenchange = 0 end
screen:blit(10,12*cursor+5,CHZ2)


if cdirn > 13 then
for i = 1, 13 do
screen:print(10, 20+ i*12+25,cdir[i+screenchange+1].name,black)
end
end



if cdirn < 13 then
for i = 1, cdirn do
screen:print(10, 20+ i*12+25,cdir[i+screenchange].name,black)
end
end



if pad:circle() then                          



if string.lower(string.sub(cdir[cursor-2+screenchange].name, -3)) == ".it" or string.lower(string.sub(cdir[cursor-2+screenchange].name, -4)) == ".s3m" or string.lower(string.sub(cdir[cursor-2+screenchange].name, -4)) == ".mod" or string.lower(string.sub(cdir[cursor-2+screenchange].name, -4)) == ".mtm"  then

mode = "music"

Music.playFile("./../../MUSIC/"..cdir[cursor-2+screenchange].name, true)



playstate = "play"
playcheck = true
System.sleep(31)

menuaccess = false
showit = true
bigBG:clear(blank)
end


if string.lower(string.sub(cdir[cursor-2+screenchange].name, -4)) == ".wav" then

mode = "wav"

WAV = Sound.load("./../../MUSIC/"..cdir[cursor-2+screenchange].name, true)

local sound = WAV
wavmusic = sound:play()

playstate = "play"
playcheck = true
System.sleep(31)

menuaccess = false
showit = true  
bigBG:clear(blank)
end


if string.lower(string.sub(cdir[cursor-2+screenchange].name, -4)) == ".mp3" then
Mp3.init(1)
mode = "mp3"

Mp3.load("./../../MUSIC/"..cdir[cursor-2+screenchange].name)

id3tag = {filename = "./../../MUSIC/"..cdir[cursor-2+screenchange].name, title = "", artist = "", album = ""}
id3v1(id3tag)
searchpng(id3tag)


playstate = "play"
Mp3.play()
playcheck = true
System.sleep(31)

menuaccess = false
showit = true  
playcheck = true
bigBG:clear(blank)
end



if string.lower(string.sub(cdir[cursor-2+screenchange].name, -4)) == ".ogg" then
Ogg.init(1)
mode = "ogg"

Ogg.load("./../../MUSIC/"..cdir[cursor-2+screenchange].name)

id3tag = {filename = "./../../MUSIC/"..cdir[cursor-2+screenchange].name, title = "", artist = "", album = ""}



playstate = "play"
Ogg.play()
playcheck = true
System.sleep(31)

menuaccess = false
showit = true  
playcheck = true
bigBG:clear(blank)
end



end




end

end












imgtemp = Image.createEmpty(170,150)

function searchpng(filezz)

  file = io.open(filezz.filename,"r")
  file:seek("set")
  dataZ = file:read(100000)
  file:close()


  found = string.find(dataZ,"image/png") start = 12 thing = 7
  if not found then found = string.find(dataZ,"image/jpg") start = 12 thing =0 end
  if not found then found = string.find(dataZ,"image/jpeg") start = 13 thing =0 end
  find1 = nil
  find2 = nil
  imagedata = nil
  if found then
  find1 = string.sub(dataZ,found+start)
  find2 = string.find(find1,"IEND")
  
  if thing ==7 then
  imagedata = string.sub(find1,0,find2+7)
  end
  
  if thing == 0 then
  imagedata = string.sub(find1,0,find2)
  end
  
  
  if imagedata then
  imgtemp2 = Image.loadFromMemory(imagedata)

  imgtemp:blit(85-imgtemp2:width()/2,75-imgtemp2:height()/2,imgtemp2)
  end
  end
end





function id3v1(tag)

  file = io.open(tag.filename,"r")
  file:seek("end", -128)
  data1 = file:read("*a")
  --file:close()
  
  magic = string.sub(data1, 0, 3)
  if magic~="TAG" then tag.title = tag.filename tag.artist = "-" tag.album = "-" data = nil return 0 end
  
  tag.title = string.sub(data1, 4, 33)
  tag.artist = string.sub(data1, 34, 63)
  tag.album = string.sub(data1, 64, 93)
  
  data = nil
  
  
  
  

end

  

chz = {x = 70, y=0, image = CHZ}
chzmove = false
chzback = false

playstate = "stop"

while true do

Time = Mp3.getTime()

  
pad = Controls.read()


  
screen:blit(0,0,bigBG)
screen:blit(0,0,BG)

screen:blit(chz.x,chz.y,chz.image)
screen:blit(84,10,np)
screen:blit(314,10,lib)
screen:blit(220,219,Play)

if playstate == "pause" or playstate == "stop" then
screen:blit(220,219,Play)
end

if playstate == "play" then
screen:blit(220,219,Pause)
end








mp3play()

if showit == true then



chzback = true
chzmove = false





if playcheck == true then

if mode == "mp3" then


screen:print(50,150,Time,black)
screen:print(0,70, id3tag.artist, black)
screen:print(0,80, id3tag.album, blue)
screen:print(0,90, id3tag.title, blue)

screen:blit(320,70,imgtemp,0,0,150,130,false)



end

if mode == "wav" or mode == "music" or mode == "ogg" then
screen:print(0,70,"./../../../../MUSIC/"..cdir[cursor-2+screenchange].name,black)
end

end











if pad:cross() and playstate == "play" then

if mode == "mp3" then
Mp3.pause()
playstate = "pause"
end

if mode == "ogg" then
Ogg.pause()
playstate = "pause"
end

if mode == "music" then
Music.pause()
playstate = "pause"
end

if mode == "wav" then
wavmusic:stop()
playstate = "stop"
end

end




if pad:circle() and playstate == "pause" then

if mode == "mp3" then
Mp3.play()
end

if mode == "ogg" then
Ogg.play()
end

if mode == "music" then
Music.resume()
end

if mode == "wav" then
wavmusic:play()
end

playstate = "play"  


end








end










if pad:l() and menuaccess == true then    --< 2nd --
menuaccess = false
showit = true  
bigBG:clear(blank)
end




if pad:r() and menuaccess == false then    -- 1st -->
bigBG:clear(skyish)
chzmove = true
chzback = false
menuaccess = true
--playing = false
showit = false

if playcheck == true then

if mode == "mp3" then
Mp3.stop()
imgtemp:clear()
end

if mode == "ogg" then
Ogg.stop()
end

playcheck = false
playstate = "stop"

if mode == "music" then
Music.stop()
end

if mode == "wav" then
wavmusic:stop()
end


end

end






if chzmove == true then
chz.x = chz.x + 23
end

if chzback == true then
chz.x = chz.x - 23
end

if chz.x >= 300 then chz.x = 300 end
if chz.x <= 70 then chz.x = 70 end




if pad:square() then

if playcheck == true then

if mode == "mp3" then
Mp3.stop()
imgtemp:clear()
end

if mode == "ogg" then
Ogg.stop()
end


if mode == "music" then
Music.stop()
end

if mode == "wav" then
wavmusic:stop()
end

playcheck = false
playstate = "stop"
end


end
  
oldpad = pad
  
  
screen.waitVblankStart()
screen.flip()
end






Other files you may be interested in ..





  • 4 892 Total Files
  • 401 Total Categories
  • 13 Total Authors
  • 326 834 Total Downloads
  • WiiMC Latest File
  • Pass_Code Latest Submitter