+ Reply to Thread
Results 1 to 10 of 10

CUE-file support in latest firmware

This is a discussion on CUE-file support in latest firmware within the General Meizu M6 forums, part of the miniPlayer M6 / SL category; Does anybody know how the cue-file support actually works? What I managed to find out is this: When update music ...

  1. #1
    Passing By
    Join Date
    May 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CUE-file support in latest firmware

    Does anybody know how the cue-file support actually works?

    What I managed to find out is this:
    When update music library runs an amount of CUL files is generated.
    Each CUL file represents a song from the CUE file.

    Code:
    #[UTF8FULLPATH]\MUSIC\VA-Global_Underground_24-7_(Mixed_by_Lee_Burridge)-RETAIL-2CD-2003-tronik\01_global_underground_24-7_(mixed_by_lee_burridge)_(cd1)-tronik.mp3
    #[STARTTIME]18:53
    #[TITLE]2 After 909
    #[ARTIST]Justus Kohncke
    #[ALBUM]Global Underground 24-7 (CD 1)
    The only problem here is (again) the song order.
    The reason people rip cd's this way is to have a seamless transition from one song to the next.
    Changing the song order cancels all the advantages of the cue file support.

    So what I am looking for is a way to correct the song order.
    1. A way to do this might be to reference all the CUL files in a playlist.
    2. An other way can be to generate your own CUL files
    I'm looking forward to hearing some ideas from other users.

  2. #2
    Passing By
    Join Date
    May 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Found some time to write a script.
    This generates it's own CUL files.

    First it scans for cue files in the "MUSIC" directory.
    Then it parses them and generates a cul file for each track.

    I hope this is useful for anybody.

    Code:
    Const ForReading = 1 
    Const ForWriting = 2 
    Const ForAppending = 8 
    Const TristateUseDefault = -2 
    Const TristateTrue = -1 
    Const TristateFalse = 0
    
    Const nTitle         = 1
    Const nPerformer     = 2
    Const nStartTime     = 3
    
    Const PlaylistFolder = "PLAYLISTS"
    Const MusicFolder = "MUSIC"
    Const UTFFullPath = "#[UTF8FULLPATH]"
    Const FileTypeCue = "cue"
    
    Dim oShell, oSysEnv, oFileSys, oFile, oStream, oNetwork, oArgs
    Dim sLine, nPos, sTopic, sData, nIndex, nCueFiles
    Dim sCurrentPath, sCulFileName, oMusicFolder, oPlaylistFolder
    Dim sAlbumPerformer, sAlbumTitle, sAlbumFile, sTracks(), sCueFiles()
    
    Set oShell         = CreateObject("WScript.Shell")
    Set oFileSys     = CreateObject("Scripting.FileSystemObject")
    Set oNetwork     = CreateObject("WScript.Network")
    Set oSysEnv     = oShell.Environment("PROCESS")
    
    'Build paths
    sCurrentPath = CStr(oShell.CurrentDirectory)
    Set oMusicFolder = oFileSys.Getfolder(sCurrentPath & MusicFolder)
    Set oPlaylistFolder = oFileSys.Getfolder(sCurrentPath & PlaylistFolder)
    
    ' Find CUE files, put in array
    For Each oFolder In oMusicFolder.SubFolders
        For Each oFile in oFolder.Files
            If LCase(oFileSys.GetExtensionName(oFile.Path)) = FileTypeCue Then
                nCueFiles = nCueFiles+1
                ReDim Preserve sCueFiles(nCueFiles)
                sCueFiles(nCueFiles) = oFile.Path
            End If
        Next
    Next
    
    ' Loop CUE-Files
    For i=1 To nCueFiles
        
        ' Parse CUE file to array
        nIndex = 0
        Set oFile = oFileSys.GetFile(sCueFiles(i))  
        Set oStream = oFile.OpenAsTextStream(ForReading, TristateUseDefault)    
        Do While Not oStream.AtEndOfStream 
            
            sLine = Trim(oStream.ReadLine)
            nPos1 = InStr(sLine," ")-1
            sTopic = Left(sLine,nPos1)
            nPos2 = InStr(sLine,Chr(34))
            nLen = InStrRev(sLine,Chr(34))-nPos2
            
            If (nPos2 <> 0) Then 
                sData = Mid(sLine,nPos2+1,nLen-1)
            Else
                nPos2 = InStr(nPos1+1,sLine," ")
                sData = Trim(Mid(sLine,nPos2))
            End If
             
            Select Case sTopic
            
                Case "REM"
                    'Do nothing
                Case "PERFORMER"
                    If nIndex = 0 Then
                        sAlbumPerformer = sData
                    Else
                        sTracks(nPerformer,nIndex) = sData
                    End If
                Case "TITLE"
                    If nIndex = 0 Then
                        sAlbumTitle = sData
                    Else
                        sTracks(nTitle,nIndex) = sData
                    End If
                Case "FILE"
                    sAlbumFile = sData
                Case "TRACK"
                    nIndex = nIndex+1
                    ReDim Preserve sTracks(3,nIndex)
                Case "INDEX"
                    sTracks(nStartTime,nIndex) = Mid(sData,4,11)
            
            End Select
        
        Loop 
        oStream.Close
        
        ' Write CUL files
        For j=1 To UBound(sTracks,2)
            sTrackNr = CStr(j)
            While Len(sTrackNr) < 2
                sTrackNr = "0"+ sTrackNr
            Wend
            sCulFileName = ConvertToValidFileName(sTrackNr & ") " & sTracks(nPerformer,j) & " - " & sTracks(nTitle,j))
            If oFileSys.FileExists(oPlaylistFolder.Path & "\" & sCulFileName & ".CUL") Then oFileSys.DeleteFile(oPlaylistFolder.Path & "\" & sCulFileName & ".CUL")
            oPlaylistFolder.CreateTextFile(sCulFileName & ".CUL")
            Set oFile = oFileSys.GetFile(oPlaylistFolder.Path & "\" & sCulFileName & ".CUL") 
            Set oCueFile = oFileSys.GetFile(sCueFiles(i))
            Set oStream = oFile.OpenAsTextStream(ForAppending, TristateUseDefault)    
            oStream.WriteLine("#[UTF8FULLPATH]" & Right(oCueFile.ParentFolder,Len(oCueFile.ParentFolder)-2) & "\" & sAlbumFile)
            oStream.WriteLine("#[STARTTIME]" & sTracks(nStartTime,j))
            If j < UBound(sTracks,2) Then oStream.WriteLine("#[ENDTIME]" & sTracks(nStartTime,j+1))
            oStream.WriteLine("#[TITLE]" & sTrackNr & ") " & sTracks(nTitle,j))
            oStream.WriteLine("#[ARTIST]" & sTracks(nPerformer,j))
            oStream.WriteLine("#[ALBUM]" & sAlbumTitle)
            
            oStream.Close
        Next
    
    Next
    
    Function ConvertToValidFileName (sFileName)
        Dim re
        Set re = New RegExp
        
        'forbidden characters in file names:
        re.Pattern = "[\\/:\*\?""<>\|]"
        
        While re.Execute(sFileName).Count > 0
            sFileName = re.Replace(sFileName," ")
        Wend  
        Set re = Nothing
    
        ConvertToValidFileName = sFileName
    End Function
    Last edited by coolchillies; 05-31-2008 at 02:56 PM.

  3. #3
    Freshman
    Join Date
    May 2008
    Location
    Czech Rep.
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    aint that cool

  4. #4
    Passing By
    Join Date
    Jan 2008
    Location
    Frankfurt/Main, Germany
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what's the language this script is written in?

  5. #5
    Passing By
    Join Date
    May 2008
    Location
    Munich, Germany
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Looks like Visual Basic to me. It's probably a WSH (Windows Scripting Host) script.

  6. #6
    Passing By
    Join Date
    May 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yep, it's VBScript. Just past the code into a text file and rename it to something.vbs. Put it in your player's root folder and doubleclick it.

    It requires VB script host to be installed. But that's usually the case.

  7. #7
    Junior Member
    Join Date
    Mar 2007
    Location
    Finland (northern)
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I found out about this few months ago. I was suprised to find CUL files from the player. Originally there was CUE files in the album folder. I haven't even heard about CUL before. And It really seemed NOT to work. In my case it just started to play from the start of any song and play till the end of album without any change in song number.
    Black 8GB miniPlayer SP with FW 2.004.6

  8. #8
    Passing By
    Join Date
    May 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think that's the way it is supposed to work.

    If you look at the content of the CUL file, there is a reference to the original mp3 and a start offset. There is no way for the player to know what the end of the track is.

    Perhaps you can try adding a line #[ENDTIME] or #[STOPTIME].
    But it will propably not work since it has to be recoginzed by the player.

  9. #9
    Passing By
    Join Date
    May 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I made a small modification to the script (code in red) which adds an "#[ENDTIME]" line to the CUL files.

    It amazes me that this is recognized by the player.

    Advantages:
    - Player switches to te next song when the endtime is reached.
    In the old situation the player would display the current track until the end of the disk.
    -Tracktimes are correctly displayed.

    Disadvantages:
    - Silences in between two tracks. No more seemless track transitions.


    Ik think i will keep the script without the end times on my meizu.
    I just hate silences between tracks.

  10. #10
    Junior Member
    Join Date
    Mar 2007
    Location
    Finland (northern)
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well now I tried that same album again... there is 3 cd:s that are all remixed to play without pauses. I found that with the two other "cd:s" the player switched from track to track, but it didn't play one song at a time. There was 2-4 tracks played and then it started again from somewhat random track. It always plays a part from beginning of the album (less than second) before it goes to start of track. So you can't see the right name of track (I'm not sure if it shows the track name which it plays first.)
    Black 8GB miniPlayer SP with FW 2.004.6


 

Similar Threads

  1. Latest firmware but no radio
    By Luminoll in forum Firmware
    Replies: 2
    Last Post: 09-21-2007, 05:05 PM
  2. Latest Firmware and Upgrade Instructions On Our Site
    By miniplayer-info in forum Firmware
    Replies: 0
    Last Post: 09-11-2007, 06:47 PM
  3. how do i put the latest firmware on my meizu
    By bege2461 in forum Firmware
    Replies: 21
    Last Post: 07-25-2007, 02:25 AM
  4. Battery Life with latest firmware (S2.002.3)???
    By sere83 in forum General Meizu M6
    Replies: 14
    Last Post: 07-25-2007, 12:57 AM
  5. What is the latest firmware update?
    By world2002traveler in forum Firmware
    Replies: 12
    Last Post: 02-13-2007, 10:47 PM