• Print

Author Topic: Reviving a dead addon! (RynO-SauruS's addon)  (Read 4933 times)

0 Members and 1 Guest are viewing this topic.

Offline Janjakob2000

  • Jr. Member
  • **
  • Posts: 65
  • Karma: 0
Reviving a dead addon! (RynO-SauruS's addon)
« on: July 28, 2015, 02:20:46 pm »
Hello, I'm trying to revive this addon!
I've always wanted to have a youtube player that works independent, so it works on every gamemode, I've (kinda) fixed the play video command, which is only accessible by admins and higher, the sound plays now, and I got the box to showup to adjust the volume, but I also want the other functions to work aswell, and I'd love if someone could help me out with the errors it has :(
Code: [Select]
[ERROR] addons/ulx_youtube_music_player/lua/ulx/modules/sh/youtube_music_player_sh.lua:47: attempt to index local 'calling_ply' (a nil value)
  1. getVideoLengthFromHTTPData - addons/ulx_youtube_music_player/lua/ulx/modules/sh/youtube_music_player_sh.lua:47
   2. unknown - addons/ulx_youtube_music_player/lua/ulx/modules/cl/youtube_music_player_cl.lua:126

If anyone wants to support me on this one, I'd love you for the rest of my life, because I love youtube and music, I'll also leave a download down for anyone who wants the working- but a bit broken - version, or if you want me to help me revive this addon!
« Last Edit: July 29, 2015, 05:57:31 am by Janjakob2000 »

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Reviving a dead addon! (RynO-SauruS's addon)
« Reply #1 on: July 28, 2015, 02:45:02 pm »
http.Get was removed from gmod...  You have to rewrite it to work with http.Fetch.

Offline Tomzen

  • Full Member
  • ***
  • Posts: 115
  • Karma: -1
  • A new lua adventurer
    • Thirdage Gaming
Re: Reviving a dead addon! (RynO-SauruS's addon)
« Reply #2 on: July 28, 2015, 08:21:16 pm »
Try this for line 47:

Code: Lua
  1. local nick = calling_ply:Nick()
  2. if nick:len() <= 0 then return end

Not sure it will work, but give it a try.
Finished:
Impersonate
<==> FakePromote/Demote <==> RandomMap <==> ForceMic <==> Search <==> PlayMenu <==
WIP:
ServerMode <==

Offline Janjakob2000

  • Jr. Member
  • **
  • Posts: 65
  • Karma: 0
Re: Reviving a dead addon! (RynO-SauruS's addon)
« Reply #3 on: July 29, 2015, 05:27:03 am »
Try this for line 47:

Code: Lua
  1. local nick = calling_ply:Nick()
  2. if nick:len() <= 0 then return end

Not sure it will work, but give it a try.

That won't really work, as the calling_ply is already an error, so if you change it to nick, it will read it as calling_ply, so it will give you kind of the same error.
http.Get was removed from gmod...  You have to rewrite it to work with http.Fetch.
I've actually tryed this:
Code: Lua
  1.         sound.PlayURL( "http://gdata.youtube.com/feeds/api/videos/" .. video_id .. "?v=2", "", function( contents )
  2.  
  3.                 local video_title = ulx.getVideoTitleFromHTTPData( contents )
  4.  
  5.                 ulx.fancyLogAdmin( calling_ply, "#A played YouTube video:\n#s\n#s", url, video_title )
  6.                 ULib.tsay( nil, "Type !stopvid to stop it.", true )
  7.                 ULib.csay( nil, "Now playing: " .. video_title, nil, 10 )
  8.  
  9.         end )
  10.  

Not sure if this will work for every function in his addon, but do you prefer the sound.PlayURL or keep http.Fetch ?
Technically I get no errors when playing some music with the ulx playvid command, only the error I posted first on this thread.

What can/would be the fix for this?
Code: [Select]
[ERROR] addons/ulx_youtube_music_player/lua/ulx/modules/sh/youtube_music_player_sh.lua:47: attempt to index local 'calling_ply' (a nil value)
  1. getVideoLengthFromHTTPData - addons/ulx_youtube_music_player/lua/ulx/modules/sh/youtube_music_player_sh.lua:47
   2. unknown - addons/ulx_youtube_music_player/lua/ulx/modules/cl/youtube_music_player_cl.lua:126


[EDIT] I've changed some stuff with the error I first posted on this thread, but still get an error, and I don't understand why it is not working, data is a value not nil, can anyone help me out with this?
Code: Lua
  1. function ulx.getVideoTitleFromHTTPData( data )
  2.         local video_title
  3.  
  4.         if data:len() <= 0 then
  5.                 print( "ULX YouTube music player: Error retrieving video title" )
  6.                 video_title = "<unknown_title>"
  7.         else
  8.                 local _, title_tag1_end = data:find( "<media:title type='plain'>", 1, true )
  9.                 local title_tag2_pos = data:find( "</media:title>", title_tag1_end + 1, true )
  10.                 video_title = data:sub( title_tag1_end + 1, title_tag2_pos - 1 )
  11.                 video_title = ( video_title ~= nil and video_title ~= "" ) and video_title or "<unknown_title>"
  12.         end
  13.  
  14.         return video_title
  15. end

This piece of code should retrieve the title of the youtube url you put in the !music menu, when saving a video, but it gives me this error:

Code: [Select]
[ERROR] addons/ulx_youtube_music_player/lua/ulx/modules/sh/youtube_music_player_sh.lua:29: attempt to index local 'data' (a nil value)
  1. getVideoTitleFromHTTPData - addons/ulx_youtube_music_player/lua/ulx/modules/sh/youtube_music_player_sh.lua:29
   2. onsuccess - addons/ulx_youtube_music_player/lua/ulx/modules/sh/youtube_music_player_sh.lua:170
    3. unknown - lua/includes/modules/http.lua:34

[EDIT] If you are trying to help me, make sure you download my edited version of rynos addon, so you can see what I messed up, and fixed partially.
« Last Edit: July 29, 2015, 06:01:38 am by Janjakob2000 »

  • Print