Jump to content

Khryus

Active Members
  • Posts

    131
  • Joined

  • Last visited

Recent Profile Visitors

169 profile views

Khryus's Achievements

  1. Hey guys! I'm working on a project which is supposed to fetch data about some titles in the user's collection, using MyAnimeList's API. The API is quite lacking, but looking for more on google, I found out some stuff just isn't documented. This page here compares 3 APIs, including MAL's. My problem comes in here: if you scroll down to 'Metadata Terms', you can see under 'MyAnimeList' that a title's Genres can be retrieved by using 'genres'. I'm not quite sure what metadata terms are, or how I'm supposed to use this information, so could you help me out here? Right now I'm getting most of the data I need using their API (it's sent back as xml after you make an http get request. You can check out the API here), but I also need score and genre, which aren't included in the stuff you get back from the API. Sorry if I wasn't clear enough!
  2. Hey guys! I'm working on a project which relies on this script I've written to fetch data from a website (using their API). The script works like this: Authenticate to API using user-inputted credentials Get a list of folders inside a given directory using _FileListToArray For each folder, check if we have a cached query. This is to reduce the number of requests we make to the API. If we don't, then start a synchronous query to the API using InetGet (this is probably what's slowing down everything and I'm aware I should be using async, but I don't know how to handle this. For instance, how do I keep track of all the queries and know when which have completed and which have failed?). This process usually takes about 14 seconds for me (I have roughly 240 folders in the root directory I'm processing). Cache previous query (if any) as an xml file. Here's the function that handles the part above. _log and _report append a line to different files. You can find queryMAL_Base below the snippet here. Func CacheCollection($refresh = False) Local $FolderList = _FileListToArray($collection_root, "*", 2, False) Local $downloadedBytes = 0 Local $newQueries = 0, $skippedQueries = 0, $successfullCachings = 0, $failedCachings = 0, $timer = TimerInit() For $Folder In $FolderList If $Folder == $FolderList[0] Then ConsoleWrite("silentskip"&@CRLF) ElseIf StartsWith($Folder, "_") Then _log("Skipped Folder '"&$Folder&"' because of special character at start or vector count.") $skippedQueries = $skippedQueries + 1 Else ;_log("Checking if '"&$query_root&CachedName($Folder)&"' exists... ") If Not Cached($Folder) Or $refresh Then _log("Caching Folder '"&$Folder&"' as '"&CachedName($Folder)&"'.") Local $CacheAttempt = queryMAL_Base($cfg_username, $cfg_password, $Folder) $newQueries = $newQueries + 1 If $CacheAttempt == 13 Then _log("Failed Cache Attempt for '"&$Folder&"'.") $failedCachings = $failedCachings + 1 Else _log("Successfully cached '"&$Folder&"'.") $successfullCachings = $successfullCachings + 1 $downloadedBytes = $downloadedBytes + $CacheAttempt EndIf Else _log("Skipped Folder '"&$Folder&"' because already cached as '"&GetCachedFileByFolderName($Folder)&"'") $skippedQueries = $skippedQueries + 1 EndIf EndIf Next _report("JOB_"&$job_id&"_COMPLETED") _report($failedCachings) _log("Done caching collection in approx. " & Floor(TimerDiff($timer)/1000) & " seconds. " & "Downloaded kilobytes: " & ($downloadedBytes > 0 ? "approx. " : "") & Floor($downloadedBytes / 1024) & " Kb.") _log("Queries: " & $newQueries & ", of which: " & $successfullCachings & " were successful and " & $failedCachings & " failed. Skipped: " & $skippedQueries&". " & ($newQueries - $failedCachings == 0 ? " (successful queries are automatically cached)" : "")) EndFunc queryMAL_Base Func queryMAL_Base($user, $password, $query) ;returns 13 on failure, number of bytes downloaded on success Local $url = StringReplace(StringReplace(StringReplace($mal_root, "[u]", $user), "[p]", $password), "[query]", $query) Local $request = InetGet($url, $query_root&CachedName($query), 0, 0) Local $error = @error If $error Then Return $error Else Return $request EndIf EndFunc I think I should be using asynchronous requests instead, but how should I handle that? Could you give me some advice? Is there anything else I can improve speed-wise, especially in the part where I check which folder should be processed? Edit: here's the API documentation in case you want to check it out http://myanimelist.net/modules.php?go=api
  3. Hey, I did search the forum, and as I said there wasn't anything that could come in handy. Thanks for the reply though Guess I'll do it another way.
  4. I wanted to try something in C# but I couldn't understand how to get the control to work the way I wanted to... So I thought I can probably do that in AutoIt, but I can't find anything about the control's existence here. Can one create a DataGridView control in autoit? If not, has someone tried to make an UDF to solve the problem?
  5. Thank you guys, I'll check it ASAP. Got a little too much into the interface (I work slowly x.x) and forgot to check back. I'll study your code carefully and hopefully if I have any questions, and if it isn't too much of an hassle, you guys can answer me
  6. ​Thank you very much - the problem weren't the labels, but the slider. I'll keep working on the rest of the interface of my program. Thanks a lot !
  7. ​Hey, thanks for the reply. I don't want to sound rude, but I already knew about this control, however I didn't want to mention it because it was very different from what I'm looking for (infact I was leaning more towards the slider control) and hence thought I had to look at something else. I gave a look at the styles and extended styles of the progress bar, but I didn't find anything that could be useful to me (or at least I think so). I don't have much experience, so bear with me please - what should I be looking for here? I'm not asking for code - I'd just like some tips on how to go about this =)
  8. I'm talking about the one media players usually have, which tells you at which point inside the media file you're playing you are. You can usually "move around" in the media file by clicking on it. For example, this is VLC's. http://puu.sh/i8CXK/ad9f3b5b0b.png http://puu.sh/i8D4j/81243541a8.png Is there a control like that in AutoIt, or should it be custom made? E: if there isn't, what should I look at for a good start?
  9. Touché. While making the reproducer script I figured out that the problem doesn't lie in the function, but it's probably something else in my script which is causing the problem (seeing as the reproducer works correctly. Here are both: reproducer: http://puu.sh/crEJv/790ab96ff2.au3 main (removed u&p): http://puu.sh/crEIV/3a8e666f90.au3 For the main script you need to use the InputEvent UDF.
  10. Hi, I've just finished writing a little function to move and resize picture controls in a particular way, which makes use of GUICtrlSetPos. The controls are moved and resized accordingly, however, while they're being moved/resized, they seem to disappear (as in they only leave the window color where the control is) and I can't move the mouse/use the keyboard while the process is going . Is this supposed to happen?
  11. Sigh. Just figured out I switched the parameters in GUISetState. Sorry mods
  12. Hi, I'm currently writing a little program which will provide information for each anime which is in my collection, depending on which one you select. Information will be gathered via myanimelist.net API. At the moment I have 2 forms: Main form, which holds all informations about currently selected title, search "bar" and more Title selection form, which is supposed to pop up after making a search. You write in the main form your query (literally just type when the window is focused), then hit enter and the search starts. Once it's done I get back an XML file. For now I'm just counting the 'entry' tags inside it to determine how many titles I found, and if it's greater than 1, the "Title selection" form will show up. What happens is, after the search, if there are more than 1 entry tags (so titles found), the main window goes hidden (GUICtrlSetState(handle of main window, @SW_HIDE) which is OK), the Title Selection form shows up, but after I select a title, the window doesn't disappear (title selection form should disappear and main form should appear). Here is the part of the code which is giving problems (lines 141-151): $hTitleSelectionWindow = Title Selection Form $hWindow = Main Form $hTitleCombo = ComboBox inside Title Selection Form While 1 $msg = GUIGetMsg() ;quit when GUI receives close message, so escape or button to close window If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $hTitleOK Then ConsoleWrite("read: "&GUICtrlRead($hTitleCombo)&@CRLF) ;if user didn't pick anything If GUICtrlRead($hTitleCombo) == "" Then MsgBox(48, "Title selection", "Please pick a valid option.") Else GUISetState($hTitleSelectionWindow, @SW_HIDE) GUISetState($hWindow, @SW_SHOW) GUICtrlSetData($hTitleCombo, "") EndIf EndIf ;reset timer and "hide" label If $lastKeypress > 0 Then ;~ ConsoleWrite("time elapsed since last keypress: "&timeOfDay_Seconds() - $lastKeypress&@CRLF) If timeOfDay_Seconds() - $lastKeypress >= 3 Then $lastKeypress=0 GUICtrlSetData($hCurrentObjectLabel, "") EndIf EndIf Sleep(10) WEnd For some reason these 2 lines aren't working (or at least seem not to), GUISetState($hTitleSelectionWindow, @SW_HIDE) GUISetState($hWindow, @SW_SHOW) however the following line works. GUICtrlSetData($hTitleCombo, "") I have attached the whole script to this post (organized it slightly better and removed username and password for MAL's API) in case the code I posted isn't enough to determine the problem. EDIT: forgot to actually attach the file. Also forgot to >link to a required UDF
  13. Well, thanks for the quick reply. It works Guess I'll spend more time thinking about it next time
  14. That would be a nice workaround if I had any suitable controls, but I don't think I'm going to have any in my GUI Would it still work if I set it to an InputBox which was outside the GUI size or invisible?
  15. Hi, how do I remove focus from a control? I'm pretty sure that the last control you create will be automatically given focus, so if you start pressing keys and your control is something which doesn't take input (for instance a label), you will hear windows' 'ding' sound (on windows 7 at least). If you don't understand what I'm saying, create a GUI and put a label in it, then run the script and start pressing keys when the window is focused. Is it possible to prevent this (automatically give focus to last created control)?
×
×
  • Create New...