Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 14 of 14
  1. #1
    Join Date
    Sep 2007
    Location
    UK
    Posts
    73

    Help with my Media Player please!

    right, so I got this app that will be used to play all my music via my internal 1Gb network.

    I need help with the following:

    I opted for a listbox for listing the availible music, but I have had to split it up into 1 listbox that shows all albums as soon as the page is shown, and when you double-click an album title, it ( should ) display ONLY the tracks in the selected album ( so far, it lists ALL tracks ) and when a track is double-clicked on, I would like it to play using the default player ( on my system its Real Player)

    code for On Show:

    tblAlbums = File.Find("AutoPlay\\Music", "", true, true)

    if tblAlbums ~= nil then
    for i,v in tblAlbums do
    tblSplitPath = String.SplitPath(v)
    ListBox.AddItem("ListBox1", tblSplitPath.Filename..tblSplitPath.Extension, tblSplitPath.Filename..tblSplitPath.Extension)
    end
    end
    Code for Listbox 1 ( Album list )

    tblTracks = File.Find("AutoPlay\\Music", "*.MP3", true, false)

    if tblTracks ~= nil then
    for i,v in tblTracks do
    tblSplitPath = String.SplitPath(v)
    ListBox.AddItem("ListBox2", tblSplitPath.Filename..tblSplitPath.Extension, tblSplitPath.Filename..tblSplitPath.Extension)
    end
    end
    Code for Listbox 2 ( Tracks )

    tblSelected = ListBox.GetSelected("ListBox1")

    if tblSelected ~= nil then
    strItemData = ListBox.GetItemData("ListBox1", tblSelected[1])

    if strItemData ~= "" then
    File.Open("AutoPlay\\Music"..strItemData, "", SW_MAXIMIZE)
    end
    end
    What I would like is when the first listbox is clicked on, it will display only the tracks in that album ( folder ) in Listbox2, and when a track is clicked on I;d like it to play.

    Also, is there anyway to remove the .mp3 from the list of tracks? as in: example.mp3 -> example

    Any and all help is welcome and well needed!

    Thank you all!

  2. #2
    Join Date
    May 2006
    Posts
    5,380
    im in the middle of making my own mp3 manager,

    i using worms (free) mp3tag dll (untill i get my own one working properly!)

    heres what i did

    create a sqlite database with 2 tables, "tracks" and "playlists", when you add a folder (of mp3 files) to the app you loop through the tracks in the folder adding the id3 info to the tracks table (title, artist, album, genre)

    then you can use a tree object, add the main node (name like Music Collection) (1) and add artist (1.1) title (1.2) album (1.3) genre (1.4) and a new node for the playlist (2)

    now you can sort through your music by id3 tag info, click a album in the tree and all tracks in that album are shown in the listbox, same for title, artist and genre

    and then you can save your playlist to the database as well, adding the id3 info for each track

    it might seem like a lot of work.....but its worth it for the end result




    failing that.....just set the recurse on your file.find action to false, then it will only add the files in that folder, and to hide the extension, just use "tblSplitPath.Filename" instead of "tblSplitPath.Filename..tblSplitPath.Extension "



    EDIT: on closer inspection of your code.....its all wrong, give me 20 mins and ill make you a simple example
    Open your eyes to Narcissism, Don't let her destroy your life!!

  3. #3
    Join Date
    May 2006
    Posts
    5,380
    ok, here ya go


    put this in page onshow and set the path to your music folder
    Code:
    FolderPath = Shell.GetFolder(SHF_MYDOCUMENTS)-- set your folder path here
    
    tblFolders = Folder.Find(FolderPath, "*", false, nil);
    if tblFolders then
    	for i,k in tblFolders do
    		FolderName = String.Mid(k, String.ReverseFind(k, "\\") + 1, -1);
    		ListBox.AddItem("ListBox1", FolderName, k);
    	end
    end

    this is the code for listbox 1,
    Code:
    lbSel = ListBox.GetSelected("ListBox1");
    if lbSel then
    	FolderPath = ListBox.GetItemData("ListBox1", lbSel[1]);
    	tblFiles = File.Find(FolderPath, "*.mp3", false, false, nil, nil);
    	ListBox.DeleteItem("ListBox2", -1);
    	if tblFiles then
    		for i,k in tblFiles do
    			sPath = String.SplitPath(k);
    			ListBox.AddItem("ListBox2", sPath.Filename, k);
    		end
    	end
    end

    this is the code for listbox 2
    Code:
    lbSel = ListBox.GetSelected("ListBox2");
    if lbSel then
    	FilePath = ListBox.GetItemData("ListBox2", lbSel[1]);
    	File.Open(FilePath, "", SW_SHOWNORMAL);
    end
    hope that helps you out
    Open your eyes to Narcissism, Don't let her destroy your life!!

  4. #4
    Join Date
    Sep 2007
    Location
    UK
    Posts
    73
    Thanks Rizla, I tried your second post and it works like a charm thanks!

    I will however, try your first method too, as Im sure I could incorporate this as a version 1.1
    If I need anymore help I will post here!

    Thanks once again fella, top notch!

  5. #5
    Join Date
    May 2006
    Posts
    5,380
    Hey no problem, always glad to help
    Open your eyes to Narcissism, Don't let her destroy your life!!

  6. #6
    Join Date
    Sep 2007
    Location
    UK
    Posts
    73

    Now for the movie part!

    right, now I have made a section for my movies & videos, but the double-clicked listbox will not open them

    On Show Code:
    tblAVIFiles = File.Find("AutoPlay\\Movies & Films\\", "*.avi", false, false)

    if tblAVIFiles ~= nil then
    for i,v in tblAVIFiles do
    tblSplitPath = String.SplitPath(v)
    ListBox.AddItem("ListBox1", tblSplitPath.Filename, tblSplitPath.Filename)
    end
    end
    On Listbox1 ( Double-click )
    tblSelected = ListBox.GetSelected("ListBox1")

    if tblSelected ~= nil then
    strItemData = ListBox.GetItemData("ListBox1", tblSelected[1])

    if strItemData ~= "" then
    File.Open("AutoPlay\\Movies & Films"..strItemData, "", SW_MAXIMIZE)
    end
    end
    Well this is all I need to get right before it will all work, then I need something major hehe!
    When I single click on a movie, I want it to display it's relevant artwork and to display a small text file in the paragraph object, this will be for the use of extra information (some knows by the titles, others by the artwork) and could proove useful for chosing the right movie as it will have a short description & plot outline ( or the like )

    So if anyone can help me with the coding for the above, that would be excellent!

  7. #7
    Join Date
    May 2006
    Posts
    5,380
    ok, well for this issue you are setting the filename as the listbox data, the file.run command needs the full path to the file


    in this block of code
    Code:
     tblAVIFiles = File.Find("AutoPlay\\Movies & Films\\", "*.avi", false, false)
    
    if tblAVIFiles ~= nil then
    for i,v in tblAVIFiles do
    tblSplitPath = String.SplitPath(v)
    ListBox.AddItem("ListBox1", tblSplitPath.Filename, tblSplitPath.Filename)
    end
    end
    change it to
    Code:
    tblAVIFiles = File.Find("AutoPlay\\Movies & Films\\", "*.avi", false, false)
    
    if tblAVIFiles ~= nil then
    for i,v in tblAVIFiles do
    tblSplitPath = String.SplitPath(v)
    ListBox.AddItem("ListBox1", tblSplitPath.Filename, v)
    end
    end
    and that should work

    EDIT:

    for the image and text info, name your image and text file the same as the movie and when a movie is selected from the listbox you can loat the image and text file with the same name

    hope that helps
    Last edited by RizlaUK; 10-11-2007 at 11:57 AM.
    Open your eyes to Narcissism, Don't let her destroy your life!!

  8. #8
    Join Date
    Sep 2007
    Location
    UK
    Posts
    73
    er, it didnt help really, it just adds the list of movies again and again lol

    Ive attatched an export of the video portion so it hopefully will be clearer & easier!

    also, reguarding the text & images, would it be OK to have them in seperate folders, as I have Movies & Videos, then something like Artwork and another folder called say "Bio's" hopefully this would work
    Attached Files

  9. #9
    Join Date
    May 2006
    Posts
    5,380
    well, i cant see why its adding the list over and over as i only changed the listbox item data, are you sure you put the code in the right place ?
    Open your eyes to Narcissism, Don't let her destroy your life!!

  10. #10
    Join Date
    Sep 2007
    Location
    UK
    Posts
    73
    I think so, I pasted the code into the listbox on double click event, but it just adds loads more to the list and dont open anything, see the exported app for what I mean happens

  11. #11
    Join Date
    May 2006
    Posts
    5,380
    lol, that was the code to add the files to the listbox, put it in page onshow
    Open your eyes to Narcissism, Don't let her destroy your life!!

  12. #12
    Join Date
    Sep 2007
    Location
    UK
    Posts
    73
    Ah right lol!
    Well I sorted that out, put it in the right place and re-did the listbox code, but I think it is a problem with the code for the Double-click as it wont do anything now, I double click and no movie!

    tblSelected = ListBox.GetSelected("ListBox1")

    if tblSelected ~= nil then
    strItemData = ListBox.GetItemData("ListBox1", tblSelected[1])

    if strItemData ~= "" then
    File.Open("AutoPlay\\Movies & Films"..strItemData, "", SW_MAXIMIZE)
    end
    end
    Is this the problem by any chance?

  13. #13
    Join Date
    May 2006
    Posts
    5,380
    try it like this
    Code:
    tblSelected = ListBox.GetSelected("ListBox1")
    if tblSelected then
        strItemData = ListBox.GetItemData("ListBox1", tblSelected[1])
        if strItemData ~= "" then
            File.Open(strItemData, "", SW_MAXIMIZE)
        end
    end
    Open your eyes to Narcissism, Don't let her destroy your life!!

  14. #14
    Join Date
    Sep 2007
    Location
    UK
    Posts
    73
    Thanks fella that works a treat

    I have added an 'admin page' so I can update (copy) the media from my server as at the moment I have this app running on a 160GB USB HDD and works lovely!

    I am interested in your database way of doing the music, so like a tree labeled My Music, with expandable branches for music in album order or individual tracks!
    The only database experience I have is with Excel & Clarion, so would this be too difficult for me to make with or without a database?

Similar Threads

  1. PROBLEM: Invalid State Error with the Media Player Object
    By Desmond in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-31-2003, 11:16 AM
  2. Media Player 9.0 Issues in AMS40
    By Brett in forum AutoPlay Media Studio 4.0
    Replies: 0
    Last Post: 01-23-2003, 10:26 AM
  3. INFO: Difference between the Media Player Object and the AVI Object
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-29-2002, 02:15 PM
  4. HOWTO: Make a Media Player Object Go Full Screen
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-23-2002, 11:23 AM
  5. Replies: 0
    Last Post: 10-04-2002, 10:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts