Spotify Album, Artist and Track Info v0.3

By OrFeAsGr on Sep 03, 2015

SCRIPT ID: SPOTIFY
With the use of Spotify API this script sends info about the Track, Artist or album Spotify URL to the chan it was detected on!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UPDATE v0.3 01/11/2016;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Fixed some bugs in Track Artist and Album ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Added Duration Value For tracks;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; Script by OrFeAsGr ;;;
;;; v0.3 01/11/2016 ;;;
;;; My website: http://humanity.ucoz.com ;;;
;;; When it finds a spotify link of artist, song or album it sends all of its info ;;;
;;; Thanks for using my script :) <3 ;;;
on *:text:*:#: {
  var %x = 1
  while (%x <= $numtok($strip($1-),32)) {
    var %y = $gettok($strip($1-),%x,32)
    if (*spotify.com/track* iswm %y) {
      set %spotchan $chan | set %spotID $+(/v1/tracks/,$gettok(%y,$iif(*https* iswm %y, 4, 3),47)) | sockopen -e spotify api.spotify.com 443 
    }
    if (*spotify.com/artist* iswm %y) {
      set %spotchan $chan | set %spotID $+(/v1/artists/,$gettok(%y,$iif(*https* iswm %y, 4, 3),47)) | sockopen -e spotifyartist api.spotify.com 443 
    }
    if (*spotify.com/album* iswm %y) {
      set %spotchan $chan | set %spotID $+(/v1/albums/,$gettok(%y,$iif(*https* iswm %y, 4, 3),47)) | sockopen -e spotifyalbum api.spotify.com 443 
    }
    inc %x
  }
}

on *:SOCKOPEN:*: {
  if (!%SPOTIFYversion) || (%SPOTIFYversion != v0.3) { set %SPOTIFYversion v0.3 }
  if ($sockname == spotify) || ($sockname == spotifyartist) || ($sockname == spotifyalbum) {
    sockwrite -nt $sockname GET %spotID HTTP/1.1
    sockwrite -nt $sockname Host: api.spotify.com
    sockwrite -nt $sockname Connection: Close
    sockwrite $sockname $crlf
  }
}

on *:SOCKREAD:*: {
  if ($sockname == spotifyalbum) {
    if ($sockerr) { msg %spotchan Error.. | sockclose $sockname }
    var %spotreadalb
    sockread %spotreadalb
    if (*name* iswm %spotreadalb) {
      inc %spotname 1
      if (%spotname == 1) {
        set %spotartist $remove($gettok(%spotreadalb,2,58),",$chr(44))
      }
      elseif (%spotname == 2) {
        set %spotalbum $remove($gettok(%spotreadalb,2,58),",$chr(44))
        unset %spotname
      }
    }
    if (*release_date* iswm %spotreadalb) {
      if (!%spotreldate) {
        set %spotreldate 1
        msg %spotchan 14-3Spotify Album Info14- 3Name14: %spotalbum 3Artist14: %spotartist 3Release date14: $remove($gettok(%spotreadalb,2,58),",$chr(44))
        sockclose $sockname 
        unset %spot*
      }
    }
  }
  if ($sockname == spotifyartist) {
    if ($sockerr) { msg %spotchan Error.. | sockclose $sockname }
    var %spotreadart
    sockread %spotreadart
    ;echo -at %spotreadart
    if (*total* iswm %spotreadart) {
      set %spotartfol $gettok(%spotreadart,2,58)
    }
    if (*genres* iswm %spotreadart) {
      set %spotartgenre $remove($gettok(%spotreadart,2,91),",$+([,$chr(44)))
    }
    if (*name* iswm %spotreadart) {
      set %spotartname $remove($gettok(%spotreadart,2,58),",$chr(44))
      sockclose $sockname
      msg %spotchan 14-3Spotify Artist Info14- 3Name14: %spotartname 3Genres14: %spotartgenre 3Followers14: %spotartfol
      .timer 1 1 unset %spotart*
    }
  }
  if ($sockname == spotify) {
    if ($sockerr) { msg %spotchan Error.. | sockclose $sockname }
    var %spotread
    sockread %spotread
    ;echo -at %spotread
    if (*available_markets" :* iswm %spotread) {
      set %spotcn album
    }
    if (*artists" :* iswm %spotread) {
      if (%spotalbum) {
        set %spotcn artist
      }
    }
    if (*duration_ms" :* iswm %spotread) { set %spotdur $replace($round($calc(($remove($gettok(%spotread,2,58),$chr(44)) / 1000) / 60),2),.,:) | set %spotcn track }
    if (*name* iswm %spotread) {
      if (%spotcn == album) {
        set %spotalbum $remove($gettok(%spotread,2,58),",$chr(44))
      }
      elseif (%spotcn == artist) {
        set %spotartist $addtok(%spotartist,$remove($gettok(%spotread,2,58),",$chr(44)),32)
        set %spotcn album
      }
      elseif (%spotcn == track) {
        set %spottrack $remove($gettok(%spotread,2,58),",$chr(44))
        sockclose $sockname
        msg %spotchan 14-3Spotify14- 3Track14: %spottrack 3Artist14: %spotartist 3Album14: %spotalbum $iif(%spotexp, 14|3Explicit14|3?14|, $null) 3Duration14: %spotdur
        .timer 1 2 unset %spot*
      }
    }
    elseif (*explicit* iswm %spotread) {
      if (*true* iswm $gettok(%spotread,2,58)) {
        set %spotexp 1
      }
    }
  }
}

Image

Image
Enjoy! :)

  • Check Out http://humanity.ucoz.com :) Humanity Bot Services!
    Do you want to help me make some money? You can do it without paying for nothing! Just visit my site, turn off your ad blocker, watch an ad and turn it back on! You'll be giving me something less than a cent! Thanks!

    Or do you want to donate some bucks because you like my scripts??? Visit https://www.paypal.me/OrFeAsGr
    Thx! ^_^

Comments

Sign in to comment.
dma   -  Aug 02, 2018

does this still work?

 Respond  
dma   -  Jul 15, 2016

lolz i finally got it

 Respond  
dma   -  Mar 25, 2016
dma  -  Jun 07, 2016

is this working i cant seem to get it to work.. i stupid all the other ones worked .. dunno any more

OrFeAsGr  -  Jun 08, 2016

yeah just send a spotify artist, track or album link in the channel and it will work ;)

dma  -  Jun 08, 2016

i tryed i dont get the dialog when i go to rightght click on screen
maybe if start all over?

OrFeAsGr  -  Jun 10, 2016

There is not a dialog in this script it works like this
Image

Image

Sign in to comment

dma   -  Jan 09, 2016

hi

dma  -  Jun 11, 2016

ok gottcha

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.