Search the Community
Showing results for tags 'playlist'.
-
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.
-
;****************************************************************** ;Spotify Automation: Start spotify and play a playlist ;v1.01 27/04/2018 ;------------------------------------------------------------------ ;by Daniel Barnes ;------------------------------------------------------------------ ;v1.01 27/04/2018 ;restarts spotify if it fails the first time ;works on computers that minimize Spotify to tray ;instead of closing it, and have a different ui element selected ;such as the Devices available option when spotify is started ;------------------------------------------------------------------ ;v1.00 25/04/2018 ;initial version ;------------------------------------------------------------------ ;Replace the below with the Spotify URI ;If you right click the playlist> share> copy spotify uri ;you can find the uri $spotifyURI = "spotify:user:12177300374:playlist:0iaTAvHRSaIkD23ofl2tck" ;****************************************************************** ;if this script breaks in the future, figure this out using the AutoIt Window Info Tool Const $SpotifyWindowIdentifier = "[Title:Spotify;Class:Chrome_WidgetWin_0]" ;NOTE ABOUT SHUFFLE: ;I couldn't automate turning shuffling on or off ;I can toggle it, but I cannot figure out the current state ;If you want to shuffle, turn on shuffle in Spotify prior ;to running this script PlaySpotifyPlaylist($spotifyURI) Func PlaySpotifyPlaylist($spotifyURI,$retry = 0) ;terminate spotify process on subsequent attempts If $retry Then echo ("Closing existing Spotify process") ProcessClose("Spotify.exe") endif echo ("Launching Spotify URI") ShellExecute($spotifyURI) ;Pause any existing song playing (if there is any) ;this is because Spotify's window title is only 'Spotify' when it is not playing any songs If Not WinExists($SpotifyWindowIdentifier) Then echo ("Pausing existing song (To find spotify window)") $timer = TimerInit() While Not WinExists($SpotifyWindowIdentifier) Send("{MEDIA_PLAY_PAUSE}") Sleep(500) If TimerDiff($timer) > 5 * 1000 Then ErrorMsg ("Timed out trying pause existing song") WEnd endif ;Get Spotify Window Handle $hwndSpotify = WinGetHandle($SpotifyWindowIdentifier) echo ("Attempting to play playlist") $timer = TimerInit() While WinGetTitle($hwndSpotify) = "Spotify" ;once it is playing the song, the title changes to the name of the song WinActivate($hwndSpotify) ControlSend($hwndSpotify,"","","{ENTER}") ;space will play what was previously playing (even another playlist or song), enter will play the playlist ;) Sleep(1000) If TimerDiff($timer) > 5 * 1000 Then If $retry Then ErrorMsg ("Timed out trying to play playlist") else Return PlaySpotifyPlaylist($spotifyURI,$retry+1) endif endif WEnd EndFunc Func echo($text) ConsoleWrite ($text&@CRLF) EndFunc Func ErrorMsg($text) MsgBox(16,StringTrimRight(@ScriptName,4),$text) Exit EndFunc
- 5 replies
-
- spotify
- automation
-
(and 1 more)
Tagged with:
-
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