Jump to content

question about reading the audio Play list using autoit


Recommended Posts

hello
Hi dear, I have a question please
I designed a function to read the content of the playlist
I succeeded in that
I have a problem
For VLC player playlists
If the path of the files in Arabic language the path is be as follows
%D8%A3%D8%B0%D9%83%D8%A7%D8%B1%20%D9%88%D8%A3%D8%AF%D8%B9%D9%8A%D8%A9/%D8%A3%D8%B0%D9%83%D8%A7%D8%B1%20%D9%85%D9%86%D9%88%D8%B9%D8%A9/%D8%A3%D8%B0%D9%83%D8%A7%D8%B1%2003.mp3
I did not know how to decrypt this text to be readable
This is the function that i used

func M3UImport($M3UFile)
dim $AM3UItems
local $fileOpen = FileOpen($path, bitOr($FO_OVERWRITE,$FO_CREATEPATH,$FO_ANSI))
_FileReadToArray ($fileOpen, $AM3UItems)
if @error then return setError(1)
local $M3UPath
for $i = 1 to $AM3UItems[0]
$AM3UItems[$i] = stringReplace($AM3UItems[$i], "file:///", "")
$AM3UItems[$i] = stringReplace($AM3UItems[$i], "/", "\")
$AM3UItems[$i] = stringReplace($AM3UItems[$i], "%20", " ")
$M3UPath = _fileGetDirPath($AM3UItems[$i])
if $M3UPath = "" then
$M3UPath = @WorkingDir
if not StringTrimRight($M3UPath, 1) = "\" then $M3UPath &= "\"
$AM3UItems[$i] = $M3UPath & $AM3UItems[$i]
endIf
local $ext = _GetFileExt($AM3UItems[$i])
if fileExists($AM3UItems[$i]) and not (StringInStr($FilesExt, $ext) = 0) then
$aListItems[0] += 1
GUICtrlCreateListViewItem(_GetFileName($AM3UItems[$i]) & Opt("GUIDataSeparatorChar") & " : " & Opt("GUIDataSeparatorChar") & $AM3UItems[$i], $list)
endIf
next
return ""
endFunc


I ask for your help in this work
with my Greetings and thanks in advance
Link to post
Share on other sites

Hello. maybe something like this:

#include <Array.au3>
Local $sString = "%D8%A3%D8%B0%D9%83%D8%A7%D8%B1%20%D9%88%D8%A3%D8%AF%D8%B9%D9%8A%D8%A9/%D8%A3%D8%B0%D9%83%D8%A7%D8%B1%20%D9%85%D9%86%D9%88%D8%B9%D8%A9/%D8%A3%D8%B0%D9%83%D8%A7%D8%B1%2003.mp3"

MsgBox(0, "", _MakeReadable($sString))


Func _MakeReadable($sString)
    Local $aReg = StringRegExp($sString, '%[0-9a-fA-F]{2}|.', 3)
    Local $sChar = ""
    Local $sReadableString=""
    For $i = 0 To UBound($aReg) - 1
        $sChar = StringReplace($aReg[$i], "%", "")
        If StringLen($sChar) = 2 Then
            $sReadableString &= Chr("0x" & $sChar)
        Else
            $sReadableString &= $sChar
        EndIf
    Next
    Return BinaryToString(StringToBinary($sReadableString), 4)
EndFunc   ;==>_MakeTeadable

Saludos

Link to post
Share on other sites

When I used this example, it just gave me as a result the number 3 only
Is there a solution please?

#include <Array.au3>
Local $sString = "%D8%A3%D8%B0%D9%83%D8%A7%D8%B1%20%D9%88%D8%A3%D8%AF%D8%B9%D9%8A%D8%A9/%D8%A3%D8%B0%D9%83%D8%A7%D8%B1%20%D9%85%D9%86%D9%88%D8%B9%D8%A9/%D8%A3%D8%B0%D9%83%D8%A7%D8%B1%2003.mp3"
MsgBox(0, "", _MakeReadable($sString))
Func _MakeReadable($sString)
Local $aReg = StringRegExp($sString, '%[0-9a-fA-F]{2}|.', 3)
    Local $sChar = ""
    Local $sReadableString=""
    For $i = 0 To UBound($aReg) - 1
$sChar = StringReplace($aReg[$i], "%", "")
If StringLen($sChar) = 2 Then
$sReadableString = Chr("0x" & $sChar)
Else
$sReadableString = $sChar
EndIf
Next
Return BinaryToString(StringToBinary($sReadableString), 4)
EndFunc


am waiting
:D

 

Link to post
Share on other sites

$sReadableString = Chr("0x" & $sChar) needs to be $sReadableString &= Chr("0x" & $sChar) and $sReadableString = $sChar needs to be $sReadableString &= $sChar

 

 

Saludos

Link to post
Share on other sites


i ded what you tell me but the result is 3
this is the function

#include <Array.au3>
Local $sString = "%D8%A3%D8%B0%D9%83%D8%A7%D8%B1%20%D9%88%D8%A3%D8%AF%D8%B9%D9%8A%D8%A9/%D8%A3%D8%B0%D9%83%D8%A7%D8%B1%20%D9%85%D9%86%D9%88%D8%B9%D8%A9/%D8%A3%D8%B0%D9%83%D8%A7%D8%B1%2003.mp3"
MsgBox(0, "", _MakeReadable($sString))
Func _MakeReadable($sString)
Local $aReg = StringRegExp($sString, '%[0-9a-fA-F]{2}|.', 3)
    Local $sChar = ""
    Local $sReadableString=""
    For $i = 0 To UBound($aReg) - 1
$sChar = StringReplace($aReg[$i], "%", "")
If StringLen($sChar) = 2 Then
$sReadableString = Chr("0x" & $sChar)
Else
$sReadableString = $sChar
EndIf
Next
Return BinaryToString(StringToBinary($sReadableString), 4)
EndFunc

Link to post
Share on other sites

@nacerbaaziz

Because you use a screen reader, the ampersands are probably not getting translated correctly because they are immediately before an equal sign.  To make the function work correctly, you need to modify 2 lines that were not transcribed correctly.  Those 2 lines are below.

 

21 hours ago, nacerbaaziz said:

$sReadableString = Chr("0x" & $sChar)

 

21 hours ago, nacerbaaziz said:

$sReadableString = $sChar

On the 2 lines above, there should be an ampersand immediately before the equal sign (without a space in between).  The operator should read ampersand equal.

I hope that helps.

Link to post
Share on other sites

Hello
it's worked with me, thank you very much
Now I have a simple request if you can help me please
the question Is how I can know if the string as   this type or normal string
I have to make it detect this type so there is no contradiction between the strings types
I mean the playlist can be in Arabic and it can be in English
I hope that my request is clear for you
Greetings

Link to post
Share on other sites

@nacerbaaziz

You can either use @Danyfirex's function on all titles to make sure they are converted if necessary or you can search each title for an ampersand followed by 2 numeric digits, and if found, use the function.  The safest and most efficient way would be to do the check for the escape sequences and only convert if necessary.

Link to post
Share on other sites

I've written the function as this form, please give me your opinion.

Func _MakeReadable($sString)
Local $aReg = StringRegExp($sString, '%[0-9a-fA-F]{2}|.', 3)
    Local $sChar = ""
    Local $sReadableString=""
local $number = 0
For $i = 0 To UBound($aReg) - 1
$sChar = StringReplace($aReg[$i], "%", "")
If StringLen($sChar) = 2 Then
$sReadableString &= Chr("0x" & $sChar)
$number += 1
Else
$sReadableString &= $sChar
$number -= 1
EndIf
Next
if $number < 2 then
return string($sReadableString)
else
Return BinaryToString(StringToBinary($sReadableString), 4)
endIf
EndFunc

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By CYCho
      This file includes the source code for zPlayer, which is a stand-alone, simple, intuitive and easy-to-use, yet fully functional media player.  I made this to suit my purpose and you can tweak it to your taste. The source code is only about 1600 lines and only standard #include files were used. Also included in the source code file are some image files which are used for drawing the graphical media controls in the main window.
      As of its release date, the compiled exe file of this player, as attached hereto, is not flagged by Windows Defender with latest Security Intelligence Update.
      Hash values for compiled file of the latest version are as follows:
      SHA256: EF952C26961241CECF5EEB3E34CCACC369F9F158E71028BAFC36F86BA0B03C03
      SHA1: 7F78EA91E069D1A6D646A6FBBB390EC68ABDED81

      This player has the following features:
      - Play back all formats of media files which can be played back by the Windows Media Player in your computer
      - Depending on the file types specified by the user in zPlayer.ini file this player can be either audio only, video only or both.
      - Video window is independent of other windows and, when maximized, increases the immersion of the user
      - Graphical media controls similar to embedded Windows Media Player
      - Forward, backward, pause, repeat, shuffle function
      - Increase/decrease/mute sound volume
      - Change folders and create playlist for all media files in that folder and its subfolders, and support for manually-made playlists
      - Save play-back environment when terminating and resume that environment when restarting
      - 'Continue playback' option for a file you left off in the middle of playback
      - With one click, you can see internet search results for the file selected in playlist
      - With a double-click, you can play back an item in the playlist
      - Search strings in the playlist
      - Option to see long file names including folder names
      - View file properties for any file in the playlist and copy their values
      - Resize the playlist and video windows, and restore them to their default positions
      - Very small footprint: very low CPU and memory usage, with only about 1MB when compiled
      - You can even hide all the windows and manipulate the player with hotkeys only
      Note: zPlayer is the name I used when I introduced the early version of this player in my blog back in early 2009 and, therefore, has nothing to do with the mobile media player of the same name which started marketing in 2015.
       
    • By fire35
      Hello. I need to write a User Script to add videos to created playlists. On the video watch page on the right, there are recommended videos.
      When cursor on thumbnail upper-right on icon appears plus sign, when cursor on that plus sign appears list of user's playlists and by clicking on playlist name video adding to playlist and appears plus sign located right of playlist name. If video already in some playlist, when cursor on thumbnail plus sign, plus sign already located right of playlist name.
      I think it must be like JS function copy thumbnail, link and video name, after adding that on playlist page. Playlist page initially is some cleared page of site, for example page that doesn't exist - when you put wrong address that's written. User Script saves data to appear it on that page.
      On the playlist page, you can remove videos from it. There is also a page set in the code where you can create or delete a playlist. When creating, along with the name, the address of an empty page is set to which the video will be added.
      On the video viewing page, a plus sign is also needed under it so that this video can be added.
      This is the code for the thumbnail on the right of the page.
      <div id="node-1001410" class="node node-video node-sidebar_teaser clearfix" data-toggle="tooltip" data-placement="top" title="" data-original-title="VIDEO NAME">
          <div>
              <div class="icon-bg">
                                  <div class="right-icon likes-icon">
                          <i class="glyphicon glyphicon-heart"></i> 795                </div>
                  
                  <div class="left-icon likes-icon">
                      <i class="glyphicon glyphicon-eye-open"></i> 37.7k            </div>
                          </div>
              <div class="field field-name-field-video field-type-video field-label-hidden"><div class="field-items"><div class="field-item even"><a href="/videos/gf45ugh5ca"><img src="//Full IMG Address" width="141" height="84" alt="VIDEO NAME" title="VIDEO NAME"></a></div></div></div>
                  </div>
          </div>
      <div>
      On the video viewing page, to add to the playlist, you need to extract the poster address from part of the code
      <div poster = "//Full IMG Address" ...>
      Title from here 
      <h1 class = "title"> VIDEO NAME </h1>
      I think it's worth copying the number of likes and views from here
      <div class="node-views"><i class="glyphicon glyphicon-heart"></i> 380 <i class="glyphicon glyphicon-eye-open"></i> 17,716 </div>
      I rely on you.
    • By CYCho
      zPlayer is the name I used when I introduced the early version of this player in my blog back in early 2009 and, therefore, has nothing to do with the mobile media player of the same name which started marketing in 2015.
      After I retired from active duty in 2002 I spent much time listening to music. First I started with CD's and LP's, then quickly moved on to mp3 files. I converted many of my CD's to mp3 and I collected many more from various sources which were freely available at the time. As the number of my mp3 files grew, I put them in folders according to their genres and my favorite classifications. I mainly used Windows Media Player to listen to them and I slowly began to dislike wmp because it had massive user interface while I just wanted to listen to music in the background while I was doing other work in the foreground, hopping between folders from time to time. It was the time I was beginning to learn AutoIt and I thought I should make my own player with AutoIt. Coming from a sales career with no experience in programming, it was not an easy task. Somehow, after about 2 years of learning and trying, I had my own audio player which worked with only hotkeys without any graphical interface. I gave it to some of my friends who were not as computer-savvy as I. They liked it but definitely wanted something to clcik with mouse. So I came up with very rude gui which took a form similar to what it is now.
      The attached source files include one au3 file, one icon file and 14 jpg files. The jpg files are used for drawing a graphical player and are fileinstalled in @DocumentsCommonDir folder. This player uses WMPlayer.OCX as its engine and supports all audio file formats supported by wmp and additional codecs installed. I would like to thank @Bilgus for kind answers to my questions and would appreciate it if anyone could review the code and give me any suggestion. This player works for me, but I don't know whether the code is presentable as an example. I am posting this here with a hope to learn much from AutoIt community.
      PS: Video function was added in August 2020. 


      Please see Downloads section of this forum for the latest version of this player.
    • By PeterVerbeek
      In this post I take the opportunity to show the awesome capabilities of AutoIt and its libraries. My open source project Peace is a long running AutoIt based app located on SourceForge. It provides users with a system-wide equalizer and effects machine. It's an interface using the power of Equalizer APO, an audio processing object software. Peace has been download over 2,600,000 times by various kind of users. Amongst others it gives them possibilities like these:
      Hearing impaired - Amplify the gain of frequencies which are impaired. Home Theatre - Create Equalizer presets for watching movies and listening to music. Music lovers & audiophiles - Create presets for listening to music on their high quality speakers and headphones. Gamers - Enhance frequencies to get an edge over other gamers. Headphones - Improve the sound quality of cheap headphones and get the max out of expensive ones. Bass lovers - Boost low frequencies for extra bass. Voice - Make a microphone sound better and improve the voice, for instance for YouTube usage. Low audio - Boost low audio of an input source to a comfortable level. This list covers the main needs of the Peace user. Many people have contacted me over the years asking for new features and telling me how they use Peace for their (sometimes specific) needs.  I was able to use AutoIt and its libraries for all of their needs. So what are the main features of Peace?
      Equalize your computer audio by using up to 31 sliders. Support of equalizing 9 speakers : left/right, center, subwoofer, left/right rear, left/right side. Per slider a filter can be chosen such as peak, low/high pass, shelving. The graph windows shows your equalization so you see exactly what you're doing. Apply an effect such as crossfeed simple/Jan Meier/Chu Moy, stereo balance, bass/treble, upmix/downmix, channel routing. Save presets (called configurations) and activate by mouse click, hotkey, desktop shortcut or Peace system tray. Select a target device to equalize, microphone as input can also be equalized. Automate: you can let Peace automatically activate presets on a switch to another device and another process. Peace is available in these languages: English, Czech, Deutsch, Français, Italiano, Nederlands, Pусский, Українська So who am I? I'm a Dutch programmer who happens the stumble upon AutoIt 5 years ago and created a small Equalizer interface app of less than 400 program lines with it. Nowadays Peace has grown to more than 18,000 lines as many features were added. Although Peace is open source, the program code isn't of the best possible quality. The reason being that I didn't expect it to become so popular. It caught me by supprise. I've created a Library of functions called Pal (link to forum post) which quality is up to the AutoIt community standard as counterpart to the Peace program code.
      I want to state here that AutoIt is a mature program language as Peace obviously shows. I wish it to be used more extensively for professional or semi-professional apps. In my view AutoIt deserves a place amongst the major programming languages for Windows computers.
      Regards,
      Peter Verbeek








    • By ripdad
      This is a project that I have been working on for several months off and on.
      It's a simple "What You Hear" MP3 @ 320Kbps and WAV audio recorder.
      Features:
      - LoudMax, a Gain Controller and Look-Ahead Limiter
      - Auto Shut-Off after one minute of silence
      - Side-by-Side Simulated LED Meter
      - Running Time Counter
      It started off being a large project, but I eventually stripped it down to its
      bare essentials because I came to realize that it would be very difficult to
      deal with every sound card and every way a PC is set up for audio. It would
      have been a nightmare that I was not willing to go through.
      This project contains the most up-to-date BASS.dll v.2.4.15.0 - December 17, 2019.
      All BASS Dll's are 32bit. Those and the needed UDF's are included in the zip file.
      I will try to explain how it works in the next post.

      Download:
      BASS VST Recorder v1.1.zip
       
×
×
  • Create New...