Coder Social home page Coder Social logo

godbout / alfred-time Goto Github PK

View Code? Open in Web Editor NEW
110.0 9.0 8.0 27.46 MB

Start and stop tracking time with Toggl, Harvest, Everhour or Clockify through Alfred 4. ⏰️

License: MIT License

PHP 100.00%
toggl timer harvest alfred workflow everhour alfred-workflow php clockify

alfred-time's Introduction

Alfred Time

PHP Versions Compatibility GitHub release build status code quality code coverage GitHub downloads

Basic workflow to start, stop and continue timers for (currently) Toggl, Harvest, Everhour or Clockify services through Alfred 4.


Current features

  • Set up services through Alfred menus
  • Start timer
  • Stop timer
  • Continue (restart) timer
  • All live (no more cache issues)

How to use

Features

  • Set up your service

setup

  • Start a timer

start

  • Stop a timer

stop

  • Continue a timer (using the ⌘ modifier)

continue

Contribute

  • Feel free to let me know if something doesn't work, if you think something could be done better, or just fork and pull request.

Download

Alternatives to Alfred Time

alfred-time's People

Contributors

andynil avatar codacy-badger avatar danstreeter avatar dependabot[bot] avatar dmyers avatar godbout avatar scrutinizer-auto-fixer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alfred-time's Issues

Continue a time results in Uncaught TypeError: Carbon\Carbon::setLastErrors()

Whilst using Alfred Time 4.3.1 on OSX Monterey with PHP 8.2 - trying to continue a timer results in the following error:

[20:03:35.633] ERROR: Time[Script Filter] Code 255: PHP Fatal error:  Uncaught TypeError: Carbon\Carbon::setLastErrors(): Argument #1 ($lastErrors) must be of type array, bool given, called in /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php on line 98 and defined in /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php:928
Stack trace:
#0 /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php(98): Carbon\Carbon::setLastErrors(false)
#1 /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php(185): Carbon\Carbon->__construct('today', NULL)
#2 /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php(264): Carbon\Carbon::rawParse('today', NULL)
#3 /<workflow_dir>/src/Services/Clockify.php(152): Carbon\Carbon::today()
#4 /<workflow_dir>/src/Menus/ChooseTimer.php(29): Godbout\Alfred\Time\Services\Clockify->pastTimers()
#5 /<workflow_dir>/src/Menus/ChooseTimer.php(16): Godbout\Alfred\Time\Menus\ChooseTimer::getServicePastTimers(Object(Godbout\Alfred\Time\Services\Clockify))
#6 /<workflow_dir>/vendor/godbout/alfred-workflow-workflow/src/BaseWorkflow.php(30): Godbout\Alfred\Time\Menus\ChooseTimer::scriptFilter()
#7 /<workflow_dir>/src/app.php(14): Godbout\Alfred\Workflow\BaseWorkflow::currentMenu()
#8 {main}
  thrown in /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php on line 928
[20:03:35.635] Time[Script Filter] Fatal error: Uncaught TypeError: Carbon\Carbon::setLastErrors(): Argument #1 ($lastErrors) must be of type array, bool given, called in /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php on line 98 and defined in /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php:928
Stack trace:
#0 /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php(98): Carbon\Carbon::setLastErrors(false)
#1 /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php(185): Carbon\Carbon->__construct('today', NULL)
#2 /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php(264): Carbon\Carbon::rawParse('today', NULL)
#3 /<workflow_dir>/src/Services/Clockify.php(152): Carbon\Carbon::today()
#4 /<workflow_dir>/src/Menus/ChooseTimer.php(29): Godbout\Alfred\Time\Services\Clockify->pastTimers()
#5 /<workflow_dir>/src/Menus/ChooseTimer.php(16): Godbout\Alfred\Time\Menus\ChooseTimer::getServicePastTimers(Object(Godbout\Alfred\Time\Services\Clockify))
#6 /<workflow_dir>/vendor/godbout/alfred-workflow-workflow/src/BaseWorkflow.php(30): Godbout\Alfred\Time\Menus\ChooseTimer::scriptFilter()
#7 /<workflow_dir>/src/app.php(14): Godbout\Alfred\Workflow\BaseWorkflow::currentMenu()
#8 {main}
  thrown in /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php on line 928
