Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to use QML Playlist Type save function to save playlist.

How to use QML Playlist Type save function to save playlist.

Scheduled Pinned Locked Moved Solved QML and Qt Quick
playlistaudiomediaplayerqml
2 Posts 1 Posters 483 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    iamRahul
    wrote on 12 Apr 2020, 03:46 last edited by iamRahul 4 Dec 2020, 03:48
    #1

    I am unable to use Playlist save function to save playlist of my Music Player made in QML.
    I already have tried using the function, but the operation always fails.

    FileDialog {
            id: filesLoader
            title: "Chose files to add to playlist"
            folder: shortcuts.music
            selectMultiple: true
            selectExisting: true
            nameFilters: ["Mp3 Files (*.mp3)"]
            onAccepted: {
                audioPlaylist.addItems(fileUrls)
                if(audioPlaylist.save("file:///E:/Playlist")) {
                    console.log("Playlist Saved")
                }
                else {
                    console.log("Playlist Save  Failed"+audioPlaylist.errorString)
                }
                
            }
        }
    

    I dont know why. May be because of providing wrong location parameter in the syntax
    bool Playlist.save (location,format)
    Syntax Link
    I checked the documentation of Playlist Type but it does not mention any guidelines about how and what type the location is required.
    I can use FolderListModel, but I want to explore Playlist Type if useful.
    Please help me.

    I 1 Reply Last reply 12 Apr 2020, 05:09
    0
    • I iamRahul
      12 Apr 2020, 03:46

      I am unable to use Playlist save function to save playlist of my Music Player made in QML.
      I already have tried using the function, but the operation always fails.

      FileDialog {
              id: filesLoader
              title: "Chose files to add to playlist"
              folder: shortcuts.music
              selectMultiple: true
              selectExisting: true
              nameFilters: ["Mp3 Files (*.mp3)"]
              onAccepted: {
                  audioPlaylist.addItems(fileUrls)
                  if(audioPlaylist.save("file:///E:/Playlist")) {
                      console.log("Playlist Saved")
                  }
                  else {
                      console.log("Playlist Save  Failed"+audioPlaylist.errorString)
                  }
                  
              }
          }
      

      I dont know why. May be because of providing wrong location parameter in the syntax
      bool Playlist.save (location,format)
      Syntax Link
      I checked the documentation of Playlist Type but it does not mention any guidelines about how and what type the location is required.
      I can use FolderListModel, but I want to explore Playlist Type if useful.
      Please help me.

      I Offline
      I Offline
      iamRahul
      wrote on 12 Apr 2020, 05:09 last edited by iamRahul 4 Dec 2020, 05:10
      #2

      @iamRahul I figured it out. We need to specify full location path till the file, and specify file type in format. Then it worked for me.

      
                  if(audioPlaylist.save("file:///C:/MyMusicPlayer/Playlists/global_playlist.m3u","m3u")) {
                      console.log("Playlist Saved")
                  }
      

      Adding the filename global_playlist.m3u and format m3u made it working for me.

      1 Reply Last reply
      0

      1/2

      12 Apr 2020, 03:46

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved