Announcement

Collapse

Forum Rules

  • No flaming or derogatory remarks, directly or through insinuation.
  • No discussion, sharing or referencing illegal software such as hacks, keygen, cracks and pirated software.
  • No offensive contents, including but not limited to, racism, gore or pornography.
  • No excessive spam/meme, i.e. copious one liners in a short period of time, typing with all caps or posting meme responses (text/image).
  • No trolling, including but not limited to, flame incitation, user provocation or false information distribution.
  • No link spamming or signature advertisements for content not specific to Dota 2.
  • No Dota 2 key requests, sell, trade etc.
  • You may not create multiple accounts for any purpose, including ban evasion, unless expressly permitted by a moderator.

  • Please search before posting. One thread per issue. Do not create another thread if there is an existing one already.
  • Before posting anything, make sure you check out all sticky threads (e.g., this). Do not create new threads about closed ones.
  • It is extremely important that you post in correct forum section.

  • Balance discussion only in Misc.
  • All art related (such as hero model) feedbacks go to Art Feedback Forum.
  • All matchmaking feedback should go here: Matchmaking Feedback
  • All report/low priority issues should go here: Commend/Report/Ban Feedback
  • No specific workshop item feedback. These should go to workshop page of that item.
  • When posting in non-bugs section (such as this), use [Bugs], [Discussion] or [Suggestion] prefix in your thread name.



In case you object some action by a moderator, please contact him directly through PM and explain your concerns politely. If you are still unable to resolve the issue, contact an administrator. Do not drag these issues in public.



All rules are meant to augment common sense, please use them when not conflicted with aforementioned policies.
See more
See less

[Example] Live League Game Signature Image

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Example] Live League Game Signature Image

    I wanted to write up a few examples of WebAPI consumers, so I spent some of my free time coming up with this one.

    Source code and up-to-date description lives here: https://github.com/danieljennings/dota2webapiexamples


    Live League Game Signature Image

    This example is a feasible forum signature that will show forum-goers the currently-live league matches occuring on Dota 2 at the time. It will rotate through all of the live league games, giving each one 3.5 seconds of visibility before moving onto the next and wrapping back around to the first.

    This image is an example of what the signature looks like, but is not live itself. Visit this link to see a live version.




    Requirements:

    Demonstrates:
    • WebAPI: GetLeagueListing
    • WebAPI: GetLiveLeagueGames
    • Caching: Using Memcached to reduce latency by caching WebAPI results
    • Images: Using ImageMagick to render images on-demand.



    Source code: https://github.com/danieljennings/do..._signature.php
    Last edited by DanielJ; 01-29-2013, 06:51 PM.
    WebAPI Examples: All (on GitHub) | Live League Game Signature Image

  • #2
    Great... except how often do we expect there to be league games on?

    A neat concept none-the-less.

    Comment


    • #3
      Sorry for double post.

      Looked a bit closer at the code.

      Why do you not use curl? File_get_contents does the job, but is not nearly as efficient (Can be more than 25% inefficient depending on number of requests). (Random Source http://stackoverflow.com/questions/5...er-performance)

      How efficient is the code (how many queries does it require?) when you instead want to make a live sig of who the players are in those games?

      Comment


      • #4
        Originally posted by jimmydorry View Post
        Great... except how often do we expect there to be league games on?

        A neat concept none-the-less.
        The concept wasn't the important part of the project, I just wanted to fit the pieces together and hopefully make it easier for new programmers or new WebAPI users to create something. :-)

        As far as Curl versus file_get_contents goes, I've always used file_get_contents and it has served me well enough. The code that I wrote would look different if I were trying to actually deploy it at any scale or ensure its maintainability.

        For the player listing, it looks like the players, spectators, and commentators are all listed by name in the GetLiveLeagueGames method, which means the data is available to this sample code already.
        WebAPI Examples: All (on GitHub) | Live League Game Signature Image

        Comment


        • #5
          Great. Thanks for the fast response. I am sure it will help someone.

          Comment


          • #6
            Originally posted by DanielJ View Post
            For the player listing, it looks like the players, spectators, and commentators are all listed by name in the GetLiveLeagueGames method, which means the data is available to this sample code already.
            Last I checked (when there was a live game on), there's just a team ID that goes between 0 and 4 (at least). Mind posting the enum for that?

            Comment


            • #7
              Here's an example GetLiveLeagueGames response for testing: https://gist.github.com/4675491

              For the Team ID's, as far as I can tell:
              0 Radiant
              1 Dire
              2 Broadcaster
              3+ Spectator (not sure what the difference is here, but it probably doesn't matter)
              WebAPI Examples: All (on GitHub) | Live League Game Signature Image

              Comment


              • #8
                Nice, I was waiting for someone to make use of the new live league API, surprised the big sites like Gosugamers and Joindota haven't implemented it into their ticker yet.
                // Economy
                "NotTheStringsYoureLookingFor"

                Comment


                • #9
                  What can we do with team_id in:

                  "radiant_team":
                  {
                  "team_name": "Absolute Legends Academy",
                  "team_id": 231312,
                  "complete": false
                  },
                  "dire_team":
                  {
                  "team_name": "4 Friends + Chrillee",
                  "team_id": 41,
                  "complete": false
                  },
                  Is there some Team API to list current players/get id (to use with getugc...) of team logo, basing on team_id?
                  You gotta FIGHT!
                  For Your RIGHT!
                  To BUUUGFIX!

                  Comment


                  • #10
                    There's no GetTeam API (yet), but specifically team_logo should be present in the response to GetLiveLeagueGames when the next server patch goes live.
                    WebAPI Examples: All (on GitHub) | Live League Game Signature Image

                    Comment


                    • #11
                      There are no protocols in some URLs returned by IDOTA2Match_570/GetLeagueListing. :\
                      In leagues 15, 65002.
                      Last edited by Gentlecat; 01-30-2013, 01:38 PM.
                      Steam is awesome.

                      Comment


                      • #12
                        These are entered by the league people, I believe, so you should probably just handle that case and assume you might need to stick an http:// in front of it if you don't see one.
                        WebAPI Examples: All (on GitHub) | Live League Game Signature Image

                        Comment

                        Working...
                        X