{"action":"created","issue":{"url":"https://api.github.com/repos/fero8/chrome-tab-counter/issues/3","repository_url":"https://api.github.com/repos/fero8/chrome-tab-counter","labels_url":"https://api.github.com/repos/fero8/chrome-tab-counter/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/fero8/chrome-tab-counter/issues/3/comments","events_url":"https://api.github.com/repos/fero8/chrome-tab-counter/issues/3/events","html_url":"https://github.com/fero8/chrome-tab-counter/issues/3","id":298040557,"number":3,"title":"save current count to CLI-accessible file","user":{"login":"ToyKeeper","id":6306903,"avatar_url":"https://avatars3.githubusercontent.com/u/6306903?v=4","gravatar_id":"","url":"https://api.github.com/users/ToyKeeper","html_url":"https://github.com/ToyKeeper","followers_url":"https://api.github.com/users/ToyKeeper/followers","following_url":"https://api.github.com/users/ToyKeeper/following{/other_user}","gists_url":"https://api.github.com/users/ToyKeeper/gists{/gist_id}","starred_url":"https://api.github.com/users/ToyKeeper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ToyKeeper/subscriptions","organizations_url":"https://api.github.com/users/ToyKeeper/orgs","repos_url":"https://api.github.com/users/ToyKeeper/repos","events_url":"https://api.github.com/users/ToyKeeper/events{/privacy}","received_events_url":"https://api.github.com/users/ToyKeeper/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-17T22:08:20Z","updated_at":"2018-03-13T06:38:15Z","closed_at":null,"author_association":"NONE","body":"It would be useful for command line and shell purposes to have the current number of tabs logged to a file somewhere.  Is this feasible within chrome-tab-counter?\r\n\r\nI've tried to determine this number directly from Chrome's \"Current Tabs\" file with Chromagnon, but its contents seem to fluctuate quite a bit for no apparent reason, and is generally off by +/- 40%.  The number of chrome processes is somewhat useful too, but it's typically less than one process per tab so that doesn't work either.  I've tried to get the number from chrome-tab-counter's local storage sqlite file, but it always shows me just 1 tab.\r\n\r\nHowever, the extension's status display always seems to be correct.  Can this be saved to a file periodically or each time it changes?"},"comment":{"url":"https://api.github.com/repos/fero8/chrome-tab-counter/issues/comments/372561958","html_url":"https://github.com/fero8/chrome-tab-counter/issues/3#issuecomment-372561958","issue_url":"https://api.github.com/repos/fero8/chrome-tab-counter/issues/3","id":372561958,"user":{"login":"ToyKeeper","id":6306903,"avatar_url":"https://avatars3.githubusercontent.com/u/6306903?v=4","gravatar_id":"","url":"https://api.github.com/users/ToyKeeper","html_url":"https://github.com/ToyKeeper","followers_url":"https://api.github.com/users/ToyKeeper/followers","following_url":"https://api.github.com/users/ToyKeeper/following{/other_user}","gists_url":"https://api.github.com/users/ToyKeeper/gists{/gist_id}","starred_url":"https://api.github.com/users/ToyKeeper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ToyKeeper/subscriptions","organizations_url":"https://api.github.com/users/ToyKeeper/orgs","repos_url":"https://api.github.com/users/ToyKeeper/repos","events_url":"https://api.github.com/users/ToyKeeper/events{/privacy}","received_events_url":"https://api.github.com/users/ToyKeeper/received_events","type":"User","site_admin":false},"created_at":"2018-03-13T06:38:15Z","updated_at":"2018-03-13T06:38:15Z","author_association":"NONE","body":"FWIW, the localStorage API caches data for long periods of time without touching the disk, so it isn't useful for this.  Several bugs are already filed against chromium for it, with resolutions of \"won't fix, works as intended\" and \"use something else if you don't like this behavior\".\r\n\r\nHowever, after trying several more methods I've found that the IndexedDB system actually writes transactions to disk... so it can be used.  I got things working using that method.\r\n\r\nThe IndexedDB system writes to a binary transaction log file though, a format which isn't really documented or supported by anything except the browser.  So I had to reverse engineer it and decode the values.  Getting current data involves replaying the database log, though in this case of a single cell with only one value, it is sufficient to simply seek near the end and take the last value.\r\n\r\nThis solution is pretty inefficient, and the transaction log may well grow quite large over time.  Also, the internal format may change periodically and break my parser.  So if there's a cleaner solution I'd love to switch to it.  But for now, this works."}}
{"actor":{"display_login":"ToyKeeper"}}