]> git.lizzy.rs Git - go-anidb.git/log
go-anidb.git
10 years agohttp, udp: Remove debug logging
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 15:39:12 +0000 (12:39 -0300)]
http, udp: Remove debug logging

Keep complaints about unknown resource types though, but mention that it
comes from the HTTP API.

10 years agoanidb: rename ed2kCache to fidCache
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 15:41:55 +0000 (12:41 -0300)]
anidb: rename ed2kCache to fidCache

10 years agomisc: Fix Episode<->Episode comparison
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 15:41:07 +0000 (12:41 -0300)]
misc: Fix Episode<->Episode comparison

10 years agoanidb: Change Episodes to be []*Episode
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 13:40:03 +0000 (10:40 -0300)]
anidb: Change Episodes to be []*Episode

10 years agoanidb: Add missing loop 'break's to EpisodeByEID
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 04:26:58 +0000 (01:26 -0300)]
anidb: Add missing loop 'break's to EpisodeByEID

Without the breaks, it's would be possible to query for an Anime
with AID 0, a clear waste of time.

Also move the 'ok = false' assignment closer to where it's documented.

10 years agoanidb: Always remove credentials on Logout()
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 04:25:55 +0000 (01:25 -0300)]
anidb: Always remove credentials on Logout()

Even if they were never used.

10 years agoanidb: Document that credentials are needed for UDP queries
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 04:25:32 +0000 (01:25 -0300)]
anidb: Document that credentials are needed for UDP queries

Commit messages aren't documentation :(

10 years agoanidb: Document which backend API is used on the Get* methods
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 04:21:38 +0000 (01:21 -0300)]
anidb: Document which backend API is used on the Get* methods

Queries that depend on the UDP API can't be used without SetCredentials.

10 years agoanidb: Fix compilation
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 04:11:53 +0000 (01:11 -0300)]
anidb: Fix compilation

10 years agoanidb: Check the HTTP API error as well for deleting invalid Anime
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 04:09:51 +0000 (01:09 -0300)]
anidb: Check the HTTP API error as well for deleting invalid Anime

10 years agoanidb: Delete invalid cache data
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 04:07:27 +0000 (01:07 -0300)]
anidb: Delete invalid cache data

If the API queries return errors specifically stating that requested
object doesn't exist, then delete the entry from the local cache.

10 years agoanidb: Return the previously available data if API refresh failed
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 04:06:01 +0000 (01:06 -0300)]
anidb: Return the previously available data if API refresh failed

Makes the GetObjectByKey family of methods behave better if the API
is somehow unavailable.

10 years agoanidb: Simplify documentation
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 04:03:41 +0000 (01:03 -0300)]
anidb: Simplify documentation

10 years agoanidb: Wait longer after each UDP API timeout
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 03:27:04 +0000 (00:27 -0300)]
anidb: Wait longer after each UDP API timeout

Reset the wait after the first successful read.

10 years agoanidb: Implement GroupByName
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 03:26:29 +0000 (00:26 -0300)]
anidb: Implement GroupByName

Also add the invalid key guard to GroupByID.

10 years agoanidb: fix ed2k caching
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 03:22:20 +0000 (00:22 -0300)]
anidb: fix ed2k caching

Don't embed time.Time in the cache struct -- time.Time has its own
GobEncode and GobDecode methods, and we don't want them to be used.

10 years agoanidb: Fix cache_test.go compilation
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 03:21:54 +0000 (00:21 -0300)]
anidb: Fix cache_test.go compilation

10 years agoanidb: Remove commented out code
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 05:07:29 +0000 (02:07 -0300)]
anidb: Remove commented out code

10 years agoanidb: (*cacheDir).Get(): reduce the time a file lock is retained
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 05:04:35 +0000 (02:04 -0300)]
anidb: (*cacheDir).Get(): reduce the time a file lock is retained

When reading from cache, read the entire file into a buffer before
attempting to decode; release the lock as soon as the read is done.

Also move the parameter sanity check to be earlier in the method.

10 years agoanidb: Fix compilation of flock_other
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 04:54:46 +0000 (01:54 -0300)]
anidb: Fix compilation of flock_other

Also fixes inverted if test.

10 years agoanidb: Don't use a nil fileLock
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 04:54:16 +0000 (01:54 -0300)]
anidb: Don't use a nil fileLock

10 years agoanidb: Update documentation
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 15:42:42 +0000 (12:42 -0300)]
anidb: Update documentation

10 years agoanidb: panic if the default cache dir can't be set
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 15:41:29 +0000 (12:41 -0300)]
anidb: panic if the default cache dir can't be set

Nothing works without a valid cache.

10 years agoanidb: Correct accidental docstring
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 15:40:53 +0000 (12:40 -0300)]
anidb: Correct accidental docstring

10 years agoanidb: Support searching for multiple Episodes in an Anime
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 23:20:41 +0000 (20:20 -0300)]
anidb: Support searching for multiple Episodes in an Anime

10 years agoanidb: Don't send UDP queries if we have no credentials
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 23:19:51 +0000 (20:19 -0300)]
anidb: Don't send UDP queries if we have no credentials

We'd just get a 501 error and wouldn't be able to do anything about it.
Skip the middleman and return the 501 right away.

10 years agoanidb: New caching mechanism
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 23:16:42 +0000 (20:16 -0300)]
anidb: New caching mechanism

Refactors the various parts of the code that interacted with the cache
to use the new cache. Moves the intent system to be decoupled from the
cache.

Caches requests made with invalid keys, avoids requerying the API for
InvalidKeyCacheDuration (1 hour).

Untested on !windows, since that uses a separate file locking mechanism.

10 years agoanidb: Make cached *File expire earlier if they're Incomplete
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 18:03:46 +0000 (15:03 -0300)]
anidb: Make cached *File expire earlier if they're Incomplete

