]> git.lizzy.rs Git - go-anidb.git/blobdiff - fileepcache.go
anidb: Parse the LID from FILE response
[go-anidb.git] / fileepcache.go
index 6e4b914992caa89188c973e58c8c43ab3413db2c..7ef396aa1f66753ffc62cd11e02fdf9c18fe4f87 100644 (file)
@@ -108,14 +108,17 @@ func (adb *AniDB) FIDsByGID(ep *Episode, gid GID) <-chan FID {
 
                switch reply.Code() {
                case 220:
-                       f := adb.parseFileResponse(reply, true)
+                       var f *File
+                       if adb.parseFileResponse(&f, reply, true) {
+                               fids = []FID{f.FID}
+                               CacheSet(&fids, key...)
 
-                       fids = []FID{f.FID}
-                       CacheSet(&fids, key...)
-
-                       cacheFile(f)
+                               cacheFile(f)
 
-                       is.NotifyClose(f.FID)
+                               is.NotifyClose(f.FID)
+                       } else {
+                               is.NotifyClose(FID(0))
+                       }
                        return
                case 322:
                        parts := strings.Split(reply.Lines()[1], "|")