]>
git.lizzy.rs Git - go-anidb.git/log
Diogo Franco (Kovensky) [Wed, 9 Oct 2013 00:07:55 +0000 (21:07 -0300)]
http: Recognize more Resource types
Diogo Franco (Kovensky) [Sat, 27 Jul 2013 15:46:18 +0000 (12:46 -0300)]
anidb: Remove unused imports, fixes compilation
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 23:34:09 +0000 (20:34 -0300)]
anidb: Implement MYLISTSTATS
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 23:32:45 +0000 (20:32 -0300)]
anidb: allow (*udpWrap).SendRecv to be called with nil parameters
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 23:32:13 +0000 (20:32 -0300)]
anidb: Add AnimeCount() call
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 23:31:50 +0000 (20:31 -0300)]
anidb: Also cache the EID-AID relationship when caching FILE results
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 23:29:44 +0000 (20:29 -0300)]
anidb: Make (*AniDB).User() try harder to return a user
Will block for at least 2 seconds if the user ID is not cached. Any UDP
API access will cache the user ID.
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 17:37:57 +0000 (14:37 -0300)]
anidb: rename misc.go to globals.go
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 15:45:32 +0000 (12:45 -0300)]
anidb: Correct cache key for LID.MyListEntry
Caused lookups to always miss cache.
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 15:25:13 +0000 (12:25 -0300)]
anidb: Correct syntax error
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 15:23:28 +0000 (12:23 -0300)]
mylistadd: Only add if the file isn't on mylist yet
Edit the file state to MyListStateHDD otherwise.
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 15:21:04 +0000 (12:21 -0300)]
anidb: Add a few more linking methods
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 15:20:43 +0000 (12:20 -0300)]
anidb: Avoid crash during MyListAdd / MyListEdit
Could happen if a file is added without a cached MyListEntry. Make a fake
MyListEntry and cache that, with an old enough Cached timestamp to make
it always stale.
Also change the always stale timestamp in parseMylistReply to a more
reliably ancient one.
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 14:00:54 +0000 (11:00 -0300)]
mylistadd: Say on stdout that you're waiting on the API
The lack of protocol spam due to the new default logger makes the program
weirdly pause at the end.
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 13:59:48 +0000 (10:59 -0300)]
anidb: Allow setting the Logger to use for logging traffic
By default, log to ioutil.Discard (logging to nil would result in a crash).
The udpWrap now needs to keep a reference to *AniDB in order to use the
Logger. UpdateTitles also had to be changed to be an *AniDB* method because
of the Logger.
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 05:32:38 +0000 (02:32 -0300)]
anidb: Correct inverted test in FileByEd2kSize
Resulted in always having cache misses.
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 05:22:40 +0000 (02:22 -0300)]
mylistadd: Add a simple mylist adder as an example program
There's no guarantee that the API is stable yet.
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 05:16:28 +0000 (02:16 -0300)]
anidb: Make ReAuth try to use the cache before sending USER query
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 05:14:10 +0000 (02:14 -0300)]
anidb: Correct the regexp used to verify ed2k hashes
The POSIX character class isn't treated as a character class unless inside
an extra set of brackets.
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 04:33:48 +0000 (01:33 -0300)]
anidb: Add new mylist entry as Unknown if MyListSet doesn't say anything
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 04:28:49 +0000 (01:28 -0300)]
anidb: Fix crash when MyListAdd/MyListEdit get a nil MyListSet
It's meant to be nillable.
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 04:20:54 +0000 (01:20 -0300)]
anidb: Implement MyListAdd / MyListEdit / MyListDel
Untested and undocumented.
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 02:48:43 +0000 (23:48 -0300)]
anidb: Update the MyListAnime when running a mylist file query
Keeps the MyListAnime's cached timestamp as it was before the update, since
this is updating a non-up-to-date view of MyListAnime.
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 02:39:52 +0000 (23:39 -0300)]
anidb: Use a map instead of various fields that have to be switched
Yet another map for which we have to write a MarshalJSON method...
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 01:54:40 +0000 (22:54 -0300)]
anidb: Try to get (*AniDB).User() from the cache if it's unset
Diogo Franco (Kovensky) [Fri, 26 Jul 2013 01:42:41 +0000 (22:42 -0300)]
anidb: Automatically run USER query after AUTH
This also lets us have a convenient adb.User() that returns the current
user; this only works though if we're already authenticated.
Diogo Franco (Kovensky) [Thu, 25 Jul 2013 22:22:59 +0000 (19:22 -0300)]
anidb: Support querying for mylist of an Anime
It's not very informative due to AniDB-side restrictions.
Diogo Franco (Kovensky) [Thu, 25 Jul 2013 22:21:50 +0000 (19:21 -0300)]
misc: Implement json.Marshaler/Unmarshaler in EpisodeList
Makes for nicer JSON dumps with anidb-like lists instead of unnecessarily
exposing all the internals.
Diogo Franco (Kovensky) [Thu, 25 Jul 2013 21:17:48 +0000 (18:17 -0300)]
misc: Add (*EpisodeRange).Len()
Use Valid() to check for validity on EpisodeRanges. Remove an unhelpful
panic.
Diogo Franco (Kovensky) [Thu, 25 Jul 2013 21:14:33 +0000 (18:14 -0300)]
anidb: Add EpisodeString field to File
Pre-formats and pre-processes the EpisodeNumber.
Diogo Franco (Kovensky) [Thu, 25 Jul 2013 21:12:12 +0000 (18:12 -0300)]
anidb: Add shortcut cache querying functions
For instance (*File).Anime() instead of (*File).AID.Anime().
Diogo Franco (Kovensky) [Wed, 17 Jul 2013 21:04:59 +0000 (18:04 -0300)]
anidb: Implement MYLIST for single files
Diogo Franco (Kovensky) [Wed, 17 Jul 2013 21:04:18 +0000 (18:04 -0300)]
anidb: Parse the LID from FILE response
Each file has a different LID (or none) depending on the currently logged
in user. LID are globally unique.
Diogo Franco (Kovensky) [Wed, 17 Jul 2013 20:58:06 +0000 (17:58 -0300)]
anidb: Implement USER
Diogo Franco (Kovensky) [Wed, 17 Jul 2013 20:56:42 +0000 (17:56 -0300)]
misc: Make String() and Format() not pointer methods
Diogo Franco (Kovensky) [Wed, 17 Jul 2013 20:55:47 +0000 (17:55 -0300)]
misc: (*EpisodeList).Sub: allow subtracting arbitrary containers
Diogo Franco (Kovensky) [Wed, 17 Jul 2013 20:55:16 +0000 (17:55 -0300)]
misc: Make the iterator part of EpisodeContainer interface
Also adds iterators to Episode (returns a single copy of itself) and to
EpisodeList (returns the contents of the iterators of each sublist in
sequence).
Diogo Franco (Kovensky) [Wed, 17 Jul 2013 20:54:10 +0000 (17:54 -0300)]
misc: Add an iterator to EpisodeRange
Diogo Franco (Kovensky) [Wed, 17 Jul 2013 20:53:31 +0000 (17:53 -0300)]
misc: Rename (Episode).(Inc|Dec) to (Episode).(IncPart|DecPart)
Diogo Franco (Kovensky) [Wed, 17 Jul 2013 17:57:56 +0000 (14:57 -0300)]
misc: Allow adding/removing arbitrary episodes to an EpisodeList
Diogo Franco (Kovensky) [Wed, 17 Jul 2013 17:56:13 +0000 (14:56 -0300)]
misc: Be more cautious when merging partial ranges
Change the touch() method to not accept touches where the left side is a
partial episode with unknown number of parts. If the number of parts is
known, then only accept if it's the last part.
Diogo Franco (Kovensky) [Wed, 17 Jul 2013 17:26:02 +0000 (14:26 -0300)]
misc: (*EpisodeRange).Split(*Episode) -- Splits a range
Also define Inc/IncNumber/Dec/DecNumber for episodes, used internally by
Split. Includes test.
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 22:47:39 +0000 (19:47 -0300)]
Convert cache system to github.com/Kovensky/go-fscache
Includes wrapper methods that keep the Cached timestamp more-or-less
synchronized with the cache. Internally assert that the objects that
are supposed to have embedded timestamps implement the right interface.
Changes intent map to use interface{}, as there's no reason for the
intents to have to be cacheable.
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 17:06:32 +0000 (14:06 -0300)]
anidb: Update documentation / comments
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 17:06:13 +0000 (14:06 -0300)]
misc: CountEpisodes and convenience conversion functions
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 17:05:42 +0000 (14:05 -0300)]
misc: Always simplify EpisodeLists
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 17:05:13 +0000 (14:05 -0300)]
anidb: Cache finished anime for longer
Once they've finished airing, it's more unlikely they'll get updates. We
only consider they as finished if they were cached more than one
AnimeCacheDuration after the end though.
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 17:03:32 +0000 (14:03 -0300)]
anidb: Change retry timer factors
Now gives a progression of 10s, 20s, 40s and 60s waits.
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 17:02:50 +0000 (14:02 -0300)]
anidb: Remove unused struct errorReply
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 17:02:35 +0000 (14:02 -0300)]
anidb: Delete params s and tag from retries
These get added by (*udpapi.AniDBUDP).SendRecv(); we don't want to show
them in the log.
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 17:01:34 +0000 (14:01 -0300)]
anidb: Handle UDP API 601 (server down)
We treat it the same as a ban: wait 30 minutes before allowing any
packets through.
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 17:00:26 +0000 (14:00 -0300)]
anidb: Handle invalid AID HTTP API response
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 17:00:02 +0000 (14:00 -0300)]
anidb: Support files with partial/multiple episodes
Correct the parsing of OtherEpisodes, rename to RelatedEpisodes. Remove
old debug logging.
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 16:57:49 +0000 (13:57 -0300)]
anidb: Support FilesByGroup/FilesByGID
Takes an Episode, for its recorded AID and episode number data.
Also includes helper method FIDsByGID.
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 16:52:51 +0000 (13:52 -0300)]
misc: Support partial episodes
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 16:50:18 +0000 (13:50 -0300)]
anidb: Simplify (*AniDB).EpisodeByID()
Use (*Anime).EpisodeByEID() to search for the requested episode.
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 16:48:23 +0000 (13:48 -0300)]
anidb: Log HTTP API traffic
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 16:46:40 +0000 (13:46 -0300)]
anidb: Log UDP traffic
But only the first line of replies. ReAuth and Logout need special
handling since they don't use the sendQueue.
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 16:43:45 +0000 (13:43 -0300)]
udp, anidb: Lock shared data, return APIReply for authentication
Makes error reporting easier.
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 16:34:16 +0000 (13:34 -0300)]
misc: Add FormatLog method to Episode/EpisodeList/EpisodeRange
EpisodeList.FormatLog takes an EpisodeCount instead of an int; and each
subrange is formatted according to the log of the count for its own
type.
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 16:25:51 +0000 (13:25 -0300)]
anidb: Refactor the intent map
Allows notifications without closing the channels. All current users of
Notify were changed to NotifyClose.
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 16:20:22 +0000 (13:20 -0300)]
anidb: Add logging to titlecache, be more careful with caching
Only cache the new anime-titles.dat.gz (thus truncating an older one) if
we can download it entirely to memory (it's little less than 600KB).
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 16:18:19 +0000 (13:18 -0300)]
anidb: (*Anime).Episode(): be more helpful in the panic message
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 16:17:28 +0000 (13:17 -0300)]
anidb: Remove debug logging from cache
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 16:16:54 +0000 (13:16 -0300)]
anidb: Immediately return error for clearly invalid IDs
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 16:02:26 +0000 (13:02 -0300)]
anidb: Move EpisodeCount struct to misc
Diogo Franco (Kovensky) [Tue, 16 Jul 2013 15:58:52 +0000 (12:58 -0300)]
anidb: Add (*Anime).EpisodeByEID
Also remove redundant type Episodes []*Episode -- the Episodes type
didn't have any methods.
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.
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 15:41:55 +0000 (12:41 -0300)]
anidb: rename ed2kCache to fidCache
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 15:41:07 +0000 (12:41 -0300)]
misc: Fix Episode<->Episode comparison
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 13:40:03 +0000 (10:40 -0300)]
anidb: Change Episodes to be []*Episode
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.
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.
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 :(
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.
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 04:11:53 +0000 (01:11 -0300)]
anidb: Fix compilation
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
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.
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.
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 04:03:41 +0000 (01:03 -0300)]
anidb: Simplify documentation
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.
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.
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.
Diogo Franco (Kovensky) [Mon, 15 Jul 2013 03:21:54 +0000 (00:21 -0300)]
anidb: Fix cache_test.go compilation
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 05:07:29 +0000 (02:07 -0300)]
anidb: Remove commented out code
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.
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.
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 04:54:16 +0000 (01:54 -0300)]
anidb: Don't use a nil fileLock
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 15:42:42 +0000 (12:42 -0300)]
anidb: Update documentation
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.
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 15:40:53 +0000 (12:40 -0300)]
anidb: Correct accidental docstring
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 23:20:41 +0000 (20:20 -0300)]
anidb: Support searching for multiple Episodes in an Anime
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.
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.
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 18:03:46 +0000 (15:03 -0300)]
anidb: Make cached *File 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
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.
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:55:31 +0000 (14:55 -0300)]
anidb: Remove (*AniDB).ReAuth() method
Diogo Franco (Kovensky) [Sun, 14 Jul 2013 17:52:40 +0000 (14:52 -0300)]
titles: Add module description comment
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.