10 years agoanime: Make cached Anime expire earlier if they're Incomplete
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 18:01:38 +0000 (15:01 -0300)]
anime: Make cached Anime expire earlier if they're Incomplete

10 years agoanime: Consistently name the *AniDB "adb" in *AniDB methods
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:58:00 +0000 (14:58 -0300)]
anime: Consistently name the *AniDB "adb" in *AniDB methods

Makes the docs look better.

10 years agoanidb: Remove (*AniDB).ReAuth() method
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:55:31 +0000 (14:55 -0300)]
anidb: Remove (*AniDB).ReAuth() method

10 years agotitles: Add module description comment
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:52:40 +0000 (14:52 -0300)]
titles: Add module description comment

10 years agoanidb: rename SaveCurrentTitles to DumpTitles, convert to function
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:49:47 +0000 (14:49 -0300)]
anidb: rename SaveCurrentTitles to DumpTitles, convert to function

It's part of the Dump family of functions, and doesn't actually need any
data from an AniDB struct.

10 years agoanidb: Initial attempt at high level AniDB library
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:45:22 +0000 (14:45 -0300)]
anidb: Initial attempt at high level AniDB library

10 years agotitles: Check if the anime-titles database was loaded correctly
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:44:47 +0000 (14:44 -0300)]
titles: Check if the anime-titles database was loaded correctly

10 years agotitles: Fix compilation of search_test
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:44:08 +0000 (14:44 -0300)]
titles: Fix compilation of search_test

Forgotten commit.

10 years agotitles: LoadDB from an io.Reader instead of io.ReadCloser
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:42:17 +0000 (14:42 -0300)]
titles: LoadDB from an io.Reader instead of io.ReadCloser

10 years agotitles: Correctly load anime-titles.dat for testing
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:41:44 +0000 (14:41 -0300)]
titles: Correctly load anime-titles.dat for testing

10 years agoudpapi: Return pointers to reply structs
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:38:24 +0000 (14:38 -0300)]
udpapi: Return pointers to reply structs

Keeps the reply structs convertible to APIReply. Also change the gob
registrations to use the pointer types.

10 years agoudpapi: Don't keep UDP API key in ecbState
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:37:10 +0000 (14:37 -0300)]
udpapi: Don't keep UDP API key in ecbState

Also add test to check if ECB is indeed correctly implemented.

10 years agoudpapi: Handle encryption correctly
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:34:21 +0000 (14:34 -0300)]
udpapi: Handle encryption correctly

Previously, the very first packet to be received after the ENCRYPT call
was not properly decrypted; the getPacket function was using the old
encryption state.

10 years agoudpapi: Avoid out-of-bounds access on malformed packets
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:32:50 +0000 (14:32 -0300)]
udpapi: Avoid out-of-bounds access on malformed packets

Also reports the strconv.ParseInt error if it's not possible to decode
the reply's code.

10 years agohttpapi: Better support for Resources
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:30:22 +0000 (14:30 -0300)]
httpapi: Better support for Resources

10 years agoudpapi: Register types with encoding/gob
Diogo Franco (Kovensky) [Sat, 13 Jul 2013 02:22:02 +0000 (23:22 -0300)]
udpapi: Register types with encoding/gob

10 years agoudpapi: Finish(?) partially-done refactor, fixes compilation
Diogo Franco (Kovensky) [Sat, 13 Jul 2013 02:12:55 +0000 (23:12 -0300)]
udpapi: Finish(?) partially-done refactor, fixes compilation

I didn't break the API with the previous commit :(

10 years agoudpapi: Server-side timeouts are unrelated to UDP timeouts
Diogo Franco (Kovensky) [Sat, 13 Jul 2013 02:03:50 +0000 (23:03 -0300)]
udpapi: Server-side timeouts are unrelated to UDP timeouts

Yay, first API breakage.

10 years agoudpapi: escape & as &amp; and \n as <br/>
Diogo Franco (Kovensky) [Sat, 13 Jul 2013 01:57:20 +0000 (22:57 -0300)]
udpapi: escape & as &amp; and \n as <br/>

10 years agomisc: refactor, add tests, add list simplification method
Diogo Franco (Kovensky) [Sat, 13 Jul 2013 01:56:39 +0000 (22:56 -0300)]
misc: refactor, add tests, add list simplification method

10 years agomisc: New module with common / useful code
Diogo Franco (Kovensky) [Fri, 12 Jul 2013 15:39:24 +0000 (12:39 -0300)]
misc: New module with common / useful code

10 years agotitles: Specify how the search string is split
Diogo Franco (Kovensky) [Fri, 12 Jul 2013 21:44:59 +0000 (18:44 -0300)]
titles: Specify how the search string is split

10 years agoudp: rename to udpapi, reformat AniDBUDP documentation
Diogo Franco (Kovensky) [Fri, 12 Jul 2013 21:20:00 +0000 (18:20 -0300)]
udp: rename to udpapi, reformat AniDBUDP documentation

10 years agotitles: Document
Diogo Franco (Kovensky) [Fri, 12 Jul 2013 21:15:44 +0000 (18:15 -0300)]
titles: Document

10 years agoInitial commit
Diogo Franco (Kovensky) [Fri, 12 Jul 2013 20:22:58 +0000 (17:22 -0300)]
Initial commit

For now, only includes low-level wrappers for AniDB's various APIs. The
current API is in no way frozen and may break at any time.

These are not intended for being used in third party code, but as building
blocks for a unified API library.

The HTTP wrapper does simple encoding/xml wrapping of the anime and categorylist
HTTP API calls. No caching is implemented.

The UDP wrapper does rate control internally and implements the essential
session-keeping API calls, but does no caching.