[20:03:35.637] ERROR: Time[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. around line 1, column 0. in JSON:
Fatal error: Uncaught TypeError: Carbon\Carbon::setLastErrors(): Argument #1 ($lastErrors) must be of type array, bool given, called in /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php on line 98 and defined in /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php:928
Stack trace:
#0 /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php(98): Carbon\Carbon::setLastErrors(false)
#1 /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php(185): Carbon\Carbon->__construct('today', NULL)
#2 /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php(264): Carbon\Carbon::rawParse('today', NULL)
#3 /<workflow_dir>/src/Services/Clockify.php(152): Carbon\Carbon::today()
#4 /<workflow_dir>/src/Menus/ChooseTimer.php(29): Godbout\Alfred\Time\Services\Clockify->pastTimers()
#5 /<workflow_dir>/src/Menus/ChooseTimer.php(16): Godbout\Alfred\Time\Menus\ChooseTimer::getServicePastTimers(Object(Godbout\Alfred\Time\Services\Clockify))
#6 /<workflow_dir>/vendor/godbout/alfred-workflow-workflow/src/BaseWorkflow.php(30): Godbout\Alfred\Time\Menus\ChooseTimer::scriptFilter()
#7 /<workflow_dir>/src/app.php(14): Godbout\Alfred\Workflow\BaseWorkflow::currentMenu()
#8 {main}
  thrown in /<workflow_dir>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php on line 928

Digging through this, the error is also found on this Stack Overflow Post which references upgrading Carbon to >2.62.1

The releases page of Carbon also states there is a fix for this: https://github.com/briannesbitt/Carbon/releases/tag/2.62.1

This can be upgraded with composer require nesbot/carbon:^2.62.1

Pull Request on the way to match the outcome of this.

Doesn't work in macOS Monterey

Hey! Wondering if you have upgraded to Monterey yet? The Time shortcut doesn't work for me, unfortunately — not sure what the problem is. I thought maybe it was a PHP compatibility problem, but I've got php 7.3.1 installed on my Mac, so that's not it.

Any thoughts?

Harvest Config Error

I've setup the config file to use Harvest to run my timer, but it fails to load my projects. I receive this error when running debug mode.

[ERROR: input.scriptfilter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Warning: Invalid argument supplied for foreach() in Harvest.php on line 129
{"items":[{"arg":"{\"action\":\"choose_project\",\"query\":\"Start primary service\",\"original_action\":\"start\",\"show\":\"project_list\",\"continue\":true,\"project_ids\":[]}","subtitle":"Timer will be created without a project","title":"No project","type":"default","valid":true}]}

I also notice that the config file in your Readme.md is different from the one included in the current Release. I attempted to update the config file to match the walk-through file, but that did not resolve the issue.
image 2017-11-28 at 1 07 50 pm

Seems like a great workflow for Alfred! I'm excited to use it.

When I select a project, can I select the task (TASK_ID) associated with it?

Your workflow is very easy to use, and I love it!

I recently noticed that Toggl allows you to set a task (tTASK_ID) for a project.
However, when I start a new timer from this workflow and select a project,
However, when I start a new timer from this workflow and select a project, it is bothering me that it is not configurable.

When selecting a project, can I select the task (TASK_ID) associated with it?

Thanks in advance.

Refactor

There's quite some work to be done to refactor using some design patterns.

Clockify: ’Continue a timer‘ does not work

I frequently make use of the ‘Continue a timer’ feature, but all of a sudden it does not work any more. The API is correctly set up and everything else works. (Timer 4.3.0 and Alfred 4.6.6 on OSX Monterey 12.4.) Here is the relevant bit of the debugging output:

STDERR: Time[Script Filter] PHP Warning: Undefined array key "" in […path…]/Alfred/Alfred.alfredpreferences/workflows/user.workflow.64635E72-D96C-48C1-AFAB-22132711B1AC/src/Services/Clockify.php on line 196

Any ideas how to resolve this?

Thanks,
Dominik.-

Can't get the list of projects

I have my config file with the toggl api key and the harvest domain and credentials in base64 as instructed (everything double checked). I also have toggl set as my primary service.

I checked in the extension data directory where the config file is located, and I see json files for both toggl and harvest. In particular the toggl one is large and it seems to contain in it a lot of information that it must have retrieved from the toggl api. In particular, I can see that there's information about projects in that json, including projects that I wanted to track time on.

However, when I attempt to start a timer by typing time something<ENTER> into Alfred, I get a second prompt with a clock-like icon to the right, which, according to what I see in the animated gifs in the README, is to type the project or something like that. No matter what I type in there, I get nothing in the dropdown list of suggestion (this list does not even appear). I can type here anything, including hitting , and nothing happens, the prompt stays open, and I can dismiss it with , but that does not help me towards achieving the goal of using this workflow to start a timer on toggl.

(I'd really like to use it to simultaneously start timers on both, but since it was not working, and there's something about needing to have projects called the same in both services, I decided to start simple and try to make ti work with a single service, toggl in this case).

readme.md

Can you update the readme file? I don't know how to set up the toggl timer, since the config file is gone.

improve tests regarding API calls?

currently API calls are real and need to be spaces with sleep(1) because it seems that sometimes the call are too fast (huh?). need to handle that better. mock the calls probably?

Old projects do not get deleted

Hi,

I can't get old Toggl projects to disappear, and the list becomes unwieldy.

  1. I synced repeatedly, and they are all deleted (not archived) on Toggl.
  2. I reinstalled the workflow several times, and deleted all files in application support or other places that seem to have something to do with this workflow. I did NOT find any cache that has a list of these projects in the clear, though.

Let me know what I can do, this workflow is excellent!

Hans

Better check if authentication is wrong?

For v2:

Currently if the authentication is wrong, you can still prepare a timer and send it. Of course it will not be started. The list of recent timers, projects and tags will be empty. It's quite obvious that there's something wrong with authentication, and it doesn't break the workflow per se, but maybe add a better failed authentication response?

For example we could check for correct authentication when a timer service is getting enabled from the menu, and not enable it if authentication failed.

Clockify - not all projects are listed

hi, sorry, it's me again :P
First of all, new release is working almost perfectly for me and I'm really grateful for it!

I have only one issue that not all of my 74 projects are on the list. Alfred is listing exactly 50 records (and ofc I've tried typing the name of the project as well :P )

PS.: I've deleted my commend below the last issue, because I've noticed that you told me to create a new issue, so there it is

3.0 Downloadable

Hi!

I think the release for 3.0 is missing the actual workflow file, in only shows the source code.

And awesome work on the plugin btw!!!

Data cache file for services are not usable if service can't login at first time

If service is set as active but credentials are wrong, a cache file will still be created with wrong data in it (this is due to refactoring, a test on the returned data is wrong). Next time a timer is started, the data is loaded and corrupt Alfred. Currently the only way to solve this is to get the right credential in the config file, and to manually resync using "time sync".

See: #19

Possible integration with Clockify?

First of all I'd like to thank you for your awesome work, your project is great and I really appreciate all the effort you've putted there <3

I only wanted to ask have you considered adding an integration with clockify.me ?
I'm asking, because it's a really great alternative for other time tracking tools and it has a very competitive pricing :P

Toggl API changing

I got an email from Toggl this morning about their API changing. In case this workflow needs to be updated, I thought I would share the email here.

We are reaching out because we detected API usage coming from your Toggl Track account using the www.toggl.com(or toggl.com) domain.

After last year's rebranding, we released api.track.toggl.com as our new domain for API usage. These changes were communicated via newsletter and the following blog post. The API Docs were also updated to reflect the domain changes.

We want to inform you that the usage of www.toggl.com(or toggl.com) domain for the API will be dropped after 'June 30th 2021'.

We encourage you to perform the switch to api.track.toggl.com as soon as possible in order to prevent disruption.

Thank you for looking into this!

When I select a project, can I select the task (TASK_ID) associated with it?

Your workflow is very easy to use, and I love it!

I recently noticed that Toggl allows you to set a task (tTASK_ID) for a project.
However, when I start a new timer from this workflow and select a project,
However, when I start a new timer from this workflow and select a project, it is bothering me that it is not configurable.

When selecting a project, can I select the task (TASK_ID) associated with it?

Thanks in advance.

P.S.

I posted this once, but accidentally closed it.
I'm going to ask it again.

Wrong PHP version

Hi,

I've been trying to add this workflow to Alfred, however, I had the wrong PHP version installed:

[11:57:57.223] Logging Stopped.
[11:57:58.749] Logging Started...
[11:58:03.071] Time[Script Filter] Queuing argument ''
[11:58:03.232] Time[Script Filter] Script with argv '' finished
[11:58:03.234] ERROR: Time[Script Filter] Code 104: Composer detected issues in your platform:

Your Composer dependencies require a PHP version ">= 7.3.0". You are running 7.1.33.
[11:58:03.235] ERROR: Time[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Composer detected issues in your platform:

Your Composer dependencies require a PHP version ">= 7.3.0". You are running 7.1.33.

I've installed PHP 7.3 using brew:

$ brew install [email protected]

But that is afterwards located at /usr/local/opt/[email protected]/bin/php. How should I change/tell the script to use that binary?

Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.