diff --git a/app.go b/app.go index 84d6a9b..740b5aa 100644 --- a/app.go +++ b/app.go @@ -54,7 +54,6 @@ type State struct { Archive archive.Archive ArchivePos int ArchivePath string - ArchiveName string PixbufL, PixbufR *gdk.Pixbuf GoToThumbPixbuf *gdk.Pixbuf Scale float64 diff --git a/archive.go b/archive.go index 7c6d212..39e8f21 100644 --- a/archive.go +++ b/archive.go @@ -70,11 +70,6 @@ func (app *App) doLoadArchive(path string, assumeHTTPURL bool, httpReferer strin app.S.ImageHashes = make(map[int]imgdiff.Hash) app.S.ArchivePath = path - if assumeHTTPURL { - app.S.ArchiveName = path - } else { - app.S.ArchiveName = filepath.Base(path) - } cache := pagecache.NewPageCache() app.S.PageCache = &cache @@ -150,7 +145,6 @@ func (app *App) archiveClose() { app.S.Archive.Close() app.S.Archive = nil - app.S.ArchiveName = "" app.S.ArchivePath = "" app.S.ArchivePos = 0 diff --git a/archive/archive.go b/archive/archive.go index c04dcb8..9c6dafb 100644 --- a/archive/archive.go +++ b/archive/archive.go @@ -36,6 +36,7 @@ var ( type Archive interface { Load(i int, autorotate bool, nPreload int) (*gdk.Pixbuf, error) Kind() Kind + ArchiveName() string Name(i int) (string, error) Len() *int // nil represents unknown length Close() error diff --git a/archive/dir.go b/archive/dir.go index 20764df..43c49b7 100644 --- a/archive/dir.go +++ b/archive/dir.go @@ -93,6 +93,10 @@ func (ar *Dir) Load(i int, autorotate bool, _nPreload int) (*gdk.Pixbuf, error) return pixbuf.Load(f, autorotate) } +func (ar *Dir) ArchiveName() string { + return ar.name +} + func (ar *Dir) Name(i int) (string, error) { if err := ar.checkbounds(i); err != nil { return "", err diff --git a/archive/http.go b/archive/http.go index f9ea212..c2e4bdf 100644 --- a/archive/http.go +++ b/archive/http.go @@ -153,6 +153,10 @@ func (ar *HTTP) Kind() Kind { return HTTPKind } +func (ar *HTTP) ArchiveName() string { + return ar.urlTemplate +} + func (ar *HTTP) Name(i int) (string, error) { return ar.urlTemplate, nil } diff --git a/archive/zip.go b/archive/zip.go index e757651..4d54423 100644 --- a/archive/zip.go +++ b/archive/zip.go @@ -94,6 +94,10 @@ func (ar *Zip) Kind() Kind { return Packed } +func (ar *Zip) ArchiveName() string { + return ar.name +} + func (ar *Zip) Name(i int) (string, error) { if err := ar.checkbounds(i); err != nil { return "", err diff --git a/image.go b/image.go index 557eeec..d1d651b 100644 --- a/image.go +++ b/image.go @@ -90,13 +90,13 @@ func (app *App) updateStatus() { leftIndex, rightIndex = rightIndex, leftIndex leftw, rightw = rightw, leftw } - msg = fmt.Sprintf("%d+%d / %s %s | %dx%d - %dx%d (%d%%) | %s | %s - %s", leftIndex, rightIndex, lenStr, markedStr, leftw, lefth, rightw, righth, zoom, s.ArchiveName, left, right) - title = fmt.Sprintf("[%d+%d / %s] %s", leftIndex, rightIndex, lenStr, s.ArchiveName) + msg = fmt.Sprintf("%d+%d / %s %s | %dx%d - %dx%d (%d%%) | %s | %s - %s", leftIndex, rightIndex, lenStr, markedStr, leftw, lefth, rightw, righth, zoom, s.Archive.ArchiveName(), left, right) + title = fmt.Sprintf("[%d+%d / %s] %s", leftIndex, rightIndex, lenStr, s.Archive.ArchiveName()) } else { imgPath, _ := s.Archive.Name(s.ArchivePos) w, h := s.PixbufL.GetWidth(), s.PixbufL.GetHeight() - msg = fmt.Sprintf("%d / %s %s | %dx%d (%d%%) | %s | %s", s.ArchivePos+1, lenStr, markedStr, w, h, zoom, s.ArchiveName, imgPath) - title = fmt.Sprintf("[%d / %s] %s", s.ArchivePos+1, lenStr, s.ArchiveName) + msg = fmt.Sprintf("%d / %s %s | %dx%d (%d%%) | %s | %s", s.ArchivePos+1, lenStr, markedStr, w, h, zoom, s.Archive.ArchiveName(), imgPath) + title = fmt.Sprintf("[%d / %s] %s", s.ArchivePos+1, lenStr, s.Archive.ArchiveName()) } app.setStatus(msg)