Announcement

Collapse
No announcement yet.

.m3u playlist app

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • .m3u playlist app

    There have been questions on using playlists to load songs using AMS rather than WMP or WinAmp or similar app. I have put this small app together for people to look at. In short, you click on the album you want play and it will load all the songs from a .m3u file into a list box. To start playing the song you will need to double-click on the song you want to play. In order to use this app correctly you will need to place mp3s into the music directory and create your own playlist.m3u. There is a .m3u there by default but you will want to add your own songs to it to have it work correctly.

    Click Here

    Download the above file and unzip (with folders) to your AMS Project directory. Open the m3u playlist.am4 file to view the program. I have not included the built files to save on room. I figured you would be able to build it on your own. The program is not very elaborate, I figured you all could embellish on your own.

    When creating your playlist, only include the name of the .mp3 file. Do not include the path. If you use WinAmp or other software to build your .m3u file you may need to edit it so it only includes the file name. If you want to build your own .m3u using the Windows Command Prompt, here is how you would do it.

    You will need to add a file called playlist.m3u along with the songs to the \music directory in order for it to work. The playlist.m3u should contain just the filenames of the songs in the \music directory. To create a simple .m3u file you can use the dir command with a /b option and output it to a file.

    1. Copy your mp3s to the \music directory
    2. Open a command prompt (Start->Run and type cmd or command if you are running Win98/95)
    3. Use cd to navigate to the \music directory of your project
    4. Type <pre>c:\dir /b > playlist.m3u</pre>
    5. While still in the command prompt type <pre>edit playlist.m3u</pre>
    6. Remove the line that contains the file name <pre>playlist.m3u</pre> and make sure that there is not a carridge return on the very last line. Use your arrow keys to navigate within the edit window. (You can use Notepad or other software as well, what ever you are most comfortable with using. To edit using notepade type <pre>notepad.exe playlist.m3u</pre>)
    7. Save your file. Within the edit window, hit <pre>Alt+F</pre> to open the file menu and the <pre>S</pre> to save.
    8. <pre>Alt+F</pre> then <pre>X</pre> will exit the edit mode.
    9. You are then ready to build and run your project
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  • #2
    New Link

    Here is the new link to the site


    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

    Comment


    • #3
      Re: .m3u playlist app

      Been on holiday thought I would show appreciation with a thanks for the time u took with the playlist app.

      One question (hehe), I want to remove some titles and replace track numbers so thought I could use ''replace string''
      Works on the first track but can't get it to work on multiple tracks.

      Eg;
      Folder name1\01 - name of track
      Folder name1\02 - name of track
      Folder name2\02 - name of track
      Folder name3\03 - name of track
      Folder name4\03 - name of track

      I want to remove Folder name\ and change one track 02 to 04 and one track 03 to 05. Got about 100 to change.

      Sorry for long example hope u can help once again
      Geo

      Comment


      • #4
        Re: .m3u playlist app

        I guess I am not understanding exactly what you are wanting to do. Is this replace function going to be part of the runtime or is it a one time only function? If it is a one time function I would use some other replace/renaming tool. If it is going to be part of the runtime, will the changes always be the same. Are you changing the .m3u file or the actual .mp3 file name?

        More details will help.

        Thanks
        Tigg
        TJ-Tigger
        "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
        "Draco dormiens nunquam titillandus."
        Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

        Comment


        • #5
          Re: .m3u playlist app

          Sorry, the changes will be for the .m3u file. When I open the greatest hits album page, instead of having a folder full of the mp3s that will load, and to save space on cd I wanted to use the tracks from the other albums that compile the greatest hits. But the album name shows and the tracks from the different albums have their position number, eg track 1, 2, 3, some with same numbers. Don't know if i'm explaining this well?

          example:

          Click on greatest hits album cover;
          page opens to reveal playlist box with tracks loaded from a .m3u file, something like this;

          qu\01 - track name
          hs\01 - track name
          inn\02 - track name
          mir\02 - track name

          and so on.The first part before\ is the album where track comes from, could get rid of that by putting every single track into one folder and using .m3u files to select tracks for appropriate albums, but it would involve a lot of changes to be made to what i've done so far.

          The position numbers some are the same because i'm taking them from different albums and can't change them in .m3u because the track won't be found. was going to use replace string the way you used it to remove _ from your .m3u playlist app example, but can only get it to work once.

          Does any of this make sense now because i'm lost

          Comment


          • #6
            Re: .m3u playlist app

            OK, so I think I understand what you are trying to do. You have multiple albums from one band on your CD and you want to include their greatests hits album as well. Rather than including the Greatest Hits album you want to conserve space and compile the songs from the other albums. In doing this you will have the .m3u pointing to the songs in their correct folders, however when you build the listbox it shows the songs as they would appear in their original albums.

            So what you want to do with the greatesthits.m3u is remove the folder names from what is displayed in the listbox and change the number of the song so that it displays correctly for the true Greatest Hits album?

            Removing the folder name is easy. Do your other .m3us have the folder names displayed in the list box as well?

            I believe your folder structure looks like this(folders are displayed in all caps):

            DATA
            autorun.exe
            autorun.inf
            autorun.ico
            greatesthitsplaylist.m3u
            DISK1\playlist.m3u
            DISK1\01 song 1
            DISK1\02 song 2
            DISK1\03 song 3
            DISK1\04 song 4
            DISK2\playlist.m3u
            DISK2\01 song 1
            DISK2\02 song 2
            DISK2\03 song 3
            DISK2\04 song 4
            DISK3\playlist.m3u
            DISK3\01 song 1
            DISK3\02 song 2
            DISK3\03 song 3
            DISK3\04 song 4

            This should be straight forward on what you want to do because it will always be the same. Meaning the replace function is static and not dynamic. The .m3u will not need to change only what is displayed in the list box needs to change. Items in a listbox are displayed in two parts

            filename;;path to file

            We only want to change the filename that is displayed to the user as part of the list box. Here is the code from the file that walks through the .m3u and builds what is displayed in the list box.
            <pre>WHILE (%Ctr% < %LineCount%)
            // Get the current %Ctr% line from the file starting at 0
            %TextLine% = TextFile.GetLine ("%SrcDir%\music\playlist.m3u", %Ctr%)

            // My songs had _ in them so this line will remove them
            %NewString% = String.Replace ("%TextLine%", "_", " ")

            <font color=blue>%NewString% = String.ParsePath ("%NewString%", Filename)</font color=blue>

            // This will remove the .mp3 from the end of the file for display purposes
            %NewString% = String.GetDelimitedString ("%NewString%", ".", 0)

            <font color=blue>insert new IF/ENDIF codes here</font color=blue>

            // This line will then add the name of the song (which was stored in the variable %NewString%
            // and the name of the file (which was stored in %TextLine% and put them in the list box
            ListBoxObject[ListBox1].Add (End, "%NewString%::%SrcDir%\music\%TextLine%")

            // Increase the counter by one and redo the same thing.
            %Ctr% = Evaluate (%Ctr% + 1)
            END WHILE</pre>

            My suggestion would be to add IF statements that would check to find the name of the song and if true change what is displayed. This would require multiple IF statements but since it is static in nature should work well. Something like this:
            <pre>IF (%NewString% = "02 song 2")
            %NewString% = "04 song 4"
            ENDIF

            IF (%NewString% = "03 song 3")
            %NewString% = "05 song 5"
            ENDIF</pre>

            Just create an IF/ENDIF statement for each song that you want to change. That should work great!!

            And as far as removing the folder names use the String.ParsePath function and grab only the filename.ext. You would want to do this before the function that removed the .ext in the above code. Here is a sample and I have marked the above code where you would probably want to place it.

            <pre>%NewString% = String.ParsePath ("%NewString%", Filename)</pre>

            I hope that helps
            Tigg
            TJ-Tigger
            "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
            "Draco dormiens nunquam titillandus."
            Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

            Comment


            • #7
              Re: .m3u playlist app

              Thanks again TJ for ur quick reply...looks good will give it a go and let u know how I get on :-)

              Comment


              • #8
                Re: .m3u playlist app

                TJ wondering if i could email u an example of what i'm doing?
                can't figure out second part of IF statement. Only 207KB.

                Comment


                • #9
                  Re: .m3u playlist app

                  Sure send it over, I sent you a PM
                  TJ-Tigger
                  "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
                  "Draco dormiens nunquam titillandus."
                  Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

                  Comment

                  Working...
                  X
                  😀
                  🥰
                  🤢
                  😎
                  😡
                  👍
                  👎